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

Unified Diff: src/ic.cc

Issue 295383004: Refactor CallICStub to use a different stub for each customization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 7 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.h ('k') | src/mips/code-stubs-mips.cc » ('j') | 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 0f1c3b416e97dd7264c0b24d85b396420086f403..b40885bf17e3d036e9cafb004c1d9c8032e4777d 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -501,14 +501,6 @@ void CallIC::Clear(Isolate* isolate,
Code* target,
ConstantPoolArray* constant_pool) {
// Currently, CallIC doesn't have state changes.
- if (target->ic_state() != v8::internal::MONOMORPHIC) return;
- CallIC::State existing_state(target->extra_ic_state());
-
- // Monomorphic array stubs don't need to be cleared because
- // 1) the stub doesn't store information that should be cleared, and
- // 2) the AllocationSite stored in the type feedback vector is immune
- // from gc type feedback clearing.
- ASSERT(existing_state.stub_type() == MONOMORPHIC_ARRAY);
}
@@ -1351,7 +1343,7 @@ void CallIC::State::Print(StringStream* stream) const {
Handle<Code> CallIC::initialize_stub(Isolate* isolate,
int argc,
CallType call_type) {
- CallICStub stub(isolate, State::DefaultCallState(argc, call_type));
+ CallICStub stub(isolate, State(argc, call_type));
Handle<Code> code = stub.GetCode();
return code;
}
@@ -1825,16 +1817,14 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
CallIC::State::State(ExtraICState extra_ic_state)
: argc_(ArgcBits::decode(extra_ic_state)),
- call_type_(CallTypeBits::decode(extra_ic_state)),
- stub_type_(StubTypeBits::decode(extra_ic_state)) {
+ call_type_(CallTypeBits::decode(extra_ic_state)) {
}
ExtraICState CallIC::State::GetExtraICState() const {
ExtraICState extra_ic_state =
ArgcBits::encode(argc_) |
- CallTypeBits::encode(call_type_) |
- StubTypeBits::encode(stub_type_);
+ CallTypeBits::encode(call_type_);
return extra_ic_state;
}
@@ -1853,8 +1843,7 @@ bool CallIC::DoCustomHandler(Handle<Object> receiver,
// Alter the slot.
Handle<AllocationSite> new_site = isolate()->factory()->NewAllocationSite();
vector->set(slot->value(), *new_site);
- State new_state = state.ToMonomorphicArrayCallState();
- CallICStub stub(isolate(), new_state);
+ CallIC_ArrayStub stub(isolate(), state);
set_target(*stub.GetCode());
Handle<String> name;
if (array_function->shared()->name()->IsString()) {
@@ -1869,6 +1858,23 @@ bool CallIC::DoCustomHandler(Handle<Object> receiver,
}
+void CallIC::PatchMegamorphic(Handle<FixedArray> vector,
+ Handle<Smi> slot) {
+ State state(target()->extra_ic_state());
+
+ // We are going generic.
+ vector->set(slot->value(),
+ *TypeFeedbackInfo::MegamorphicSentinel(isolate()),
+ SKIP_WRITE_BARRIER);
+
+ CallICStub stub(isolate(), state);
+ Handle<Code> code = stub.GetCode();
+ set_target(*code);
+
+ TRACE_GENERIC_IC(isolate(), "CallIC", "megamorphic");
+}
+
+
void CallIC::HandleMiss(Handle<Object> receiver,
Handle<Object> function,
Handle<FixedArray> vector,
@@ -1876,23 +1882,12 @@ void CallIC::HandleMiss(Handle<Object> receiver,
State state(target()->extra_ic_state());
Object* feedback = vector->get(slot->value());
- if (feedback->IsJSFunction() || !function->IsJSFunction() ||
- state.stub_type() != DEFAULT) {
+ if (feedback->IsJSFunction() || !function->IsJSFunction()) {
// We are going generic.
vector->set(slot->value(),
*TypeFeedbackInfo::MegamorphicSentinel(isolate()),
SKIP_WRITE_BARRIER);
- State new_state = state.ToGenericState();
- if (new_state != state) {
- // Only happens when the array ic goes generic.
- ASSERT(state.stub_type() == MONOMORPHIC_ARRAY &&
- FLAG_use_ic);
- CallICStub stub(isolate(), new_state);
- Handle<Code> code = stub.GetCode();
- set_target(*code);
- }
-
TRACE_GENERIC_IC(isolate(), "CallIC", "megamorphic");
} else {
// If we came here feedback must be the uninitialized sentinel,
@@ -1934,6 +1929,19 @@ RUNTIME_FUNCTION(CallIC_Miss) {
}
+RUNTIME_FUNCTION(CallIC_Customization_Miss) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 4);
+ // A miss on a custom call ic always results in going megamorphic.
+ CallIC ic(isolate);
+ Handle<Object> function = args.at<Object>(1);
+ Handle<FixedArray> vector = args.at<FixedArray>(2);
+ Handle<Smi> slot = args.at<Smi>(3);
+ ic.PatchMegamorphic(vector, slot);
+ return *function;
+}
+
+
// Used from ic-<arch>.cc.
RUNTIME_FUNCTION(LoadIC_Miss) {
HandleScope scope(isolate);
« no previous file with comments | « src/ic.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698