VectorICs: Create a StoreICState to more easily create matching code stubs.
This follows the logic of the load ics, in that the base extra ic state is better encapsulated. Introduce flag vector_stores to aid development of vector-based store ics. BUG= R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/1151253004 Cr-Commit-Position: refs/heads/master@{#28576}
This commit is contained in:
parent
5f11a5fa19
commit
3ce81e193d
121
src/builtins.h
121
src/builtins.h
@ -64,66 +64,67 @@ enum BuiltinExtraArguments {
|
||||
V(RestrictedStrictArgumentsPropertiesThrower, NO_EXTRA_ARGUMENTS)
|
||||
|
||||
// Define list of builtins implemented in assembly.
|
||||
#define BUILTIN_LIST_A(V) \
|
||||
V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubForDerived, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileLazy, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileOptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyStubFailure, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \
|
||||
\
|
||||
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, StoreIC::kStrictModeState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, MEGAMORPHIC, kNoExtraICState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
/* Uses KeyedLoadIC_Initialize; must be after in list. */ \
|
||||
V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ReflectApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ReflectConstruct, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(InternalArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(StringConstructCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(OnStackReplacement, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(InterruptCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(StackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(MarkCodeAsToBeExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
#define BUILTIN_LIST_A(V) \
|
||||
V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubForDerived, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(JSConstructEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileLazy, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileOptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(CompileOptimizedConcurrent, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyStubFailure, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(StoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedStoreIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedLoadIC_Megamorphic, KEYED_LOAD_IC, MEGAMORPHIC, kNoExtraICState) \
|
||||
\
|
||||
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
|
||||
StoreICState::kStrictModeState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize, KEYED_STORE_IC, UNINITIALIZED, kNoExtraICState) \
|
||||
V(KeyedStoreIC_PreMonomorphic, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_Megamorphic, KEYED_STORE_IC, MEGAMORPHIC, kNoExtraICState) \
|
||||
\
|
||||
V(KeyedStoreIC_Initialize_Strict, KEYED_STORE_IC, UNINITIALIZED, \
|
||||
StoreICState::kStrictModeState) \
|
||||
V(KeyedStoreIC_PreMonomorphic_Strict, KEYED_STORE_IC, PREMONOMORPHIC, \
|
||||
StoreICState::kStrictModeState) \
|
||||
V(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, MEGAMORPHIC, \
|
||||
StoreICState::kStrictModeState) \
|
||||
V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
/* Uses KeyedLoadIC_Initialize; must be after in list. */ \
|
||||
V(FunctionCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(FunctionApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ReflectApply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ReflectConstruct, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(InternalArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(ArrayCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(StringConstructCode, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(OnStackReplacement, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(InterruptCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(OsrAfterStackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(StackCheck, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
\
|
||||
V(MarkCodeAsToBeExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(MarkCodeAsExecutedOnce, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
V(MarkCodeAsExecutedTwice, BUILTIN, UNINITIALIZED, kNoExtraICState) \
|
||||
CODE_AGE_LIST_WITH_ARG(DECLARE_CODE_AGE_BUILTIN, V)
|
||||
|
||||
// Define list of builtin handlers implemented in assembly.
|
||||
|
@ -664,6 +664,7 @@ DEFINE_BOOL(use_idle_notification, true,
|
||||
// ic.cc
|
||||
DEFINE_BOOL(use_ic, true, "use inline caching")
|
||||
DEFINE_BOOL(trace_ic, false, "trace inline cache state transitions")
|
||||
DEFINE_BOOL(vector_stores, false, "use vectors for store ics")
|
||||
|
||||
// macro-assembler-ia32.cc
|
||||
DEFINE_BOOL(native_code_counters, false,
|
||||
|
@ -308,7 +308,7 @@ Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) {
|
||||
|
||||
Handle<Code> PropertyICCompiler::CompileStoreGeneric(Code::Flags flags) {
|
||||
ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
|
||||
LanguageMode language_mode = StoreIC::GetLanguageMode(extra_state);
|
||||
LanguageMode language_mode = StoreICState::GetLanguageMode(extra_state);
|
||||
GenerateRuntimeSetProperty(masm(), language_mode);
|
||||
Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
|
||||
PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
|
||||
|
@ -109,8 +109,8 @@ void IC::SetTargetAtAddress(Address address, Code* target,
|
||||
// ICs as language mode. The language mode of the IC must be preserved.
|
||||
if (old_target->kind() == Code::STORE_IC ||
|
||||
old_target->kind() == Code::KEYED_STORE_IC) {
|
||||
DCHECK(StoreIC::GetLanguageMode(old_target->extra_ic_state()) ==
|
||||
StoreIC::GetLanguageMode(target->extra_ic_state()));
|
||||
DCHECK(StoreICState::GetLanguageMode(old_target->extra_ic_state()) ==
|
||||
StoreICState::GetLanguageMode(target->extra_ic_state()));
|
||||
}
|
||||
#endif
|
||||
Assembler::set_target_address_at(address, constant_pool,
|
||||
@ -141,15 +141,16 @@ void LoadIC::set_target(Code* code) {
|
||||
|
||||
void StoreIC::set_target(Code* code) {
|
||||
// Language mode must be preserved across IC patching.
|
||||
DCHECK(GetLanguageMode(code->extra_ic_state()) ==
|
||||
GetLanguageMode(target()->extra_ic_state()));
|
||||
DCHECK(StoreICState::GetLanguageMode(code->extra_ic_state()) ==
|
||||
StoreICState::GetLanguageMode(target()->extra_ic_state()));
|
||||
IC::set_target(code);
|
||||
}
|
||||
|
||||
|
||||
void KeyedStoreIC::set_target(Code* code) {
|
||||
// Language mode must be preserved across IC patching.
|
||||
DCHECK(GetLanguageMode(code->extra_ic_state()) == language_mode());
|
||||
DCHECK(StoreICState::GetLanguageMode(code->extra_ic_state()) ==
|
||||
language_mode());
|
||||
IC::set_target(code);
|
||||
}
|
||||
|
||||
|
@ -224,6 +224,36 @@ class LoadICState final BASE_EMBEDDED {
|
||||
|
||||
const ExtraICState state_;
|
||||
};
|
||||
|
||||
|
||||
class StoreICState final BASE_EMBEDDED {
|
||||
public:
|
||||
explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {}
|
||||
|
||||
explicit StoreICState(LanguageMode mode)
|
||||
: state_(LanguageModeState::encode(mode)) {}
|
||||
|
||||
ExtraICState GetExtraICState() const { return state_; }
|
||||
|
||||
LanguageMode language_mode() const {
|
||||
return LanguageModeState::decode(state_);
|
||||
}
|
||||
|
||||
static LanguageMode GetLanguageMode(ExtraICState state) {
|
||||
return StoreICState(state).language_mode();
|
||||
}
|
||||
|
||||
class LanguageModeState : public BitField<LanguageMode, 1, 2> {};
|
||||
STATIC_ASSERT(i::LANGUAGE_END == 3);
|
||||
|
||||
// For convenience, a statically declared encoding of strict mode extra
|
||||
// IC state.
|
||||
static const ExtraICState kStrictModeState = STRICT
|
||||
<< LanguageModeState::kShift;
|
||||
|
||||
private:
|
||||
const ExtraICState state_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,10 +561,9 @@ void StoreIC::Clear(Isolate* isolate, Address address, Code* target,
|
||||
void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target,
|
||||
ConstantPoolArray* constant_pool) {
|
||||
if (IsCleared(target)) return;
|
||||
SetTargetAtAddress(
|
||||
address, *pre_monomorphic_stub(
|
||||
isolate, StoreIC::GetLanguageMode(target->extra_ic_state())),
|
||||
constant_pool);
|
||||
Handle<Code> code = pre_monomorphic_stub(
|
||||
isolate, StoreICState::GetLanguageMode(target->extra_ic_state()));
|
||||
SetTargetAtAddress(address, *code, constant_pool);
|
||||
}
|
||||
|
||||
|
||||
|
16
src/ic/ic.h
16
src/ic/ic.h
@ -492,26 +492,16 @@ class KeyedLoadIC : public LoadIC {
|
||||
|
||||
class StoreIC : public IC {
|
||||
public:
|
||||
STATIC_ASSERT(i::LANGUAGE_END == 3);
|
||||
class LanguageModeState : public BitField<LanguageMode, 1, 2> {};
|
||||
static ExtraICState ComputeExtraICState(LanguageMode flag) {
|
||||
return LanguageModeState::encode(flag);
|
||||
return StoreICState(flag).GetExtraICState();
|
||||
}
|
||||
static LanguageMode GetLanguageMode(ExtraICState state) {
|
||||
return LanguageModeState::decode(state);
|
||||
}
|
||||
|
||||
// For convenience, a statically declared encoding of strict mode extra
|
||||
// IC state.
|
||||
static const ExtraICState kStrictModeState = STRICT
|
||||
<< LanguageModeState::kShift;
|
||||
|
||||
StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) {
|
||||
DCHECK(IsStoreStub());
|
||||
}
|
||||
|
||||
LanguageMode language_mode() const {
|
||||
return LanguageModeState::decode(extra_ic_state());
|
||||
return StoreICState::GetLanguageMode(extra_ic_state());
|
||||
}
|
||||
|
||||
// Code generators for stub routines. Only called once at startup.
|
||||
@ -587,7 +577,7 @@ class KeyedStoreIC : public StoreIC {
|
||||
|
||||
static ExtraICState ComputeExtraICState(LanguageMode flag,
|
||||
KeyedAccessStoreMode mode) {
|
||||
return LanguageModeState::encode(flag) |
|
||||
return StoreICState(flag).GetExtraICState() |
|
||||
ExtraICStateKeyedAccessStoreMode::encode(mode) |
|
||||
IcCheckTypeField::encode(ELEMENT);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user