WebKit Bugzilla
Attachment 373303 Details for
Bug 199395
: Exception from For..of loop destructured assignment eliminates TDZ checks in subsequent code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
199395.patch (text/plain), 3.39 KB, created by
Michael Saboff
on 2019-07-01 21:31:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Michael Saboff
Created:
2019-07-01 21:31:08 PDT
Size:
3.39 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 247033) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-07-01 Michael Saboff <msaboff@apple.com> >+ >+ Exception from For..of loop assignment eliminates TDZ checks in subsequent code >+ https://bugs.webkit.org/show_bug.cgi?id=199395 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ New regession test. >+ >+ * stress/for-of-tdz-with-try-catch.js: Added. >+ (test): >+ (i.catch): >+ > 2019-07-01 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r246946. >Index: JSTests/stress/for-of-tdz-with-try-catch.js >=================================================================== >--- JSTests/stress/for-of-tdz-with-try-catch.js (nonexistent) >+++ JSTests/stress/for-of-tdz-with-try-catch.js (working copy) >@@ -0,0 +1,22 @@ >+// This regression test checks that a let in the TDZ state is handled properly >+// with a for-of in a try as well as the ensuing catch block. >+ >+function test() { >+ try { >+ for ({o} of [, 0]) >+ ; >+ } catch (e) { >+ o[0] = 1.5; >+ } >+ let o = { >+ }; >+} >+ >+for (i = 0; i < 1000; i++) { >+ try { >+ test(); >+ } catch(e) { >+ if (e != "ReferenceError: Cannot access uninitialized variable.") >+ throw "Expected \"ReferenceError: Cannot access uninitialized variable.\", but got \"" + e +"\""; >+ } >+} >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 247033) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2019-07-01 Michael Saboff <msaboff@apple.com> >+ >+ Exception from For..of loop assignment eliminates TDZ checks in subsequent code >+ https://bugs.webkit.org/show_bug.cgi?id=199395 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ By saving the current state of the TDZ stack before processing the setting of >+ the target values and then restoring afterwards, we won't optimize out >+ future TDZ checks. >+ >+ A similar change was done for for..in loops in change set r232219. >+ >+ * bytecompiler/NodesCodegen.cpp: >+ (JSC::ObjectPatternNode::bindValue const): >+ > 2019-07-01 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r246946. >Index: Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >=================================================================== >--- Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (revision 247033) >+++ Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (working copy) >@@ -4304,6 +4304,9 @@ void ObjectPatternNode::bindValue(Byteco > addMethod = generator.emitGetById(generator.newTemporary(), excludedList.get(), generator.propertyNames().builtinNames().addPrivateName()); > } > >+ BytecodeGenerator::PreservedTDZStack preservedTDZStack; >+ generator.preserveTDZStack(preservedTDZStack); >+ > for (size_t i = 0; i < m_targetPatterns.size(); i++) { > const auto& target = m_targetPatterns[i]; > if (target.bindingType == BindingType::Element) { >@@ -4366,6 +4369,8 @@ void ObjectPatternNode::bindValue(Byteco > target.pattern->bindValue(generator, result.get()); > } > } >+ >+ generator.restoreTDZStack(preservedTDZStack); > } > > void ObjectPatternNode::collectBoundIdentifiers(Vector<Identifier>& identifiers) const
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199395
:
373303
|
373322