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

Unified Diff: runtime/vm/disassembler.cc

Issue 1439893002: - Annotate instructions that load objects from the ObjectPool or Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 | « runtime/vm/disassembler.h ('k') | runtime/vm/instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/disassembler.cc
diff --git a/runtime/vm/disassembler.cc b/runtime/vm/disassembler.cc
index 986b9b2e48895ffb41e54b18d3e49c54800403b7..99b13ce4bb29afcd9145c2ad30e11701a15c51f2 100644
--- a/runtime/vm/disassembler.cc
+++ b/runtime/vm/disassembler.cc
@@ -7,14 +7,17 @@
#include "vm/assembler.h"
#include "vm/globals.h"
#include "vm/il_printer.h"
+#include "vm/instructions.h"
#include "vm/json_stream.h"
#include "vm/log.h"
#include "vm/os.h"
+#include "vm/code_patcher.h"
namespace dart {
-void DisassembleToStdout::ConsumeInstruction(char* hex_buffer,
+void DisassembleToStdout::ConsumeInstruction(const Code& code,
+ char* hex_buffer,
intptr_t hex_size,
char* human_buffer,
intptr_t human_size,
@@ -41,18 +44,26 @@ void DisassembleToStdout::Print(const char* format, ...) {
}
-void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
+void DisassembleToJSONStream::ConsumeInstruction(const Code& code,
+ char* hex_buffer,
intptr_t hex_size,
char* human_buffer,
intptr_t human_size,
uword pc) {
- // Instructions are represented as three consecutive values in a JSON array.
- // All three are strings. The first is the address of the instruction,
- // the second is the hex string of the code, and the final is a human
- // readable string.
+ // Instructions are represented as four consecutive values in a JSON array.
+ // The first is the address of the instruction, the second is the hex string,
+ // of the code, and the third is a human readable string, and the fourth is
+ // the object loaded by the instruction.
jsarr_.AddValueF("%" Pp "", pc);
jsarr_.AddValue(hex_buffer);
jsarr_.AddValue(human_buffer);
+
+ Object& object = Object::Handle();
+ if (DecodeLoadObjectFromPoolOrThread(pc, code, &object)) {
+ jsarr_.AddValue(object);
+ } else {
+ jsarr_.AddValueNull(); // Not a reference to null.
+ }
}
@@ -71,12 +82,12 @@ void DisassembleToJSONStream::Print(const char* format, ...) {
p[i] = ' ';
}
}
- // Instructions are represented as three consecutive values in a JSON array.
- // All three are strings. Comments only use the third slot. See above comment
- // for more information.
- jsarr_.AddValue("");
- jsarr_.AddValue("");
+ // Instructions are represented as four consecutive values in a JSON array.
+ // Comments only use the third slot. See above comment for more information.
+ jsarr_.AddValueNull();
+ jsarr_.AddValueNull();
jsarr_.AddValue(p);
+ jsarr_.AddValueNull();
free(p);
}
@@ -158,7 +169,8 @@ void Disassembler::Disassemble(uword start,
human_buffer,
sizeof(human_buffer),
&instruction_length, pc);
- formatter->ConsumeInstruction(hex_buffer,
+ formatter->ConsumeInstruction(code,
+ hex_buffer,
sizeof(hex_buffer),
human_buffer,
sizeof(human_buffer),
« no previous file with comments | « runtime/vm/disassembler.h ('k') | runtime/vm/instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698