Closed
Bug 1414228
Opened 8 years ago
Closed 8 years ago
Allocate type monitor fallback stubs lazily
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla58
| Tracking | Status | |
|---|---|---|
| firefox58 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file)
|
28.51 KB,
patch
|
tcampbell
:
review+
|
Details | Diff | Splinter Review |
Right now we allocate these in BaselineCompiler for ops that are monitored. The attached patch splits fallbackMonitorStub() into maybeFallbackMonitorStub() and getFallbackMonitorStub(), and then we just have to update all callers to use one or the other.
The micro-benchmark below improves from 875 ms to 778 ms (best of 5 runs). Now this is obviously a best case micro-benchmark for this patch, but it's a pretty simple perf and memory usage improvement.
function f() {
var s = "if (x) return 1;";
for (var i = 0; i < 2000; i++)
s += "x = x.foo;";
var arr = [];
for (var i = 0; i < 1000; i++)
arr.push(new Function("x", s));
var t = new Date;
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < 12; j++)
arr[i](1);
}
print(new Date - t);
}
f();
Attachment #8924927 -
Flags: review?(tcampbell)
Comment 1•8 years ago
|
||
Comment on attachment 8924927 [details] [diff] [review]
Patch
Review of attachment 8924927 [details] [diff] [review]:
-----------------------------------------------------------------
Great! This patch was hard to follow, but I now see that it was the existing system was confusing and the new code makes way more sense. :)
::: js/src/jit/BaselineBailouts.cpp
@@ +1390,5 @@
>
> // Push BaselineStub frame descriptor
> if (!builder.writeWord(baselineStubFrameDescr, "Descriptor"))
> return false;
>
Please add comments to callers of offsetOfFallbackMonitorStub to describe that this code is the corresponding de-lazify. A comment here about the converse.
::: js/src/jit/BaselineIC.h
@@ +430,5 @@
> hasReceiver_(hasReceiver)
> { }
>
> ICStub* getStub(ICStubSpace* space) {
> + return newStub<ICGetElem_Fallback>(space, getStubCode());
Nice
::: js/src/jit/SharedIC.h
@@ +1204,1 @@
> // Pointer to the fallback monitor stub.
Mention that this is lazily created when an optimized stub needing it is added.
Attachment #8924927 -
Flags: review?(tcampbell) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/21fe8fa6b8e6
Allocate type monitor fallback stubs lazily instead of allocating them in BaselineCompiler. r=tcampbell
Comment 3•8 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•