Commit d0e12549 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Reset IC to premonomorphic rather than uninitialized.

R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/24512003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16936 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6eb86918
......@@ -403,7 +403,7 @@ void IC::Clear(Isolate* isolate, Address address) {
void CallICBase::Clear(Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
if (IsCleared(target)) return;
bool contextual = CallICBase::Contextual::decode(target->extra_ic_state());
Code* code =
target->GetIsolate()->stub_cache()->FindCallInitialize(
......@@ -415,35 +415,35 @@ void CallICBase::Clear(Address address, Code* target) {
void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
if (IsCleared(target)) return;
// Make sure to also clear the map used in inline fast cases. If we
// do not clear these maps, cached code can keep objects alive
// through the embedded maps.
SetTargetAtAddress(address, *initialize_stub(isolate));
SetTargetAtAddress(address, *pre_monomorphic_stub(isolate));
}
void LoadIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
SetTargetAtAddress(address, *initialize_stub(isolate));
if (IsCleared(target)) return;
SetTargetAtAddress(address, *pre_monomorphic_stub(isolate));
}
void StoreIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
if (IsCleared(target)) return;
SetTargetAtAddress(address,
(Code::GetStrictMode(target->extra_ic_state()) == kStrictMode)
? *initialize_stub_strict(isolate)
: *initialize_stub(isolate));
? *pre_monomorphic_stub_strict(isolate)
: *pre_monomorphic_stub(isolate));
}
void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
if (IsCleared(target)) return;
SetTargetAtAddress(address,
(Code::GetStrictMode(target->extra_ic_state()) == kStrictMode)
? *initialize_stub_strict(isolate)
: *initialize_stub(isolate));
? *pre_monomorphic_stub_strict(isolate)
: *pre_monomorphic_stub(isolate));
}
......
......@@ -134,6 +134,11 @@ class IC {
Object* object,
InlineCacheHolderFlag holder);
static bool IsCleared(Code* code) {
InlineCacheState state = code->ic_state();
return state == UNINITIALIZED || state == PREMONOMORPHIC;
}
protected:
Address fp() const { return fp_; }
Address pc() const { return *pc_address_; }
......@@ -423,8 +428,11 @@ class LoadIC: public IC {
static Handle<Code> initialize_stub(Isolate* isolate) {
return isolate->builtins()->LoadIC_Initialize();
}
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
return isolate->builtins()->LoadIC_PreMonomorphic();
}
virtual Handle<Code> pre_monomorphic_stub() {
return isolate()->builtins()->LoadIC_PreMonomorphic();
return pre_monomorphic_stub(isolate());
}
static void Clear(Isolate* isolate, Address address, Code* target);
......@@ -502,8 +510,11 @@ class KeyedLoadIC: public LoadIC {
static Handle<Code> initialize_stub(Isolate* isolate) {
return isolate->builtins()->KeyedLoadIC_Initialize();
}
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
}
virtual Handle<Code> pre_monomorphic_stub() {
return isolate()->builtins()->KeyedLoadIC_PreMonomorphic();
return pre_monomorphic_stub(isolate());
}
Handle<Code> indexed_interceptor_stub() {
return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
......@@ -564,11 +575,17 @@ class StoreIC: public IC {
virtual Handle<Code> generic_stub_strict() const {
return isolate()->builtins()->StoreIC_Generic_Strict();
}
virtual Handle<Code> pre_monomorphic_stub() const {
return isolate()->builtins()->StoreIC_PreMonomorphic();
virtual Handle<Code> pre_monomorphic_stub() {
return pre_monomorphic_stub(isolate());
}
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
return isolate->builtins()->StoreIC_PreMonomorphic();
}
virtual Handle<Code> pre_monomorphic_stub_strict() {
return pre_monomorphic_stub_strict(isolate());
}
virtual Handle<Code> pre_monomorphic_stub_strict() const {
return isolate()->builtins()->StoreIC_PreMonomorphic_Strict();
static Handle<Code> pre_monomorphic_stub_strict(Isolate* isolate) {
return isolate->builtins()->StoreIC_PreMonomorphic_Strict();
}
virtual Handle<Code> global_proxy_stub() {
return isolate()->builtins()->StoreIC_GlobalProxy();
......@@ -675,11 +692,17 @@ class KeyedStoreIC: public StoreIC {
Handle<Object> value);
virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
virtual Handle<Code> pre_monomorphic_stub() const {
return isolate()->builtins()->KeyedStoreIC_PreMonomorphic();
virtual Handle<Code> pre_monomorphic_stub() {
return pre_monomorphic_stub(isolate());
}
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
return isolate->builtins()->KeyedStoreIC_PreMonomorphic();
}
virtual Handle<Code> pre_monomorphic_stub_strict() {
return pre_monomorphic_stub_strict(isolate());
}
virtual Handle<Code> pre_monomorphic_stub_strict() const {
return isolate()->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
static Handle<Code> pre_monomorphic_stub_strict(Isolate* isolate) {
return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
}
virtual Handle<Code> megamorphic_stub() {
return isolate()->builtins()->KeyedStoreIC_Generic();
......
......@@ -2822,7 +2822,7 @@ TEST(IncrementalMarkingClearsMonomorhpicIC) {
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CHECK(ic_after->ic_state() == UNINITIALIZED);
CHECK(IC::IsCleared(ic_after));
}
......@@ -2863,7 +2863,7 @@ TEST(IncrementalMarkingClearsPolymorhpicIC) {
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CHECK(ic_after->ic_state() == UNINITIALIZED);
CHECK(IC::IsCleared(ic_after));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment