Index: vm/stub_code_ia32.cc |
=================================================================== |
--- vm/stub_code_ia32.cc (revision 10541) |
+++ vm/stub_code_ia32.cc (working copy) |
@@ -252,91 +252,6 @@ |
} |
-// Lookup for [function-name, arg count] in 'functions_map_'. |
-// Input parameters (to be treated as read only, unless calling to target!): |
-// ECX: ic-data. |
-// EDX: arguments descriptor array (num_args is first Smi element). |
-// Stack: return address, arguments. |
-// If the lookup succeeds we jump to the target method from here, otherwise |
-// we continue in code generated by the caller of 'MegamorphicLookup'. |
-static void MegamorphicLookup(Assembler* assembler) { |
- const Immediate raw_null = |
- Immediate(reinterpret_cast<intptr_t>(Object::null())); |
- Label class_in_eax, smi_receiver, null_receiver, not_found; |
- // Total number of args is the first Smi in args descriptor array (EDX). |
- __ movl(EAX, FieldAddress(EDX, Array::data_offset())); |
- __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // Get receiver. EAX is a Smi. |
- // TODO(srdjan): Remove the special casing below for null receiver, once |
- // NullClass is implemented. |
- __ cmpl(EAX, raw_null); |
- // Use Object class if receiver is null. |
- __ j(EQUAL, &null_receiver, Assembler::kNearJump); |
- __ testl(EAX, Immediate(kSmiTagMask)); |
- __ j(ZERO, &smi_receiver, Assembler::kNearJump); |
- __ LoadClass(EAX, EAX, EDI); |
- __ jmp(&class_in_eax, Assembler::kNearJump); |
- __ Bind(&smi_receiver); |
- // For Smis we need to get the class from the isolate. |
- // Load current Isolate pointer from Context structure into EAX. |
- __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); |
- __ movl(EAX, Address(EAX, Isolate::object_store_offset())); |
- __ movl(EAX, Address(EAX, ObjectStore::smi_class_offset())); |
- __ jmp(&class_in_eax, Assembler::kNearJump); |
- __ Bind(&null_receiver); |
- __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); |
- __ movl(EAX, Address(EAX, Isolate::object_store_offset())); |
- __ movl(EAX, Address(EAX, ObjectStore::object_class_offset())); |
- |
- __ Bind(&class_in_eax); |
- // Class is in EAX. |
- |
- Label loop, next_iteration; |
- // Get functions_cache, since it is allocated lazily it maybe null. |
- __ movl(EAX, FieldAddress(EAX, Class::functions_cache_offset())); |
- __ cmpl(EAX, raw_null); |
- __ j(EQUAL, ¬_found, Assembler::kNearJump); |
- |
- // Iterate and search for identical name. |
- __ leal(EBX, FieldAddress(EAX, Array::data_offset())); |
- |
- // EBX is pointing into content of functions_map_ array. |
- __ Bind(&loop); |
- __ movl(EDI, Address(EBX, FunctionsCache::kFunctionName * kWordSize)); |
- |
- __ cmpl(EDI, raw_null); |
- __ j(EQUAL, ¬_found, Assembler::kNearJump); |
- |
- __ cmpl(EDI, FieldAddress(ECX, ICData::target_name_offset())); |
- __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); |
- |
- // Name found, check total argument count and named argument count. |
- __ movl(EAX, FieldAddress(EDX, Array::data_offset())); |
- // EAX is total argument count as Smi. |
- __ movl(EDI, Address(EBX, FunctionsCache::kArgCount * kWordSize)); |
- __ cmpl(EAX, EDI); // Compare total argument counts. |
- __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); |
- __ subl(EAX, FieldAddress(EDX, Array::data_offset() + kWordSize)); |
- // EAX is named argument count as Smi. |
- __ movl(EDI, Address(EBX, FunctionsCache::kNamedArgCount * kWordSize)); |
- __ cmpl(EAX, EDI); // Compare named argument counts. |
- __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump); |
- |
- // Argument count matches, jump to target. |
- // EDX: arguments descriptor array. |
- __ movl(ECX, Address(EBX, FunctionsCache::kFunction * kWordSize)); |
- __ movl(ECX, FieldAddress(ECX, Function::code_offset())); |
- __ movl(ECX, FieldAddress(ECX, Code::instructions_offset())); |
- __ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
- __ jmp(ECX); |
- |
- __ Bind(&next_iteration); |
- __ AddImmediate(EBX, Immediate(FunctionsCache::kNumEntries * kWordSize)); |
- __ jmp(&loop, Assembler::kNearJump); |
- |
- __ Bind(¬_found); |
-} |
- |
- |
// Input parameters: |
// EDI: argument count, may be zero. |
// Uses EAX, EBX, ECX, EDX. |
@@ -375,14 +290,10 @@ |
// called, the stub accesses the receiver from this location directly |
// when trying to resolve the call. |
// Uses EDI. |
-void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
+void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { |
const Immediate raw_null = |
Immediate(reinterpret_cast<intptr_t>(Object::null())); |
- MegamorphicLookup(assembler); |
- // Lookup in function_table_ failed, resolve, compile and enter function |
- // into function_table_. |
- |
// Create a stub frame as we are pushing some objects on the stack before |
// calling into the runtime. |
AssemblerMacros::EnterStubFrame(assembler); |
@@ -1710,7 +1621,7 @@ |
__ cmpl(EAX, raw_null); |
__ j(NOT_EQUAL, &call_target_function, Assembler::kNearJump); |
// NoSuchMethod or closure. |
- __ jmp(&StubCode::MegamorphicLookupLabel()); |
+ __ jmp(&StubCode::InstanceFunctionLookupLabel()); |
__ Bind(&found); |
// EBX: Pointer to an IC data check group (classes + target) |