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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 2289613002: [turbofan] Remove special JSForInStep and JSForInDone. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 for_loop.BeginLoop(GetVariablesAssignedInLoop(stmt), CheckOsrEntry(stmt)); 1385 for_loop.BeginLoop(GetVariablesAssignedInLoop(stmt), CheckOsrEntry(stmt));
1386 { 1386 {
1387 // These stack values are renamed in the case of OSR, so reload them 1387 // These stack values are renamed in the case of OSR, so reload them
1388 // from the environment. 1388 // from the environment.
1389 Node* index = environment()->Peek(0); 1389 Node* index = environment()->Peek(0);
1390 Node* cache_length = environment()->Peek(1); 1390 Node* cache_length = environment()->Peek(1);
1391 Node* cache_array = environment()->Peek(2); 1391 Node* cache_array = environment()->Peek(2);
1392 Node* cache_type = environment()->Peek(3); 1392 Node* cache_type = environment()->Peek(3);
1393 Node* object = environment()->Peek(4); 1393 Node* object = environment()->Peek(4);
1394 1394
1395 // Check loop termination condition. 1395 // Check loop termination condition (we know that the {index} is always
1396 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); 1396 // in Smi range, so we can just set the hint on the comparison below).
1397 for_loop.BreakWhen(exit_cond); 1397 PrepareEagerCheckpoint(stmt->EntryId());
1398 Node* exit_cond =
1399 NewNode(javascript()->LessThan(CompareOperationHint::kSignedSmall),
1400 index, cache_length);
1401 PrepareFrameState(exit_cond, BailoutId::None());
1402 for_loop.BreakUnless(exit_cond);
1398 1403
1399 // Compute the next enumerated value. 1404 // Compute the next enumerated value.
1400 Node* value = NewNode(javascript()->ForInNext(), object, cache_array, 1405 Node* value = NewNode(javascript()->ForInNext(), object, cache_array,
1401 cache_type, index); 1406 cache_type, index);
1402 PrepareFrameState(value, stmt->FilterId(), 1407 PrepareFrameState(value, stmt->FilterId(),
1403 OutputFrameStateCombine::Push()); 1408 OutputFrameStateCombine::Push());
1404 IfBuilder test_value(this); 1409 IfBuilder test_value(this);
1405 Node* test_value_cond = 1410 Node* test_value_cond =
1406 NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), value, 1411 NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), value,
1407 jsgraph()->UndefinedConstant()); 1412 jsgraph()->UndefinedConstant());
1408 test_value.If(test_value_cond, BranchHint::kFalse); 1413 test_value.If(test_value_cond, BranchHint::kFalse);
1409 test_value.Then(); 1414 test_value.Then();
1410 test_value.Else(); 1415 test_value.Else();
1411 { 1416 {
1412 environment()->Push(value); 1417 environment()->Push(value);
1413 PrepareEagerCheckpoint(stmt->FilterId()); 1418 PrepareEagerCheckpoint(stmt->FilterId());
1414 value = environment()->Pop(); 1419 value = environment()->Pop();
1415 // Bind value and do loop body. 1420 // Bind value and do loop body.
1416 VectorSlotPair feedback = 1421 VectorSlotPair feedback =
1417 CreateVectorSlotPair(stmt->EachFeedbackSlot()); 1422 CreateVectorSlotPair(stmt->EachFeedbackSlot());
1418 VisitForInAssignment(stmt->each(), value, feedback, 1423 VisitForInAssignment(stmt->each(), value, feedback,
1419 stmt->AssignmentId()); 1424 stmt->AssignmentId());
1420 VisitIterationBody(stmt, &for_loop, stmt->StackCheckId()); 1425 VisitIterationBody(stmt, &for_loop, stmt->StackCheckId());
1421 } 1426 }
1422 test_value.End(); 1427 test_value.End();
1423 for_loop.EndBody(); 1428 for_loop.EndBody();
1424 1429
1425 // Increment counter and continue. 1430 // Increment counter and continue (we know that the {index} is always
1431 // in Smi range, so we can just set the hint on the increment below).
1426 index = environment()->Peek(0); 1432 index = environment()->Peek(0);
1427 index = NewNode(javascript()->ForInStep(), index); 1433 PrepareEagerCheckpoint(stmt->IncrementId());
1434 index = NewNode(javascript()->Add(BinaryOperationHint::kSignedSmall),
1435 index, jsgraph()->OneConstant());
1436 PrepareFrameState(index, BailoutId::None());
1428 environment()->Poke(0, index); 1437 environment()->Poke(0, index);
1429 } 1438 }
1430 for_loop.EndLoop(); 1439 for_loop.EndLoop();
1431 environment()->Drop(5); 1440 environment()->Drop(5);
1432 } 1441 }
1433 for_block.EndBlock(); 1442 for_block.EndBlock();
1434 } 1443 }
1435 1444
1436 1445
1437 void AstGraphBuilder::VisitForOfStatement(ForOfStatement* stmt) { 1446 void AstGraphBuilder::VisitForOfStatement(ForOfStatement* stmt) {
(...skipping 2887 matching lines...) Expand 10 before | Expand all | Expand 10 after
4325 // Phi does not exist yet, introduce one. 4334 // Phi does not exist yet, introduce one.
4326 value = NewPhi(inputs, value, control); 4335 value = NewPhi(inputs, value, control);
4327 value->ReplaceInput(inputs - 1, other); 4336 value->ReplaceInput(inputs - 1, other);
4328 } 4337 }
4329 return value; 4338 return value;
4330 } 4339 }
4331 4340
4332 } // namespace compiler 4341 } // namespace compiler
4333 } // namespace internal 4342 } // namespace internal
4334 } // namespace v8 4343 } // namespace v8
OLDNEW
« 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