Chromium Code Reviews| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 157 |
| 158 | 158 |
| 159 void BytecodeGraphBuilder::Environment::BindAccumulator( | 159 void BytecodeGraphBuilder::Environment::BindAccumulator( |
| 160 Node* node, FrameStateBeforeAndAfter* states) { | 160 Node* node, FrameStateBeforeAndAfter* states) { |
| 161 if (states) { | 161 if (states) { |
| 162 states->AddToNode(node, AccumulatorUpdateMode::kOutputInAccumulator); | 162 states->AddToNode(node, AccumulatorUpdateMode::kOutputInAccumulator); |
| 163 } | 163 } |
| 164 values()->at(accumulator_base_) = node; | 164 values()->at(accumulator_base_) = node; |
| 165 } | 165 } |
| 166 | 166 |
| 167 | |
| 167 void BytecodeGraphBuilder::Environment::RecordAfterState( | 168 void BytecodeGraphBuilder::Environment::RecordAfterState( |
| 168 Node* node, FrameStateBeforeAndAfter* states) { | 169 Node* node, FrameStateBeforeAndAfter* states) { |
| 169 states->AddToNode(node, AccumulatorUpdateMode::kOutputIgnored); | 170 states->AddToNode(node, AccumulatorUpdateMode::kOutputIgnored); |
| 170 } | 171 } |
| 171 | 172 |
| 172 | 173 |
| 174 void BytecodeGraphBuilder::Environment::ExchangeRegisters( | |
| 175 interpreter::Register r0, interpreter::Register r1) { | |
|
rmcilroy
2016/01/04 11:54:53
nit - reg0, reg1
oth
2016/01/04 14:01:42
Done.
| |
| 176 int i0 = RegisterToValuesIndex(r0); | |
|
rmcilroy
2016/01/04 11:54:53
nit - reg0_index
oth
2016/01/04 14:01:42
Done.
| |
| 177 int i1 = RegisterToValuesIndex(r1); | |
| 178 Node* saved = values()->at(i0); | |
| 179 values()->at(i0) = values()->at(i1); | |
| 180 values()->at(i1) = saved; | |
| 181 } | |
| 182 | |
| 183 | |
| 173 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const { | 184 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const { |
| 174 return values()->at(accumulator_base_); | 185 return values()->at(accumulator_base_); |
| 175 } | 186 } |
| 176 | 187 |
| 177 | 188 |
| 178 bool BytecodeGraphBuilder::Environment::IsMarkedAsUnreachable() const { | 189 bool BytecodeGraphBuilder::Environment::IsMarkedAsUnreachable() const { |
| 179 return GetControlDependency()->opcode() == IrOpcode::kDead; | 190 return GetControlDependency()->opcode() == IrOpcode::kDead; |
| 180 } | 191 } |
| 181 | 192 |
| 182 | 193 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 } | 565 } |
| 555 | 566 |
| 556 | 567 |
| 557 void BytecodeGraphBuilder::VisitMov( | 568 void BytecodeGraphBuilder::VisitMov( |
| 558 const interpreter::BytecodeArrayIterator& iterator) { | 569 const interpreter::BytecodeArrayIterator& iterator) { |
| 559 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 570 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 560 environment()->BindRegister(iterator.GetRegisterOperand(1), value); | 571 environment()->BindRegister(iterator.GetRegisterOperand(1), value); |
| 561 } | 572 } |
| 562 | 573 |
| 563 | 574 |
| 575 void BytecodeGraphBuilder::VisitExchange( | |
| 576 const interpreter::BytecodeArrayIterator& iterator) { | |
| 577 environment()->ExchangeRegisters(iterator.GetRegisterOperand(0), | |
| 578 iterator.GetRegisterOperand(1)); | |
| 579 } | |
| 580 | |
| 581 | |
| 582 void BytecodeGraphBuilder::VisitExchangeWide( | |
| 583 const interpreter::BytecodeArrayIterator& iterator) { | |
| 584 environment()->ExchangeRegisters(iterator.GetRegisterOperand(0), | |
| 585 iterator.GetRegisterOperand(1)); | |
| 586 } | |
| 587 | |
| 588 | |
| 564 void BytecodeGraphBuilder::BuildLoadGlobal( | 589 void BytecodeGraphBuilder::BuildLoadGlobal( |
| 565 const interpreter::BytecodeArrayIterator& iterator, | 590 const interpreter::BytecodeArrayIterator& iterator, |
| 566 TypeofMode typeof_mode) { | 591 TypeofMode typeof_mode) { |
| 567 FrameStateBeforeAndAfter states(this, iterator); | 592 FrameStateBeforeAndAfter states(this, iterator); |
| 568 Handle<Name> name = | 593 Handle<Name> name = |
| 569 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); | 594 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); |
| 570 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); | 595 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); |
| 571 | 596 |
| 572 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); | 597 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); |
| 573 Node* node = NewNode(op, BuildLoadFeedbackVector()); | 598 Node* node = NewNode(op, BuildLoadFeedbackVector()); |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1827 | 1852 |
| 1828 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1853 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
| 1829 if (environment()->IsMarkedAsUnreachable()) return; | 1854 if (environment()->IsMarkedAsUnreachable()) return; |
| 1830 environment()->MarkAsUnreachable(); | 1855 environment()->MarkAsUnreachable(); |
| 1831 exit_controls_.push_back(exit); | 1856 exit_controls_.push_back(exit); |
| 1832 } | 1857 } |
| 1833 | 1858 |
| 1834 } // namespace compiler | 1859 } // namespace compiler |
| 1835 } // namespace internal | 1860 } // namespace internal |
| 1836 } // namespace v8 | 1861 } // namespace v8 |
| OLD | NEW |