Status: Assigned
Owner: [email protected]
CC: [email protected], [email protected]
Labels: Type-Bug Priority-Medium HW-All OS-All Area-Language Harmony
New issue 4284 by [email protected]: Sloppy let binding and eval does not
enforce TDZ
https://code.google.com/p/v8/issues/detail?id=4284
The sloppy block scope mode needs some work related to how it interacts
with eval.
The following code does not throw a ReferenceError. It should as far as I
can tell.
```js
function f() {
eval("var y = 2;");
x = 1;
};
f();
let x;
```
The eval turns the x IdentifierReference into a DYNAMIC_LOCAL
```
$ out/Debug/d8 --no-legacy-const --harmony-sloppy --print-scopes test.js
global { // (0, 61)
// scope has trivial outer context
// inner scope calls 'eval'
// 1 stack slots
// 5 heap slots (including 0 global slots)
// temporary vars:
TEMPORARY .result; // local[0], maybe assigned
// local vars:
VAR f; // maybe assigned
LET x; // context[4], forced context allocation, maybe assigned
function f () { // (10, 47)
// scope calls 'eval'
// 6 heap slots (including 0 global slots)
// local vars:
VAR this; // context[4], maybe assigned
VAR arguments; // context[5], maybe assigned
// dynamic vars:
DYNAMIC_LOCAL x; // lookup, maybe assigned
DYNAMIC_GLOBAL eval; // lookup
}
}
function f () { // (10, 47)
// scope calls 'eval'
// 6 heap slots (including 0 global slots)
// local vars:
VAR this; // context[4], maybe assigned
VAR arguments; // context[5], maybe assigned
// dynamic vars:
DYNAMIC_LOCAL x; // lookup, maybe assigned
DYNAMIC_GLOBAL eval; // lookup
}
eval { // (0, 10)
// outer scope calls 'eval' in sloppy context
// temporary vars:
// dynamic vars:
DYNAMIC_GLOBAL y; // lookup
}
```
It looks like we are not checking for the hole when we assign here. Doing a
lookup throws as expected.
--
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.