Commit 209b17ac authored by verwaest@chromium.org's avatar verwaest@chromium.org

Don't mix handler flags into regular flag computation.

BUG=
R=ishell@chromium.org

Review URL: https://codereview.chromium.org/163363003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19384 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fe0fe20e
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -247,8 +247,7 @@ Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) {
GetCodeKind(),
GetICState(),
GetExtraICState(),
GetStubType(),
GetHandlerKind());
GetStubType());
Handle<Code> new_object = factory->NewCode(
desc, flags, masm.CodeObject(), NeedsImmovableCode());
return new_object;
......
......@@ -119,8 +119,7 @@ Handle<Code> PlatformCodeStub::GenerateCode(Isolate* isolate) {
GetCodeKind(),
GetICState(),
GetExtraICState(),
GetStubType(),
GetHandlerKind());
GetStubType());
Handle<Code> new_object = factory->NewCode(
desc, flags, masm.CodeObject(), NeedsImmovableCode());
return new_object;
......
......@@ -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<bool, 0, 1> {};
class RepresentationBits: public BitField<Representation::Kind, 1, 8> {};
int bit_field_;
DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
};
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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<Flags>(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);
}
......
......@@ -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);
......
......@@ -118,7 +118,7 @@ Handle<Code> StubCache::FindHandler(Handle<Name> 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<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_);
if (probe->IsCode()) return Handle<Code>::cast(probe);
......@@ -1235,8 +1235,8 @@ Handle<Code> BaseLoadStoreStubCompiler::GetICCode(Code::Kind kind,
Handle<Code> BaseLoadStoreStubCompiler::GetCode(Code::Kind kind,
Code::StubType type,
Handle<Name> 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> code = GetCodeWithFlags(flags, name);
PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
JitEvent(name, code);
......
......@@ -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<String> 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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment