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

Unified Diff: runtime/vm/object.cc

Issue 1377583005: Restore back pointer from Instructions to Code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 9311f7264ea62585ef7cbdbf9f8883bb00b96cac..11cd82bf551d184b8534b81d16cf345d63d33828 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -13029,6 +13029,7 @@ RawCode* Code::FinalizeCode(const char* name,
INC_STAT(Thread::Current(), total_instr_size, assembler->CodeSize());
INC_STAT(Thread::Current(), total_code_size, assembler->CodeSize());
+ instrs.set_code(code.raw());
// Copy the instructions into the instruction area and apply all fixups.
// Embedded pointers are still in handles at this point.
MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()),
@@ -13110,8 +13111,13 @@ RawCode* Code::FinalizeCode(const Function& function,
// Check if object matches find condition.
-bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) const {
- return RawCode::ContainsPC(obj, pc_);
+bool Code::FindRawCodeVisitor::FindObject(RawObject* raw_obj) const {
+ uword tags = raw_obj->ptr()->tags_;
+ if (RawObject::ClassIdTag::decode(tags) == kInstructionsCid) {
+ RawInstructions* raw_insts = reinterpret_cast<RawInstructions*>(raw_obj);
+ return RawInstructions::ContainsPC(raw_insts, pc_);
+ }
+ return false;
}
@@ -13119,13 +13125,18 @@ RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) {
ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate()));
NoSafepointScope no_safepoint;
FindRawCodeVisitor visitor(pc);
- RawObject* instr;
+ RawInstructions* instr;
+ if (Dart::IsRunningPrecompiledCode()) {
+ // TODO(johnmccutchan): Make code lookup work when running precompiled.
+ UNIMPLEMENTED();
+ return Code::null();
+ }
if (isolate->heap() == NULL) {
return Code::null();
}
- instr = isolate->heap()->FindOldObject(&visitor);
- if (instr != Code::null()) {
- return static_cast<RawCode*>(instr);
+ instr = isolate->heap()->FindObjectInCodeSpace(&visitor);
+ if (instr != Instructions::null()) {
+ return Instructions::Handle(instr).code();
}
return Code::null();
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698