diff --git a/src/a64/ic-a64.cc b/src/a64/ic-a64.cc index bdc7f00016..d4ac556469 100644 --- a/src/a64/ic-a64.cc +++ b/src/a64/ic-a64.cc @@ -435,9 +435,7 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_state, - Code::NORMAL, Code::LOAD_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, x0, x2, x3, x4, x5, x6); @@ -1220,7 +1218,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, void StoreIC::GenerateMegamorphic(MacroAssembler* masm, - ExtraICState extra_ic_state) { + ExtraICState extra_state) { // ----------- S t a t e ------------- // -- x0 : value // -- x1 : receiver @@ -1229,9 +1227,7 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_ic_state, - Code::NORMAL, Code::STORE_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, x1, x2, x3, x4, x5, x6); diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc index d324a8c6b3..314a07f4dc 100644 --- a/src/arm/ic-arm.cc +++ b/src/arm/ic-arm.cc @@ -342,9 +342,7 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_state, - Code::NORMAL, Code::LOAD_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, r0, r2, r3, r4, r5, r6); @@ -1163,7 +1161,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, void StoreIC::GenerateMegamorphic(MacroAssembler* masm, - ExtraICState extra_ic_state) { + ExtraICState extra_state) { // ----------- S t a t e ------------- // -- r0 : value // -- r1 : receiver @@ -1172,9 +1170,7 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Get the receiver from the stack and probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_ic_state, - Code::NORMAL, Code::STORE_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, r1, r2, r3, r4, r5, r6); diff --git a/src/builtins.cc b/src/builtins.cc index cf5e0e9415..b9ff9e1344 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -1599,9 +1599,7 @@ void Builtins::InitBuiltinFunctionTable() { functions->c_code = NULL; \ functions->s_name = #aname; \ functions->name = k##aname; \ - functions->flags = Code::ComputeFlags( \ - Code::HANDLER, MONOMORPHIC, kNoExtraICState, \ - Code::NORMAL, Code::kind); \ + functions->flags = Code::ComputeHandlerFlags(Code::kind); \ functions->extra_args = NO_EXTRA_ARGUMENTS; \ ++functions; diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index 4c646fea08..020514e08d 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -247,8 +247,7 @@ Handle HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) { GetCodeKind(), GetICState(), GetExtraICState(), - GetStubType(), - GetHandlerKind()); + GetStubType()); Handle new_object = factory->NewCode( desc, flags, masm.CodeObject(), NeedsImmovableCode()); return new_object; diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 0f76dee1ef..be14cf6e87 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -119,8 +119,7 @@ Handle PlatformCodeStub::GenerateCode(Isolate* isolate) { GetCodeKind(), GetICState(), GetExtraICState(), - GetStubType(), - GetHandlerKind()); + GetStubType()); Handle new_object = factory->NewCode( desc, flags, masm.CodeObject(), NeedsImmovableCode()); return new_object; diff --git a/src/code-stubs.h b/src/code-stubs.h index 01d9fe3659..5cbeaacb5c 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -188,9 +188,6 @@ class CodeStub BASE_EMBEDDED { virtual Code::StubType GetStubType() { return Code::NORMAL; } - virtual Code::Kind GetHandlerKind() { - return Code::STUB; - } virtual void PrintName(StringStream* stream); @@ -885,7 +882,9 @@ class HICStub: public HydrogenCodeStub { class HandlerStub: public HICStub { public: virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } - virtual Code::Kind GetHandlerKind() { return kind(); } + virtual ExtraICState GetExtraICState() { + return Code::HandlerKindField::encode(kind()); + } protected: HandlerStub() : HICStub() { } @@ -981,8 +980,6 @@ class StoreGlobalStub : public HandlerStub { Isolate* isolate, CodeStubInterfaceDescriptor* descriptor); - virtual ExtraICState GetExtraICState() { return bit_field_; } - bool is_constant() { return IsConstantBits::decode(bit_field_); } @@ -998,14 +995,11 @@ class StoreGlobalStub : public HandlerStub { } private: - virtual int NotMissMinorKey() { return GetExtraICState(); } Major MajorKey() { return StoreGlobal; } class IsConstantBits: public BitField {}; class RepresentationBits: public BitField {}; - int bit_field_; - DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); }; diff --git a/src/compiler.cc b/src/compiler.cc index 003c5abc7f..d466778069 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -215,8 +215,7 @@ Code::Flags CompilationInfo::flags() const { return Code::ComputeFlags(code_stub()->GetCodeKind(), code_stub()->GetICState(), code_stub()->GetExtraICState(), - code_stub()->GetStubType(), - code_stub()->GetHandlerKind()); + code_stub()->GetStubType()); } else { return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); } diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc index bd6dcefe15..729a3daee7 100644 --- a/src/ia32/ic-ia32.cc +++ b/src/ia32/ic-ia32.cc @@ -956,9 +956,7 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_state, - Code::NORMAL, Code::LOAD_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, edx, ecx, ebx, eax); @@ -1065,16 +1063,14 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { void StoreIC::GenerateMegamorphic(MacroAssembler* masm, - ExtraICState extra_ic_state) { + ExtraICState extra_state) { // ----------- S t a t e ------------- // -- eax : value // -- ecx : name // -- edx : receiver // -- esp[0] : return address // ----------------------------------- - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_ic_state, - Code::NORMAL, Code::STORE_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, edx, ecx, ebx, no_reg); diff --git a/src/objects-inl.h b/src/objects-inl.h index a59eea653d..387065ffe0 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -4478,7 +4478,6 @@ Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, ExtraICState extra_ic_state, StubType type, - Kind handler_kind, InlineCacheHolderFlag holder) { // Compute the bit mask. unsigned int bits = KindField::encode(kind) @@ -4486,10 +4485,6 @@ Code::Flags Code::ComputeFlags(Kind kind, | TypeField::encode(type) | ExtraICStateField::encode(extra_ic_state) | CacheHolderField::encode(holder); - // TODO(verwaest): Move to the valid uses of |handler_kind|. - if (handler_kind != STUB) { - bits |= HandlerKindField::encode(handler_kind); - } return static_cast(bits); } @@ -4497,10 +4492,17 @@ Code::Flags Code::ComputeFlags(Kind kind, Code::Flags Code::ComputeMonomorphicFlags(Kind kind, ExtraICState extra_ic_state, InlineCacheHolderFlag holder, - StubType type, - Kind handler_kind) { - return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, - handler_kind, holder); + StubType type) { + return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder); +} + + +Code::Flags Code::ComputeHandlerFlags(Kind handler_kind, + ExtraICState extra_ic_state, + StubType type, + InlineCacheHolderFlag holder) { + ExtraICState extra = HandlerKindField::encode(handler_kind) | extra_ic_state; + return ComputeFlags(Code::HANDLER, MONOMORPHIC, extra, type, holder); } diff --git a/src/objects.h b/src/objects.h index ef70f60ce4..eb8a756523 100644 --- a/src/objects.h +++ b/src/objects.h @@ -5375,15 +5375,19 @@ class Code: public HeapObject { InlineCacheState ic_state = UNINITIALIZED, ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, - Kind handler_kind = STUB, InlineCacheHolderFlag holder = OWN_MAP); static inline Flags ComputeMonomorphicFlags( Kind kind, ExtraICState extra_ic_state = kNoExtraICState, InlineCacheHolderFlag holder = OWN_MAP, + StubType type = NORMAL); + + static inline Flags ComputeHandlerFlags( + Kind handler_kind, + ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, - Kind handler_kind = STUB); + InlineCacheHolderFlag holder = OWN_MAP); static inline InlineCacheState ExtractICStateFromFlags(Flags flags); static inline StubType ExtractTypeFromFlags(Flags flags); diff --git a/src/stub-cache.cc b/src/stub-cache.cc index 3c51d4a550..bf449d8bf7 100644 --- a/src/stub-cache.cc +++ b/src/stub-cache.cc @@ -118,7 +118,7 @@ Handle StubCache::FindHandler(Handle name, Code::Kind kind, InlineCacheHolderFlag cache_holder) { Code::Flags flags = Code::ComputeMonomorphicFlags( - Code::HANDLER, kNoExtraICState, cache_holder, Code::NORMAL, kind); + Code::HANDLER, kNoExtraICState, cache_holder, Code::NORMAL); Handle probe(stub_holder->FindInCodeCache(*name, flags), isolate_); if (probe->IsCode()) return Handle::cast(probe); @@ -1235,8 +1235,8 @@ Handle BaseLoadStoreStubCompiler::GetICCode(Code::Kind kind, Handle BaseLoadStoreStubCompiler::GetCode(Code::Kind kind, Code::StubType type, Handle name) { - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_state(), type, kind, cache_holder_); + Code::Flags flags = Code::ComputeHandlerFlags( + kind, extra_state(), type, cache_holder_); Handle code = GetCodeWithFlags(flags, name); PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); JitEvent(name, code); diff --git a/src/type-info.cc b/src/type-info.cc index 695b9dd787..7372693dfa 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -283,9 +283,7 @@ void TypeFeedbackOracle::PropertyReceiverTypes( FunctionPrototypeStub proto_stub(Code::LOAD_IC); *is_prototype = LoadIsStub(id, &proto_stub); if (!*is_prototype) { - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, kNoExtraICState, - Code::NORMAL, Code::LOAD_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); CollectReceiverTypes(id, name, flags, receiver_types); } } @@ -306,9 +304,7 @@ void TypeFeedbackOracle::KeyedPropertyReceiverTypes( void TypeFeedbackOracle::AssignmentReceiverTypes( TypeFeedbackId id, Handle name, SmallMapList* receiver_types) { receiver_types->Clear(); - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, kNoExtraICState, - Code::NORMAL, Code::STORE_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); CollectReceiverTypes(id, name, flags, receiver_types); } diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc index c76eca04d8..06105f30ae 100644 --- a/src/x64/ic-x64.cc +++ b/src/x64/ic-x64.cc @@ -982,9 +982,7 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_state, - Code::NORMAL, Code::LOAD_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, rax, rcx, rbx, rdx); @@ -1092,7 +1090,7 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { void StoreIC::GenerateMegamorphic(MacroAssembler* masm, - ExtraICState extra_ic_state) { + ExtraICState extra_state) { // ----------- S t a t e ------------- // -- rax : value // -- rcx : name @@ -1101,9 +1099,7 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm, // ----------------------------------- // Get the receiver from the stack and probe the stub cache. - Code::Flags flags = Code::ComputeFlags( - Code::HANDLER, MONOMORPHIC, extra_ic_state, - Code::NORMAL, Code::STORE_IC); + Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC, extra_state); masm->isolate()->stub_cache()->GenerateProbe( masm, flags, rdx, rcx, rbx, no_reg);