Index: src/ic/ic-compiler.cc |
diff --git a/src/ic/ic-compiler.cc b/src/ic/ic-compiler.cc |
index d42bfa77934e95dfe5b2a375291498f2cf3474f4..875d98729fc83f8e340b99809e37e917b9939f95 100644 |
--- a/src/ic/ic-compiler.cc |
+++ b/src/ic/ic-compiler.cc |
@@ -119,6 +119,25 @@ Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
} |
+Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( |
+ Handle<Map> receiver_map, LanguageMode language_mode, |
+ KeyedAccessStoreMode store_mode) { |
+ Isolate* isolate = receiver_map->GetIsolate(); |
+ ExtraICState extra_state = |
+ KeyedStoreIC::ComputeExtraICState(language_mode, store_mode); |
+ |
+ DCHECK(store_mode == STANDARD_STORE || |
+ store_mode == STORE_AND_GROW_NO_TRANSITION || |
+ store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
+ store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
+ |
+ PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state); |
+ Handle<Code> code = |
+ compiler.CompileKeyedStoreMonomorphicHandler(receiver_map, store_mode); |
+ return code; |
+} |
+ |
+ |
Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( |
Handle<Map> receiver_map, LanguageMode language_mode, |
KeyedAccessStoreMode store_mode) { |
@@ -220,31 +239,6 @@ Handle<Code> PropertyICCompiler::ComputeCompareNil(Handle<Map> receiver_map, |
} |
-Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic( |
- MapHandleList* receiver_maps, LanguageMode language_mode) { |
- Isolate* isolate = receiver_maps->at(0)->GetIsolate(); |
- DCHECK(KeyedLoadIC::GetKeyType(kNoExtraICState) == ELEMENT); |
- Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC); |
- Handle<PolymorphicCodeCache> cache = |
- isolate->factory()->polymorphic_code_cache(); |
- Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
- if (probe->IsCode()) return Handle<Code>::cast(probe); |
- |
- CodeHandleList handlers(receiver_maps->length()); |
- ElementHandlerCompiler compiler(isolate); |
- compiler.CompileElementHandlers(receiver_maps, &handlers, language_mode); |
- PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC); |
- Handle<Code> code = ic_compiler.CompilePolymorphic( |
- receiver_maps, &handlers, isolate->factory()->empty_string(), |
- Code::NORMAL, ELEMENT); |
- |
- isolate->counters()->keyed_load_polymorphic_stubs()->Increment(); |
- |
- PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); |
- return code; |
-} |
- |
- |
Handle<Code> PropertyICCompiler::ComputePolymorphic( |
Code::Kind kind, MapHandleList* maps, CodeHandleList* handlers, |
int valid_maps, Handle<Name> name, ExtraICState extra_ic_state) { |
@@ -256,6 +250,23 @@ Handle<Code> PropertyICCompiler::ComputePolymorphic( |
} |
+void PropertyICCompiler::ComputeKeyedStorePolymorphicHandlers( |
+ MapHandleList* receiver_maps, MapHandleList* transitioned_maps, |
+ CodeHandleList* handlers, KeyedAccessStoreMode store_mode, |
+ LanguageMode language_mode) { |
+ Isolate* isolate = receiver_maps->at(0)->GetIsolate(); |
+ DCHECK(store_mode == STANDARD_STORE || |
+ store_mode == STORE_AND_GROW_NO_TRANSITION || |
+ store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
+ store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
+ ExtraICState extra_state = |
+ KeyedStoreIC::ComputeExtraICState(language_mode, store_mode); |
+ PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state); |
+ compiler.CompileKeyedStorePolymorphicHandlers( |
+ receiver_maps, transitioned_maps, handlers, store_mode); |
+} |
+ |
+ |
Handle<Code> PropertyICCompiler::ComputeKeyedStorePolymorphic( |
MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode, |
LanguageMode language_mode) { |
@@ -338,11 +349,9 @@ Handle<Code> PropertyICCompiler::GetCode(Code::Kind kind, Code::StubType type, |
} |
-Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |
- MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode) { |
- // Collect MONOMORPHIC stubs for all |receiver_maps|. |
- CodeHandleList handlers(receiver_maps->length()); |
- MapHandleList transitioned_maps(receiver_maps->length()); |
+void PropertyICCompiler::CompileKeyedStorePolymorphicHandlers( |
+ MapHandleList* receiver_maps, MapHandleList* transitioned_maps, |
+ CodeHandleList* handlers, KeyedAccessStoreMode store_mode) { |
for (int i = 0; i < receiver_maps->length(); ++i) { |
Handle<Map> receiver_map(receiver_maps->at(i)); |
Handle<Code> cached_stub; |
@@ -379,9 +388,19 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |
} |
} |
DCHECK(!cached_stub.is_null()); |
- handlers.Add(cached_stub); |
- transitioned_maps.Add(transitioned_map); |
+ handlers->Add(cached_stub); |
+ transitioned_maps->Add(transitioned_map); |
} |
+} |
+ |
+ |
+Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |
+ MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode) { |
+ // Collect MONOMORPHIC stubs for all |receiver_maps|. |
+ CodeHandleList handlers(receiver_maps->length()); |
+ MapHandleList transitioned_maps(receiver_maps->length()); |
+ CompileKeyedStorePolymorphicHandlers(receiver_maps, &transitioned_maps, |
+ &handlers, store_mode); |
Handle<Code> code = CompileKeyedStorePolymorphic(receiver_maps, &handlers, |
&transitioned_maps); |
@@ -394,7 +413,7 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |
#define __ ACCESS_MASM(masm()) |
-Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic( |
+Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphicHandler( |
Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
ElementsKind elements_kind = receiver_map->elements_kind(); |
bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; |
@@ -408,6 +427,14 @@ Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic( |
} else { |
stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); |
} |
+ return stub; |
+} |
+ |
+ |
+Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic( |
+ Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
+ Handle<Code> stub = |
+ CompileKeyedStoreMonomorphicHandler(receiver_map, store_mode); |
Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |