From 70910752393dc194b948b4aef094233e08a8b49c Mon Sep 17 00:00:00 2001 From: epertoso Date: Tue, 16 Feb 2016 02:07:49 -0800 Subject: [PATCH] Make NamedLoadHandlerCompiler::CompileLoadInterceptor behave correcly with lazy accessors. Before this fix, we always ended up calling Runtime_LoadPropertyWithInterceptor, which caused the performance regression reported in http://crbug.com/585764. BUG=585764 LOG=y Review URL: https://codereview.chromium.org/1699913002 Cr-Commit-Position: refs/heads/master@{#34025} --- src/ic/handler-compiler.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index 6a8a5db763..dfbb54fc1a 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -301,10 +301,11 @@ Handle NamedLoadHandlerCompiler::CompileLoadInterceptor( Handle property_holder(it->GetHolder()); Handle getter(Handle::cast(accessors)->getter(), isolate()); - if (!getter->IsJSFunction()) break; + if (!(getter->IsJSFunction() || getter->IsFunctionTemplateInfo())) { + break; + } if (!property_holder->HasFastProperties()) break; - auto function = Handle::cast(getter); - CallOptimization call_optimization(function); + CallOptimization call_optimization(getter); Handle receiver_map = map(); inline_followup = call_optimization.is_simple_api_call() && call_optimization.IsCompatibleReceiverMap( @@ -397,8 +398,8 @@ void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( DCHECK_NOT_NULL(info->getter()); GenerateLoadCallback(reg, info); } else { - auto function = handle(JSFunction::cast( - AccessorPair::cast(*it->GetAccessors())->getter())); + Handle function = handle( + AccessorPair::cast(*it->GetAccessors())->getter(), isolate()); CallOptimization call_optimization(function); GenerateApiAccessorCall(masm(), call_optimization, holder_map, receiver(), scratch2(), false, no_reg, reg,