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/bytecode-branch-analysis.h" | 10 #include "src/compiler/bytecode-branch-analysis.h" |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 834 |
835 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { | 835 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { |
836 BuildStoreGlobal(LanguageMode::SLOPPY); | 836 BuildStoreGlobal(LanguageMode::SLOPPY); |
837 } | 837 } |
838 | 838 |
839 void BytecodeGraphBuilder::VisitStaGlobalStrict() { | 839 void BytecodeGraphBuilder::VisitStaGlobalStrict() { |
840 BuildStoreGlobal(LanguageMode::STRICT); | 840 BuildStoreGlobal(LanguageMode::STRICT); |
841 } | 841 } |
842 | 842 |
843 Node* BytecodeGraphBuilder::BuildLoadContextSlot() { | 843 Node* BytecodeGraphBuilder::BuildLoadContextSlot() { |
844 // TODO(mythria): LoadContextSlots are unrolled by the required depth when | |
845 // generating bytecode. Hence the value of depth is always 0. Update this | |
846 // code, when the implementation changes. | |
847 // TODO(mythria): immutable flag is also set to false. This information is not | 844 // TODO(mythria): immutable flag is also set to false. This information is not |
848 // available in bytecode array. update this code when the implementation | 845 // available in bytecode array. update this code when the implementation |
849 // changes. | 846 // changes. |
850 const Operator* op = javascript()->LoadContext( | 847 const Operator* op = |
851 0, bytecode_iterator().GetIndexOperand(1), false); | 848 javascript()->LoadContext(bytecode_iterator().GetIndexOperand(2), |
| 849 bytecode_iterator().GetIndexOperand(1), false); |
852 Node* context = | 850 Node* context = |
853 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 851 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
854 return NewNode(op, context); | 852 return NewNode(op, context); |
855 } | 853 } |
856 | 854 |
857 void BytecodeGraphBuilder::VisitLdaContextSlot() { | 855 void BytecodeGraphBuilder::VisitLdaContextSlot() { |
858 Node* node = BuildLoadContextSlot(); | 856 Node* node = BuildLoadContextSlot(); |
859 environment()->BindAccumulator(node); | 857 environment()->BindAccumulator(node); |
860 } | 858 } |
861 | 859 |
862 void BytecodeGraphBuilder::VisitLdrContextSlot() { | 860 void BytecodeGraphBuilder::VisitLdrContextSlot() { |
863 Node* node = BuildLoadContextSlot(); | 861 Node* node = BuildLoadContextSlot(); |
864 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node); | 862 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node); |
865 } | 863 } |
866 | 864 |
867 void BytecodeGraphBuilder::VisitStaContextSlot() { | 865 void BytecodeGraphBuilder::VisitStaContextSlot() { |
868 // TODO(mythria): LoadContextSlots are unrolled by the required depth when | |
869 // generating bytecode. Hence the value of depth is always 0. Update this | |
870 // code, when the implementation changes. | |
871 const Operator* op = | 866 const Operator* op = |
872 javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(1)); | 867 javascript()->StoreContext(bytecode_iterator().GetIndexOperand(2), |
| 868 bytecode_iterator().GetIndexOperand(1)); |
873 Node* context = | 869 Node* context = |
874 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 870 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
875 Node* value = environment()->LookupAccumulator(); | 871 Node* value = environment()->LookupAccumulator(); |
876 NewNode(op, context, value); | 872 NewNode(op, context, value); |
877 } | 873 } |
878 | 874 |
879 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { | 875 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { |
880 FrameStateBeforeAndAfter states(this); | 876 FrameStateBeforeAndAfter states(this); |
881 Node* name = | 877 Node* name = |
882 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); | 878 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 // Phi does not exist yet, introduce one. | 2072 // Phi does not exist yet, introduce one. |
2077 value = NewPhi(inputs, value, control); | 2073 value = NewPhi(inputs, value, control); |
2078 value->ReplaceInput(inputs - 1, other); | 2074 value->ReplaceInput(inputs - 1, other); |
2079 } | 2075 } |
2080 return value; | 2076 return value; |
2081 } | 2077 } |
2082 | 2078 |
2083 } // namespace compiler | 2079 } // namespace compiler |
2084 } // namespace internal | 2080 } // namespace internal |
2085 } // namespace v8 | 2081 } // namespace v8 |
OLD | NEW |