Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: src/interpreter/bytecode-array-iterator.cc

Issue 2084623002: Reland: [Interpreter] Map runtime id's to intrinsic id's in InvokeIntrinsic bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reland Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-array-iterator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-iterator.h" 5 #include "src/interpreter/bytecode-array-iterator.h"
6 6
7 #include "src/interpreter/interpreter-intrinsics.h"
7 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
8 9
9 namespace v8 { 10 namespace v8 {
10 namespace internal { 11 namespace internal {
11 namespace interpreter { 12 namespace interpreter {
12 13
13 BytecodeArrayIterator::BytecodeArrayIterator( 14 BytecodeArrayIterator::BytecodeArrayIterator(
14 Handle<BytecodeArray> bytecode_array) 15 Handle<BytecodeArray> bytecode_array)
15 : bytecode_array_(bytecode_array), 16 : bytecode_array_(bytecode_array),
16 bytecode_offset_(0), 17 bytecode_offset_(0),
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Bytecodes::GetOperandTypes(current_bytecode()); 134 Bytecodes::GetOperandTypes(current_bytecode());
134 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index])); 135 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index]));
135 if (operand_types[operand_index + 1] == OperandType::kRegCount) { 136 if (operand_types[operand_index + 1] == OperandType::kRegCount) {
136 return GetRegisterCountOperand(operand_index + 1); 137 return GetRegisterCountOperand(operand_index + 1);
137 } else { 138 } else {
138 OperandType operand_type = operand_types[operand_index]; 139 OperandType operand_type = operand_types[operand_index];
139 return Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type); 140 return Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type);
140 } 141 }
141 } 142 }
142 143
143 uint32_t BytecodeArrayIterator::GetRuntimeIdOperand(int operand_index) const { 144 Runtime::FunctionId BytecodeArrayIterator::GetRuntimeIdOperand(
145 int operand_index) const {
144 OperandType operand_type = 146 OperandType operand_type =
145 Bytecodes::GetOperandType(current_bytecode(), operand_index); 147 Bytecodes::GetOperandType(current_bytecode(), operand_index);
146 DCHECK(operand_type == OperandType::kRuntimeId); 148 DCHECK(operand_type == OperandType::kRuntimeId);
147 return GetUnsignedOperand(operand_index, operand_type); 149 uint32_t raw_id = GetUnsignedOperand(operand_index, operand_type);
150 return static_cast<Runtime::FunctionId>(raw_id);
151 }
152
153 Runtime::FunctionId BytecodeArrayIterator::GetIntrinsicIdOperand(
154 int operand_index) const {
155 OperandType operand_type =
156 Bytecodes::GetOperandType(current_bytecode(), operand_index);
157 DCHECK(operand_type == OperandType::kIntrinsicId);
158 uint32_t raw_id = GetUnsignedOperand(operand_index, operand_type);
159 return IntrinsicsHelper::ToRuntimeId(
160 static_cast<IntrinsicsHelper::IntrinsicId>(raw_id));
148 } 161 }
149 162
150 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( 163 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand(
151 int operand_index) const { 164 int operand_index) const {
152 return FixedArray::get(bytecode_array()->constant_pool(), 165 return FixedArray::get(bytecode_array()->constant_pool(),
153 GetIndexOperand(operand_index), 166 GetIndexOperand(operand_index),
154 bytecode_array()->GetIsolate()); 167 bytecode_array()->GetIsolate());
155 } 168 }
156 169
157 170
158 int BytecodeArrayIterator::GetJumpTargetOffset() const { 171 int BytecodeArrayIterator::GetJumpTargetOffset() const {
159 Bytecode bytecode = current_bytecode(); 172 Bytecode bytecode = current_bytecode();
160 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { 173 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) {
161 int relative_offset = GetImmediateOperand(0); 174 int relative_offset = GetImmediateOperand(0);
162 return current_offset() + relative_offset + current_prefix_offset(); 175 return current_offset() + relative_offset + current_prefix_offset();
163 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { 176 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) {
164 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); 177 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0));
165 return current_offset() + smi->value() + current_prefix_offset(); 178 return current_offset() + smi->value() + current_prefix_offset();
166 } else { 179 } else {
167 UNREACHABLE(); 180 UNREACHABLE();
168 return kMinInt; 181 return kMinInt;
169 } 182 }
170 } 183 }
171 184
172 } // namespace interpreter 185 } // namespace interpreter
173 } // namespace internal 186 } // namespace internal
174 } // namespace v8 187 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-iterator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698