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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value); | 619 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value); |
620 } | 620 } |
621 | 621 |
622 void BytecodeGraphBuilder::VisitMov() { | 622 void BytecodeGraphBuilder::VisitMov() { |
623 Node* value = | 623 Node* value = |
624 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 624 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
625 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value); | 625 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value); |
626 } | 626 } |
627 | 627 |
628 Node* BytecodeGraphBuilder::BuildLoadGlobal(TypeofMode typeof_mode) { | 628 Node* BytecodeGraphBuilder::BuildLoadGlobal(TypeofMode typeof_mode) { |
629 Handle<Name> name = | |
630 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); | |
631 VectorSlotPair feedback = | 629 VectorSlotPair feedback = |
632 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 630 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(0)); |
| 631 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, |
| 632 feedback_vector()->GetKind(feedback.slot())); |
| 633 Handle<Name> name(feedback_vector()->GetName(feedback.slot())); |
633 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); | 634 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); |
634 return NewNode(op, GetFunctionClosure()); | 635 return NewNode(op, GetFunctionClosure()); |
635 } | 636 } |
636 | 637 |
637 void BytecodeGraphBuilder::VisitLdaGlobal() { | 638 void BytecodeGraphBuilder::VisitLdaGlobal() { |
638 FrameStateBeforeAndAfter states(this); | 639 FrameStateBeforeAndAfter states(this); |
639 Node* node = BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | 640 Node* node = BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); |
640 environment()->BindAccumulator(node, &states); | 641 environment()->BindAccumulator(node, &states); |
641 } | 642 } |
642 | 643 |
643 void BytecodeGraphBuilder::VisitLdrGlobal() { | 644 void BytecodeGraphBuilder::VisitLdrGlobal() { |
644 FrameStateBeforeAndAfter states(this); | 645 FrameStateBeforeAndAfter states(this); |
645 Node* node = BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | 646 Node* node = BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); |
646 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node, | 647 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), node, |
647 &states); | 648 &states); |
648 } | 649 } |
649 | 650 |
650 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() { | 651 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() { |
651 FrameStateBeforeAndAfter states(this); | 652 FrameStateBeforeAndAfter states(this); |
652 Node* node = BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); | 653 Node* node = BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); |
653 environment()->BindAccumulator(node, &states); | 654 environment()->BindAccumulator(node, &states); |
654 } | 655 } |
655 | 656 |
656 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { | 657 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 // Phi does not exist yet, introduce one. | 1744 // Phi does not exist yet, introduce one. |
1744 value = NewPhi(inputs, value, control); | 1745 value = NewPhi(inputs, value, control); |
1745 value->ReplaceInput(inputs - 1, other); | 1746 value->ReplaceInput(inputs - 1, other); |
1746 } | 1747 } |
1747 return value; | 1748 return value; |
1748 } | 1749 } |
1749 | 1750 |
1750 } // namespace compiler | 1751 } // namespace compiler |
1751 } // namespace internal | 1752 } // namespace internal |
1752 } // namespace v8 | 1753 } // namespace v8 |
OLD | NEW |