EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
}
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ mov(StoreDescriptor::NameRegister(), Operand(instr->name()));
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
}
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
DCHECK(ToRegister(instr->result()).is(x0));
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ Mov(StoreDescriptor::NameRegister(), Operand(instr->name()));
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
// static
-Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate,
- ContextualMode mode) {
+Callable CodeFactory::LoadICInOptimizedCode(
+ Isolate* isolate, ContextualMode mode,
+ InlineCacheState initialization_state) {
+ auto code = LoadIC::initialize_stub_in_optimized_code(
+ isolate, LoadICState(mode).GetExtraICState(), initialization_state);
if (FLAG_vector_ics) {
- return Callable(LoadIC::initialize_stub_in_optimized_code(
- isolate, LoadICState(mode).GetExtraICState()),
- VectorLoadICDescriptor(isolate));
+ return Callable(code, VectorLoadICDescriptor(isolate));
}
- return CodeFactory::LoadIC(isolate, mode);
+ return Callable(code, LoadDescriptor(isolate));
}
// static
Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) {
- return Callable(StoreIC::initialize_stub(isolate, language_mode),
- StoreDescriptor(isolate));
+ return Callable(
+ StoreIC::initialize_stub(isolate, language_mode, UNINITIALIZED),
+ StoreDescriptor(isolate));
}
public:
// Initial states for ICs.
static Callable LoadIC(Isolate* isolate, ContextualMode mode);
- static Callable LoadICInOptimizedCode(Isolate* isolate, ContextualMode mode);
+ static Callable LoadICInOptimizedCode(Isolate* isolate, ContextualMode mode,
+ InlineCacheState initialization_state);
static Callable KeyedLoadIC(Isolate* isolate);
static Callable KeyedLoadICInOptimizedCode(Isolate* isolate);
static Callable CallIC(Isolate* isolate, int argc,
void JSGenericLowering::LowerJSLoadNamed(Node* node) {
const LoadNamedParameters& p = LoadNamedParametersOf(node->op());
- Callable callable =
- CodeFactory::LoadICInOptimizedCode(isolate(), p.contextual_mode());
+ Callable callable = CodeFactory::LoadICInOptimizedCode(
+ isolate(), p.contextual_mode(), UNINITIALIZED);
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
if (FLAG_vector_ics) {
node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
class HLoadNamedGeneric FINAL : public HTemplateInstruction<2> {
public:
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
- Handle<Object>);
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadNamedGeneric, HValue*,
+ Handle<Object>, InlineCacheState);
HValue* context() const { return OperandAt(0); }
HValue* object() const { return OperandAt(1); }
Handle<Object> name() const { return name_; }
+ InlineCacheState initialization_state() const {
+ return initialization_state_;
+ }
FeedbackVectorICSlot slot() const { return slot_; }
Handle<TypeFeedbackVector> feedback_vector() const {
return feedback_vector_;
DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
private:
- HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
- : name_(name), slot_(FeedbackVectorICSlot::Invalid()) {
+ HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name,
+ InlineCacheState initialization_state)
+ : name_(name),
+ slot_(FeedbackVectorICSlot::Invalid()),
+ initialization_state_(initialization_state) {
SetOperandAt(0, context);
SetOperandAt(1, object);
set_representation(Representation::Tagged());
Handle<Object> name_;
Handle<TypeFeedbackVector> feedback_vector_;
FeedbackVectorICSlot slot_;
+ InlineCacheState initialization_state_;
};
class HStoreNamedGeneric FINAL : public HTemplateInstruction<3> {
public:
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreNamedGeneric, HValue*,
Handle<String>, HValue*,
- LanguageMode);
+ LanguageMode, InlineCacheState);
HValue* object() const { return OperandAt(0); }
HValue* value() const { return OperandAt(1); }
HValue* context() const { return OperandAt(2); }
Handle<String> name() const { return name_; }
LanguageMode language_mode() const { return language_mode_; }
+ InlineCacheState initialization_state() const {
+ return initialization_state_;
+ }
std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
private:
HStoreNamedGeneric(HValue* context, HValue* object, Handle<String> name,
- HValue* value, LanguageMode language_mode)
- : name_(name), language_mode_(language_mode) {
+ HValue* value, LanguageMode language_mode,
+ InlineCacheState initialization_state)
+ : name_(name),
+ language_mode_(language_mode),
+ initialization_state_(initialization_state) {
SetOperandAt(0, object);
SetOperandAt(1, value);
SetOperandAt(2, context);
Handle<String> name_;
LanguageMode language_mode_;
+ InlineCacheState initialization_state_;
};
HValue* global_object = Add<HLoadNamedField>(
context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
- HStoreNamedGeneric* instr = Add<HStoreNamedGeneric>(
- global_object, var->name(), value, function_language_mode());
+ HStoreNamedGeneric* instr =
+ Add<HStoreNamedGeneric>(global_object, var->name(), value,
+ function_language_mode(), PREMONOMORPHIC);
USE(instr);
DCHECK(instr->HasObservableSideEffects());
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric(
- PropertyAccessType access_type,
- Expression* expr,
- HValue* object,
- Handle<String> name,
- HValue* value,
- bool is_uninitialized) {
+ PropertyAccessType access_type, Expression* expr, HValue* object,
+ Handle<String> name, HValue* value, bool is_uninitialized) {
if (is_uninitialized) {
Add<HDeoptimize>(
Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess,
Deoptimizer::SOFT);
}
if (access_type == LOAD) {
- HLoadNamedGeneric* result = New<HLoadNamedGeneric>(object, name);
+ HLoadNamedGeneric* result =
+ New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC);
if (FLAG_vector_ics) {
Handle<SharedFunctionInfo> current_shared =
function_state()->compilation_info()->shared_info();
return result;
} else {
return New<HStoreNamedGeneric>(object, name, value,
- function_language_mode());
+ function_language_mode(), PREMONOMORPHIC);
}
}
PropertyAccessType access_type,
bool* has_side_effects);
- HInstruction* BuildNamedGeneric(PropertyAccessType access,
- Expression* expr,
- HValue* object,
- Handle<String> name,
- HValue* value,
- bool is_uninitialized = false);
+ HInstruction* BuildNamedGeneric(PropertyAccessType access, Expression* expr,
+ HValue* object, Handle<String> name,
+ HValue* value, bool is_uninitialized = false);
HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map);
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ mov(StoreDescriptor::NameRegister(), instr->name());
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
code = compiler.CompileLoadInitialize(flags);
} else if (ic_state == PREMONOMORPHIC) {
code = compiler.CompileLoadPreMonomorphic(flags);
+ } else if (ic_state == MEGAMORPHIC) {
+ code = compiler.CompileLoadMegamorphic(flags);
} else {
UNREACHABLE();
}
}
+Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) {
+ MegamorphicLoadStub stub(isolate(), LoadICState(extra_ic_state_));
+ auto code = stub.GetCode();
+ PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0));
+ return code;
+}
+
+
Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) {
StoreIC::GenerateInitialize(masm());
Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize");
Handle<Code> CompileLoadInitialize(Code::Flags flags);
Handle<Code> CompileLoadPreMonomorphic(Code::Flags flags);
+ Handle<Code> CompileLoadMegamorphic(Code::Flags flags);
Handle<Code> CompileStoreInitialize(Code::Flags flags);
Handle<Code> CompileStorePreMonomorphic(Code::Flags flags);
Handle<Code> CompileStoreGeneric(Code::Flags flags);
Handle<Code> LoadIC::initialize_stub_in_optimized_code(
- Isolate* isolate, ExtraICState extra_state) {
+ 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();
}
- return initialize_stub(isolate, extra_state);
+ return PropertyICCompiler::ComputeLoad(isolate, initialization_state,
+ extra_state);
}
Handle<Code> StoreIC::initialize_stub(Isolate* isolate,
- LanguageMode language_mode) {
+ LanguageMode language_mode,
+ State initialization_state) {
+ DCHECK(initialization_state == UNINITIALIZED ||
+ initialization_state == PREMONOMORPHIC ||
+ initialization_state == MEGAMORPHIC);
ExtraICState extra_state = ComputeExtraICState(language_mode);
- Handle<Code> ic =
- PropertyICCompiler::ComputeStore(isolate, UNINITIALIZED, extra_state);
+ Handle<Code> ic = PropertyICCompiler::ComputeStore(
+ isolate, initialization_state, extra_state);
return ic;
}
static Handle<Code> initialize_stub(Isolate* isolate,
ExtraICState extra_state);
static Handle<Code> initialize_stub_in_optimized_code(
- Isolate* isolate, ExtraICState extra_state);
+ Isolate* isolate, ExtraICState extra_state, State initialization_state);
MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
Handle<Name> name);
LanguageMode language_mode);
static Handle<Code> initialize_stub(Isolate* isolate,
- LanguageMode language_mode);
+ LanguageMode language_mode,
+ State initialization_state);
MUST_USE_RESULT MaybeHandle<Object> Store(
Handle<Object> object, Handle<Name> name, Handle<Object> value,
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ li(StoreDescriptor::NameRegister(), Operand(instr->name()));
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ li(StoreDescriptor::NameRegister(), Operand(instr->name()));
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name());
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
}
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
- Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode,
+ PREMONOMORPHIC).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
}
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), NOT_CONTEXTUAL).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_CONTEXTUAL,
+ instr->hydrogen()->initialization_state()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ mov(StoreDescriptor::NameRegister(), instr->name());
- Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
+ Handle<Code> ic =
+ StoreIC::initialize_stub(isolate(), instr->language_mode(),
+ instr->hydrogen()->initialization_state());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}