Index: src/stub-cache.cc |
diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
index 553c6f509710a5736c343a063bd09dc5cf838de9..396e92ce39a6601295a6632de73088a0e05fec2f 100644 |
--- a/src/stub-cache.cc |
+++ b/src/stub-cache.cc |
@@ -402,18 +402,30 @@ Handle<Code> StubCache::ComputeKeyedLoadCallback( |
Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, |
Handle<JSObject> receiver, |
LookupResult* lookup, |
- Handle<Map> transition, |
StrictModeFlag strict_mode) { |
- Code::StubType type = |
- transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION; |
+ Handle<Code> stub = FindIC( |
+ name, receiver, Code::STORE_IC, Code::FIELD, strict_mode); |
+ if (!stub.is_null()) return stub; |
+ |
+ StoreStubCompiler compiler(isolate_, strict_mode); |
+ Handle<Code> code = compiler.CompileStoreField(receiver, lookup, name); |
+ JSObject::UpdateMapCodeCache(receiver, name, code); |
+ return code; |
+} |
+ |
+Handle<Code> StubCache::ComputeStoreTransition(Handle<Name> name, |
+ Handle<JSObject> receiver, |
+ LookupResult* lookup, |
+ Handle<Map> transition, |
+ StrictModeFlag strict_mode) { |
Handle<Code> stub = FindIC( |
- name, receiver, Code::STORE_IC, type, strict_mode); |
+ name, receiver, Code::STORE_IC, Code::MAP_TRANSITION, strict_mode); |
if (!stub.is_null()) return stub; |
StoreStubCompiler compiler(isolate_, strict_mode); |
Handle<Code> code = |
- compiler.CompileStoreField(receiver, lookup, transition, name); |
+ compiler.CompileStoreTransition(receiver, lookup, transition, name); |
JSObject::UpdateMapCodeCache(receiver, name, code); |
return code; |
} |
@@ -534,20 +546,35 @@ Handle<Code> StubCache::ComputeStoreInterceptor(Handle<Name> name, |
return code; |
} |
+ |
Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, |
Handle<JSObject> receiver, |
LookupResult* lookup, |
- Handle<Map> transition, |
StrictModeFlag strict_mode) { |
- Code::StubType type = |
- (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; |
Handle<Code> stub = FindIC( |
- name, receiver, Code::KEYED_STORE_IC, type, strict_mode); |
+ name, receiver, Code::KEYED_STORE_IC, Code::FIELD, strict_mode); |
+ if (!stub.is_null()) return stub; |
+ |
+ KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); |
+ Handle<Code> code = compiler.CompileStoreField(receiver, lookup, name); |
+ JSObject::UpdateMapCodeCache(receiver, name, code); |
+ return code; |
+} |
+ |
+ |
+Handle<Code> StubCache::ComputeKeyedStoreTransition( |
+ Handle<Name> name, |
+ Handle<JSObject> receiver, |
+ LookupResult* lookup, |
+ Handle<Map> transition, |
+ StrictModeFlag strict_mode) { |
+ Handle<Code> stub = FindIC( |
+ name, receiver, Code::KEYED_STORE_IC, Code::MAP_TRANSITION, strict_mode); |
if (!stub.is_null()) return stub; |
KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); |
Handle<Code> code = |
- compiler.CompileStoreField(receiver, lookup, transition, name); |
+ compiler.CompileStoreTransition(receiver, lookup, transition, name); |
JSObject::UpdateMapCodeCache(receiver, name, code); |
return code; |
} |
@@ -1587,11 +1614,39 @@ Handle<Code> LoadStubCompiler::CompileLoadViaGetter( |
} |
+Handle<Code> BaseStoreStubCompiler::CompileStoreTransition( |
+ Handle<JSObject> object, |
+ LookupResult* lookup, |
+ Handle<Map> transition, |
+ Handle<Name> name) { |
+ Label miss, miss_restore_name; |
+ |
+ GenerateNameCheck(name, this->name(), &miss); |
+ |
+ GenerateStoreTransition(masm(), |
+ object, |
+ lookup, |
+ transition, |
+ name, |
+ receiver(), this->name(), value(), |
+ scratch1(), scratch2(), |
+ &miss, |
+ &miss_restore_name); |
+ |
+ // Handle store cache miss. |
+ GenerateRestoreName(masm(), &miss_restore_name, name); |
+ __ bind(&miss); |
+ TailCallBuiltin(masm(), MissBuiltin(kind())); |
+ |
+ // Return the generated code. |
+ return GetICCode(kind(), Code::MAP_TRANSITION, name); |
+} |
+ |
+ |
Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object, |
LookupResult* lookup, |
- Handle<Map> transition, |
Handle<Name> name) { |
- Label miss, miss_restore_name; |
+ Label miss; |
GenerateNameCheck(name, this->name(), &miss); |
@@ -1599,21 +1654,15 @@ Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object, |
GenerateStoreField(masm(), |
object, |
lookup, |
- transition, |
- name, |
receiver(), this->name(), value(), scratch1(), scratch2(), |
- &miss, |
- &miss_restore_name); |
+ &miss); |
// Handle store cache miss. |
- GenerateRestoreName(masm(), &miss_restore_name, name); |
__ bind(&miss); |
TailCallBuiltin(masm(), MissBuiltin(kind())); |
// Return the generated code. |
- return GetICCode(kind(), |
- transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION, |
- name); |
+ return GetICCode(kind(), Code::FIELD, name); |
} |