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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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): 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 |
845 // available in bytecode array. update this code when the implementation | 845 // available in bytecode array. update this code when the implementation |
846 // changes. | 846 // changes. |
847 const Operator* op = | 847 const Operator* op = javascript()->LoadContext( |
848 javascript()->LoadContext(bytecode_iterator().GetIndexOperand(2), | 848 bytecode_iterator().GetUnsignedImmediateOperand(2), |
849 bytecode_iterator().GetIndexOperand(1), false); | 849 bytecode_iterator().GetIndexOperand(1), false); |
850 Node* context = | 850 Node* context = |
851 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 851 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
852 return NewNode(op, context); | 852 return NewNode(op, context); |
853 } | 853 } |
854 | 854 |
855 void BytecodeGraphBuilder::VisitLdaContextSlot() { | 855 void BytecodeGraphBuilder::VisitLdaContextSlot() { |
856 Node* node = BuildLoadContextSlot(); | 856 Node* node = BuildLoadContextSlot(); |
857 environment()->BindAccumulator(node); | 857 environment()->BindAccumulator(node); |
858 } | 858 } |
859 | 859 |
860 void BytecodeGraphBuilder::VisitLdrContextSlot() { | 860 void BytecodeGraphBuilder::VisitLdrContextSlot() { |
861 Node* node = BuildLoadContextSlot(); | 861 Node* node = BuildLoadContextSlot(); |
862 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node); | 862 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node); |
863 } | 863 } |
864 | 864 |
865 void BytecodeGraphBuilder::VisitStaContextSlot() { | 865 void BytecodeGraphBuilder::VisitStaContextSlot() { |
866 const Operator* op = | 866 const Operator* op = javascript()->StoreContext( |
867 javascript()->StoreContext(bytecode_iterator().GetIndexOperand(2), | 867 bytecode_iterator().GetUnsignedImmediateOperand(2), |
868 bytecode_iterator().GetIndexOperand(1)); | 868 bytecode_iterator().GetIndexOperand(1)); |
869 Node* context = | 869 Node* context = |
870 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 870 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
871 Node* value = environment()->LookupAccumulator(); | 871 Node* value = environment()->LookupAccumulator(); |
872 NewNode(op, context, value); | 872 NewNode(op, context, value); |
873 } | 873 } |
874 | 874 |
875 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { | 875 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { |
876 FrameStateBeforeAndAfter states(this); | 876 FrameStateBeforeAndAfter states(this); |
877 Node* name = | 877 Node* name = |
878 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); | 878 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 void BytecodeGraphBuilder::VisitCreateBlockContext() { | 1036 void BytecodeGraphBuilder::VisitCreateBlockContext() { |
1037 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast( | 1037 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast( |
1038 bytecode_iterator().GetConstantForIndexOperand(0)); | 1038 bytecode_iterator().GetConstantForIndexOperand(0)); |
1039 | 1039 |
1040 const Operator* op = javascript()->CreateBlockContext(scope_info); | 1040 const Operator* op = javascript()->CreateBlockContext(scope_info); |
1041 Node* context = NewNode(op, environment()->LookupAccumulator()); | 1041 Node* context = NewNode(op, environment()->LookupAccumulator()); |
1042 environment()->BindAccumulator(context); | 1042 environment()->BindAccumulator(context); |
1043 } | 1043 } |
1044 | 1044 |
1045 void BytecodeGraphBuilder::VisitCreateFunctionContext() { | 1045 void BytecodeGraphBuilder::VisitCreateFunctionContext() { |
1046 uint32_t slots = bytecode_iterator().GetIndexOperand(0); | 1046 uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(0); |
1047 const Operator* op = javascript()->CreateFunctionContext(slots); | 1047 const Operator* op = javascript()->CreateFunctionContext(slots); |
1048 Node* context = NewNode(op, GetFunctionClosure()); | 1048 Node* context = NewNode(op, GetFunctionClosure()); |
1049 environment()->BindAccumulator(context); | 1049 environment()->BindAccumulator(context); |
1050 } | 1050 } |
1051 | 1051 |
1052 void BytecodeGraphBuilder::VisitCreateCatchContext() { | 1052 void BytecodeGraphBuilder::VisitCreateCatchContext() { |
1053 interpreter::Register reg = bytecode_iterator().GetRegisterOperand(0); | 1053 interpreter::Register reg = bytecode_iterator().GetRegisterOperand(0); |
1054 Node* exception = environment()->LookupRegister(reg); | 1054 Node* exception = environment()->LookupRegister(reg); |
1055 Handle<String> name = | 1055 Handle<String> name = |
1056 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 1056 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 // Phi does not exist yet, introduce one. | 2072 // Phi does not exist yet, introduce one. |
2073 value = NewPhi(inputs, value, control); | 2073 value = NewPhi(inputs, value, control); |
2074 value->ReplaceInput(inputs - 1, other); | 2074 value->ReplaceInput(inputs - 1, other); |
2075 } | 2075 } |
2076 return value; | 2076 return value; |
2077 } | 2077 } |
2078 | 2078 |
2079 } // namespace compiler | 2079 } // namespace compiler |
2080 } // namespace internal | 2080 } // namespace internal |
2081 } // namespace v8 | 2081 } // namespace v8 |
OLD | NEW |