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

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

Issue 1531693002: [Interpreter] Implement ForIn in bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0009-phi
Patch Set: Rebase after de-opt landed. Created 5 years 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 | « no previous file | src/interpreter/bytecode-array-builder.h » ('j') | src/interpreter/interpreter.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 environment()->BindAccumulator(node, &states); 1387 environment()->BindAccumulator(node, &states);
1388 } 1388 }
1389 1389
1390 1390
1391 void BytecodeGraphBuilder::VisitToName( 1391 void BytecodeGraphBuilder::VisitToName(
1392 const interpreter::BytecodeArrayIterator& iterator) { 1392 const interpreter::BytecodeArrayIterator& iterator) {
1393 BuildCastOperator(javascript()->ToName(), iterator); 1393 BuildCastOperator(javascript()->ToName(), iterator);
1394 } 1394 }
1395 1395
1396 1396
1397 void BytecodeGraphBuilder::VisitToObject(
1398 const interpreter::BytecodeArrayIterator& iterator) {
1399 BuildCastOperator(javascript()->ToObject(), iterator);
1400 }
1401
1402
1397 void BytecodeGraphBuilder::VisitToNumber( 1403 void BytecodeGraphBuilder::VisitToNumber(
1398 const interpreter::BytecodeArrayIterator& iterator) { 1404 const interpreter::BytecodeArrayIterator& iterator) {
1399 BuildCastOperator(javascript()->ToNumber(), iterator); 1405 BuildCastOperator(javascript()->ToNumber(), iterator);
1400 } 1406 }
1401 1407
1402 1408
1403 void BytecodeGraphBuilder::VisitToObject(
1404 const interpreter::BytecodeArrayIterator& iterator) {
1405 BuildCastOperator(javascript()->ToObject(), iterator);
1406 }
1407
1408
1409 void BytecodeGraphBuilder::VisitJump( 1409 void BytecodeGraphBuilder::VisitJump(
1410 const interpreter::BytecodeArrayIterator& iterator) { 1410 const interpreter::BytecodeArrayIterator& iterator) {
1411 BuildJump(); 1411 BuildJump();
1412 } 1412 }
1413 1413
1414 1414
1415 void BytecodeGraphBuilder::VisitJumpConstant( 1415 void BytecodeGraphBuilder::VisitJumpConstant(
1416 const interpreter::BytecodeArrayIterator& iterator) { 1416 const interpreter::BytecodeArrayIterator& iterator) {
1417 BuildJump(); 1417 BuildJump();
1418 } 1418 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 const interpreter::BytecodeArrayIterator& iterator) { 1506 const interpreter::BytecodeArrayIterator& iterator) {
1507 Node* control = 1507 Node* control =
1508 NewNode(common()->Return(), environment()->LookupAccumulator()); 1508 NewNode(common()->Return(), environment()->LookupAccumulator());
1509 UpdateControlDependencyToLeaveFunction(control); 1509 UpdateControlDependencyToLeaveFunction(control);
1510 set_environment(nullptr); 1510 set_environment(nullptr);
1511 } 1511 }
1512 1512
1513 1513
1514 void BytecodeGraphBuilder::VisitForInPrepare( 1514 void BytecodeGraphBuilder::VisitForInPrepare(
1515 const interpreter::BytecodeArrayIterator& iterator) { 1515 const interpreter::BytecodeArrayIterator& iterator) {
1516 UNIMPLEMENTED(); 1516 // Bytecodes in the boilerplate emitted by the bytecode generator
1517 // have already cast the object to JSReceiver and checked it is
1518 // valid.
1519 Node* receiver =
1520 environment()->LookupRegister(iterator.GetRegisterOperand(0));
1521 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver);
1522 Node* cache_type = NewNode(common()->Projection(0), prepare);
1523 Node* cache_array = NewNode(common()->Projection(1), prepare);
1524 Node* cache_length = NewNode(common()->Projection(2), prepare);
1525 environment()->BindRegister(iterator.GetRegisterOperand(1), cache_type);
1526 environment()->BindRegister(iterator.GetRegisterOperand(2), cache_array);
1527 environment()->BindRegister(iterator.GetRegisterOperand(3), cache_length);
1528 }
1529
1530
1531 void BytecodeGraphBuilder::VisitForInDone(
1532 const interpreter::BytecodeArrayIterator& iterator) {
1533 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1534 Node* cache_length =
1535 environment()->LookupRegister(iterator.GetRegisterOperand(1));
1536 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length);
1537 environment()->BindAccumulator(exit_cond);
1517 } 1538 }
1518 1539
1519 1540
1520 void BytecodeGraphBuilder::VisitForInNext( 1541 void BytecodeGraphBuilder::VisitForInNext(
1521 const interpreter::BytecodeArrayIterator& iterator) { 1542 const interpreter::BytecodeArrayIterator& iterator) {
1522 UNIMPLEMENTED(); 1543 Node* receiver =
1544 environment()->LookupRegister(iterator.GetRegisterOperand(0));
1545 Node* cache_type =
1546 environment()->LookupRegister(iterator.GetRegisterOperand(1));
1547 Node* cache_array =
1548 environment()->LookupRegister(iterator.GetRegisterOperand(2));
1549 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(3));
1550 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array,
1551 cache_type, index);
1552 environment()->BindAccumulator(value);
1523 } 1553 }
1524 1554
1525 1555
1526 void BytecodeGraphBuilder::VisitForInDone( 1556 void BytecodeGraphBuilder::VisitForInStep(
1527 const interpreter::BytecodeArrayIterator& iterator) { 1557 const interpreter::BytecodeArrayIterator& iterator) {
1528 UNIMPLEMENTED(); 1558 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1559 index = NewNode(javascript()->ForInStep(), index);
1560 environment()->BindRegister(iterator.GetRegisterOperand(0), index);
1529 } 1561 }
1530 1562
1531 1563
1532 void BytecodeGraphBuilder::MergeEnvironmentsOfBackwardBranches( 1564 void BytecodeGraphBuilder::MergeEnvironmentsOfBackwardBranches(
1533 int source_offset, int target_offset) { 1565 int source_offset, int target_offset) {
1534 DCHECK_GE(source_offset, target_offset); 1566 DCHECK_GE(source_offset, target_offset);
1535 const ZoneVector<int>* branch_sites = 1567 const ZoneVector<int>* branch_sites =
1536 branch_analysis()->BackwardBranchesTargetting(target_offset); 1568 branch_analysis()->BackwardBranchesTargetting(target_offset);
1537 if (branch_sites->back() == source_offset) { 1569 if (branch_sites->back() == source_offset) {
1538 // The set of back branches is complete, merge them. 1570 // The set of back branches is complete, merge them.
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 1803
1772 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { 1804 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) {
1773 if (environment()->IsMarkedAsUnreachable()) return; 1805 if (environment()->IsMarkedAsUnreachable()) return;
1774 environment()->MarkAsUnreachable(); 1806 environment()->MarkAsUnreachable();
1775 exit_controls_.push_back(exit); 1807 exit_controls_.push_back(exit);
1776 } 1808 }
1777 1809
1778 } // namespace compiler 1810 } // namespace compiler
1779 } // namespace internal 1811 } // namespace internal
1780 } // namespace v8 1812 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-builder.h » ('j') | src/interpreter/interpreter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698