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

Unified Diff: src/ic/ic.cc

Issue 1679683004: Revert of Do not eagerly instantiate accessors' JSFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index 9c7ae574c0b624d613dbda767aaa1453a19a4f2a..1adf24a01b3e645b2987204fc01ed57eda9e8f10 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -986,24 +986,17 @@
} else if (accessors->IsAccessorPair()) {
Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
isolate);
- if (!getter->IsJSFunction() && !getter->IsFunctionTemplateInfo())
- return false;
Handle<JSObject> holder = lookup->GetHolder<JSObject>();
Handle<Object> receiver = lookup->GetReceiver();
- if (holder->HasFastProperties()) {
- if (getter->IsJSFunction()) {
- Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
- if (!receiver->IsJSObject() && !function->shared()->IsBuiltin() &&
- is_sloppy(function->shared()->language_mode())) {
- // Calling sloppy non-builtins with a value as the receiver
- // requires boxing.
+ if (getter->IsJSFunction() && holder->HasFastProperties()) {
+ Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
+ if (receiver->IsJSObject() || function->shared()->IsBuiltin() ||
+ !is_sloppy(function->shared()->language_mode())) {
+ CallOptimization call_optimization(function);
+ if (call_optimization.is_simple_api_call() &&
+ !call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) {
return false;
}
- }
- CallOptimization call_optimization(getter);
- if (call_optimization.is_simple_api_call() &&
- !call_optimization.IsCompatibleReceiverMap(receiver_map, holder)) {
- return false;
}
}
}
@@ -1174,39 +1167,48 @@
return stub.GetCode();
}
- if (IsCompatibleReceiver(lookup, map)) {
- Handle<Object> accessors = lookup->GetAccessors();
- if (accessors->IsAccessorPair()) {
- if (!holder->HasFastProperties()) break;
- // When debugging we need to go the slow path to flood the accessor.
- if (GetSharedFunctionInfo()->HasDebugInfo()) break;
- Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
- isolate());
- CallOptimization call_optimization(getter);
- NamedLoadHandlerCompiler compiler(isolate(), map, holder,
- cache_holder);
- if (call_optimization.is_simple_api_call()) {
+ Handle<Object> accessors = lookup->GetAccessors();
+ if (accessors->IsAccessorInfo()) {
+ Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
+ if (v8::ToCData<Address>(info->getter()) == 0) break;
+ if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)) {
+ // This case should be already handled in LoadIC::UpdateCaches.
+ UNREACHABLE();
+ break;
+ }
+ if (!holder->HasFastProperties()) break;
+ NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
+ return compiler.CompileLoadCallback(lookup->name(), info);
+ }
+ if (accessors->IsAccessorPair()) {
+ Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
+ isolate());
+ if (!getter->IsJSFunction()) break;
+ if (!holder->HasFastProperties()) break;
+ // When debugging we need to go the slow path to flood the accessor.
+ if (GetSharedFunctionInfo()->HasDebugInfo()) break;
+ Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
+ if (!receiver->IsJSObject() && !function->shared()->IsBuiltin() &&
+ is_sloppy(function->shared()->language_mode())) {
+ // Calling sloppy non-builtins with a value as the receiver
+ // requires boxing.
+ break;
+ }
+ CallOptimization call_optimization(function);
+ NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
+ if (call_optimization.is_simple_api_call()) {
+ if (call_optimization.IsCompatibleReceiver(receiver, holder)) {
return compiler.CompileLoadCallback(
lookup->name(), call_optimization, lookup->GetAccessorIndex());
- }
- int expected_arguments = Handle<JSFunction>::cast(getter)
- ->shared()
- ->internal_formal_parameter_count();
- return compiler.CompileLoadViaGetter(
- lookup->name(), lookup->GetAccessorIndex(), expected_arguments);
- } else if (accessors->IsAccessorInfo()) {
- Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
- if (v8::ToCData<Address>(info->getter()) == 0) break;
- if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)) {
+ } else {
// This case should be already handled in LoadIC::UpdateCaches.
UNREACHABLE();
- break;
}
- if (!holder->HasFastProperties()) break;
- NamedLoadHandlerCompiler compiler(isolate(), map, holder,
- cache_holder);
- return compiler.CompileLoadCallback(lookup->name(), info);
}
+ int expected_arguments =
+ function->shared()->internal_formal_parameter_count();
+ return compiler.CompileLoadViaGetter(
+ lookup->name(), lookup->GetAccessorIndex(), expected_arguments);
}
break;
}
« no previous file with comments | « src/ic/ia32/handler-compiler-ia32.cc ('k') | src/ic/mips/handler-compiler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698