Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Unified Diff: src/parsing/parser.cc

Issue 2533803002: [parser] removed undefined check of for-of iterator (Closed)
Patch Set: regolden Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/ForOf.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 073800d8167d4583c3091880555cb5b474ed11c6..e049c84539795dea890b5571bc7bc2db153716a3 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -5431,7 +5431,7 @@ Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop,
// %ReThrow(e);
// }
// } finally {
- // if (!(completion === kNormalCompletion || IS_UNDEFINED(#iterator))) {
+ // if (!(completion === kNormalCompletion)) {
neis 2016/11/28 14:52:51 See below.
// #BuildIteratorCloseForCompletion(#iterator, completion)
// }
// }
@@ -5442,18 +5442,13 @@ Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop,
const int nopos = kNoSourcePosition;
- // !(completion === kNormalCompletion || IS_UNDEFINED(#iterator))
+ // !(completion === kNormalCompletion)
Expression* closing_condition;
{
- Expression* lhs = factory()->NewCompareOperation(
+ Expression* cmp = factory()->NewCompareOperation(
Token::EQ_STRICT, factory()->NewVariableProxy(var_completion),
factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), nopos);
- Expression* rhs = factory()->NewCompareOperation(
- Token::EQ_STRICT, factory()->NewVariableProxy(loop->iterator()),
- factory()->NewUndefinedLiteral(nopos), nopos);
- closing_condition = factory()->NewUnaryOperation(
- Token::NOT, factory()->NewBinaryOperation(Token::OR, lhs, rhs, nopos),
- nopos);
+ closing_condition = factory()->NewUnaryOperation(Token::NOT, cmp, nopos);
neis 2016/11/28 14:52:51 You can use NE_STRICT (!==) instead of negating EQ
}
Block* final_loop = factory()->NewBlock(nullptr, 2, false, nopos);
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/ForOf.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698