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/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/compiler-source-position-table.h" | 10 #include "src/compiler/compiler-source-position-table.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 int flags = bytecode_iterator().GetFlagOperand(2); | 763 int flags = bytecode_iterator().GetFlagOperand(2); |
764 VectorSlotPair feedback = | 764 VectorSlotPair feedback = |
765 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); | 765 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
766 | 766 |
767 const Operator* op = javascript()->StoreDataPropertyInLiteral(feedback); | 767 const Operator* op = javascript()->StoreDataPropertyInLiteral(feedback); |
768 Node* node = NewNode(op, object, name, value, jsgraph()->Constant(flags)); | 768 Node* node = NewNode(op, object, name, value, jsgraph()->Constant(flags)); |
769 environment()->RecordAfterState(node, Environment::kAttachFrameState); | 769 environment()->RecordAfterState(node, Environment::kAttachFrameState); |
770 } | 770 } |
771 | 771 |
772 void BytecodeGraphBuilder::VisitLdaContextSlot() { | 772 void BytecodeGraphBuilder::VisitLdaContextSlot() { |
773 // TODO(mythria): immutable flag is also set to false. This information is not | |
774 // available in bytecode array. update this code when the implementation | |
775 // changes. | |
776 const Operator* op = javascript()->LoadContext( | 773 const Operator* op = javascript()->LoadContext( |
777 bytecode_iterator().GetUnsignedImmediateOperand(2), | 774 bytecode_iterator().GetUnsignedImmediateOperand(2), |
778 bytecode_iterator().GetIndexOperand(1), false); | 775 bytecode_iterator().GetIndexOperand(1), false); |
779 Node* node = NewNode(op); | 776 Node* node = NewNode(op); |
780 Node* context = | 777 Node* context = |
781 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 778 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
782 NodeProperties::ReplaceContextInput(node, context); | 779 NodeProperties::ReplaceContextInput(node, context); |
783 environment()->BindAccumulator(node); | 780 environment()->BindAccumulator(node); |
784 } | 781 } |
785 | 782 |
| 783 void BytecodeGraphBuilder::VisitLdaImmutableContextSlot() { |
| 784 const Operator* op = javascript()->LoadContext( |
| 785 bytecode_iterator().GetUnsignedImmediateOperand(2), |
| 786 bytecode_iterator().GetIndexOperand(1), true); |
| 787 Node* node = NewNode(op); |
| 788 Node* context = |
| 789 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 790 NodeProperties::ReplaceContextInput(node, context); |
| 791 environment()->BindAccumulator(node); |
| 792 } |
| 793 |
786 void BytecodeGraphBuilder::VisitLdaCurrentContextSlot() { | 794 void BytecodeGraphBuilder::VisitLdaCurrentContextSlot() { |
787 // TODO(mythria): immutable flag is also set to false. This information is not | |
788 // available in bytecode array. update this code when the implementation | |
789 // changes. | |
790 const Operator* op = javascript()->LoadContext( | 795 const Operator* op = javascript()->LoadContext( |
791 0, bytecode_iterator().GetIndexOperand(0), false); | 796 0, bytecode_iterator().GetIndexOperand(0), false); |
792 Node* node = NewNode(op); | 797 Node* node = NewNode(op); |
793 environment()->BindAccumulator(node); | 798 environment()->BindAccumulator(node); |
794 } | 799 } |
795 | 800 |
| 801 void BytecodeGraphBuilder::VisitLdaImmutableCurrentContextSlot() { |
| 802 const Operator* op = javascript()->LoadContext( |
| 803 0, bytecode_iterator().GetIndexOperand(0), true); |
| 804 Node* node = NewNode(op); |
| 805 environment()->BindAccumulator(node); |
| 806 } |
| 807 |
796 void BytecodeGraphBuilder::VisitStaContextSlot() { | 808 void BytecodeGraphBuilder::VisitStaContextSlot() { |
797 const Operator* op = javascript()->StoreContext( | 809 const Operator* op = javascript()->StoreContext( |
798 bytecode_iterator().GetUnsignedImmediateOperand(2), | 810 bytecode_iterator().GetUnsignedImmediateOperand(2), |
799 bytecode_iterator().GetIndexOperand(1)); | 811 bytecode_iterator().GetIndexOperand(1)); |
800 Node* value = environment()->LookupAccumulator(); | 812 Node* value = environment()->LookupAccumulator(); |
801 Node* node = NewNode(op, value); | 813 Node* node = NewNode(op, value); |
802 Node* context = | 814 Node* context = |
803 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 815 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
804 NodeProperties::ReplaceContextInput(node, context); | 816 NodeProperties::ReplaceContextInput(node, context); |
805 } | 817 } |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2327 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2316 it->Advance(); | 2328 it->Advance(); |
2317 } else { | 2329 } else { |
2318 DCHECK_GT(it->code_offset(), offset); | 2330 DCHECK_GT(it->code_offset(), offset); |
2319 } | 2331 } |
2320 } | 2332 } |
2321 | 2333 |
2322 } // namespace compiler | 2334 } // namespace compiler |
2323 } // namespace internal | 2335 } // namespace internal |
2324 } // namespace v8 | 2336 } // namespace v8 |
OLD | NEW |