Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 0ea7ac96b59b29e563ce4e95267ffdbb593ecadd..edbc93d142c7cf3e32fe2ac4f05ffc491b29bb11 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -1124,46 +1124,50 @@ class ICCompareStub: public PlatformCodeStub { |
class CompareNilICStub : public HydrogenCodeStub { |
public: |
- enum Type { |
+ enum CompareNilType { |
UNDEFINED, |
NULL_TYPE, |
MONOMORPHIC_MAP, |
UNDETECTABLE, |
+ GENERIC, |
NUMBER_OF_TYPES |
}; |
- class Types : public EnumSet<Type, byte> { |
+ class State : public EnumSet<CompareNilType, byte> { |
public: |
- Types() : EnumSet<Type, byte>(0) { } |
- explicit Types(byte bits) : EnumSet<Type, byte>(bits) { } |
+ State() : EnumSet<CompareNilType, byte>(0) { } |
+ explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } |
- static Types FullCompare() { |
- Types set; |
+ static State Generic() { |
+ State set; |
set.Add(UNDEFINED); |
set.Add(NULL_TYPE); |
set.Add(UNDETECTABLE); |
+ set.Add(GENERIC); |
return set; |
} |
void Print(StringStream* stream) const; |
- void TraceTransition(Types to) const; |
+ void TraceTransition(State to) const; |
}; |
+ static Handle<Type> StateToType( |
+ Isolate* isolate, State state, Handle<Map> map = Handle<Map>()); |
+ |
// At most 6 different types can be distinguished, because the Code object |
// only has room for a single byte to hold a set and there are two more |
// boolean flags we need to store. :-P |
STATIC_ASSERT(NUMBER_OF_TYPES <= 6); |
- CompareNilICStub(NilValue nil, Types types = Types()) |
- : types_(types) { |
- nil_value_ = nil; |
+ CompareNilICStub(NilValue nil, State state = State()) |
+ : nil_value_(nil), state_(state) { |
} |
CompareNilICStub(Code::ExtraICState ic_state, |
InitializationState init_state = INITIALIZED) |
: HydrogenCodeStub(init_state) { |
nil_value_ = NilValueField::decode(ic_state); |
- types_ = Types(ExtractTypesFromExtraICState(ic_state)); |
+ state_ = State(ExtractTypesFromExtraICState(ic_state)); |
} |
static Handle<Code> GetUninitialized(Isolate* isolate, |
@@ -1183,9 +1187,9 @@ class CompareNilICStub : public HydrogenCodeStub { |
} |
virtual InlineCacheState GetICState() { |
- if (types_ == Types::FullCompare()) { |
+ if (state_ == State::Generic()) { |
return MEGAMORPHIC; |
- } else if (types_.Contains(MONOMORPHIC_MAP)) { |
+ } else if (state_.Contains(MONOMORPHIC_MAP)) { |
return MONOMORPHIC; |
} else { |
return PREMONOMORPHIC; |
@@ -1198,20 +1202,18 @@ class CompareNilICStub : public HydrogenCodeStub { |
// extra ic state = nil_value | type_n-1 | ... | type_0 |
virtual Code::ExtraICState GetExtraICState() { |
- return NilValueField::encode(nil_value_) | |
- types_.ToIntegral(); |
+ return NilValueField::encode(nil_value_) | state_.ToIntegral(); |
} |
- static byte ExtractTypesFromExtraICState( |
- Code::ExtraICState state) { |
+ static byte ExtractTypesFromExtraICState(Code::ExtraICState state) { |
return state & ((1 << NUMBER_OF_TYPES) - 1); |
} |
void Record(Handle<Object> object); |
- bool IsMonomorphic() const { return types_.Contains(MONOMORPHIC_MAP); } |
+ bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } |
NilValue GetNilValue() const { return nil_value_; } |
- Types GetTypes() const { return types_; } |
- void ClearTypes() { types_.RemoveAll(); } |
+ State GetState() const { return state_; } |
+ void ClearState() { state_.RemoveAll(); } |
virtual void PrintName(StringStream* stream); |
@@ -1229,7 +1231,7 @@ class CompareNilICStub : public HydrogenCodeStub { |
virtual int NotMissMinorKey() { return GetExtraICState(); } |
NilValue nil_value_; |
- Types types_; |
+ State state_; |
DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); |
}; |