Status: Assigned
Owner: [email protected]
Labels: Type-Bug Priority-Medium
New issue 4336 by [email protected]: Function literal constant does not
respect strict mode on first compile.
https://code.google.com/p/v8/issues/detail?id=4336
Test case:
// Flags: --always-opt
eval("(function f() { 'use strict'; f = 123; })()");
Note that inside the function, 'f' is a constant referencing the function
itself.
We compile the function f twice due to --always-opt. Scope resolution gives
us this:
eval { // (0, 43)
// scope has trivial outer context
// 1 stack slots
// temporary vars:
TEMPORARY .result; // local[0]
function f () { // (11, 40)
// (local) function name: f
// strict mode scope
// 1 stack slots
// function var:
CONST_LEGACY f; // local[0], maybe assigned
// local vars:
}
}
function f () { // (11, 40)
// (local) function name: f
// scope has trivial outer context
// strict mode scope
// 1 stack slots
// function var:
CONST f; // local[0], maybe assigned
// local vars:
}
The first time, f is a sloppy const. The second time, f is a strict const.
This causes the compiled code to look slightly different, since the strict
const compiles into a reference error and a const-assign error, whereas the
sloppy const compiled into a const-assign error only.
This is fine for normal use case, but causes problems for the debugger when
we try to redirect to newly-compiled code on stack.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.