Index: runtime/vm/stub_code_ia32.cc |
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc |
index 140eb70bb1eab70ac52fe2ed55645e6e3f312b9a..3f6fbc1e2cb053617962e47a64c32aeab2eff6e8 100644 |
--- a/runtime/vm/stub_code_ia32.cc |
+++ b/runtime/vm/stub_code_ia32.cc |
@@ -564,6 +564,38 @@ void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
} |
+void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { |
+ const Immediate raw_null = |
+ Immediate(reinterpret_cast<intptr_t>(Instructions::null())); |
+ AssemblerMacros::EnterStubFrame(assembler); |
+ __ pushl(raw_null); // Space for the result of the runtime call. |
+ // Load the receiver into EAX. The argument count in the arguments |
+ // descriptor is a smi. |
srdjan
2012/12/03 19:10:46
Please document that EDX contains argument descrip
Kevin Millikin (Google)
2012/12/06 14:03:11
OK.
|
+ __ movl(EAX, FieldAddress(EDX, Array::data_offset())); |
+ // Three words in the stack above the last argument. |
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, 3 * kWordSize)); |
+ __ pushl(EAX); // Receiver. |
+ __ pushl(ECX); // IC data. |
+ __ pushl(EDX); // Arguments descriptor. |
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry); |
+ __ popl(EDX); // Arguments descriptor. |
srdjan
2012/12/03 19:10:46
You need to preserve/restore argument descriptor a
Kevin Millikin (Google)
2012/12/06 14:03:11
Thank you, good catch.
|
+ __ popl(ECX); // IC data. |
+ __ popl(EAX); // Discard. |
+ __ popl(EAX); // Return value from the runtime call (instructions). |
+ __ LeaveFrame(); |
srdjan
2012/12/03 19:10:46
null as result should not be possible, should it?
Kevin Millikin (Google)
2012/12/06 14:03:11
No such method, implicit closures.
|
+ |
+ Label lookup; |
+ __ cmpl(EAX, raw_null); |
+ __ j(EQUAL, &lookup, Assembler::kNearJump); |
+ __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
+ __ jmp(EAX); |
+ |
+ __ Bind(&lookup); |
+ __ int3(); |
Vyacheslav Egorov (Google)
2012/12/03 14:55:22
What's up with this int3?
If it can not be reache
Kevin Millikin (Google)
2012/12/06 14:03:11
Thanks for catching it. It's a reminder to myself
|
+ __ jmp(&StubCode::InstanceFunctionLookupLabel()); |
+} |
+ |
+ |
// Called for inline allocation of arrays. |
// Input parameters: |
// EDX : Array length as Smi. |