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

Unified Diff: runtime/vm/object.cc

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 6a5830bacb4d19749267ccd873e81eed06b7e8a8..015db8c882f0eedc869f26e7d3ad8ed268b3ac71 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5124,7 +5124,7 @@ bool Function::HasBreakpoint() const {
void Function::SetInstructions(const Code& value) const {
- StorePointer(&raw_ptr()->instructions_, value.instructions());
+ StorePointer(&raw_ptr()->code_, value.raw());
}
void Function::AttachCode(const Code& value) const {
@@ -5136,10 +5136,9 @@ void Function::AttachCode(const Code& value) const {
bool Function::HasCode() const {
- ASSERT(raw_ptr()->instructions_ != Instructions::null());
+ ASSERT(raw_ptr()->code_ != Code::null());
StubCode* stub_code = Isolate::Current()->stub_code();
- return raw_ptr()->instructions_ !=
- stub_code->LazyCompile_entry()->code()->ptr()->instructions_;
+ return raw_ptr()->code_ != stub_code->LazyCompile_entry()->code();
}
@@ -5147,8 +5146,8 @@ void Function::ClearCode() const {
ASSERT(ic_data_array() == Array::null());
StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
StubCode* stub_code = Isolate::Current()->stub_code();
- StorePointer(&raw_ptr()->instructions_,
- Code::Handle(stub_code->LazyCompile_entry()->code()).instructions());
+ StorePointer(&raw_ptr()->code_,
+ stub_code->LazyCompile_entry()->code());
}
@@ -6593,8 +6592,7 @@ RawScript* Function::script() const {
bool Function::HasOptimizedCode() const {
- return HasCode() && Code::Handle(Instructions::Handle(
- raw_ptr()->instructions_).code()).is_optimized();
+ return HasCode() && Code::Handle(CurrentCode()).is_optimized();
}
@@ -12638,14 +12636,13 @@ RawCode* Code::FinalizeCode(const char* name,
}
// Hook up Code and Instructions objects.
- instrs.set_code(code.raw());
code.set_instructions(instrs.raw());
code.set_is_alive(true);
// Set object pool in Instructions object.
INC_STAT(Isolate::Current(),
total_code_size, object_pool.Length() * sizeof(uintptr_t));
- instrs.set_object_pool(object_pool.raw());
+ code.set_object_pool(object_pool.raw());
if (FLAG_write_protect_code) {
uword address = RawObject::ToAddr(instrs.raw());
@@ -12687,7 +12684,7 @@ RawCode* Code::FinalizeCode(const Function& function,
// Check if object matches find condition.
bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) const {
- return RawInstructions::ContainsPC(obj, pc_);
+ return RawCode::ContainsPC(obj, pc_);
}
@@ -12695,13 +12692,13 @@ RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) {
ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate()));
NoSafepointScope no_safepoint;
FindRawCodeVisitor visitor(pc);
- RawInstructions* instr;
+ RawObject* instr;
if (isolate->heap() == NULL) {
return Code::null();
}
- instr = isolate->heap()->FindObjectInCodeSpace(&visitor);
- if (instr != Instructions::null()) {
- return instr->ptr()->code_;
+ instr = isolate->heap()->FindOldObject(&visitor);
+ if (instr != Code::null()) {
+ return static_cast<RawCode*>(instr);
}
return Code::null();
}

Powered by Google App Engine
This is Rietveld 408576698