EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
}
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
}
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
DCHECK(ToRegister(instr->result()).Is(x0));
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
// static
-Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) {
+Callable CodeFactory::KeyedLoadICInOptimizedCode(
+ Isolate* isolate, InlineCacheState initialization_state) {
+ auto code = KeyedLoadIC::initialize_stub_in_optimized_code(
+ isolate, initialization_state);
if (FLAG_vector_ics) {
- return Callable(KeyedLoadIC::initialize_stub_in_optimized_code(isolate),
- VectorLoadICDescriptor(isolate));
+ return Callable(code, VectorLoadICDescriptor(isolate));
}
- return CodeFactory::KeyedLoadIC(isolate);
+ return Callable(code, LoadDescriptor(isolate));
}
// static
Callable CodeFactory::KeyedStoreIC(Isolate* isolate,
LanguageMode language_mode) {
- Handle<Code> ic = is_strict(language_mode)
- ? isolate->builtins()->KeyedStoreIC_Initialize_Strict()
- : isolate->builtins()->KeyedStoreIC_Initialize();
- return Callable(ic, StoreDescriptor(isolate));
+ return Callable(
+ KeyedStoreIC::initialize_stub(isolate, language_mode, UNINITIALIZED),
+ StoreDescriptor(isolate));
+}
+
+
+// static
+Callable CodeFactory::KeyedStoreICInOptimizedCode(
+ Isolate* isolate, LanguageMode language_mode,
+ InlineCacheState initialization_state) {
+ return Callable(KeyedStoreIC::initialize_stub(isolate, language_mode,
+ initialization_state),
+ StoreDescriptor(isolate));
}
static Callable LoadICInOptimizedCode(Isolate* isolate, ContextualMode mode,
InlineCacheState initialization_state);
static Callable KeyedLoadIC(Isolate* isolate);
- static Callable KeyedLoadICInOptimizedCode(Isolate* isolate);
+ static Callable KeyedLoadICInOptimizedCode(
+ Isolate* isolate, InlineCacheState initialization_state);
static Callable CallIC(Isolate* isolate, int argc,
CallICState::CallType call_type);
static Callable CallICInOptimizedCode(Isolate* isolate, int argc,
CallICState::CallType call_type);
static Callable StoreIC(Isolate* isolate, LanguageMode mode);
static Callable KeyedStoreIC(Isolate* isolate, LanguageMode mode);
+ static Callable KeyedStoreICInOptimizedCode(
+ Isolate* isolate, LanguageMode mode,
+ InlineCacheState initialization_state);
static Callable CompareIC(Isolate* isolate, Token::Value op);
void JSGenericLowering::LowerJSLoadProperty(Node* node) {
const LoadPropertyParameters& p = LoadPropertyParametersOf(node->op());
- Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate());
+ Callable callable =
+ CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED);
if (FLAG_vector_ics) {
node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
node->InsertInput(zone(), 3,
void JSGenericLowering::LowerJSStoreProperty(Node* node) {
LanguageMode language_mode = OpParameter<LanguageMode>(node);
- Callable callable = CodeFactory::KeyedStoreIC(isolate(), language_mode);
+ Callable callable = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), language_mode, UNINITIALIZED);
ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
}
class HLoadKeyedGeneric FINAL : public HTemplateInstruction<3> {
public:
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*,
- HValue*);
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadKeyedGeneric, HValue*,
+ HValue*, InlineCacheState);
HValue* object() const { return OperandAt(0); }
HValue* key() const { return OperandAt(1); }
HValue* context() const { return OperandAt(2); }
+ InlineCacheState initialization_state() const {
+ return initialization_state_;
+ }
FeedbackVectorICSlot slot() const { return slot_; }
Handle<TypeFeedbackVector> feedback_vector() const {
return feedback_vector_;
DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
private:
- HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key)
- : slot_(FeedbackVectorICSlot::Invalid()) {
+ HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key,
+ InlineCacheState initialization_state)
+ : slot_(FeedbackVectorICSlot::Invalid()),
+ initialization_state_(initialization_state) {
set_representation(Representation::Tagged());
SetOperandAt(0, obj);
SetOperandAt(1, key);
Handle<TypeFeedbackVector> feedback_vector_;
FeedbackVectorICSlot slot_;
+ InlineCacheState initialization_state_;
};
class HStoreKeyedGeneric FINAL : public HTemplateInstruction<4> {
public:
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
- HValue*, HValue*, LanguageMode);
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreKeyedGeneric, HValue*,
+ HValue*, HValue*, LanguageMode,
+ InlineCacheState);
HValue* object() const { return OperandAt(0); }
HValue* key() const { return OperandAt(1); }
HValue* value() const { return OperandAt(2); }
HValue* context() const { return OperandAt(3); }
LanguageMode language_mode() const { return language_mode_; }
+ InlineCacheState initialization_state() const {
+ return initialization_state_;
+ }
Representation RequiredInputRepresentation(int index) OVERRIDE {
// tagged[tagged] = tagged
private:
HStoreKeyedGeneric(HValue* context, HValue* object, HValue* key,
- HValue* value, LanguageMode language_mode)
- : language_mode_(language_mode) {
+ HValue* value, LanguageMode language_mode,
+ InlineCacheState initialization_state)
+ : language_mode_(language_mode),
+ initialization_state_(initialization_state) {
SetOperandAt(0, object);
SetOperandAt(1, key);
SetOperandAt(2, value);
}
LanguageMode language_mode_;
+ InlineCacheState initialization_state_;
};
HValue* key,
HValue* value) {
if (access_type == LOAD) {
- HLoadKeyedGeneric* result = New<HLoadKeyedGeneric>(object, key);
+ HLoadKeyedGeneric* result =
+ New<HLoadKeyedGeneric>(object, key, PREMONOMORPHIC);
if (FLAG_vector_ics) {
Handle<SharedFunctionInfo> current_shared =
function_state()->compilation_info()->shared_info();
}
return result;
} else {
- return New<HStoreKeyedGeneric>(object, key, value,
- function_language_mode());
+ return New<HStoreKeyedGeneric>(object, key, value, function_language_mode(),
+ PREMONOMORPHIC);
}
}
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
Handle<Code> LoadIC::initialize_stub_in_optimized_code(
Isolate* isolate, ExtraICState extra_state, State initialization_state) {
- DCHECK(initialization_state == UNINITIALIZED ||
- initialization_state == PREMONOMORPHIC ||
- initialization_state == MEGAMORPHIC);
if (FLAG_vector_ics) {
return VectorLoadStub(isolate, LoadICState(extra_state)).GetCode();
}
}
-Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(Isolate* isolate) {
+Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(
+ Isolate* isolate, State initialization_state) {
if (FLAG_vector_ics) {
return VectorKeyedLoadStub(isolate).GetCode();
}
- return initialize_stub(isolate);
+ switch (initialization_state) {
+ case UNINITIALIZED:
+ return isolate->builtins()->KeyedLoadIC_Initialize();
+ case PREMONOMORPHIC:
+ return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
+ case MEGAMORPHIC:
+ return isolate->builtins()->KeyedLoadIC_Megamorphic();
+ default:
+ UNREACHABLE();
+ }
+ return Handle<Code>();
+}
+
+
+Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate,
+ LanguageMode language_mode,
+ State initialization_state) {
+ switch (initialization_state) {
+ case UNINITIALIZED:
+ return is_strict(language_mode)
+ ? isolate->builtins()->KeyedStoreIC_Initialize_Strict()
+ : isolate->builtins()->KeyedStoreIC_Initialize();
+ case PREMONOMORPHIC:
+ return is_strict(language_mode)
+ ? isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict()
+ : isolate->builtins()->KeyedStoreIC_PreMonomorphic();
+ case MEGAMORPHIC:
+ return is_strict(language_mode)
+ ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict()
+ : isolate->builtins()->KeyedStoreIC_Megamorphic();
+ default:
+ UNREACHABLE();
+ }
+ return Handle<Code>();
}
(1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
static Handle<Code> initialize_stub(Isolate* isolate);
- static Handle<Code> initialize_stub_in_optimized_code(Isolate* isolate);
+ static Handle<Code> initialize_stub_in_optimized_code(
+ Isolate* isolate, State initialization_state);
static Handle<Code> ChooseMegamorphicStub(Isolate* isolate);
static Handle<Code> pre_monomorphic_stub(Isolate* isolate);
LanguageMode language_mode);
static void GenerateSloppyArguments(MacroAssembler* masm);
+ static Handle<Code> initialize_stub(Isolate* isolate,
+ LanguageMode language_mode,
+ State initialization_state);
+
protected:
virtual Handle<Code> pre_monomorphic_stub() const {
return pre_monomorphic_stub(isolate(), language_mode());
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
}
- Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code();
+ Handle<Code> ic =
+ CodeFactory::KeyedLoadICInOptimizedCode(
+ isolate(), instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister()));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
- Handle<Code> ic =
- CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
+ Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode(
+ isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}