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

Unified Diff: runtime/vm/disassembler.cc

Issue 2160343003: Use the Code's pointer offsets to find object references when disassembling IA32. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 5 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 | « runtime/vm/disassembler.h ('k') | runtime/vm/disassembler_arm.cc » ('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 d1ff765dfe1a76c726cc981367ef4f318dd60b30..a735289c94cd9b83e89607469f9bce426cd6e805 100644
--- a/runtime/vm/disassembler.cc
+++ b/runtime/vm/disassembler.cc
@@ -26,6 +26,7 @@ void DisassembleToStdout::ConsumeInstruction(const Code& code,
intptr_t hex_size,
char* human_buffer,
intptr_t human_size,
+ Object* object,
uword pc) {
static const int kHexColumnWidth = 23;
uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
@@ -37,6 +38,9 @@ void DisassembleToStdout::ConsumeInstruction(const Code& code,
}
}
THR_Print("%s", human_buffer);
+ if (object != NULL) {
+ THR_Print(" %s", object->ToCString());
+ }
THR_Print("\n");
}
@@ -54,6 +58,7 @@ void DisassembleToJSONStream::ConsumeInstruction(const Code& code,
intptr_t hex_size,
char* human_buffer,
intptr_t human_size,
+ Object* object,
uword pc) {
// 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,
@@ -63,9 +68,8 @@ void DisassembleToJSONStream::ConsumeInstruction(const Code& code,
jsarr_.AddValue(hex_buffer);
jsarr_.AddValue(human_buffer);
- Object& object = Object::Handle();
- if (DecodeLoadObjectFromPoolOrThread(pc, code, &object)) {
- jsarr_.AddValue(object);
+ if (object != NULL) {
+ jsarr_.AddValue(*object);
} else {
jsarr_.AddValueNull(); // Not a reference to null.
}
@@ -97,33 +101,6 @@ void DisassembleToJSONStream::Print(const char* format, ...) {
}
-class FindAddrVisitor : public FindObjectVisitor {
- public:
- explicit FindAddrVisitor(uword addr) : addr_(addr) { }
- virtual ~FindAddrVisitor() { }
-
- virtual uword filter_addr() const { return addr_; }
-
- // Check if object matches find condition.
- virtual bool FindObject(RawObject* obj) const {
- return obj == reinterpret_cast<RawObject*>(addr_);
- }
-
- private:
- const uword addr_;
-
- DISALLOW_COPY_AND_ASSIGN(FindAddrVisitor);
-};
-
-
-bool Disassembler::CanFindOldObject(uword addr) {
- FindAddrVisitor visitor(addr);
- NoSafepointScope no_safepoint;
- return Dart::vm_isolate()->heap()->FindOldObject(&visitor) != Object::null()
- || Isolate::Current()->heap()->FindOldObject(&visitor) != Object::null();
-}
-
-
void Disassembler::Disassemble(uword start,
uword end,
DisassemblyFormatter* formatter,
@@ -168,16 +145,18 @@ void Disassembler::Disassemble(uword start,
}
}
int instruction_length;
+ Object* object;
DecodeInstruction(hex_buffer,
sizeof(hex_buffer),
human_buffer,
sizeof(human_buffer),
- &instruction_length, pc);
+ &instruction_length, code, &object, pc);
formatter->ConsumeInstruction(code,
hex_buffer,
sizeof(hex_buffer),
human_buffer,
sizeof(human_buffer),
+ object,
pc);
pc += instruction_length;
}
« no previous file with comments | « runtime/vm/disassembler.h ('k') | runtime/vm/disassembler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698