Chromium Code Reviews| Index: runtime/vm/stub_code_ia32.cc |
| =================================================================== |
| --- runtime/vm/stub_code_ia32.cc (revision 41279) |
| +++ runtime/vm/stub_code_ia32.cc (working copy) |
| @@ -54,29 +54,10 @@ |
| __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); |
| #if defined(DEBUG) |
| - if (FLAG_verify_incoming_contexts) { |
| - Label ok; |
| - // Check that the isolate's saved ctx is null. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ cmpl(Address(EAX, Isolate::top_context_offset()), raw_null); |
| - __ j(EQUAL, &ok, Assembler::kNearJump); |
| - __ Stop("Found non-null incoming top context: call to runtime stub"); |
| - __ Bind(&ok); |
| - } |
| -#endif |
| - |
| - // Save current Context pointer into Isolate structure. |
| - __ movl(Address(EAX, Isolate::top_context_offset()), CTX); |
| - |
| - // Cache Isolate pointer into CTX while executing runtime code. |
| - __ movl(CTX, EAX); |
| - |
| -#if defined(DEBUG) |
| { Label ok; |
| // Check that we are always entering from Dart code. |
| - __ movl(EAX, Address(CTX, Isolate::vm_tag_offset())); |
| - __ cmpl(EAX, Immediate(VMTag::kDartTagId)); |
| + __ cmpl(Address(EAX, Isolate::vm_tag_offset()), |
| + Immediate(VMTag::kDartTagId)); |
| __ j(EQUAL, &ok, Assembler::kNearJump); |
| __ Stop("Not coming from Dart code."); |
| __ Bind(&ok); |
| @@ -84,7 +65,7 @@ |
| #endif |
| // Mark that the isolate is executing VM code. |
| - __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); |
| + __ movl(Address(EAX, Isolate::vm_tag_offset()), ECX); |
| // Reserve space for arguments and align frame before entering C++ world. |
| __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments))); |
| @@ -93,7 +74,7 @@ |
| } |
| // Pass NativeArguments structure by value and call runtime. |
| - __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| + __ movl(Address(ESP, isolate_offset), EAX); // Set isolate in NativeArgs. |
| // There are no runtime calls to closures, so we do not need to set the tag |
| // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
| @@ -104,23 +85,13 @@ |
| __ call(ECX); |
| // Mark that the isolate is executing Dart code. |
| - __ movl(Address(CTX, Isolate::vm_tag_offset()), |
| + __ LoadIsolate(EAX); |
| + __ movl(Address(EAX, Isolate::vm_tag_offset()), |
| Immediate(VMTag::kDartTagId)); |
| // Reset exit frame information in Isolate structure. |
| - __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| + __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| - // Load Context pointer from Isolate structure into ECX. |
| - __ movl(ECX, Address(CTX, Isolate::top_context_offset())); |
| - |
| - // Reset Context pointer in Isolate structure. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ movl(Address(CTX, Isolate::top_context_offset()), raw_null); |
| - |
| - // Cache Context pointer into CTX while executing Dart code. |
| - __ movl(CTX, ECX); |
| - |
| __ LeaveFrame(); |
| __ ret(); |
| } |
| @@ -174,30 +145,10 @@ |
| __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); |
| #if defined(DEBUG) |
| - if (FLAG_verify_incoming_contexts) { |
| - Label ok; |
| - // Check that the isolate's saved ctx is null. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ cmpl(Address(EDI, Isolate::top_context_offset()), raw_null); |
| - __ j(EQUAL, &ok, Assembler::kNearJump); |
| - __ Stop("Found non-null incoming top context: " |
| - "call to native c function stub"); |
| - __ Bind(&ok); |
| - } |
| -#endif |
| - |
| - // Save current Context pointer into Isolate structure. |
| - __ movl(Address(EDI, Isolate::top_context_offset()), CTX); |
| - |
| - // Cache Isolate pointer into CTX while executing native code. |
| - __ movl(CTX, EDI); |
| - |
| -#if defined(DEBUG) |
| { Label ok; |
| // Check that we are always entering from Dart code. |
| - __ movl(EDI, Address(CTX, Isolate::vm_tag_offset())); |
| - __ cmpl(EDI, Immediate(VMTag::kDartTagId)); |
| + __ cmpl(Address(EDI, Isolate::vm_tag_offset()), |
| + Immediate(VMTag::kDartTagId)); |
| __ j(EQUAL, &ok, Assembler::kNearJump); |
| __ Stop("Not coming from Dart code."); |
| __ Bind(&ok); |
| @@ -205,7 +156,7 @@ |
| #endif |
| // Mark that the isolate is executing Native code. |
| - __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); |
| + __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX); |
| // Reserve space for the native arguments structure, the outgoing parameters |
| // (pointer to the native arguments structure, the C function entry point) |
| @@ -217,7 +168,7 @@ |
| } |
| // Pass NativeArguments structure by value and call native function. |
| - __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| + __ movl(Address(ESP, isolate_offset), EDI); // Set isolate in NativeArgs. |
| __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
| __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
| __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
| @@ -229,23 +180,13 @@ |
| __ call(&NativeEntry::NativeCallWrapperLabel()); |
| // Mark that the isolate is executing Dart code. |
| - __ movl(Address(CTX, Isolate::vm_tag_offset()), |
| + __ LoadIsolate(EDI); |
| + __ movl(Address(EDI, Isolate::vm_tag_offset()), |
| Immediate(VMTag::kDartTagId)); |
| // Reset exit frame information in Isolate structure. |
| - __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| + __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| - // Load Context pointer from Isolate structure into EDI. |
| - __ movl(EDI, Address(CTX, Isolate::top_context_offset())); |
| - |
| - // Reset Context pointer in Isolate structure. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ movl(Address(CTX, Isolate::top_context_offset()), raw_null); |
| - |
| - // Cache Context pointer into CTX while executing Dart code. |
| - __ movl(CTX, EDI); |
| - |
| __ LeaveFrame(); |
| __ ret(); |
| } |
| @@ -278,30 +219,10 @@ |
| __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); |
| #if defined(DEBUG) |
| - if (FLAG_verify_incoming_contexts) { |
| - Label ok; |
| - // Check that the isolate's saved ctx is null. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ cmpl(Address(EDI, Isolate::top_context_offset()), raw_null); |
| - __ j(EQUAL, &ok, Assembler::kNearJump); |
| - __ Stop("Found non-null incoming top context: " |
| - "call to bootstrap c function stub"); |
| - __ Bind(&ok); |
| - } |
| -#endif |
| - |
| - // Save current Context pointer into Isolate structure. |
| - __ movl(Address(EDI, Isolate::top_context_offset()), CTX); |
| - |
| - // Cache Isolate pointer into CTX while executing native code. |
| - __ movl(CTX, EDI); |
| - |
| -#if defined(DEBUG) |
| { Label ok; |
| // Check that we are always entering from Dart code. |
| - __ movl(EDI, Address(CTX, Isolate::vm_tag_offset())); |
| - __ cmpl(EDI, Immediate(VMTag::kDartTagId)); |
| + __ cmpl(Address(EDI, Isolate::vm_tag_offset()), |
| + Immediate(VMTag::kDartTagId)); |
| __ j(EQUAL, &ok, Assembler::kNearJump); |
| __ Stop("Not coming from Dart code."); |
| __ Bind(&ok); |
| @@ -309,7 +230,7 @@ |
| #endif |
| // Mark that the isolate is executing Native code. |
| - __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); |
| + __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX); |
| // Reserve space for the native arguments structure, the outgoing parameter |
| // (pointer to the native arguments structure) and align frame before |
| @@ -320,7 +241,7 @@ |
| } |
| // Pass NativeArguments structure by value and call native function. |
| - __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| + __ movl(Address(ESP, isolate_offset), EDI); // Set isolate in NativeArgs. |
| __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
| __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
| __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
| @@ -330,23 +251,13 @@ |
| __ call(ECX); |
| // Mark that the isolate is executing Dart code. |
| - __ movl(Address(CTX, Isolate::vm_tag_offset()), |
| + __ LoadIsolate(EDI); |
|
Vyacheslav Egorov (Google)
2014/10/28 13:44:58
no need to reload, EDI and ESI are both callee sav
Florian Schneider
2014/10/28 19:04:31
Done.
|
| + __ movl(Address(EDI, Isolate::vm_tag_offset()), |
| Immediate(VMTag::kDartTagId)); |
| // Reset exit frame information in Isolate structure. |
| - __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| + __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| - // Load Context pointer from Isolate structure into EDI. |
| - __ movl(EDI, Address(CTX, Isolate::top_context_offset())); |
| - |
| - // Reset Context pointer in Isolate structure. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ movl(Address(CTX, Isolate::top_context_offset()), raw_null); |
| - |
| - // Cache Context pointer into CTX while executing Dart code. |
| - __ movl(CTX, EDI); |
| - |
| __ LeaveFrame(); |
| __ ret(); |
| } |
| @@ -795,13 +706,7 @@ |
| __ pushl(ESI); |
| __ pushl(EDI); |
| - // The new Context structure contains a pointer to the current Isolate |
| - // structure. Cache the Context pointer in the CTX register so that it is |
| - // available in generated code and calls to Isolate::Current() need not be |
| - // done. The assumption is that this register will never be clobbered by |
| - // compiled or runtime stub code. |
| - |
| - // Cache the new Context pointer into CTX while executing dart code. |
| + // Pass the new Context pointer in CTX while executing dart code. |
| __ movl(CTX, Address(EBP, kNewContextOffset)); |
| __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); |
| @@ -825,29 +730,6 @@ |
| __ pushl(EDX); |
| __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| - // Save the old Context pointer. Use ECX as a temporary register. |
| - // Note that VisitObjectPointers will find this saved Context pointer during |
| - // GC marking, since it traverses any information between SP and |
| - // FP - kExitLinkSlotFromEntryFp. |
| - // EntryFrame::SavedContext reads the context saved in this frame. |
| - // The constant kSavedContextSlotFromEntryFp must be kept in sync with |
| - // the code below. |
| - ASSERT(kSavedContextSlotFromEntryFp == -6); |
| - __ movl(ECX, Address(EDI, Isolate::top_context_offset())); |
| - __ pushl(ECX); |
| - |
| - // TODO(turnidge): This code should probably be emitted all the time |
| - // on all architectures but I am leaving it under DEBUG/flag for |
| - // now. |
| -#if defined(DEBUG) |
| - if (FLAG_verify_incoming_contexts) { |
| - // Clear Context pointer in Isolate structure. |
| - const Immediate& raw_null = |
| - Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| - __ movl(Address(EDI, Isolate::top_context_offset()), raw_null); |
| - } |
| -#endif |
| - |
| // Load arguments descriptor array into EDX. |
| __ movl(EDX, Address(EBP, kArgumentsDescOffset)); |
| __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle)); |
| @@ -891,17 +773,12 @@ |
| // Get rid of arguments pushed on the stack. |
| __ leal(ESP, Address(ESP, EDX, TIMES_2, 0)); // EDX is a Smi. |
| - // Load Isolate pointer into CTX. Drop Context. |
| - __ LoadIsolate(CTX); |
| - |
| - // Restore the saved Context pointer into the Isolate structure. |
| - __ popl(Address(CTX, Isolate::top_context_offset())); |
| - |
| // Restore the saved top exit frame info back into the Isolate structure. |
| - __ popl(Address(CTX, Isolate::top_exit_frame_info_offset())); |
| + __ LoadIsolate(EDI); |
| + __ popl(Address(EDI, Isolate::top_exit_frame_info_offset())); |
| // Restore the current VMTag from the stack. |
| - __ popl(Address(CTX, Isolate::vm_tag_offset())); |
| + __ popl(Address(EDI, Isolate::vm_tag_offset())); |
| // Restore C++ ABI callee-saved registers. |
| __ popl(EDI); |
| @@ -1409,7 +1286,6 @@ |
| } |
| #endif // DEBUG |
| - // Check single stepping. |
| Label stepping, done_stepping; |
| uword single_step_address = reinterpret_cast<uword>(Isolate::Current()) + |
| Isolate::single_step_offset(); |