Closed Bug 1490055 Opened 6 years ago Closed 6 years ago

ParseTask can report OOM on the wrong context, and other improvements

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(3 files)

ParseTask is created with a main thread JSContext and then used on a helper thread with a different JSContext.  It contains two vectors which use the default TempAllocPolicy, which records the context used to create it and uses that to report OOM.  I think this means that multi script decode jobs can report OOM to the wrong context.
Patch to use SystemAllocPolicy for ParseTask vectors because it doesn't hold a pointer to a JSContext and so this confusion can't arise.
Attachment #9007829 - Flags: review?(nicolas.b.pierron)
Helper thread JSContexts already have a LifoAlloc that we can use for parsing.  We don't need to create a new one for every parse task.
Attachment #9007831 - Flags: review?(nicolas.b.pierron)
Finally, this patch removes the callback to finishParseTask.  We can run this code after it returns so we don't need the complexity.  I also renamed the finishParseTask methods to hopefully make things clearer and moved the contents of ParseTask::finish into finishParseTaskCommon.
Attachment #9007832 - Flags: review?(nicolas.b.pierron)
Attachment #9007829 - Flags: review?(nicolas.b.pierron) → review+
Attachment #9007831 - Flags: review?(nicolas.b.pierron) → review+
Comment on attachment 9007832 [details] [diff] [review]
bug1490055-parse-task-refactor-callback

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

Thanks for these clean-ups!
Attachment #9007832 - Flags: review?(nicolas.b.pierron) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/20e30197e490
Use SystemAllocPolicy for ParseTask which can be used by both main thread and helper thread contexts r=nbp
https://hg.mozilla.org/integration/mozilla-inbound/rev/44ca8ba219dd
Use JSContext's temp LifoAlloc for off-thread parsing r=nbp
https://hg.mozilla.org/integration/mozilla-inbound/rev/3f4e2a2ad3be
Refactor to remove callback passed when finishing a parse task r=nbp
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: