Closed Bug 660630 Opened 13 years ago Closed 13 years ago

Only error once on OOM in NewCompartment

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: paul.biggar, Unassigned)

References

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(2 files)

Attached patch fixSplinter Review
We shouldn't be calling js_reportOutOfMemory error more than once. JSCompartment::init() does, and then NewCompartment does too. This removes the partial redundancy.
Attachment #536079 - Flags: review?(igor)
Comment on attachment 536079 [details] [diff] [review]
fix

Review of attachment 536079 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsgc.cpp
@@ +2936,5 @@
>          AutoLockGC lock(rt);
>          if (rt->compartments.append(compartment))
>              return compartment;
> +        else
> +            JS_ReportOutOfMemory(cx);

1. Memory reporting must be done outside any lock.

2. Use js_ReportOutOfMemory.

3. No else after return
Attachment #536079 - Flags: review?(igor) → review-
Attachment #536108 - Flags: review?(igor)
Comment on attachment 536108 [details] [diff] [review]
with error reporting outseide lock

Review of attachment 536108 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsgc.cpp
@@ +2933,5 @@
>  
>          compartment->setGCLastBytes(8192);
>  
> +        {
> +            AutoLockGC lock(rt);

Comment that the extra block is for lock-less error reporting.
Attachment #536108 - Flags: review?(igor) → review+
http://hg.mozilla.org/tracemonkey/rev/d6987081e730
Whiteboard: [fixed-in-tracemonkey]
cdleary-bot missed this.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: