Index: runtime/vm/assembler_ia32.cc |
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc |
index 2da038334bc5822889d40e059e0692bb97139e26..c6c8da8a468aff6b8b5f5b12f092a1f10267af03 100644 |
--- a/runtime/vm/assembler_ia32.cc |
+++ b/runtime/vm/assembler_ia32.cc |
@@ -2366,7 +2366,7 @@ void Assembler::StoreIntoObject(Register object, |
if (object != EDX) { |
movl(EDX, object); |
} |
- call(Address(THR, Thread::update_store_buffer_entry_point_offset())); |
+ Call(*StubCode::UpdateStoreBuffer_entry()); |
if (value != EDX) { |
popl(EDX); // Restore EDX. |
} |
@@ -2622,9 +2622,8 @@ void Assembler::CallRuntime(const RuntimeEntry& entry, |
void Assembler::Call(const StubEntry& stub_entry) { |
- const Code& target = Code::ZoneHandle(stub_entry.code()); |
- LoadObject(CODE_REG, target); |
- call(FieldAddress(CODE_REG, Code::entry_point_offset())); |
+ const ExternalLabel label(stub_entry.EntryPoint()); |
+ call(&label); |
} |
@@ -2870,19 +2869,18 @@ void Assembler::TryAllocateArray(intptr_t cid, |
} |
-void Assembler::PushCodeObject() { |
- ASSERT(code_.IsNotTemporaryScopedHandle()); |
- AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
- EmitUint8(0x68); |
- buffer_.EmitObject(code_); |
-} |
- |
- |
void Assembler::EnterDartFrame(intptr_t frame_size) { |
EnterFrame(0); |
- |
- PushCodeObject(); |
- |
+ Label dart_entry; |
+ call(&dart_entry); |
+ Bind(&dart_entry); |
+ // The runtime system assumes that the code marker address is |
+ // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code |
+ // generated before entering the frame, the address needs to be adjusted. |
+ const intptr_t offset = EntryPointToPcMarkerOffset() - CodeSize(); |
+ if (offset != 0) { |
+ addl(Address(ESP, 0), Immediate(offset)); |
+ } |
if (frame_size != 0) { |
subl(ESP, Immediate(frame_size)); |
} |
@@ -2891,7 +2889,8 @@ void Assembler::EnterDartFrame(intptr_t frame_size) { |
// On entry to a function compiled for OSR, the caller's frame pointer, the |
// stack locals, and any copied parameters are already in place. The frame |
-// pointer is already set up. There may be extra space for spill slots to |
+// pointer is already set up. The PC marker is not correct for the |
+// optimized function and there may be extra space for spill slots to |
// allocate. |
void Assembler::EnterOsrFrame(intptr_t extra_size) { |
Comment("EnterOsrFrame"); |
@@ -2899,7 +2898,17 @@ void Assembler::EnterOsrFrame(intptr_t extra_size) { |
Comment("PrologueOffset = %" Pd "", CodeSize()); |
prologue_offset_ = CodeSize(); |
} |
- |
+ Label dart_entry; |
+ call(&dart_entry); |
+ Bind(&dart_entry); |
+ // The runtime system assumes that the code marker address is |
+ // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no |
+ // code to set up the frame pointer, the address needs to be adjusted. |
+ const intptr_t offset = EntryPointToPcMarkerOffset() - CodeSize(); |
+ if (offset != 0) { |
+ addl(Address(ESP, 0), Immediate(offset)); |
+ } |
+ popl(Address(EBP, kPcMarkerSlotFromFp * kWordSize)); |
if (extra_size != 0) { |
subl(ESP, Immediate(extra_size)); |
} |
@@ -2907,7 +2916,8 @@ void Assembler::EnterOsrFrame(intptr_t extra_size) { |
void Assembler::EnterStubFrame() { |
- EnterDartFrame(0); |
+ EnterFrame(0); |
+ pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
} |