Index: src/stub-cache.cc |
diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
index 06edc0d6871d652ba6e5248a53370a0c6883a54a..26915bcf1c2f943a770b3f74a872541a1b74ac0e 100644 |
--- a/src/stub-cache.cc |
+++ b/src/stub-cache.cc |
@@ -102,7 +102,7 @@ Code* StubCache::Set(Name* name, Map* map, Code* code) { |
Handle<Code> StubCache::FindIC(Handle<Name> name, |
Handle<Map> stub_holder, |
Code::Kind kind, |
- Code::ExtraICState extra_state, |
+ ExtraICState extra_state, |
InlineCacheHolderFlag cache_holder) { |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
kind, extra_state, cache_holder); |
@@ -117,10 +117,12 @@ Handle<Code> StubCache::FindHandler(Handle<Name> name, |
Code::Kind kind, |
InlineCacheHolderFlag cache_holder, |
StrictModeFlag strict_mode) { |
- Code::ExtraICState extra_ic_state = Code::kNoExtraICState; |
- if (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC) { |
- extra_ic_state = Code::ComputeExtraICState( |
- STANDARD_STORE, strict_mode); |
+ ExtraICState extra_ic_state = kNoExtraICState; |
+ if (kind == Code::STORE_IC) { |
+ extra_ic_state = StoreIC::ComputeExtraICState(strict_mode); |
+ } else if (kind == Code::KEYED_STORE_IC) { |
+ extra_ic_state = KeyedStoreIC::ComputeExtraICState(strict_mode, |
+ STANDARD_STORE); |
} |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
Code::HANDLER, extra_ic_state, cache_holder, Code::NORMAL, kind); |
@@ -131,10 +133,11 @@ Handle<Code> StubCache::FindHandler(Handle<Name> name, |
} |
-Handle<Code> StubCache::ComputeMonomorphicIC(Handle<Name> name, |
- Handle<Type> type, |
- Handle<Code> handler, |
- StrictModeFlag strict_mode) { |
+Handle<Code> StubCache::ComputeMonomorphicIC( |
+ Handle<Name> name, |
+ Handle<Type> type, |
+ Handle<Code> handler, |
+ ExtraICState extra_ic_state) { |
Code::Kind kind = handler->handler_kind(); |
InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type); |
@@ -146,7 +149,7 @@ Handle<Code> StubCache::ComputeMonomorphicIC(Handle<Name> name, |
bool can_be_cached = !type->Is(Type::String()); |
if (can_be_cached) { |
stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate()); |
- ic = FindIC(name, stub_holder, kind, strict_mode, flag); |
+ ic = FindIC(name, stub_holder, kind, extra_ic_state, flag); |
if (!ic.is_null()) return ic; |
} |
@@ -157,10 +160,12 @@ Handle<Code> StubCache::ComputeMonomorphicIC(Handle<Name> name, |
KeyedLoadStubCompiler ic_compiler(isolate(), flag); |
ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
} else if (kind == Code::STORE_IC) { |
+ StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); |
StoreStubCompiler ic_compiler(isolate(), strict_mode); |
ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
} else { |
ASSERT(kind == Code::KEYED_STORE_IC); |
+ StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); |
KeyedStoreStubCompiler ic_compiler(isolate(), strict_mode, STANDARD_STORE); |
ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
} |
@@ -224,8 +229,8 @@ Handle<Code> StubCache::ComputeKeyedStoreElement( |
Handle<Map> receiver_map, |
StrictModeFlag strict_mode, |
KeyedAccessStoreMode store_mode) { |
- Code::ExtraICState extra_state = |
- Code::ComputeExtraICState(store_mode, strict_mode); |
+ ExtraICState extra_state = |
+ KeyedStoreIC::ComputeExtraICState(strict_mode, store_mode); |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
Code::KEYED_STORE_IC, extra_state); |
@@ -243,7 +248,8 @@ Handle<Code> StubCache::ComputeKeyedStoreElement( |
Handle<Code> code = compiler.CompileStoreElement(receiver_map); |
Map::UpdateCodeCache(receiver_map, name, code); |
- ASSERT(Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == store_mode); |
+ ASSERT(KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()) |
+ == store_mode); |
return code; |
} |
@@ -253,7 +259,7 @@ Handle<Code> StubCache::ComputeKeyedStoreElement( |
Handle<Code> StubCache::ComputeCallConstant(int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state, |
+ ExtraICState extra_state, |
Handle<Name> name, |
Handle<Object> object, |
Handle<JSObject> holder, |
@@ -307,7 +313,7 @@ Handle<Code> StubCache::ComputeCallConstant(int argc, |
Handle<Code> StubCache::ComputeCallField(int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state, |
+ ExtraICState extra_state, |
Handle<Name> name, |
Handle<Object> object, |
Handle<JSObject> holder, |
@@ -346,7 +352,7 @@ Handle<Code> StubCache::ComputeCallField(int argc, |
Handle<Code> StubCache::ComputeCallInterceptor(int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state, |
+ ExtraICState extra_state, |
Handle<Name> name, |
Handle<Object> object, |
Handle<JSObject> holder) { |
@@ -384,7 +390,7 @@ Handle<Code> StubCache::ComputeCallInterceptor(int argc, |
Handle<Code> StubCache::ComputeCallGlobal(int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state, |
+ ExtraICState extra_state, |
Handle<Name> name, |
Handle<JSObject> receiver, |
Handle<GlobalObject> holder, |
@@ -422,9 +428,10 @@ static void FillCache(Isolate* isolate, Handle<Code> code) { |
Code* StubCache::FindCallInitialize(int argc, |
RelocInfo::Mode mode, |
Code::Kind kind) { |
- Code::ExtraICState extra_state = |
+ ExtraICState extra_state = |
CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | |
- CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT); |
+ CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT |
+ ? CONTEXTUAL : NOT_CONTEXTUAL); |
Code::Flags flags = |
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); |
UnseededNumberDictionary* dictionary = |
@@ -441,9 +448,10 @@ Code* StubCache::FindCallInitialize(int argc, |
Handle<Code> StubCache::ComputeCallInitialize(int argc, |
RelocInfo::Mode mode, |
Code::Kind kind) { |
- Code::ExtraICState extra_state = |
+ ExtraICState extra_state = |
CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | |
- CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT); |
+ CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT |
+ ? CONTEXTUAL : NOT_CONTEXTUAL); |
Code::Flags flags = |
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); |
Handle<UnseededNumberDictionary> cache = |
@@ -472,7 +480,7 @@ Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) { |
Handle<Code> StubCache::ComputeCallPreMonomorphic( |
int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state) { |
+ ExtraICState extra_state) { |
Code::Flags flags = |
Code::ComputeFlags(kind, PREMONOMORPHIC, extra_state, Code::NORMAL, argc); |
Handle<UnseededNumberDictionary> cache = |
@@ -489,7 +497,7 @@ Handle<Code> StubCache::ComputeCallPreMonomorphic( |
Handle<Code> StubCache::ComputeCallNormal(int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state) { |
+ ExtraICState extra_state) { |
Code::Flags flags = |
Code::ComputeFlags(kind, MONOMORPHIC, extra_state, Code::NORMAL, argc); |
Handle<UnseededNumberDictionary> cache = |
@@ -507,7 +515,7 @@ Handle<Code> StubCache::ComputeCallNormal(int argc, |
Handle<Code> StubCache::ComputeCallArguments(int argc) { |
Code::Flags flags = |
Code::ComputeFlags(Code::KEYED_CALL_IC, MEGAMORPHIC, |
- Code::kNoExtraICState, Code::NORMAL, argc); |
+ kNoExtraICState, Code::NORMAL, argc); |
Handle<UnseededNumberDictionary> cache = |
isolate_->factory()->non_monomorphic_cache(); |
int entry = cache->FindEntry(isolate_, flags); |
@@ -523,7 +531,7 @@ Handle<Code> StubCache::ComputeCallArguments(int argc) { |
Handle<Code> StubCache::ComputeCallMegamorphic( |
int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state) { |
+ ExtraICState extra_state) { |
Code::Flags flags = |
Code::ComputeFlags(kind, MEGAMORPHIC, extra_state, |
Code::NORMAL, argc); |
@@ -541,7 +549,7 @@ Handle<Code> StubCache::ComputeCallMegamorphic( |
Handle<Code> StubCache::ComputeCallMiss(int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state) { |
+ ExtraICState extra_state) { |
// MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs |
// and monomorphic stubs are not mixed up together in the stub cache. |
Code::Flags flags = |
@@ -605,11 +613,13 @@ Handle<Code> StubCache::ComputeLoadElementPolymorphic( |
} |
-Handle<Code> StubCache::ComputePolymorphicIC(TypeHandleList* types, |
- CodeHandleList* handlers, |
- int number_of_valid_types, |
- Handle<Name> name, |
- StrictModeFlag strict_mode) { |
+Handle<Code> StubCache::ComputePolymorphicIC( |
+ TypeHandleList* types, |
+ CodeHandleList* handlers, |
+ int number_of_valid_types, |
+ Handle<Name> name, |
+ ExtraICState extra_ic_state) { |
+ |
Handle<Code> handler = handlers->at(0); |
Code::Kind kind = handler->handler_kind(); |
Code::StubType type = number_of_valid_types == 1 ? handler->type() |
@@ -620,6 +630,7 @@ Handle<Code> StubCache::ComputePolymorphicIC(TypeHandleList* types, |
types, handlers, name, type, PROPERTY); |
} else { |
ASSERT(kind == Code::STORE_IC); |
+ StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); |
StoreStubCompiler ic_compiler(isolate_, strict_mode); |
return ic_compiler.CompilePolymorphicIC( |
types, handlers, name, type, PROPERTY); |
@@ -637,8 +648,8 @@ Handle<Code> StubCache::ComputeStoreElementPolymorphic( |
store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
Handle<PolymorphicCodeCache> cache = |
isolate_->factory()->polymorphic_code_cache(); |
- Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, |
- strict_mode); |
+ ExtraICState extra_state = KeyedStoreIC::ComputeExtraICState( |
+ strict_mode, store_mode); |
Code::Flags flags = |
Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); |
Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
@@ -947,7 +958,7 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor) { |
Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) { |
int argc = Code::ExtractArgumentsCountFromFlags(flags); |
Code::Kind kind = Code::ExtractKindFromFlags(flags); |
- Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
+ ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
if (kind == Code::CALL_IC) { |
CallIC::GenerateInitialize(masm(), argc, extra_state); |
} else { |
@@ -968,7 +979,7 @@ Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { |
// The code of the PreMonomorphic stub is the same as the code |
// of the Initialized stub. They just differ on the code object flags. |
Code::Kind kind = Code::ExtractKindFromFlags(flags); |
- Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
+ ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
if (kind == Code::CALL_IC) { |
CallIC::GenerateInitialize(masm(), argc, extra_state); |
} else { |
@@ -1008,7 +1019,7 @@ Handle<Code> StubCompiler::CompileCallNormal(Code::Flags flags) { |
Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) { |
int argc = Code::ExtractArgumentsCountFromFlags(flags); |
Code::Kind kind = Code::ExtractKindFromFlags(flags); |
- Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
+ ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
if (kind == Code::CALL_IC) { |
CallIC::GenerateMegamorphic(masm(), argc, extra_state); |
} else { |
@@ -1040,7 +1051,7 @@ Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) { |
Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) { |
int argc = Code::ExtractArgumentsCountFromFlags(flags); |
Code::Kind kind = Code::ExtractKindFromFlags(flags); |
- Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
+ ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
if (kind == Code::CALL_IC) { |
CallIC::GenerateMiss(masm(), argc, extra_state); |
} else { |
@@ -1075,7 +1086,7 @@ Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { |
Code::Kind kind = Code::ExtractKindFromFlags(flags); |
if (kind == Code::CALL_IC) { |
// For the debugger extra ic state is irrelevant. |
- CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState); |
+ CallIC::GenerateMiss(masm(), argc, kNoExtraICState); |
} else { |
KeyedCallIC::GenerateMiss(masm(), argc); |
} |
@@ -1679,7 +1690,7 @@ void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( |
CallStubCompiler::CallStubCompiler(Isolate* isolate, |
int argc, |
Code::Kind kind, |
- Code::ExtraICState extra_state, |
+ ExtraICState extra_state, |
InlineCacheHolderFlag cache_holder) |
: StubCompiler(isolate), |
arguments_(argc), |