Closed
Bug 1030945
Opened 11 years ago
Closed 11 years ago
Support asm.js frames in SavedStacks
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: fitzgen, Assigned: fitzgen)
References
Details
Attachments
(2 files, 3 obsolete files)
367 bytes,
text/plain
|
Details | |
6.68 KB,
patch
|
fitzgen
:
review+
|
Details | Diff | Splinter Review |
Right now SavedStacks::insertFrames uses ScriptFrameIter, which means that it skips asm.js frames.
If we used a normal FrameIter, we would see them, but we would also have to start using FrameIter::computeLine instead of PCToLineNumber directly.
Comment 1•11 years ago
|
||
Some notes from IRC:
We don't want to use FrameIter::computeLine if we have a script, because that will call PCToLineNumber and miss out memoization bits in pcLocationMap.
So in the case when we have a script, we want to keep doing what we're doing. In the case when we have no script, we'd need to grab the line/column/source directly from the iterator before we increment it. Getting the line/column via computeLine is fast in this case. Getting the script filename is too, but then we'd have to atomize it...
If we care about that part, we could push down the pcLocationMap bits into FrameIter and have it memoize stuff based on the info it has (so script+pc in the non-asm case, and scriptSource+line+column in the asm.js case). And then we could just use FrameIter::scriptFilename and FrameIter::computeLine directly.
Comment 2•11 years ago
|
||
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8446822 -
Flags: review?(luke)
Comment 4•11 years ago
|
||
Comment on attachment 8446822 [details] [diff] [review]
asm-frames.patch
Review of attachment 8446822 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks! Let me take one more look at the patch with these addressed:
::: js/src/jit-test/tests/saved-stacks/asm-frames.js
@@ +26,5 @@
> +print(stack);
> +assertEq(stack.functionDisplayName, "tester");
> +
> +assertEq(stack.parent.line, 6);
> +assertEq(stack.parent.column, 4);
With the fix mentioned in the other comment, you should be able to add functionDisplayName assertions here and below.
::: js/src/vm/SavedStacks.cpp
@@ +472,5 @@
> // here, rather than inside saveCurrentStack, because in some cases we will
> // pass the check there, despite later failing the check here (for example,
> // in js/src/jit-test/tests/saved-stacks/bug-1006876-too-much-recursion.js).
> JS_CHECK_RECURSION_DONT_REPORT(cx, return false);
> + JSPrincipals* principals = iter.compartment() ? iter.compartment()->principals : nullptr;
Maybe I'm missing something, but I think iter.compartment() is always no-null, so you could just have iter.compartment()->principals here.
@@ +478,5 @@
> + LocationValue location;
> +
> + if (iter.hasScript()) {
> + RootedScript script(cx, iter.script());
> + callee.set(iter.maybeCallee());
Instead of doing this, I think you can just use:
iter.isNonEvalFunctionFrame() ? iter.functionDisplayName() : nullptr,
below when constructing AutoLookupRooter. That way asm.js functions will have names.
@@ +479,5 @@
> +
> + if (iter.hasScript()) {
> + RootedScript script(cx, iter.script());
> + callee.set(iter.maybeCallee());
> + jsbytecode* pc = iter.pc();
jsbytecode *pc
Attachment #8446822 -
Flags: review?(luke)
Assignee | ||
Comment 5•11 years ago
|
||
Updated based on review comments.
New try push: https://tbpl.mozilla.org/?tree=Try&rev=25efadefdd72
Attachment #8446822 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Attachment #8446865 -
Flags: review?(luke)
Comment 6•11 years ago
|
||
Ah, this is safe because getLocation() actually copies out of the hashtable instead of returning a reference into it, so it's OK if the recursive insertFrames call has to rehash the hashtable?
Might be worth adding a comment to that effect, because I can totally see someone like me trying to optimize away that copy that by returning references into the hashtable. ;)
Now that you're not holding on to the JSScript* across the iterator increment, I don't think you need the RootedScript. It wasn't there before bug 1030938.
As far as filenames, as a followup, I wonder how much people would hate it if we just atomized the filename on JSScript creation and stored the JSAtom* in addition to the const char*...
Comment 7•11 years ago
|
||
Comment on attachment 8446865 [details] [diff] [review]
asm-frames.patch
Review of attachment 8446865 [details] [diff] [review]:
-----------------------------------------------------------------
Great, thanks!
::: js/src/vm/SavedStacks.cpp
@@ +476,5 @@
> + JSPrincipals* principals = iter.compartment()->principals;
> + RootedAtom name(cx, iter.isNonEvalFunctionFrame() ? iter.functionDisplayAtom() : nullptr);
> + LocationValue location;
> +
> + if (iter.hasScript()) {
Super nit: I think it'd read a bit better to have the \n before the 'location' decl, not after.
Attachment #8446865 -
Flags: review?(luke) → review+
Assignee | ||
Comment 8•11 years ago
|
||
With requested update.
Attachment #8446865 -
Attachment is obsolete: true
Attachment #8447332 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Keywords: checkin-needed
I botched resolving a conflict when I pushed the patch, so here's a followup to fix that: https://hg.mozilla.org/integration/mozilla-inbound/rev/d2e790e8bc8e
And I had to back these both out for introducing a new hazard: https://tbpl.mozilla.org/php/getParsedLog.php?id=42665020&tree=Mozilla-Inbound
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/67cdb3cbea9f
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/3f4fe642a893
Flags: needinfo?(nfitzgerald)
Assignee | ||
Comment 12•11 years ago
|
||
Need bug 1031168 to fix the hazards, its the same issue.
Depends on: 1031168
Flags: needinfo?(nfitzgerald)
Assignee | ||
Comment 13•11 years ago
|
||
Rebased now that bug 1031168 landed. Shouldn't have the hazard anymore.
Try: https://tbpl.mozilla.org/?tree=Try&rev=281321298314
Attachment #8447332 -
Attachment is obsolete: true
Attachment #8451844 -
Flags: review+
Assignee | ||
Comment 14•11 years ago
|
||
I think the one build failure is unrelated, I've been seeing it in a bunch of other try pushes as well.
Keywords: checkin-needed
Comment 15•11 years ago
|
||
Keywords: checkin-needed
Comment 16•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in
before you can comment on or make changes to this bug.
Description
•