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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 #include "src/interpreter/interpreter-intrinsics.h" | |
7 | 8 |
8 namespace v8 { | 9 namespace v8 { |
9 namespace internal { | 10 namespace internal { |
10 namespace interpreter { | 11 namespace interpreter { |
11 | 12 |
12 class BytecodeArrayBuilder::PreviousBytecodeHelper BASE_EMBEDDED { | 13 class BytecodeArrayBuilder::PreviousBytecodeHelper BASE_EMBEDDED { |
13 public: | 14 public: |
14 explicit PreviousBytecodeHelper(const BytecodeArrayBuilder& array_builder) | 15 explicit PreviousBytecodeHelper(const BytecodeArrayBuilder& array_builder) |
15 : array_builder_(array_builder), | 16 : array_builder_(array_builder), |
16 previous_bytecode_start_(array_builder_.last_bytecode_start_) { | 17 previous_bytecode_start_(array_builder_.last_bytecode_start_) { |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1116 | 1117 |
1117 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime( | 1118 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime( |
1118 Runtime::FunctionId function_id, Register first_arg, size_t arg_count) { | 1119 Runtime::FunctionId function_id, Register first_arg, size_t arg_count) { |
1119 DCHECK_EQ(1, Runtime::FunctionForId(function_id)->result_size); | 1120 DCHECK_EQ(1, Runtime::FunctionForId(function_id)->result_size); |
1120 DCHECK(FitsInIdx16Operand(function_id)); | 1121 DCHECK(FitsInIdx16Operand(function_id)); |
1121 if (!first_arg.is_valid()) { | 1122 if (!first_arg.is_valid()) { |
1122 DCHECK_EQ(0u, arg_count); | 1123 DCHECK_EQ(0u, arg_count); |
1123 first_arg = Register(0); | 1124 first_arg = Register(0); |
1124 } | 1125 } |
1125 if (FitsInReg8Operand(first_arg) && FitsInIdx8Operand(arg_count)) { | 1126 if (FitsInReg8Operand(first_arg) && FitsInIdx8Operand(arg_count)) { |
1126 Output(Bytecode::kCallRuntime, static_cast<uint16_t>(function_id), | 1127 Bytecode bytecode = IntrinsicsHelper::IsSupported(function_id) |
rmcilroy
2016/03/05 04:21:46
Please pull this out above the if block and then a
epertoso
2016/03/07 11:26:35
Done.
| |
1128 ? Bytecode::kInvokeIntrinsic | |
1129 : Bytecode::kCallRuntime; | |
1130 Output(bytecode, static_cast<uint16_t>(function_id), | |
1127 first_arg.ToRawOperand(), static_cast<uint8_t>(arg_count)); | 1131 first_arg.ToRawOperand(), static_cast<uint8_t>(arg_count)); |
1128 } else if (FitsInReg16Operand(first_arg) && FitsInIdx16Operand(arg_count)) { | 1132 } else if (FitsInReg16Operand(first_arg) && FitsInIdx16Operand(arg_count)) { |
1129 Output(Bytecode::kCallRuntimeWide, static_cast<uint16_t>(function_id), | 1133 Bytecode bytecode = IntrinsicsHelper::IsSupported(function_id) |
1134 ? Bytecode::kInvokeIntrinsicWide | |
1135 : Bytecode::kCallRuntimeWide; | |
1136 Output(bytecode, static_cast<uint16_t>(function_id), | |
1130 first_arg.ToRawOperand(), static_cast<uint16_t>(arg_count)); | 1137 first_arg.ToRawOperand(), static_cast<uint16_t>(arg_count)); |
1131 } else { | 1138 } else { |
1132 UNIMPLEMENTED(); | 1139 UNIMPLEMENTED(); |
1133 } | 1140 } |
1134 return *this; | 1141 return *this; |
1135 } | 1142 } |
1136 | 1143 |
1137 | 1144 |
1138 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair( | 1145 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair( |
1139 Runtime::FunctionId function_id, Register first_arg, size_t arg_count, | 1146 Runtime::FunctionId function_id, Register first_arg, size_t arg_count, |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1645 } | 1652 } |
1646 | 1653 |
1647 // static | 1654 // static |
1648 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1655 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
1649 return value.is_short_operand(); | 1656 return value.is_short_operand(); |
1650 } | 1657 } |
1651 | 1658 |
1652 } // namespace interpreter | 1659 } // namespace interpreter |
1653 } // namespace internal | 1660 } // namespace internal |
1654 } // namespace v8 | 1661 } // namespace v8 |
OLD | NEW |