Closed Bug 754720 Opened 11 years ago Closed 11 years ago

IonMonkey: Assertion failure: ionInlineFrames_.numActualArgs() <= ionInlineFrames_.callee()->nargs, at vm/Stack.cpp:1496 or Crash [@ js::StackFrame::isFunctionFrame]


(Core :: JavaScript Engine, defect)

Other Branch
Not set





(Reporter: decoder, Assigned: nbp)



(Keywords: assertion, testcase, Whiteboard: [jsbugmon:update,ignore])


(1 file, 1 obsolete file)

The following testcase asserts on ionmonkey revision e8de64e7e9fe (run with --ion -n -m --ion-eager):

function f2() {
  return f2.arguments;
actual = (f2() == null);
actual = (f2(0) == null);
Crashes only in debug build but I cannot judge if that is coincidence or not. Crash trace when stepping through assertions:

Assertion failure: Crossing fingers: Unable to read snapshot slot., at ../ion/IonFrameIterator.h:224

Program received signal SIGABRT, Aborted.

Program received signal SIGSEGV, Segmentation fault.
0x000000000040681c in js::StackFrame::isFunctionFrame (this=0x6d65) at ../../vm/Stack.h:462
462             return !!(flags_ & FUNCTION);
Missing separate debuginfos, use: debuginfo-install libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
(gdb) bt 8
#0  0x000000000040681c in js::StackFrame::isFunctionFrame (this=0x6d65) at ../../vm/Stack.h:462
#1  0x0000000000639e7c in js::StackFrame::functionScript (this=0x6d65) at ../vm/Stack.h:622
#2  0x00007f0700000002 in ?? ()
#3  0xffffffff00000001 in ?? ()
#4  0x00007fffffffb600 in ?? ()
#5  0x00007fffffffb620 in ?? ()
#6  0x00007f0700000002 in ?? ()
#7  0xffffffff00000001 in ?? ()
(More stack frames follow...)
(gdb) x /i $pc
=> 0x40681c <js::StackFrame::isFunctionFrame() const+12>:       mov    (%rax),%eax
(gdb) info reg rax
rax            0x6d65   28005
I added this code because this case is not handled yet.  Currently we are not mapping all arguments of the function, only the expected number of arguments and add Undefined arguments as padding if not provided.

So if the number of actual argument is larger than the number of formal argument, which explain why we have this assertion.  Eager compilation cause f2 to be compiled and when f2.arguments tries to create an unexpected argument object, it needs to recover them from the Ion stack.

Sadly we have no current way to detect such cases ahead enough to avoid entering the ion code which is shrinking the argument vector.
Assignee: general → nicolas.b.pierron
This patch should fix the current bug but it also introduce a problem in case of bailouts with an overflow of arguments which is not yet handled and will be fixed in a follow-up bug/patch.
Attachment #624427 - Flags: review?(dvander)
The same except that this fix an additional bug SnapshotIterator::hasLocation which raised when I added one formal argument in the test case.
Attachment #624427 - Attachment is obsolete: true
Attachment #624427 - Flags: review?(dvander)
Attachment #624439 - Flags: review?(dvander)
Comment on attachment 624439 [details] [diff] [review]
f.arguments: Recover overflow of arguments from the stack.

Review of attachment 624439 [details] [diff] [review]:

::: js/src/ion/Ion.cpp
@@ +960,5 @@
>          argv = fp->formalArgs() - 1;
> +        if (fp->hasOverflowArgs()) {
> +            argc = fp->numActualArgs() + 1;
> +            argv = fp->actualArgs() - 1;
> +        }

nit: It might read better to put the initial argc/argv assignment in an else branch.

::: js/src/ion/IonFrameIterator-inl.h
@@ +65,5 @@
> +        // Currently inlining does not support overflow of arguments, we have to
> +        // add this feature in IonBuilder.cpp and in Bailouts.cpp before
> +        // continuing. We need to add it to Bailouts.cpp because we need to know
> +        // how to walk over the oveflow of arguments.
> +        JS_ASSERT(end <= nformal);

nit: Please brace this if/else (comment makes it multi-line)
Attachment #624439 - Flags: review?(dvander) → review+
Blocks: 755979
No longer blocks: 755979
Closed: 11 years ago
Resolution: --- → FIXED
Previous commits have been reverted, due to errors on tbpl.
Resolution: FIXED → ---
JSBugMon: The testcase found in this bug no longer reproduces (tried revision 8c54899dae82).
Whiteboard: [jsbugmon:update] → [jsbugmon:update,ignore]
Group: core-security
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
A testcase for this bug was automatically identified at js/src/jit-test/tests/ion/bug754720.js.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.