Closed Bug 492491 Opened 13 years ago Closed 13 years ago

nanojit: convert some error() tests to asserts

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

In pageValidate() and resourceConsistencyCheck(), abort on prior error, rather than skipping.  This establishes an invariant -- prior error should be impossible due to the calling context.
Attachment #376860 - Flags: review?(edwsmith)
is this valid for all the possible ways error() can be set?  (out of memory, stackfull, etc?)
It's valid.  Both functions only have one calling context, which looks like this:

        if (error())
            return;

        // check that all is well (don't check in exit paths since its more complicated)
        debug_only( pageValidate(); )
        debug_only( resourceConsistencyCheck();  )
I should add the reason for this change.  It's because the use of the Assembler._err field, accessed through the error() and setError() methods, is very confusing, and this ties in with the difficulties of OOM handling.  Converting these two cases to assertions effectively removed two uses of error(), and so made a small step towards simplifying the error handling.
Comment on attachment 376860 [details] [diff] [review]
patch that converts some error() tests to asserts

cool
Attachment #376860 - Flags: review?(edwsmith) → review+
http://hg.mozilla.org/tracemonkey/rev/b76004a6fae3
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/b76004a6fae3
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.