| OLD | NEW |
| 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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 FrameStateBeforeAndAfter states(this); | 1539 FrameStateBeforeAndAfter states(this); |
| 1540 Node* receiver = | 1540 Node* receiver = |
| 1541 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1541 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1542 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); | 1542 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); |
| 1543 environment()->BindRegistersToProjections( | 1543 environment()->BindRegistersToProjections( |
| 1544 bytecode_iterator().GetRegisterOperand(1), prepare, &states); | 1544 bytecode_iterator().GetRegisterOperand(1), prepare, &states); |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); } | 1547 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); } |
| 1548 | 1548 |
| 1549 void BytecodeGraphBuilder::VisitForInDone() { | 1549 void BytecodeGraphBuilder::VisitForInContinue() { |
| 1550 FrameStateBeforeAndAfter states(this); | 1550 FrameStateBeforeAndAfter states(this); |
| 1551 Node* index = | 1551 Node* index = |
| 1552 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1552 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1553 Node* cache_length = | 1553 Node* cache_length = |
| 1554 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 1554 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); |
| 1555 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); | 1555 Node* exit_cond = |
| 1556 NewNode(javascript()->LessThan(CompareOperationHint::kSignedSmall), index, |
| 1557 cache_length); |
| 1556 environment()->BindAccumulator(exit_cond, &states); | 1558 environment()->BindAccumulator(exit_cond, &states); |
| 1557 } | 1559 } |
| 1558 | 1560 |
| 1559 void BytecodeGraphBuilder::BuildForInNext() { | 1561 void BytecodeGraphBuilder::BuildForInNext() { |
| 1560 FrameStateBeforeAndAfter states(this); | 1562 FrameStateBeforeAndAfter states(this); |
| 1561 Node* receiver = | 1563 Node* receiver = |
| 1562 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1564 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1563 Node* index = | 1565 Node* index = |
| 1564 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 1566 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); |
| 1565 int catch_reg_pair_index = bytecode_iterator().GetRegisterOperand(2).index(); | 1567 int catch_reg_pair_index = bytecode_iterator().GetRegisterOperand(2).index(); |
| 1566 Node* cache_type = environment()->LookupRegister( | 1568 Node* cache_type = environment()->LookupRegister( |
| 1567 interpreter::Register(catch_reg_pair_index)); | 1569 interpreter::Register(catch_reg_pair_index)); |
| 1568 Node* cache_array = environment()->LookupRegister( | 1570 Node* cache_array = environment()->LookupRegister( |
| 1569 interpreter::Register(catch_reg_pair_index + 1)); | 1571 interpreter::Register(catch_reg_pair_index + 1)); |
| 1570 | 1572 |
| 1571 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, | 1573 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, |
| 1572 cache_type, index); | 1574 cache_type, index); |
| 1573 environment()->BindAccumulator(value, &states); | 1575 environment()->BindAccumulator(value, &states); |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); } | 1578 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); } |
| 1577 | 1579 |
| 1578 void BytecodeGraphBuilder::VisitForInStep() { | 1580 void BytecodeGraphBuilder::VisitForInStep() { |
| 1579 FrameStateBeforeAndAfter states(this); | 1581 FrameStateBeforeAndAfter states(this); |
| 1580 Node* index = | 1582 Node* index = |
| 1581 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1583 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1582 index = NewNode(javascript()->ForInStep(), index); | 1584 index = NewNode(javascript()->Add(BinaryOperationHint::kSignedSmall), index, |
| 1585 jsgraph()->OneConstant()); |
| 1583 environment()->BindAccumulator(index, &states); | 1586 environment()->BindAccumulator(index, &states); |
| 1584 } | 1587 } |
| 1585 | 1588 |
| 1586 void BytecodeGraphBuilder::VisitSuspendGenerator() { | 1589 void BytecodeGraphBuilder::VisitSuspendGenerator() { |
| 1587 Node* state = environment()->LookupAccumulator(); | 1590 Node* state = environment()->LookupAccumulator(); |
| 1588 Node* generator = environment()->LookupRegister( | 1591 Node* generator = environment()->LookupRegister( |
| 1589 bytecode_iterator().GetRegisterOperand(0)); | 1592 bytecode_iterator().GetRegisterOperand(0)); |
| 1590 // The offsets used by the bytecode iterator are relative to a different base | 1593 // The offsets used by the bytecode iterator are relative to a different base |
| 1591 // than what is used in the interpreter, hence the addition. | 1594 // than what is used in the interpreter, hence the addition. |
| 1592 Node* offset = | 1595 Node* offset = |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 // Phi does not exist yet, introduce one. | 1934 // Phi does not exist yet, introduce one. |
| 1932 value = NewPhi(inputs, value, control); | 1935 value = NewPhi(inputs, value, control); |
| 1933 value->ReplaceInput(inputs - 1, other); | 1936 value->ReplaceInput(inputs - 1, other); |
| 1934 } | 1937 } |
| 1935 return value; | 1938 return value; |
| 1936 } | 1939 } |
| 1937 | 1940 |
| 1938 } // namespace compiler | 1941 } // namespace compiler |
| 1939 } // namespace internal | 1942 } // namespace internal |
| 1940 } // namespace v8 | 1943 } // namespace v8 |
| OLD | NEW |