diff --git a/src/ic/arm/handler-compiler-arm.cc b/src/ic/arm/handler-compiler-arm.cc index aac838b4f9..7f3e55b544 100644 --- a/src/ic/arm/handler-compiler-arm.cc +++ b/src/ic/arm/handler-compiler-arm.cc @@ -241,7 +241,9 @@ static void CompileCallLoadPropertyWithInterceptor( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch_in, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!accessor_holder.is(scratch_in)); DCHECK(!receiver.is(scratch_in)); __ push(receiver); // Write the arguments to stack frame. @@ -258,6 +260,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register holder = r2; Register api_function_address = r1; + // Put callee in place. + __ LoadAccessor(callee, accessor_holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -275,13 +281,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ Move(callee, function); - bool call_data_undefined = false; // Put call_data in place. if (isolate->heap()->InNewSpace(*call_data_obj)) { diff --git a/src/ic/arm64/handler-compiler-arm64.cc b/src/ic/arm64/handler-compiler-arm64.cc index f804521115..3fd5807e12 100644 --- a/src/ic/arm64/handler-compiler-arm64.cc +++ b/src/ic/arm64/handler-compiler-arm64.cc @@ -149,7 +149,9 @@ static void CompileCallLoadPropertyWithInterceptor( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!AreAliased(accessor_holder, scratch)); DCHECK(!AreAliased(receiver, scratch)); MacroAssembler::PushPopQueue queue(masm); @@ -170,6 +172,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register holder = x2; Register api_function_address = x1; + // Put callee in place. + __ LoadAccessor(callee, accessor_holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -187,13 +193,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ LoadObject(callee, function); - bool call_data_undefined = false; // Put call_data in place. if (isolate->heap()->InNewSpace(*call_data_obj)) { diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index ce66b4efd2..16e42cebd6 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -229,12 +229,13 @@ Handle NamedLoadHandlerCompiler::CompileLoadCallback( Handle NamedLoadHandlerCompiler::CompileLoadCallback( - Handle name, const CallOptimization& call_optimization) { + Handle name, const CallOptimization& call_optimization, + int accessor_index) { DCHECK(call_optimization.is_simple_api_call()); - Frontend(name); + Register holder = Frontend(name); Handle receiver_map = IC::TypeToMap(*type(), isolate()); GenerateApiAccessorCall(masm(), call_optimization, receiver_map, receiver(), - scratch1(), false, no_reg); + scratch2(), false, no_reg, holder, accessor_index); return GetCode(kind(), Code::FAST, name); } @@ -454,10 +455,11 @@ Handle NamedStoreHandlerCompiler::CompileStoreViaSetter( Handle NamedStoreHandlerCompiler::CompileStoreCallback( Handle object, Handle name, - const CallOptimization& call_optimization) { - Frontend(name); + const CallOptimization& call_optimization, int accessor_index) { + Register holder = Frontend(name); GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()), - receiver(), scratch1(), true, value()); + receiver(), scratch2(), true, value(), holder, + accessor_index); return GetCode(kind(), Code::FAST, name); } diff --git a/src/ic/handler-compiler.h b/src/ic/handler-compiler.h index c498592d08..b7a60b5cd7 100644 --- a/src/ic/handler-compiler.h +++ b/src/ic/handler-compiler.h @@ -58,7 +58,9 @@ class PropertyHandlerCompiler : public PropertyAccessCompiler { const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch, - bool is_store, Register store_parameter); + bool is_store, Register store_parameter, + Register accessor_holder, + int accessor_index); // Helper function used to check that the dictionary doesn't contain // the property. This function may return false negatives, so miss_label @@ -124,7 +126,8 @@ class NamedLoadHandlerCompiler : public PropertyHandlerCompiler { Handle callback); Handle CompileLoadCallback(Handle name, - const CallOptimization& call_optimization); + const CallOptimization& call_optimization, + int accessor_index); Handle CompileLoadConstant(Handle name, int constant_index); @@ -224,7 +227,8 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler { Handle CompileStoreCallback(Handle object, Handle name, Handle callback); Handle CompileStoreCallback(Handle object, Handle name, - const CallOptimization& call_optimization); + const CallOptimization& call_optimization, + int accessor_index); Handle CompileStoreViaSetter(Handle object, Handle name, int accessor_index, int expected_arguments); diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc index 367d6ceb94..409f1b3827 100644 --- a/src/ic/ia32/handler-compiler-ia32.cc +++ b/src/ic/ia32/handler-compiler-ia32.cc @@ -145,7 +145,9 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch_in, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!accessor_holder.is(scratch_in)); // Copy return value. __ pop(scratch_in); // receiver @@ -167,6 +169,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register api_function_address = edx; Register scratch = eax; // scratch_in is no longer valid. + // Put callee in place. + __ LoadAccessor(callee, accessor_holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -184,12 +190,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ LoadHeapObject(callee, function); bool call_data_undefined = false; // Put call_data in place. diff --git a/src/ic/ic.cc b/src/ic/ic.cc index f3789822ac..68c7cc2c45 100644 --- a/src/ic/ic.cc +++ b/src/ic/ic.cc @@ -1237,8 +1237,8 @@ Handle LoadIC::CompileHandler(LookupIterator* lookup, cache_holder); if (call_optimization.is_simple_api_call() && call_optimization.IsCompatibleReceiver(receiver, holder)) { - return compiler.CompileLoadCallback(lookup->name(), - call_optimization); + return compiler.CompileLoadCallback(lookup->name(), call_optimization, + lookup->GetAccessorIndex()); } int expected_arguments = function->shared()->formal_parameter_count(); return compiler.CompileLoadViaGetter( @@ -1741,7 +1741,8 @@ Handle StoreIC::CompileHandler(LookupIterator* lookup, if (call_optimization.is_simple_api_call() && call_optimization.IsCompatibleReceiver(receiver, holder)) { return compiler.CompileStoreCallback(receiver, lookup->name(), - call_optimization); + call_optimization, + lookup->GetAccessorIndex()); } int expected_arguments = function->shared()->formal_parameter_count(); return compiler.CompileStoreViaSetter(receiver, lookup->name(), diff --git a/src/ic/mips/handler-compiler-mips.cc b/src/ic/mips/handler-compiler-mips.cc index cb394da9a1..9c98c6d73e 100644 --- a/src/ic/mips/handler-compiler-mips.cc +++ b/src/ic/mips/handler-compiler-mips.cc @@ -234,7 +234,9 @@ static void CompileCallLoadPropertyWithInterceptor( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch_in, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!accessor_holder.is(scratch_in)); DCHECK(!receiver.is(scratch_in)); __ push(receiver); // Write the arguments to stack frame. @@ -251,6 +253,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register holder = a2; Register api_function_address = a1; + // Put callee in place. + __ LoadAccessor(callee, holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -268,13 +274,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ li(callee, function); - bool call_data_undefined = false; // Put call_data in place. if (isolate->heap()->InNewSpace(*call_data_obj)) { diff --git a/src/ic/mips64/handler-compiler-mips64.cc b/src/ic/mips64/handler-compiler-mips64.cc index cd237aa1ae..a708053ec0 100644 --- a/src/ic/mips64/handler-compiler-mips64.cc +++ b/src/ic/mips64/handler-compiler-mips64.cc @@ -235,7 +235,9 @@ static void CompileCallLoadPropertyWithInterceptor( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch_in, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!accessor_holder.is(scratch_in)); DCHECK(!receiver.is(scratch_in)); __ push(receiver); // Write the arguments to stack frame. @@ -252,6 +254,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register holder = a2; Register api_function_address = a1; + // Put callee in place. + __ LoadAccessor(callee, holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -269,13 +275,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ li(callee, function); - bool call_data_undefined = false; // Put call_data in place. if (isolate->heap()->InNewSpace(*call_data_obj)) { diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc index d2ee3aaf44..12a6003448 100644 --- a/src/ic/x64/handler-compiler-x64.cc +++ b/src/ic/x64/handler-compiler-x64.cc @@ -131,7 +131,9 @@ static void CompileCallLoadPropertyWithInterceptor( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch_in, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!accessor_holder.is(scratch_in)); DCHECK(optimization.is_simple_api_call()); __ PopReturnAddressTo(scratch_in); @@ -153,6 +155,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register api_function_address = rdx; Register scratch = rax; // scratch_in is no longer valid. + // Put callee in place. + __ LoadAccessor(callee, accessor_holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -170,13 +176,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ Move(callee, function); - bool call_data_undefined = false; // Put call_data in place. if (isolate->heap()->InNewSpace(*call_data_obj)) { diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index 091e009a63..bac7920345 100644 --- a/src/ic/x87/handler-compiler-x87.cc +++ b/src/ic/x87/handler-compiler-x87.cc @@ -145,7 +145,9 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( void PropertyHandlerCompiler::GenerateApiAccessorCall( MacroAssembler* masm, const CallOptimization& optimization, Handle receiver_map, Register receiver, Register scratch_in, - bool is_store, Register store_parameter) { + bool is_store, Register store_parameter, Register accessor_holder, + int accessor_index) { + DCHECK(!accessor_holder.is(scratch_in)); // Copy return value. __ pop(scratch_in); // receiver @@ -167,6 +169,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( Register api_function_address = edx; Register scratch = edi; // scratch_in is no longer valid. + // Put callee in place. + __ LoadAccessor(callee, accessor_holder, accessor_index, + is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); + // Put holder in place. CallOptimization::HolderLookup holder_lookup; Handle api_holder = @@ -184,13 +190,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( } Isolate* isolate = masm->isolate(); - Handle function = optimization.constant_function(); Handle api_call_info = optimization.api_call_info(); Handle call_data_obj(api_call_info->data(), isolate); - // Put callee in place. - __ LoadHeapObject(callee, function); - bool call_data_undefined = false; // Put call_data in place. if (isolate->heap()->InNewSpace(*call_data_obj)) {