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

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

Issue 2151693003: Revert of [interpreter] Reduce dependencies in bytecodes.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/bytecode-array-writer.cc » ('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/bytecode-decoder.h"
8 #include "src/interpreter/interpreter-intrinsics.h" 7 #include "src/interpreter/interpreter-intrinsics.h"
9 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
10 9
11 namespace v8 { 10 namespace v8 {
12 namespace internal { 11 namespace internal {
13 namespace interpreter { 12 namespace interpreter {
14 13
15 BytecodeArrayIterator::BytecodeArrayIterator( 14 BytecodeArrayIterator::BytecodeArrayIterator(
16 Handle<BytecodeArray> bytecode_array) 15 Handle<BytecodeArray> bytecode_array)
17 : bytecode_array_(bytecode_array), 16 : bytecode_array_(bytecode_array),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 DCHECK_GE(operand_index, 0); 63 DCHECK_GE(operand_index, 0);
65 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); 64 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode()));
66 DCHECK_EQ(operand_type, 65 DCHECK_EQ(operand_type,
67 Bytecodes::GetOperandType(current_bytecode(), operand_index)); 66 Bytecodes::GetOperandType(current_bytecode(), operand_index));
68 DCHECK(Bytecodes::IsUnsignedOperandType(operand_type)); 67 DCHECK(Bytecodes::IsUnsignedOperandType(operand_type));
69 const uint8_t* operand_start = 68 const uint8_t* operand_start =
70 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + 69 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ +
71 current_prefix_offset() + 70 current_prefix_offset() +
72 Bytecodes::GetOperandOffset(current_bytecode(), operand_index, 71 Bytecodes::GetOperandOffset(current_bytecode(), operand_index,
73 current_operand_scale()); 72 current_operand_scale());
74 return BytecodeDecoder::DecodeUnsignedOperand(operand_start, operand_type, 73 return Bytecodes::DecodeUnsignedOperand(operand_start, operand_type,
75 current_operand_scale()); 74 current_operand_scale());
76 } 75 }
77 76
78 int32_t BytecodeArrayIterator::GetSignedOperand( 77 int32_t BytecodeArrayIterator::GetSignedOperand(
79 int operand_index, OperandType operand_type) const { 78 int operand_index, OperandType operand_type) const {
80 DCHECK_GE(operand_index, 0); 79 DCHECK_GE(operand_index, 0);
81 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); 80 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode()));
82 DCHECK_EQ(operand_type, 81 DCHECK_EQ(operand_type,
83 Bytecodes::GetOperandType(current_bytecode(), operand_index)); 82 Bytecodes::GetOperandType(current_bytecode(), operand_index));
84 DCHECK(!Bytecodes::IsUnsignedOperandType(operand_type)); 83 DCHECK(!Bytecodes::IsUnsignedOperandType(operand_type));
85 const uint8_t* operand_start = 84 const uint8_t* operand_start =
86 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + 85 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ +
87 current_prefix_offset() + 86 current_prefix_offset() +
88 Bytecodes::GetOperandOffset(current_bytecode(), operand_index, 87 Bytecodes::GetOperandOffset(current_bytecode(), operand_index,
89 current_operand_scale()); 88 current_operand_scale());
90 return BytecodeDecoder::DecodeSignedOperand(operand_start, operand_type, 89 return Bytecodes::DecodeSignedOperand(operand_start, operand_type,
91 current_operand_scale()); 90 current_operand_scale());
92 } 91 }
93 92
94 uint32_t BytecodeArrayIterator::GetFlagOperand(int operand_index) const { 93 uint32_t BytecodeArrayIterator::GetFlagOperand(int operand_index) const {
95 DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index), 94 DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index),
96 OperandType::kFlag8); 95 OperandType::kFlag8);
97 return GetUnsignedOperand(operand_index, OperandType::kFlag8); 96 return GetUnsignedOperand(operand_index, OperandType::kFlag8);
98 } 97 }
99 98
100 int32_t BytecodeArrayIterator::GetImmediateOperand(int operand_index) const { 99 int32_t BytecodeArrayIterator::GetImmediateOperand(int operand_index) const {
101 DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index), 100 DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index),
(...skipping 16 matching lines...) Expand all
118 } 117 }
119 118
120 Register BytecodeArrayIterator::GetRegisterOperand(int operand_index) const { 119 Register BytecodeArrayIterator::GetRegisterOperand(int operand_index) const {
121 OperandType operand_type = 120 OperandType operand_type =
122 Bytecodes::GetOperandType(current_bytecode(), operand_index); 121 Bytecodes::GetOperandType(current_bytecode(), operand_index);
123 const uint8_t* operand_start = 122 const uint8_t* operand_start =
124 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + 123 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ +
125 current_prefix_offset() + 124 current_prefix_offset() +
126 Bytecodes::GetOperandOffset(current_bytecode(), operand_index, 125 Bytecodes::GetOperandOffset(current_bytecode(), operand_index,
127 current_operand_scale()); 126 current_operand_scale());
128 return BytecodeDecoder::DecodeRegisterOperand(operand_start, operand_type, 127 return Bytecodes::DecodeRegisterOperand(operand_start, operand_type,
129 current_operand_scale()); 128 current_operand_scale());
130 } 129 }
131 130
132 int BytecodeArrayIterator::GetRegisterOperandRange(int operand_index) const { 131 int BytecodeArrayIterator::GetRegisterOperandRange(int operand_index) const {
133 DCHECK_LE(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); 132 DCHECK_LE(operand_index, Bytecodes::NumberOfOperands(current_bytecode()));
134 const OperandType* operand_types = 133 const OperandType* operand_types =
135 Bytecodes::GetOperandTypes(current_bytecode()); 134 Bytecodes::GetOperandTypes(current_bytecode());
136 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index])); 135 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index]));
137 if (operand_types[operand_index + 1] == OperandType::kRegCount) { 136 if (operand_types[operand_index + 1] == OperandType::kRegCount) {
138 return GetRegisterCountOperand(operand_index + 1); 137 return GetRegisterCountOperand(operand_index + 1);
139 } else { 138 } else {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return current_offset() + smi->value() + current_prefix_offset(); 178 return current_offset() + smi->value() + current_prefix_offset();
180 } else { 179 } else {
181 UNREACHABLE(); 180 UNREACHABLE();
182 return kMinInt; 181 return kMinInt;
183 } 182 }
184 } 183 }
185 184
186 } // namespace interpreter 185 } // namespace interpreter
187 } // namespace internal 186 } // namespace internal
188 } // namespace v8 187 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-iterator.h ('k') | src/interpreter/bytecode-array-writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698