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 = bytecode_iterator().GetRuntimeIdOperand(0); | 1004 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>( |
| 1005 bytecode_iterator().GetRuntimeIdOperand(0)); |
1005 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1006 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1006 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1007 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1007 | 1008 |
1008 // Create node to perform the runtime call. | 1009 // Create node to perform the runtime call. |
1009 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1010 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1010 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1011 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1011 environment()->BindAccumulator(value, &states); | 1012 environment()->BindAccumulator(value, &states); |
1012 } | 1013 } |
1013 | 1014 |
1014 void BytecodeGraphBuilder::VisitCallRuntimeForPair() { | 1015 void BytecodeGraphBuilder::VisitCallRuntimeForPair() { |
1015 FrameStateBeforeAndAfter states(this); | 1016 FrameStateBeforeAndAfter states(this); |
1016 Runtime::FunctionId functionId = bytecode_iterator().GetRuntimeIdOperand(0); | 1017 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>( |
| 1018 bytecode_iterator().GetRuntimeIdOperand(0)); |
1017 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1019 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1018 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1020 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1019 interpreter::Register first_return = | 1021 interpreter::Register first_return = |
1020 bytecode_iterator().GetRegisterOperand(3); | 1022 bytecode_iterator().GetRegisterOperand(3); |
1021 | 1023 |
1022 // Create node to perform the runtime call. | 1024 // Create node to perform the runtime call. |
1023 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1025 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1024 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1026 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1025 environment()->BindRegistersToProjections(first_return, return_pair, &states); | 1027 environment()->BindRegistersToProjections(first_return, return_pair, &states); |
1026 } | 1028 } |
1027 | 1029 |
1028 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { | 1030 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { |
1029 FrameStateBeforeAndAfter states(this); | 1031 FrameStateBeforeAndAfter states(this); |
1030 Runtime::FunctionId functionId = bytecode_iterator().GetIntrinsicIdOperand(0); | 1032 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>( |
| 1033 bytecode_iterator().GetRuntimeIdOperand(0)); |
1031 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1034 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1032 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1035 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1033 | 1036 |
1034 // Create node to perform the runtime call. Turbofan will take care of the | 1037 // Create node to perform the runtime call. Turbofan will take care of the |
1035 // lowering. | 1038 // lowering. |
1036 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1039 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1037 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1040 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1038 environment()->BindAccumulator(value, &states); | 1041 environment()->BindAccumulator(value, &states); |
1039 } | 1042 } |
1040 | 1043 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 // Phi does not exist yet, introduce one. | 1740 // Phi does not exist yet, introduce one. |
1738 value = NewPhi(inputs, value, control); | 1741 value = NewPhi(inputs, value, control); |
1739 value->ReplaceInput(inputs - 1, other); | 1742 value->ReplaceInput(inputs - 1, other); |
1740 } | 1743 } |
1741 return value; | 1744 return value; |
1742 } | 1745 } |
1743 | 1746 |
1744 } // namespace compiler | 1747 } // namespace compiler |
1745 } // namespace internal | 1748 } // namespace internal |
1746 } // namespace v8 | 1749 } // namespace v8 |
OLD | NEW |