Closed
Bug 1251529
Opened 9 years ago
Closed 9 years ago
JavaScript allocation metadata should be collected by a builder class, not a callback
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: jimb, Assigned: jimb)
References
(Blocks 1 open bug)
Details
Attachments
(5 files)
61.49 KB,
patch
|
fitzgen
:
review+
|
Details | Diff | Splinter Review |
16.02 KB,
patch
|
fitzgen
:
review+
|
Details | Diff | Splinter Review |
6.31 KB,
patch
|
fitzgen
:
review+
|
Details | Diff | Splinter Review |
2.23 KB,
patch
|
jimb
:
review+
|
Details | Diff | Splinter Review |
1.16 KB,
patch
|
jimb
:
review+
|
Details | Diff | Splinter Review |
At the moment, the embedding registers a callback function with SpiderMonkey to provide allocation metadata to attach to new objects. Since we'll soon have string allocation metadata as well, we should replace this callback function with a builder object, and provide an appropriate base class.
Assignee | ||
Comment 1•9 years ago
|
||
The code that handles metadata now talks exclusively of "object metadata callbacks", but we want "allocation metadata builders". This is a purely mechanical patch that changes the names.
This does mean that we'll momentarily have a function pointer typedef named ...Builder, but I don't think that's entirely wrong. We'll replace it in the next patch anyway.
Attachment #8723947 -
Flags: review?(nfitzgerald)
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8723948 -
Flags: review?(nfitzgerald)
Assignee | ||
Comment 3•9 years ago
|
||
Neither of these changes should have any visible effect on behavior, so there are no tests.
Assignee | ||
Updated•9 years ago
|
Flags: in-testsuite-
Updated•9 years ago
|
Attachment #8723947 -
Flags: review?(nfitzgerald) → review+
Comment 4•9 years ago
|
||
Comment on attachment 8723948 [details] [diff] [review]
Replace allocation metadata callback with a builder class.
Review of attachment 8723948 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/builtin/TestingFunctions.cpp
@@ +1664,5 @@
> AutoEnterOOMUnsafeRegion oomUnsafe;
>
> RootedObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
> if (!obj)
> + oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
If all the metadata callbacks are oom-unsafe in practice, maybe we should pass that in to ::build()?
Attachment #8723948 -
Flags: review?(nfitzgerald) → review+
Assignee | ||
Comment 5•9 years ago
|
||
(In reply to Nick Fitzgerald [:fitzgen] [⏰PST; UTC-8] from comment #4)
> If all the metadata callbacks are oom-unsafe in practice, maybe we should
> pass that in to ::build()?
Yeah, good suggestion. I didn't realize it, but JSCompartment::setNewObjectMetadata returns void.
Assignee | ||
Comment 6•9 years ago
|
||
Make metadata builder methods take an AutoEnterOOMUnsafeRegion, since they're not designed to report OOM conditions.
Attachment #8725070 -
Flags: review?(nfitzgerald)
Updated•9 years ago
|
Attachment #8725070 -
Flags: review?(nfitzgerald) → review+
Assignee | ||
Updated•9 years ago
|
Target Milestone: --- → mozilla48
Assignee | ||
Comment 9•9 years ago
|
||
This was required for the Clang builds.
The general reason seems to be explained here:
http://stackoverflow.com/questions/7411515/why-does-c-require-a-user-provided-default-constructor-to-default-construct-a
But since the class has a virtual method, it shouldn't be POD, so I don't really understand.
Attachment #8738015 -
Flags: review+
Comment 10•9 years ago
|
||
Assignee | ||
Comment 11•9 years ago
|
||
Attachment #8738022 -
Flags: review+
Comment 12•9 years ago
|
||
bugherder |
You need to log in
before you can comment on or make changes to this bug.
Description
•