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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 2289613002: [turbofan] Remove special JSForInStep and JSForInDone. (Closed)
Patch Set: Created 4 years, 4 months 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 | « src/ast/ast.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 2db91d5b72c8fd8df980a88c7cf7456906e03f86..b1df934582955c0735ea27e2bdbf6d0636e8f059 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1392,9 +1392,14 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
Node* cache_type = environment()->Peek(3);
Node* object = environment()->Peek(4);
- // Check loop termination condition.
- Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length);
- for_loop.BreakWhen(exit_cond);
+ // Check loop termination condition (we know that the {index} is always
+ // in Smi range, so we can just set the hint on the comparison below).
+ PrepareEagerCheckpoint(stmt->EntryId());
+ Node* exit_cond =
+ NewNode(javascript()->LessThan(CompareOperationHint::kSignedSmall),
+ index, cache_length);
+ PrepareFrameState(exit_cond, BailoutId::None());
+ for_loop.BreakUnless(exit_cond);
// Compute the next enumerated value.
Node* value = NewNode(javascript()->ForInNext(), object, cache_array,
@@ -1422,9 +1427,13 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
test_value.End();
for_loop.EndBody();
- // Increment counter and continue.
+ // Increment counter and continue (we know that the {index} is always
+ // in Smi range, so we can just set the hint on the increment below).
index = environment()->Peek(0);
- index = NewNode(javascript()->ForInStep(), index);
+ PrepareEagerCheckpoint(stmt->IncrementId());
+ index = NewNode(javascript()->Add(BinaryOperationHint::kSignedSmall),
+ index, jsgraph()->OneConstant());
+ PrepareFrameState(index, BailoutId::None());
environment()->Poke(0, index);
}
for_loop.EndLoop();
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698