Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Unified Diff: src/ic/handler-compiler.cc

Issue 885763004: follow up named interceptor miss with api callback getter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/call-optimization.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/handler-compiler.cc
diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc
index 3af36fac203974c572d55d2a317b8168892037b3..00df7be065371c46a40f732385eeae0b12a55840 100644
--- a/src/ic/handler-compiler.cc
+++ b/src/ic/handler-compiler.cc
@@ -289,13 +289,25 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor(
break;
case LookupIterator::ACCESSOR: {
Handle<Object> accessors = it->GetAccessors();
- inline_followup = accessors->IsExecutableAccessorInfo();
- if (!inline_followup) break;
- Handle<ExecutableAccessorInfo> info =
- Handle<ExecutableAccessorInfo>::cast(accessors);
- inline_followup = info->getter() != NULL &&
- ExecutableAccessorInfo::IsCompatibleReceiverType(
- isolate(), info, type());
+ if (accessors->IsExecutableAccessorInfo()) {
+ Handle<ExecutableAccessorInfo> info =
+ Handle<ExecutableAccessorInfo>::cast(accessors);
+ inline_followup = info->getter() != NULL &&
+ ExecutableAccessorInfo::IsCompatibleReceiverType(
+ isolate(), info, type());
+ } else if (accessors->IsAccessorPair()) {
+ Handle<JSObject> property_holder(it->GetHolder<JSObject>());
+ Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
+ isolate());
+ if (!getter->IsJSFunction()) break;
+ if (!property_holder->HasFastProperties()) break;
+ auto function = Handle<JSFunction>::cast(getter);
+ CallOptimization call_optimization(function);
+ Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
+ inline_followup = call_optimization.is_simple_api_call() &&
+ call_optimization.IsCompatibleReceiverType(
+ receiver_map, property_holder);
+ }
}
}
@@ -345,10 +357,20 @@ void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor(
break;
}
case LookupIterator::ACCESSOR:
- Handle<ExecutableAccessorInfo> info =
- Handle<ExecutableAccessorInfo>::cast(it->GetAccessors());
- DCHECK_NOT_NULL(info->getter());
- GenerateLoadCallback(reg, info);
+ if (it->GetAccessors()->IsExecutableAccessorInfo()) {
+ Handle<ExecutableAccessorInfo> info =
+ Handle<ExecutableAccessorInfo>::cast(it->GetAccessors());
+ DCHECK_NOT_NULL(info->getter());
+ GenerateLoadCallback(reg, info);
+ } else {
+ auto function = handle(JSFunction::cast(
+ AccessorPair::cast(*it->GetAccessors())->getter()));
+ CallOptimization call_optimization(function);
+ Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
+ GenerateApiAccessorCall(masm(), call_optimization, receiver_map,
+ receiver(), scratch2(), false, no_reg, reg,
+ it->GetAccessorIndex());
+ }
}
}
« no previous file with comments | « src/ic/call-optimization.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698