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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 581703003: VM: Use current isolate as immediate in per-isolate stubs. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed arm64 bug Created 6 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/stub_code_ia32.cc
===================================================================
--- runtime/vm/stub_code_ia32.cc (revision 40376)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -773,8 +773,7 @@
__ movl(CTX, Address(EBP, kNewContextOffset));
__ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
- // Load Isolate pointer from Context structure into EDI.
- __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
+ __ movl(EDI, Immediate(Isolate::CurrentAddress()));
// Save the current VMTag on the stack.
ASSERT(kSavedVMTagSlotFromEntryFp == -4);
@@ -860,22 +859,17 @@
// Get rid of arguments pushed on the stack.
__ leal(ESP, Address(ESP, EDX, TIMES_2, 0)); // EDX is a Smi.
- // Load Isolate pointer from Context structure into CTX. Drop Context.
- __ movl(CTX, FieldAddress(CTX, Context::isolate_offset()));
+ // Load Isolate pointer into CTX. Drop Context.
+ __ movl(CTX, Immediate(Isolate::CurrentAddress()));
// Restore the saved Context pointer into the Isolate structure.
- // Uses ECX as a temporary register for this.
- __ popl(ECX);
- __ movl(Address(CTX, Isolate::top_context_offset()), ECX);
+ __ popl(Address(CTX, Isolate::top_context_offset()));
// Restore the saved top exit frame info back into the Isolate structure.
- // Uses EDX as a temporary register for this.
- __ popl(EDX);
- __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), EDX);
+ __ popl(Address(CTX, Isolate::top_exit_frame_info_offset()));
// Restore the current VMTag from the stack.
- __ popl(ECX);
- __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX);
+ __ popl(Address(CTX, Isolate::vm_tag_offset()));
// Restore C++ ABI callee-saved registers.
__ popl(EDI);
@@ -901,7 +895,8 @@
if (FLAG_inline_alloc) {
const Class& context_class = Class::ZoneHandle(Object::context_class());
Label slow_case;
- Heap* heap = Isolate::Current()->heap();
+ Isolate* isolate = Isolate::Current();
+ Heap* heap = isolate->heap();
// First compute the rounded instance size.
// EDX: number of context variables.
intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1);
@@ -968,9 +963,8 @@
// Load Isolate pointer from Context structure into EBX.
// EAX: new object.
// EDX: number of context variables.
- __ movl(EBX, FieldAddress(CTX, Context::isolate_offset()));
- // EBX: Isolate, not an object.
- __ movl(FieldAddress(EAX, Context::isolate_offset()), EBX);
+ __ movl(FieldAddress(EAX, Context::isolate_offset()),
+ Immediate(reinterpret_cast<int32_t>(isolate)));
const Immediate& raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
@@ -1045,10 +1039,10 @@
__ orl(ECX, Immediate(1 << RawObject::kRememberedBit));
__ movl(FieldAddress(EAX, Object::tags_offset()), ECX);
- // Load the isolate out of the context.
+ // Load the isolate.
// Spilled: EDX, ECX
// EAX: Address being stored
- __ movl(EDX, FieldAddress(CTX, Context::isolate_offset()));
+ __ movl(EDX, Immediate(Isolate::CurrentAddress()));
// Load the StoreBuffer block out of the isolate. Then load top_ out of the
// StoreBufferBlock and add the address to the pointers_.
@@ -1079,7 +1073,7 @@
// Setup frame, push callee-saved registers.
__ EnterCallRuntimeFrame(1 * kWordSize);
- __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
+ __ movl(EAX, Immediate(Isolate::CurrentAddress()));
__ movl(Address(ESP, 0), EAX); // Push the isolate as the only argument.
__ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
// Restore callee-saved registers, tear down frame.
@@ -1383,10 +1377,11 @@
}
#endif // DEBUG
- Label stepping, done_stepping;
// Check single stepping.
- __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
- __ cmpb(Address(EAX, Isolate::single_step_offset()), Immediate(0));
+ Label stepping, done_stepping;
+ uword single_step_address =
+ Isolate::CurrentAddress() + Isolate::single_step_offset();
+ __ cmpb(Address::Absolute(single_step_address), Immediate(0));
__ j(NOT_EQUAL, &stepping);
__ Bind(&done_stepping);
@@ -1622,9 +1617,9 @@
#endif // DEBUG
// Check single stepping.
Label stepping, done_stepping;
- __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
- __ movzxb(EAX, Address(EAX, Isolate::single_step_offset()));
- __ cmpl(EAX, Immediate(0));
+ uword single_step_address =
+ Isolate::CurrentAddress() + Isolate::single_step_offset();
+ __ cmpb(Address::Absolute(single_step_address), Immediate(0));
__ j(NOT_EQUAL, &stepping, Assembler::kNearJump);
__ Bind(&done_stepping);

Powered by Google App Engine
This is Rietveld 408576698