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

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

Issue 2085823003: Revert of [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: 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"
8 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
9 8
10 namespace v8 { 9 namespace v8 {
11 namespace internal { 10 namespace internal {
12 namespace interpreter { 11 namespace interpreter {
13 12
14 BytecodeArrayIterator::BytecodeArrayIterator( 13 BytecodeArrayIterator::BytecodeArrayIterator(
15 Handle<BytecodeArray> bytecode_array) 14 Handle<BytecodeArray> bytecode_array)
16 : bytecode_array_(bytecode_array), 15 : bytecode_array_(bytecode_array),
17 bytecode_offset_(0), 16 bytecode_offset_(0),
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 Bytecodes::GetOperandTypes(current_bytecode()); 133 Bytecodes::GetOperandTypes(current_bytecode());
135 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index])); 134 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index]));
136 if (operand_types[operand_index + 1] == OperandType::kRegCount) { 135 if (operand_types[operand_index + 1] == OperandType::kRegCount) {
137 return GetRegisterCountOperand(operand_index + 1); 136 return GetRegisterCountOperand(operand_index + 1);
138 } else { 137 } else {
139 OperandType operand_type = operand_types[operand_index]; 138 OperandType operand_type = operand_types[operand_index];
140 return Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type); 139 return Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type);
141 } 140 }
142 } 141 }
143 142
144 Runtime::FunctionId BytecodeArrayIterator::GetRuntimeIdOperand( 143 uint32_t BytecodeArrayIterator::GetRuntimeIdOperand(int operand_index) const {
145 int operand_index) const {
146 OperandType operand_type = 144 OperandType operand_type =
147 Bytecodes::GetOperandType(current_bytecode(), operand_index); 145 Bytecodes::GetOperandType(current_bytecode(), operand_index);
148 DCHECK(operand_type == OperandType::kRuntimeId); 146 DCHECK(operand_type == OperandType::kRuntimeId);
149 uint32_t raw_id = GetUnsignedOperand(operand_index, operand_type); 147 return 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));
161 } 148 }
162 149
163 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( 150 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand(
164 int operand_index) const { 151 int operand_index) const {
165 return FixedArray::get(bytecode_array()->constant_pool(), 152 return FixedArray::get(bytecode_array()->constant_pool(),
166 GetIndexOperand(operand_index), 153 GetIndexOperand(operand_index),
167 bytecode_array()->GetIsolate()); 154 bytecode_array()->GetIsolate());
168 } 155 }
169 156
170 157
171 int BytecodeArrayIterator::GetJumpTargetOffset() const { 158 int BytecodeArrayIterator::GetJumpTargetOffset() const {
172 Bytecode bytecode = current_bytecode(); 159 Bytecode bytecode = current_bytecode();
173 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { 160 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) {
174 int relative_offset = GetImmediateOperand(0); 161 int relative_offset = GetImmediateOperand(0);
175 return current_offset() + relative_offset + current_prefix_offset(); 162 return current_offset() + relative_offset + current_prefix_offset();
176 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { 163 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) {
177 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); 164 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0));
178 return current_offset() + smi->value() + current_prefix_offset(); 165 return current_offset() + smi->value() + current_prefix_offset();
179 } else { 166 } else {
180 UNREACHABLE(); 167 UNREACHABLE();
181 return kMinInt; 168 return kMinInt;
182 } 169 }
183 } 170 }
184 171
185 } // namespace interpreter 172 } // namespace interpreter
186 } // namespace internal 173 } // namespace internal
187 } // namespace v8 174 } // 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