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

Unified Diff: src/ic/ic.cc

Issue 1332563003: Vector ICs: No more patching for call ics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix x64 build break. Created 5 years, 3 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/ic.h ('k') | src/ic/ic-inl.h » ('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 3ea251cd7b52e9569ff156d9f83d8eae20056cff..e6a34797163b29aa720343c7bea2ccffef0de3a6 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -2297,73 +2297,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
}
-bool CallIC::DoCustomHandler(Handle<Object> function,
- const CallICState& callic_state) {
- DCHECK(FLAG_use_ic && function->IsJSFunction());
-
- // Are we the array function?
- Handle<JSFunction> array_function =
- Handle<JSFunction>(isolate()->native_context()->array_function());
- if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) {
- // Alter the slot.
- CallICNexus* nexus = casted_nexus<CallICNexus>();
- nexus->ConfigureMonomorphicArray();
-
- // Vector-based ICs have a different calling convention in optimized code
- // than full code so the correct stub has to be chosen.
- if (AddressIsOptimizedCode()) {
- CallIC_ArrayStub stub(isolate(), callic_state);
- set_target(*stub.GetCode());
- } else {
- CallIC_ArrayTrampolineStub stub(isolate(), callic_state);
- set_target(*stub.GetCode());
- }
-
- Handle<String> name;
- if (array_function->shared()->name()->IsString()) {
- name = Handle<String>(String::cast(array_function->shared()->name()),
- isolate());
- }
- TRACE_IC("CallIC", name);
- OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
- MONOMORPHIC);
- return true;
- }
- return false;
-}
-
-
-void CallIC::PatchMegamorphic(Handle<Object> function) {
- CallICState callic_state(target()->extra_ic_state());
-
- // We are going generic.
- CallICNexus* nexus = casted_nexus<CallICNexus>();
- nexus->ConfigureMegamorphic();
-
- // Vector-based ICs have a different calling convention in optimized code
- // than full code so the correct stub has to be chosen.
- if (AddressIsOptimizedCode()) {
- CallICStub stub(isolate(), callic_state);
- set_target(*stub.GetCode());
- } else {
- CallICTrampolineStub stub(isolate(), callic_state);
- set_target(*stub.GetCode());
- }
-
- Handle<Object> name = isolate()->factory()->empty_string();
- if (function->IsJSFunction()) {
- Handle<JSFunction> js_function = Handle<JSFunction>::cast(function);
- name = handle(js_function->shared()->name(), isolate());
- }
-
- TRACE_IC("CallIC", name);
- OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
- GENERIC);
-}
-
-
void CallIC::HandleMiss(Handle<Object> function) {
- CallICState callic_state(target()->extra_ic_state());
Handle<Object> name = isolate()->factory()->empty_string();
CallICNexus* nexus = casted_nexus<CallICNexus>();
Object* feedback = nexus->GetFeedback();
@@ -2371,25 +2305,22 @@ void CallIC::HandleMiss(Handle<Object> function) {
// Hand-coded MISS handling is easier if CallIC slots don't contain smis.
DCHECK(!feedback->IsSmi());
- if (feedback->IsWeakCell() || !function->IsJSFunction()) {
+ if (feedback->IsWeakCell() || !function->IsJSFunction() ||
+ feedback->IsAllocationSite()) {
// We are going generic.
nexus->ConfigureMegamorphic();
} else {
- // The feedback is either uninitialized or an allocation site.
- // It might be an allocation site because if we re-compile the full code
- // to add deoptimization support, we call with the default call-ic, and
- // merely need to patch the target to match the feedback.
- // TODO(mvstanton): the better approach is to dispense with patching
- // altogether, which is in progress.
- DCHECK(feedback == *TypeFeedbackVector::UninitializedSentinel(isolate()) ||
- feedback->IsAllocationSite());
-
- // Do we want to install a custom handler?
- if (FLAG_use_ic && DoCustomHandler(function, callic_state)) {
- return;
- }
+ DCHECK(feedback == *TypeFeedbackVector::UninitializedSentinel(isolate()));
+ Handle<JSFunction> js_function = Handle<JSFunction>::cast(function);
- nexus->ConfigureMonomorphic(Handle<JSFunction>::cast(function));
+ Handle<JSFunction> array_function =
+ Handle<JSFunction>(isolate()->native_context()->array_function());
+ if (array_function.is_identical_to(js_function)) {
+ // Alter the slot.
+ nexus->ConfigureMonomorphicArray();
+ } else {
+ nexus->ConfigureMonomorphic(js_function);
+ }
}
if (function->IsJSFunction()) {
@@ -2426,22 +2357,6 @@ RUNTIME_FUNCTION(Runtime_CallIC_Miss) {
}
-RUNTIME_FUNCTION(Runtime_CallIC_Customization_Miss) {
- TimerEventScope<TimerEventIcMiss> timer(isolate);
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
- Handle<Object> function = args.at<Object>(0);
- Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(1);
- Handle<Smi> slot = args.at<Smi>(2);
- FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value());
- CallICNexus nexus(vector, vector_slot);
- // A miss on a custom call ic always results in going megamorphic.
- CallIC ic(isolate, &nexus);
- ic.PatchMegamorphic(function);
- return *function;
-}
-
-
// Used from ic-<arch>.cc.
RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698