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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 for (int i = 0; i < static_cast<int>(arity); ++i) { | 994 for (int i = 0; i < static_cast<int>(arity); ++i) { |
995 all[i] = environment()->LookupRegister( | 995 all[i] = environment()->LookupRegister( |
996 interpreter::Register(first_arg_index + i)); | 996 interpreter::Register(first_arg_index + i)); |
997 } | 997 } |
998 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); | 998 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); |
999 return value; | 999 return value; |
1000 } | 1000 } |
1001 | 1001 |
1002 void BytecodeGraphBuilder::VisitCallRuntime() { | 1002 void BytecodeGraphBuilder::VisitCallRuntime() { |
1003 FrameStateBeforeAndAfter states(this); | 1003 FrameStateBeforeAndAfter states(this); |
1004 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>( | 1004 Runtime::FunctionId functionId = bytecode_iterator().GetRuntimeIdOperand(0); |
1005 bytecode_iterator().GetRuntimeIdOperand(0)); | |
1006 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1005 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1007 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1006 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1008 | 1007 |
1009 // Create node to perform the runtime call. | 1008 // Create node to perform the runtime call. |
1010 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1009 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1011 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1010 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1012 environment()->BindAccumulator(value, &states); | 1011 environment()->BindAccumulator(value, &states); |
1013 } | 1012 } |
1014 | 1013 |
1015 void BytecodeGraphBuilder::VisitCallRuntimeForPair() { | 1014 void BytecodeGraphBuilder::VisitCallRuntimeForPair() { |
1016 FrameStateBeforeAndAfter states(this); | 1015 FrameStateBeforeAndAfter states(this); |
1017 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>( | 1016 Runtime::FunctionId functionId = bytecode_iterator().GetRuntimeIdOperand(0); |
1018 bytecode_iterator().GetRuntimeIdOperand(0)); | |
1019 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1017 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1020 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1018 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1021 interpreter::Register first_return = | 1019 interpreter::Register first_return = |
1022 bytecode_iterator().GetRegisterOperand(3); | 1020 bytecode_iterator().GetRegisterOperand(3); |
1023 | 1021 |
1024 // Create node to perform the runtime call. | 1022 // Create node to perform the runtime call. |
1025 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1023 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1026 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1024 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1027 environment()->BindRegistersToProjections(first_return, return_pair, &states); | 1025 environment()->BindRegistersToProjections(first_return, return_pair, &states); |
1028 } | 1026 } |
1029 | 1027 |
1030 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { | 1028 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { |
1031 FrameStateBeforeAndAfter states(this); | 1029 FrameStateBeforeAndAfter states(this); |
1032 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>( | 1030 Runtime::FunctionId functionId = bytecode_iterator().GetIntrinsicIdOperand(0); |
1033 bytecode_iterator().GetRuntimeIdOperand(0)); | |
1034 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1031 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1035 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1032 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1036 | 1033 |
1037 // Create node to perform the runtime call. Turbofan will take care of the | 1034 // Create node to perform the runtime call. Turbofan will take care of the |
1038 // lowering. | 1035 // lowering. |
1039 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1036 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1040 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1037 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1041 environment()->BindAccumulator(value, &states); | 1038 environment()->BindAccumulator(value, &states); |
1042 } | 1039 } |
1043 | 1040 |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 // Phi does not exist yet, introduce one. | 1743 // Phi does not exist yet, introduce one. |
1747 value = NewPhi(inputs, value, control); | 1744 value = NewPhi(inputs, value, control); |
1748 value->ReplaceInput(inputs - 1, other); | 1745 value->ReplaceInput(inputs - 1, other); |
1749 } | 1746 } |
1750 return value; | 1747 return value; |
1751 } | 1748 } |
1752 | 1749 |
1753 } // namespace compiler | 1750 } // namespace compiler |
1754 } // namespace internal | 1751 } // namespace internal |
1755 } // namespace v8 | 1752 } // namespace v8 |
OLD | NEW |