Closed
Bug 1401577
Opened 7 years ago
Closed 7 years ago
Optimize object flag accessors on native objects
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox57 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file)
19.97 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
While looking at the profile in bug 1398578 I noticed NativeSetProperty calls obj->watched() -> JSObject::hasAllFlags -> JSObject::maybeShape -> JSObject::is<js::ShapedObject>(). This is slower than necessary: we check for native/proxy/TypedObject even though NativeSetProperty is called with a NativeObject argument. The patch fixes this and some related issues: * NativeObject now shadows hasAllFlags, watched, nonProxyIsExtensible. These are faster than the methods on JSObject. * I moved isIndexed, setHadElementsAccess/hadElementsAccess, setNewScriptCleared/wasNewScriptCleared from JSObject to NativeObject. These methods are only relevant for native objects and can now call the faster NativeObject::hasAllFlags. * For consistency, I added NativeObject::hasInterestingSymbol and used that instead of calling hasAllFlags directly.
Attachment #8910311 -
Flags: review?(andrebargull)
Comment 1•7 years ago
|
||
Comment on attachment 8910311 [details] [diff] [review] Patch Review of attachment 8910311 [details] [diff] [review]: ----------------------------------------------------------------- Looks reasonable. ::: js/src/vm/NativeObject.h @@ +758,5 @@ > + // Mark an object as having its 'new' script information cleared. > + bool wasNewScriptCleared() const { > + return hasAllFlags(js::BaseShape::NEW_SCRIPT_CLEARED); > + } > + static bool setNewScriptCleared(JSContext* cx, JS::HandleObject obj) { HandleNativeObject instead of HandleObject
Attachment #8910311 -
Flags: review?(andrebargull) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/e3835d35a46e Optimize object flag accessors on native objects. r=anba
Assignee | ||
Comment 3•7 years ago
|
||
This improved object-assign-es6 by a few %: https://arewefastyet.com/#machine=29&view=single&suite=six-speed&subtest=object-assign-es6 We're now very close to JSC. We really need to kill watch/unwatch and there's a bit more stuff to optimize on the NativeSetProperty path.
Comment 4•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e3835d35a46e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in
before you can comment on or make changes to this bug.
Description
•