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

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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 02084f8249123ad68c42339ec894d52fda7a33da..f74ae6a16360bbfb406d7521d80fb6aba022bc93 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -13049,6 +13049,8 @@ RawCode* Code::FinalizeCode(const char* name,
INC_STAT(Thread::Current(), total_instr_size, assembler->CodeSize());
INC_STAT(Thread::Current(), total_code_size, assembler->CodeSize());
+ // TODO(johnmccutchan): Protect this behind precompilation flag.
rmacnak 2015/09/29 16:50:12 This is safe. Reading is the problem.
+ 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()),
@@ -13130,8 +13132,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;
}
@@ -13139,13 +13146,13 @@ RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) {
ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate()));
rmacnak 2015/09/29 16:50:12 if (Dart::IsRunningPrecompiledCode()) { // Fall
Cutch 2015/09/29 23:24:29 Done.
NoSafepointScope no_safepoint;
FindRawCodeVisitor visitor(pc);
- RawObject* instr;
+ RawInstructions* instr;
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 instr->ptr()->code_;
rmacnak 2015/09/29 16:50:12 instr->code() for ASSERT
Cutch 2015/09/29 23:24:29 Done.
}
return Code::null();
}

Powered by Google App Engine
This is Rietveld 408576698