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

Unified Diff: src/ic.cc

Issue 443993002: Only allocate a handler compiler when necessary (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 02d66b34ac6acc0325f6f2603fa081c4a82845ce..9007e9338f907210fc8746f667926175a8ac6e7e 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -998,12 +998,11 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
Handle<HeapType> type = receiver_type();
Handle<JSObject> holder = lookup->GetHolder<JSObject>();
bool receiver_is_holder = object.is_identical_to(holder);
- NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
- cache_holder);
-
// -------------- Interceptors --------------
if (lookup->state() == LookupIterator::INTERCEPTOR) {
DCHECK(!holder->GetNamedInterceptor()->getter()->IsUndefined());
+ NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
+ cache_holder);
return compiler.CompileLoadInterceptor(name);
}
DCHECK(lookup->state() == LookupIterator::PROPERTY);
@@ -1033,6 +1032,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
return slow_stub();
}
if (!holder->HasFastProperties()) return slow_stub();
+ NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
+ cache_holder);
return compiler.CompileLoadCallback(name, info);
}
if (accessors->IsAccessorPair()) {
@@ -1048,6 +1049,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
return slow_stub();
}
CallOptimization call_optimization(function);
+ NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
+ cache_holder);
if (call_optimization.is_simple_api_call() &&
call_optimization.IsCompatibleReceiver(object, holder)) {
return compiler.CompileLoadCallback(name, call_optimization);
@@ -1064,6 +1067,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
if (lookup->property_encoding() == LookupIterator::DICTIONARY) {
if (kind() != Code::LOAD_IC) return slow_stub();
if (holder->IsGlobalObject()) {
+ NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
+ cache_holder);
Handle<PropertyCell> cell = lookup->GetPropertyCell();
Handle<Code> code =
compiler.CompileLoadGlobal(cell, name, lookup->IsConfigurable());
@@ -1089,6 +1094,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
if (receiver_is_holder) {
return SimpleFieldLoad(field);
}
+ NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
+ cache_holder);
return compiler.CompileLoadField(name, field);
}
@@ -1098,6 +1105,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
LoadConstantStub stub(isolate(), lookup->GetConstantIndex());
return stub.GetCode();
}
+ NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
+ cache_holder);
return compiler.CompileLoadConstant(name, lookup->GetConstantIndex());
}
@@ -1459,7 +1468,6 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
Handle<JSObject> holder(lookup->holder());
- NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
if (lookup->IsTransition()) {
// Explicitly pass in the receiver map since LookupForWrite may have
@@ -1469,6 +1477,7 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
if (details.type() != CALLBACKS && details.attributes() == NONE &&
holder->HasFastProperties()) {
+ NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
return compiler.CompileStoreTransition(transition, name);
}
} else {
@@ -1486,6 +1495,7 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
lookup->representation());
return stub.GetCode();
}
+ NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
return compiler.CompileStoreField(lookup, name);
}
case NORMAL:
@@ -1521,6 +1531,8 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
isolate(), info, receiver_type())) {
break;
}
+ NamedStoreHandlerCompiler compiler(isolate(), receiver_type(),
+ holder);
return compiler.CompileStoreCallback(receiver, name, info);
} else if (callback->IsAccessorPair()) {
Handle<Object> setter(
@@ -1530,6 +1542,8 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
if (!holder->HasFastProperties()) break;
Handle<JSFunction> function = Handle<JSFunction>::cast(setter);
CallOptimization call_optimization(function);
+ NamedStoreHandlerCompiler compiler(isolate(), receiver_type(),
+ holder);
if (call_optimization.is_simple_api_call() &&
call_optimization.IsCompatibleReceiver(receiver, holder)) {
return compiler.CompileStoreCallback(receiver, name,
@@ -1542,9 +1556,11 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
DCHECK(callback->IsDeclaredAccessorInfo());
break;
}
- case INTERCEPTOR:
+ case INTERCEPTOR: {
DCHECK(HasInterceptorSetter(*holder));
+ NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder);
return compiler.CompileStoreInterceptor(name);
+ }
case CONSTANT:
break;
case NONEXISTENT:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698