| Index: vm/stub_code_x64.cc
|
| ===================================================================
|
| --- vm/stub_code_x64.cc (revision 10541)
|
| +++ vm/stub_code_x64.cc (working copy)
|
| @@ -247,91 +247,6 @@
|
| }
|
|
|
|
|
| -// Lookup for [function-name, arg count] in 'functions_map_'.
|
| -// Input parameters (to be treated as read only, unless calling to target!):
|
| -// RBX: ic-data.
|
| -// R10: 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_rax, smi_receiver, null_receiver, not_found;
|
| - // Total number of args is the first Smi in args descriptor array (R10).
|
| - __ movq(RAX, FieldAddress(R10, Array::data_offset()));
|
| - __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // Get receiver. RAX is a Smi.
|
| - // TODO(srdjan): Remove the special casing below for null receiver, once
|
| - // NullClass is implemented.
|
| - __ cmpq(RAX, raw_null);
|
| - // Use Object class if receiver is null.
|
| - __ j(EQUAL, &null_receiver, Assembler::kNearJump);
|
| - __ testq(RAX, Immediate(kSmiTagMask));
|
| - __ j(ZERO, &smi_receiver, Assembler::kNearJump);
|
| - __ LoadClass(RAX, RAX);
|
| - __ jmp(&class_in_rax, Assembler::kNearJump);
|
| - __ Bind(&smi_receiver);
|
| - // For Smis we need to get the class from the isolate.
|
| - // Load current Isolate pointer from Context structure into RAX.
|
| - __ movq(RAX, FieldAddress(CTX, Context::isolate_offset()));
|
| - __ movq(RAX, Address(RAX, Isolate::object_store_offset()));
|
| - __ movq(RAX, Address(RAX, ObjectStore::smi_class_offset()));
|
| - __ jmp(&class_in_rax, Assembler::kNearJump);
|
| - __ Bind(&null_receiver);
|
| - __ movq(RAX, FieldAddress(CTX, Context::isolate_offset()));
|
| - __ movq(RAX, Address(RAX, Isolate::object_store_offset()));
|
| - __ movq(RAX, Address(RAX, ObjectStore::object_class_offset()));
|
| -
|
| - __ Bind(&class_in_rax);
|
| - // Class is in RAX.
|
| -
|
| - Label loop, next_iteration;
|
| - // Get functions_cache, since it is allocated lazily it maybe null.
|
| - __ movq(RAX, FieldAddress(RAX, Class::functions_cache_offset()));
|
| - __ cmpq(RAX, raw_null);
|
| - __ j(EQUAL, ¬_found, Assembler::kNearJump);
|
| -
|
| - // Iterate and search for identical name.
|
| - __ leaq(R12, FieldAddress(RAX, Array::data_offset()));
|
| -
|
| - // R12 is pointing into content of functions_map_ array.
|
| - __ Bind(&loop);
|
| - __ movq(R13, Address(R12, FunctionsCache::kFunctionName * kWordSize));
|
| -
|
| - __ cmpq(R13, raw_null);
|
| - __ j(EQUAL, ¬_found, Assembler::kNearJump);
|
| -
|
| - __ cmpq(R13, FieldAddress(RBX, ICData::target_name_offset()));
|
| - __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump);
|
| -
|
| - // Name found, check total argument count and named argument count.
|
| - __ movq(RAX, FieldAddress(R10, Array::data_offset()));
|
| - // RAX is total argument count as Smi.
|
| - __ movq(R13, Address(R12, FunctionsCache::kArgCount * kWordSize));
|
| - __ cmpq(RAX, R13); // Compare total argument counts.
|
| - __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump);
|
| - __ subq(RAX, FieldAddress(R10, Array::data_offset() + kWordSize));
|
| - // RAX is named argument count as Smi.
|
| - __ movq(R13, Address(R12, FunctionsCache::kNamedArgCount * kWordSize));
|
| - __ cmpq(RAX, R13); // Compare named argument counts.
|
| - __ j(NOT_EQUAL, &next_iteration, Assembler::kNearJump);
|
| -
|
| - // Argument count matches, jump to target.
|
| - // R10: arguments descriptor array.
|
| - __ movq(RBX, Address(R12, FunctionsCache::kFunction * kWordSize));
|
| - __ movq(RBX, FieldAddress(RBX, Function::code_offset()));
|
| - __ movq(RBX, FieldAddress(RBX, Code::instructions_offset()));
|
| - __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
|
| - __ jmp(RBX);
|
| -
|
| - __ Bind(&next_iteration);
|
| - __ AddImmediate(R12, Immediate(FunctionsCache::kNumEntries * kWordSize));
|
| - __ jmp(&loop, Assembler::kNearJump);
|
| -
|
| - __ Bind(¬_found);
|
| -}
|
| -
|
| -
|
| // Input parameters:
|
| // R13: argument count, may be zero.
|
| static void PushArgumentsArray(Assembler* assembler, intptr_t arg_offset) {
|
| @@ -368,14 +283,10 @@
|
| // Note: The receiver object is the first argument to the function being
|
| // called, the stub accesses the receiver from this location directly
|
| // when trying to resolve the call.
|
| -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);
|
| @@ -1681,7 +1592,7 @@
|
| __ cmpq(RAX, raw_null);
|
| __ j(NOT_EQUAL, &call_target_function, Assembler::kNearJump);
|
| // NoSuchMethod or closure.
|
| - __ jmp(&StubCode::MegamorphicLookupLabel());
|
| + __ jmp(&StubCode::InstanceFunctionLookupLabel());
|
|
|
| __ Bind(&found);
|
| // R12: Pointer to an IC data check group (classes + target)
|
|
|