Chromium Code Reviews| Index: src/interpreter/bytecodes.cc |
| diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc |
| index f58f37c770d6b4fd1165f4b2071b071a7e6b9e4c..fa780a404d8ecba885ae4b91c96a4c37ec86d2ad 100644 |
| --- a/src/interpreter/bytecodes.cc |
| +++ b/src/interpreter/bytecodes.cc |
| @@ -71,6 +71,20 @@ Bytecode Bytecodes::FromByte(uint8_t value) { |
| // static |
| +Bytecode Bytecodes::GetDebugBreak(Bytecode bytecode) { |
| + switch (Size(bytecode)) { |
| +#define CASE(Name, ...) \ |
| + case BytecodeTraits<__VA_ARGS__, OPERAND_TERM>::kSize: \ |
| + return Bytecode::k##Name; |
| + DEBUG_BREAK_BYTECODE_LIST(CASE) |
| +#undef CASE |
| + default: |
| + break; |
| + } |
| + return Bytecode::kLdaUndefined; |
|
rmcilroy
2016/02/16 10:46:38
UNREACHABLE() and return static_cast<Bytecode>(-1)
Yang
2016/02/19 13:09:18
Done.
|
| +} |
| + |
| +// static |
| int Bytecodes::Size(Bytecode bytecode) { |
| DCHECK(bytecode <= Bytecode::kLast); |
| switch (bytecode) { |
| @@ -267,6 +281,15 @@ bool Bytecodes::IsCallOrNew(Bytecode bytecode) { |
| } |
| // static |
| +bool Bytecodes::IsDebugBreak(Bytecode bytecode) { |
| +#define DEBUG_BREAK(Name, ...) \ |
| + if (bytecode == Bytecode::k##Name) return true; |
|
rmcilroy
2016/02/16 10:46:38
Could you do this as a switch statement instead pl
Yang
2016/02/19 13:09:17
Done.
|
| + DEBUG_BREAK_BYTECODE_LIST(DEBUG_BREAK); |
| +#undef DEBUG_BREAK |
| + return false; |
| +} |
| + |
| +// static |
| bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { |
| return bytecode == Bytecode::kReturn || IsJump(bytecode); |
| } |
| @@ -383,6 +406,9 @@ std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start, |
| os << bytecode << " "; |
| + // Operands for the debug break are from the original instruction. |
| + if (IsDebugBreak(bytecode)) return os; |
| + |
| int number_of_operands = NumberOfOperands(bytecode); |
| int range = 0; |
| for (int i = 0; i < number_of_operands; i++) { |