Last Comment Bug 660630 - Only error once on OOM in NewCompartment
: Only error once on OOM in NewCompartment
Status: RESOLVED FIXED
[fixed-in-tracemonkey]
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: general
:
: Jason Orendorff [:jorendorff]
Mentors:
Depends on:
Blocks: 624094
  Show dependency treegraph
 
Reported: 2011-05-30 06:33 PDT by Paul Biggar
Modified: 2011-06-21 16:31 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (790 bytes, patch)
2011-05-30 06:33 PDT, Paul Biggar
igor: review-
Details | Diff | Splinter Review
with error reporting outseide lock (1.02 KB, patch)
2011-05-30 09:03 PDT, Paul Biggar
igor: review+
Details | Diff | Splinter Review

Description Paul Biggar 2011-05-30 06:33:16 PDT
Created attachment 536079 [details] [diff] [review]
fix

We shouldn't be calling js_reportOutOfMemory error more than once. JSCompartment::init() does, and then NewCompartment does too. This removes the partial redundancy.
Comment 1 Igor Bukanov 2011-05-30 07:43:51 PDT
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
Comment 2 Paul Biggar 2011-05-30 09:03:21 PDT
Created attachment 536108 [details] [diff] [review]
with error reporting outseide lock
Comment 3 Igor Bukanov 2011-05-30 09:17:43 PDT
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.
Comment 5 Paul Biggar 2011-06-21 16:31:45 PDT
cdleary-bot missed this.

Note You need to log in before you can comment on or make changes to this bug.