Index: src/stub-cache.cc |
diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
index 09ee7939473302ec0bed956e2c080e26d3201e8f..67451f2b88febf0739ad4b2c7d6682f2d96fd349 100644 |
--- a/src/stub-cache.cc |
+++ b/src/stub-cache.cc |
@@ -497,38 +497,56 @@ MaybeObject* StubCache::ComputeStoreField(String* name, |
MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement( |
JSObject* receiver, |
- bool is_store, |
+ KeyedIC::StubKind stub_kind, |
StrictModeFlag strict_mode) { |
Code::Flags flags = |
Code::ComputeMonomorphicFlags( |
- is_store ? Code::KEYED_STORE_IC : |
- Code::KEYED_LOAD_IC, |
+ stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC |
+ : Code::KEYED_STORE_IC, |
NORMAL, |
strict_mode); |
- String* name = is_store |
- ? isolate()->heap()->KeyedStoreElementMonomorphic_symbol() |
- : isolate()->heap()->KeyedLoadElementMonomorphic_symbol(); |
+ String* name = NULL; |
+ switch (stub_kind) { |
+ case KeyedIC::LOAD: |
+ name = isolate()->heap()->KeyedLoadElementMonomorphic_symbol(); |
+ break; |
+ case KeyedIC::STORE_NO_TRANSITION: |
+ name = isolate()->heap()->KeyedStoreElementMonomorphic_symbol(); |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ break; |
+ } |
Object* maybe_code = receiver->map()->FindInCodeCache(name, flags); |
if (!maybe_code->IsUndefined()) return Code::cast(maybe_code); |
- MaybeObject* maybe_new_code = NULL; |
Map* receiver_map = receiver->map(); |
- if (is_store) { |
- KeyedStoreStubCompiler compiler(strict_mode); |
- maybe_new_code = compiler.CompileStoreElement(receiver_map); |
- } else { |
- KeyedLoadStubCompiler compiler; |
- maybe_new_code = compiler.CompileLoadElement(receiver_map); |
+ MaybeObject* maybe_new_code = NULL; |
+ switch (stub_kind) { |
+ case KeyedIC::LOAD: { |
+ KeyedLoadStubCompiler compiler; |
+ maybe_new_code = compiler.CompileLoadElement(receiver_map); |
+ break; |
+ } |
+ case KeyedIC::STORE_NO_TRANSITION: { |
+ KeyedStoreStubCompiler compiler(strict_mode); |
+ maybe_new_code = compiler.CompileStoreElement(receiver_map); |
+ break; |
+ } |
+ default: |
+ UNREACHABLE(); |
+ break; |
} |
- Code* code; |
+ Code* code = NULL; |
if (!maybe_new_code->To(&code)) return maybe_new_code; |
- if (is_store) { |
+ |
+ if (stub_kind == KeyedIC::LOAD) { |
PROFILE(isolate_, |
- CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
+ CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, |
Code::cast(code), 0)); |
} else { |
PROFILE(isolate_, |
- CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, |
+ CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
Code::cast(code), 0)); |
} |
ASSERT(code->IsCode()); |