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

Unified Diff: src/interpreter/bytecode-decoder.cc

Issue 2712943002: [interpreter] Teach --print-bytecode the names of runtime functions and intrinsics. (Closed)
Patch Set: Make use of ToRuntimeId. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/unittests/interpreter/bytecode-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-decoder.cc
diff --git a/src/interpreter/bytecode-decoder.cc b/src/interpreter/bytecode-decoder.cc
index 49751897ee8a46608829be148fdb2ae153b4835a..f003969d4ba0b20f4a12aa4d75740ef87074407d 100644
--- a/src/interpreter/bytecode-decoder.cc
+++ b/src/interpreter/bytecode-decoder.cc
@@ -6,7 +6,7 @@
#include <iomanip>
-#include "src/utils.h"
+#include "src/interpreter/interpreter-intrinsics.h"
namespace v8 {
namespace internal {
@@ -67,6 +67,23 @@ uint32_t BytecodeDecoder::DecodeUnsignedOperand(const uint8_t* operand_start,
return 0;
}
+namespace {
+const char* NameForRuntimeId(uint32_t idx) {
+ switch (idx) {
+#define CASE(name, nargs, ressize) \
+ case Runtime::k##name: \
+ return #name; \
+ case Runtime::kInline##name: \
+ return #name;
+ FOR_EACH_INTRINSIC(CASE)
+#undef CASE
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+} // anonymous namespace
+
// static
std::ostream& BytecodeDecoder::Decode(std::ostream& os,
const uint8_t* bytecode_start,
@@ -112,12 +129,21 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os,
switch (op_type) {
case interpreter::OperandType::kIdx:
case interpreter::OperandType::kUImm:
- case interpreter::OperandType::kRuntimeId:
- case interpreter::OperandType::kIntrinsicId:
os << "["
<< DecodeUnsignedOperand(operand_start, op_type, operand_scale)
<< "]";
break;
+ case interpreter::OperandType::kIntrinsicId: {
+ auto id = static_cast<IntrinsicsHelper::IntrinsicId>(
+ DecodeUnsignedOperand(operand_start, op_type, operand_scale));
+ os << "[" << NameForRuntimeId(IntrinsicsHelper::ToRuntimeId(id)) << "]";
+ break;
+ }
+ case interpreter::OperandType::kRuntimeId:
+ os << "[" << NameForRuntimeId(DecodeUnsignedOperand(
+ operand_start, op_type, operand_scale))
+ << "]";
+ break;
case interpreter::OperandType::kImm:
os << "[" << DecodeSignedOperand(operand_start, op_type, operand_scale)
<< "]";
« no previous file with comments | « no previous file | test/unittests/interpreter/bytecode-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698