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/bytecodes.h" | 5 #include "src/interpreter/bytecodes.h" |
6 | 6 |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 #include "src/interpreter/bytecode-traits.h" | 8 #include "src/interpreter/bytecode-traits.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 return IsJumpImmediate(bytecode) || IsJumpConstant(bytecode) || | 257 return IsJumpImmediate(bytecode) || IsJumpConstant(bytecode) || |
258 IsJumpConstantWide(bytecode); | 258 IsJumpConstantWide(bytecode); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 // static | 262 // static |
263 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { | 263 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { |
264 return bytecode == Bytecode::kReturn || IsJump(bytecode); | 264 return bytecode == Bytecode::kReturn || IsJump(bytecode); |
265 } | 265 } |
266 | 266 |
267 bool Bytecodes::IsMaybeRegisterOperandType(OperandType operand_type) { | 267 // static |
268 return (operand_type == OperandType::kMaybeReg8 || | 268 bool Bytecodes::IsIndexOperandType(OperandType operand_type) { |
269 operand_type == OperandType::kMaybeReg16); | 269 return operand_type == OperandType::kIdx8 || |
270 operand_type == OperandType::kIdx16; | |
270 } | 271 } |
271 | 272 |
273 // static | |
272 bool Bytecodes::IsRegisterCountOperandType(OperandType operand_type) { | 274 bool Bytecodes::IsRegisterCountOperandType(OperandType operand_type) { |
273 return (operand_type == OperandType::kRegCount8 || | 275 return (operand_type == OperandType::kRegCount8 || |
274 operand_type == OperandType::kRegCount16); | 276 operand_type == OperandType::kRegCount16); |
275 } | 277 } |
276 | 278 |
277 // static | 279 // static |
280 bool Bytecodes::IsMaybeRegisterOperandType(OperandType operand_type) { | |
281 return (operand_type == OperandType::kMaybeReg8 || | |
282 operand_type == OperandType::kMaybeReg16); | |
283 } | |
284 | |
285 // static | |
278 bool Bytecodes::IsRegisterOperandType(OperandType operand_type) { | 286 bool Bytecodes::IsRegisterOperandType(OperandType operand_type) { |
279 switch (operand_type) { | 287 switch (operand_type) { |
280 #define CASE(Name, _) \ | 288 #define CASE(Name, _) \ |
281 case OperandType::k##Name: \ | 289 case OperandType::k##Name: \ |
282 return true; | 290 return true; |
283 REGISTER_OPERAND_TYPE_LIST(CASE) | 291 REGISTER_OPERAND_TYPE_LIST(CASE) |
284 #undef CASE | 292 #undef CASE |
285 #define CASE(Name, _) \ | 293 #define CASE(Name, _) \ |
286 case OperandType::k##Name: \ | 294 case OperandType::k##Name: \ |
287 break; | 295 break; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 #define CASE(Name, _) \ | 328 #define CASE(Name, _) \ |
321 case OperandType::k##Name: \ | 329 case OperandType::k##Name: \ |
322 break; | 330 break; |
323 NON_REGISTER_OPERAND_TYPE_LIST(CASE) | 331 NON_REGISTER_OPERAND_TYPE_LIST(CASE) |
324 REGISTER_INPUT_OPERAND_TYPE_LIST(CASE) | 332 REGISTER_INPUT_OPERAND_TYPE_LIST(CASE) |
325 #undef CASE | 333 #undef CASE |
326 } | 334 } |
327 return false; | 335 return false; |
328 } | 336 } |
329 | 337 |
338 // static | |
339 bool Bytecodes::IsImmediateOperandType(OperandType operand_type) { | |
rmcilroy
2016/02/10 16:43:14
nit - move above IsRegisterCountOperandType
Stefano Sanfilippo
2016/02/10 16:49:30
Done.
| |
340 return operand_type == OperandType::kImm8; | |
341 } | |
342 | |
330 namespace { | 343 namespace { |
331 static Register DecodeRegister(const uint8_t* operand_start, | 344 static Register DecodeRegister(const uint8_t* operand_start, |
332 OperandType operand_type) { | 345 OperandType operand_type) { |
333 switch (Bytecodes::SizeOfOperand(operand_type)) { | 346 switch (Bytecodes::SizeOfOperand(operand_type)) { |
334 case OperandSize::kByte: | 347 case OperandSize::kByte: |
335 return Register::FromOperand(*operand_start); | 348 return Register::FromOperand(*operand_start); |
336 case OperandSize::kShort: | 349 case OperandSize::kShort: |
337 return Register::FromWideOperand(ReadUnalignedUInt16(operand_start)); | 350 return Register::FromWideOperand(ReadUnalignedUInt16(operand_start)); |
338 case OperandSize::kNone: { | 351 case OperandSize::kNone: { |
339 UNREACHABLE(); | 352 UNREACHABLE(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 } else { | 592 } else { |
580 std::ostringstream s; | 593 std::ostringstream s; |
581 s << "r" << index(); | 594 s << "r" << index(); |
582 return s.str(); | 595 return s.str(); |
583 } | 596 } |
584 } | 597 } |
585 | 598 |
586 } // namespace interpreter | 599 } // namespace interpreter |
587 } // namespace internal | 600 } // namespace internal |
588 } // namespace v8 | 601 } // namespace v8 |
OLD | NEW |