Install a generic handler whenever we fail to update the IC.

Ignore select cases in StoreIC since we don't have premonomorphic.

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15145 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2013-06-14 11:21:34 +00:00
parent b0860dd2b0
commit 2987b11701
7 changed files with 59 additions and 27 deletions

View File

@ -1581,8 +1581,8 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
StrictModeFlag strict_mode) {
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictModeFlag strict_mode) {
// ----------- S t a t e -------------
// -- r0 : value
// -- r1 : receiver

View File

@ -1496,12 +1496,12 @@ static void Generate_StoreIC_Megamorphic_Strict(MacroAssembler* masm) {
static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) {
StoreIC::GenerateGlobalProxy(masm, kNonStrictMode);
StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode);
}
static void Generate_StoreIC_GlobalProxy_Strict(MacroAssembler* masm) {
StoreIC::GenerateGlobalProxy(masm, kStrictMode);
StoreIC::GenerateRuntimeSetProperty(masm, kStrictMode);
}
@ -1510,6 +1510,16 @@ static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
}
static void Generate_StoreIC_Generic(MacroAssembler* masm) {
StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode);
}
static void Generate_StoreIC_Generic_Strict(MacroAssembler* masm) {
StoreIC::GenerateRuntimeSetProperty(masm, kStrictMode);
}
static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
KeyedStoreIC::GenerateGeneric(masm, kNonStrictMode);
}

View File

@ -166,6 +166,10 @@ enum BuiltinExtraArguments {
Code::kNoExtraICState) \
V(StoreIC_Megamorphic, STORE_IC, MEGAMORPHIC, \
Code::kNoExtraICState) \
V(StoreIC_Generic, STORE_IC, GENERIC, \
Code::kNoExtraICState) \
V(StoreIC_Generic_Strict, STORE_IC, GENERIC, \
kStrictMode) \
V(StoreIC_GlobalProxy, STORE_IC, GENERIC, \
Code::kNoExtraICState) \
V(StoreIC_Initialize_Strict, STORE_IC, UNINITIALIZED, \

View File

@ -1482,8 +1482,8 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
StrictModeFlag strict_mode) {
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictModeFlag strict_mode) {
// ----------- S t a t e -------------
// -- eax : value
// -- ecx : name

View File

@ -936,15 +936,7 @@ MaybeObject* LoadIC::Load(State state,
}
// Update inline cache and stub cache.
if (FLAG_use_ic) {
if (!object->IsJSObject()) {
// TODO(jkummerow): It would be nice to support non-JSObjects in
// UpdateCaches, then we wouldn't need to go generic here.
set_target(*generic_stub());
} else {
UpdateCaches(&lookup, state, object, name);
}
}
if (FLAG_use_ic) UpdateCaches(&lookup, state, object, name);
PropertyAttributes attr;
if (lookup.IsInterceptor() || lookup.IsHandler()) {
@ -1204,11 +1196,17 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
Handle<Object> object,
Handle<String> name) {
// Bail out if the result is not cacheable.
if (!lookup->IsCacheable()) return;
if (!lookup->IsCacheable()) {
set_target(*generic_stub());
return;
}
// Loading properties from values is not common, so don't try to
// deal with non-JS objects here.
if (!object->IsJSObject()) return;
// TODO(jkummerow): It would be nice to support non-JSObjects in
// UpdateCaches, then we wouldn't need to go generic here.
if (!object->IsJSObject()) {
set_target(*generic_stub());
return;
}
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
Handle<Code> code;
@ -1219,7 +1217,10 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
code = pre_monomorphic_stub();
} else {
code = ComputeLoadHandler(lookup, receiver, name);
if (code.is_null()) return;
if (code.is_null()) {
set_target(*generic_stub());
return;
}
}
PatchCache(state, kNonStrictMode, receiver, name, code);
@ -1640,6 +1641,12 @@ MaybeObject* StoreIC::Store(State state,
IsUndeclaredGlobal(object)) {
// Strict mode doesn't allow setting non-existent global property.
return ReferenceError("not_defined", name);
} else if (FLAG_use_ic &&
(lookup.IsNormal() ||
(lookup.IsField() && lookup.CanHoldValue(value)))) {
Handle<Code> stub = strict_mode == kStrictMode
? generic_stub_strict() : generic_stub();
set_target(*stub);
}
// Set the property.
@ -1660,9 +1667,14 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
// These are not cacheable, so we never see such LookupResults here.
ASSERT(!lookup->IsHandler());
Handle<Code> code =
ComputeStoreMonomorphic(lookup, strict_mode, receiver, name);
if (code.is_null()) return;
Handle<Code> code = ComputeStoreMonomorphic(
lookup, strict_mode, receiver, name);
if (code.is_null()) {
Handle<Code> stub = strict_mode == kStrictMode
? generic_stub_strict() : generic_stub();
set_target(*stub);
return;
}
PatchCache(state, strict_mode, receiver, name, code);
TRACE_IC("StoreIC", name, state, target());

View File

@ -511,8 +511,8 @@ class StoreIC: public IC {
static void GenerateMegamorphic(MacroAssembler* masm,
StrictModeFlag strict_mode);
static void GenerateNormal(MacroAssembler* masm);
static void GenerateGlobalProxy(MacroAssembler* masm,
StrictModeFlag strict_mode);
static void GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictModeFlag strict_mode);
MUST_USE_RESULT MaybeObject* Store(
State state,
@ -532,6 +532,12 @@ class StoreIC: public IC {
virtual Handle<Code> megamorphic_stub_strict() {
return isolate()->builtins()->StoreIC_Megamorphic_Strict();
}
virtual Handle<Code> generic_stub() const {
return isolate()->builtins()->StoreIC_Generic();
}
virtual Handle<Code> generic_stub_strict() const {
return isolate()->builtins()->StoreIC_Generic_Strict();
}
virtual Handle<Code> global_proxy_stub() {
return isolate()->builtins()->StoreIC_GlobalProxy();
}

View File

@ -1502,8 +1502,8 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
StrictModeFlag strict_mode) {
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictModeFlag strict_mode) {
// ----------- S t a t e -------------
// -- rax : value
// -- rcx : name