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. |
773 const Operator* op = javascript()->LoadContext( | 776 const Operator* op = javascript()->LoadContext( |
774 bytecode_iterator().GetUnsignedImmediateOperand(2), | 777 bytecode_iterator().GetUnsignedImmediateOperand(2), |
775 bytecode_iterator().GetIndexOperand(1), false); | 778 bytecode_iterator().GetIndexOperand(1), false); |
776 Node* node = NewNode(op); | 779 Node* node = NewNode(op); |
777 Node* context = | 780 Node* context = |
778 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 781 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
779 NodeProperties::ReplaceContextInput(node, context); | 782 NodeProperties::ReplaceContextInput(node, context); |
780 environment()->BindAccumulator(node); | 783 environment()->BindAccumulator(node); |
781 } | 784 } |
782 | 785 |
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 | |
794 void BytecodeGraphBuilder::VisitLdaCurrentContextSlot() { | 786 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. |
795 const Operator* op = javascript()->LoadContext( | 790 const Operator* op = javascript()->LoadContext( |
796 0, bytecode_iterator().GetIndexOperand(0), false); | 791 0, bytecode_iterator().GetIndexOperand(0), false); |
797 Node* node = NewNode(op); | 792 Node* node = NewNode(op); |
798 environment()->BindAccumulator(node); | 793 environment()->BindAccumulator(node); |
799 } | 794 } |
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 | 795 |
808 void BytecodeGraphBuilder::VisitStaContextSlot() { | 796 void BytecodeGraphBuilder::VisitStaContextSlot() { |
809 const Operator* op = javascript()->StoreContext( | 797 const Operator* op = javascript()->StoreContext( |
810 bytecode_iterator().GetUnsignedImmediateOperand(2), | 798 bytecode_iterator().GetUnsignedImmediateOperand(2), |
811 bytecode_iterator().GetIndexOperand(1)); | 799 bytecode_iterator().GetIndexOperand(1)); |
812 Node* value = environment()->LookupAccumulator(); | 800 Node* value = environment()->LookupAccumulator(); |
813 Node* node = NewNode(op, value); | 801 Node* node = NewNode(op, value); |
814 Node* context = | 802 Node* context = |
815 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 803 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
816 NodeProperties::ReplaceContextInput(node, context); | 804 NodeProperties::ReplaceContextInput(node, context); |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2315 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2328 it->Advance(); | 2316 it->Advance(); |
2329 } else { | 2317 } else { |
2330 DCHECK_GT(it->code_offset(), offset); | 2318 DCHECK_GT(it->code_offset(), offset); |
2331 } | 2319 } |
2332 } | 2320 } |
2333 | 2321 |
2334 } // namespace compiler | 2322 } // namespace compiler |
2335 } // namespace internal | 2323 } // namespace internal |
2336 } // namespace v8 | 2324 } // namespace v8 |
OLD | NEW |