summaryrefslogtreecommitdiff
path: root/deps/v8/src/disassembler.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-07 08:54:53 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-07 16:48:52 +0100
commit88786fecff336342a56e6f2e7ff3b286be716e47 (patch)
tree92e6ba5b8ac8dae1a058988d20c9d27bfa654390 /deps/v8/src/disassembler.cc
parent4e86f9b5ab83cbabf43839385bf383e6a7ef7d19 (diff)
downloadandroid-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.tar.gz
android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.tar.bz2
android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.zip
deps: update V8 to 6.5.254.31
PR-URL: https://github.com/nodejs/node/pull/18453 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/v8/src/disassembler.cc')
-rw-r--r--deps/v8/src/disassembler.cc42
1 files changed, 30 insertions, 12 deletions
diff --git a/deps/v8/src/disassembler.cc b/deps/v8/src/disassembler.cc
index 603f0bbe03..a26517b432 100644
--- a/deps/v8/src/disassembler.cc
+++ b/deps/v8/src/disassembler.cc
@@ -17,6 +17,8 @@
#include "src/objects-inl.h"
#include "src/snapshot/serializer-common.h"
#include "src/string-stream.h"
+#include "src/wasm/wasm-code-manager.h"
+#include "src/wasm/wasm-engine.h"
namespace v8 {
namespace internal {
@@ -37,21 +39,29 @@ class V8NameConverter: public disasm::NameConverter {
const char* V8NameConverter::NameOfAddress(byte* pc) const {
- const char* name =
- code_ == nullptr ? nullptr : code_->GetIsolate()->builtins()->Lookup(pc);
+ if (code_ != nullptr) {
+ Isolate* isolate = code_->GetIsolate();
+ const char* name = isolate->builtins()->Lookup(pc);
- if (name != nullptr) {
- SNPrintF(v8_buffer_, "%p (%s)", static_cast<void*>(pc), name);
- return v8_buffer_.start();
- }
+ if (name != nullptr) {
+ SNPrintF(v8_buffer_, "%p (%s)", static_cast<void*>(pc), name);
+ return v8_buffer_.start();
+ }
- if (code_ != nullptr) {
int offs = static_cast<int>(pc - code_->instruction_start());
// print as code offset, if it seems reasonable
if (0 <= offs && offs < code_->instruction_size()) {
SNPrintF(v8_buffer_, "%p <+0x%x>", static_cast<void*>(pc), offs);
return v8_buffer_.start();
}
+
+ wasm::WasmCode* wasm_code =
+ isolate->wasm_engine()->code_manager()->LookupCode(pc);
+ if (wasm_code != nullptr) {
+ SNPrintF(v8_buffer_, "%p (%s)", static_cast<void*>(pc),
+ GetWasmCodeKindAsString(wasm_code->kind()));
+ return v8_buffer_.start();
+ }
}
return disasm::NameConverter::NameOfAddress(pc);
@@ -155,7 +165,8 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
}
static int DecodeIt(Isolate* isolate, std::ostream* os,
- const V8NameConverter& converter, byte* begin, byte* end) {
+ const V8NameConverter& converter, byte* begin, byte* end,
+ void* current_pc) {
SealHandleScope shs(isolate);
DisallowHeapAllocation no_alloc;
ExternalReferenceEncoder ref_encoder(isolate);
@@ -232,6 +243,10 @@ static int DecodeIt(Isolate* isolate, std::ostream* os,
}
// Instruction address and instruction offset.
+ if (FLAG_log_colour && prev_pc == current_pc) {
+ // If this is the given "current" pc, make it yellow and bold.
+ out.AddFormatted("\033[33;1m");
+ }
out.AddFormatted("%p %4" V8PRIxPTRDIFF " ", static_cast<void*>(prev_pc),
prev_pc - begin);
@@ -269,6 +284,10 @@ static int DecodeIt(Isolate* isolate, std::ostream* os,
}
}
+ if (FLAG_log_colour && prev_pc == current_pc) {
+ out.AddFormatted("\033[m");
+ }
+
DumpBuffer(os, &out);
}
@@ -287,17 +306,16 @@ static int DecodeIt(Isolate* isolate, std::ostream* os,
return static_cast<int>(pc - begin);
}
-
int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
- byte* end, Code* code) {
+ byte* end, Code* code, void* current_pc) {
V8NameConverter v8NameConverter(code);
- return DecodeIt(isolate, os, v8NameConverter, begin, end);
+ return DecodeIt(isolate, os, v8NameConverter, begin, end, current_pc);
}
#else // ENABLE_DISASSEMBLER
int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
- byte* end, Code* code) {
+ byte* end, Code* code, void* current_pc) {
return 0;
}