[Webkit-unassigned] [Bug 155153] New: How we load new.target in arrow functions is broken
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Mar 7 19:00:29 PST 2016
https://bugs.webkit.org/show_bug.cgi?id=155153
Bug ID: 155153
Summary: How we load new.target in arrow functions is broken
Classification: Unclassified
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: sbarati at apple.com
CC: gskachkov at gmail.com
function foo() {
let arr = () => {
if (false) {
print(new.target);
} else {
print(new.target);
}
};
arr();
}
new foo();
This prints undefined. It shouldn't.
The reason is that we make a classic mistake
where we emit code to load new.target once.
Even if that code is behind a branch in byte code,
we assume all uses can use that already loaded value.
That's wrong. We either need to always emit the load from
the scope for each new.target, or we need to emit the load
at the function prologue before any uses of new.target.
I think loading it from the scope is probably cleaner because
the alternative punishes programs that never use new.target.
That said, always loading it from the scope will punish programs
that do the load in a loop.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160308/32126fdb/attachment-0001.html>
More information about the webkit-unassigned
mailing list