Chromium Code Reviews| Index: src/stub-cache.cc |
| diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
| index 21ff8eb80d1d50bc6903068acb593b96d019260e..641a16556158bda8df37018ed0249e7d6b48eb9e 100644 |
| --- a/src/stub-cache.cc |
| +++ b/src/stub-cache.cc |
| @@ -429,28 +429,26 @@ Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { |
| Handle<Code> StubCache::ComputeKeyedStoreElement( |
| Handle<Map> receiver_map, |
| - KeyedStoreIC::StubKind stub_kind, |
| StrictModeFlag strict_mode, |
| - KeyedAccessGrowMode grow_mode) { |
| + KeyedAccessStoreMode store_mode) { |
| Code::ExtraICState extra_state = |
| - Code::ComputeExtraICState(grow_mode, strict_mode); |
| + Code::ComputeExtraICState(store_mode, strict_mode); |
| Code::Flags flags = Code::ComputeMonomorphicFlags( |
| Code::KEYED_STORE_IC, extra_state); |
| - ASSERT(stub_kind == KeyedStoreIC::STORE_NO_TRANSITION || |
| - stub_kind == KeyedStoreIC::STORE_AND_GROW_NO_TRANSITION); |
| - |
| - Handle<Name> name = stub_kind == KeyedStoreIC::STORE_NO_TRANSITION |
| - ? isolate()->factory()->KeyedStoreElementMonomorphic_string() |
| - : isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_string(); |
| + ASSERT(store_mode == STORE_NO_TRANSITION || |
| + IsGrowStoreMode(store_mode)); |
|
Toon Verwaest
2013/03/06 14:47:28
It seems like we should not relax this condition.
danno
2013/03/06 16:56:06
Done.
|
| + Handle<String> name = |
| + isolate()->factory()->KeyedStoreElementMonomorphic_string(); |
| Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); |
| if (probe->IsCode()) return Handle<Code>::cast(probe); |
| - KeyedStoreStubCompiler compiler(isolate(), strict_mode, grow_mode); |
| + KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); |
| Handle<Code> code = compiler.CompileStoreElement(receiver_map); |
| Map::UpdateCodeCache(receiver_map, name, code); |
| + ASSERT(Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == store_mode); |
| return code; |
| } |
| @@ -547,8 +545,7 @@ Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, |
| isolate_); |
| if (probe->IsCode()) return Handle<Code>::cast(probe); |
| - KeyedStoreStubCompiler compiler(isolate(), strict_mode, |
| - DO_NOT_ALLOW_JSARRAY_GROWTH); |
| + KeyedStoreStubCompiler compiler(isolate(), strict_mode, STORE_NO_TRANSITION); |
| Handle<Code> code = |
| compiler.CompileStoreField(receiver, field_index, transition, name); |
| JSObject::UpdateMapCodeCache(receiver, name, code); |
| @@ -903,18 +900,18 @@ Handle<Code> StubCache::ComputePolymorphicIC(MapHandleList* receiver_maps, |
| Handle<Code> StubCache::ComputeStoreElementPolymorphic( |
| MapHandleList* receiver_maps, |
| - KeyedAccessGrowMode grow_mode, |
| + KeyedAccessStoreMode store_mode, |
| StrictModeFlag strict_mode) { |
|
Toon Verwaest
2013/03/06 14:47:28
I presume store_mode is
ASSERT(stub_kind == Keyed
danno
2013/03/06 16:56:06
Done.
|
| Handle<PolymorphicCodeCache> cache = |
| isolate_->factory()->polymorphic_code_cache(); |
| - Code::ExtraICState extra_state = Code::ComputeExtraICState(grow_mode, |
| + Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, |
| strict_mode); |
| Code::Flags flags = |
| Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); |
| Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
| if (probe->IsCode()) return Handle<Code>::cast(probe); |
| - KeyedStoreStubCompiler compiler(isolate_, strict_mode, grow_mode); |
| + KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); |
| Handle<Code> code = compiler.CompileStoreElementPolymorphic(receiver_maps); |
| PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); |
| return code; |
| @@ -1639,7 +1636,7 @@ Handle<Code> KeyedStoreStubCompiler::GetCode(Code::StubType type, |
| Handle<Name> name, |
| InlineCacheState state) { |
| Code::ExtraICState extra_state = |
| - Code::ComputeExtraICState(grow_mode_, strict_mode_); |
| + Code::ComputeExtraICState(store_mode_, strict_mode_); |
| Code::Flags flags = |
| Code::ComputeFlags(Code::KEYED_STORE_IC, state, extra_state, type); |
| Handle<Code> code = GetCodeWithFlags(flags, name); |
| @@ -1673,12 +1670,12 @@ Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic( |
| transitioned_map->elements_kind(), |
| is_js_array, |
| strict_mode_, |
| - grow_mode_).GetCode(isolate()); |
| + store_mode_).GetCode(isolate()); |
| } else { |
| cached_stub = KeyedStoreElementStub( |
| is_js_array, |
| elements_kind, |
| - grow_mode_).GetCode(isolate()); |
| + store_mode_).GetCode(isolate()); |
| } |
| ASSERT(!cached_stub.is_null()); |
| handlers.Add(cached_stub); |