Chromium Code Reviews| Index: src/code-stubs.cc |
| diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
| index aa2c82172c16250172db0fa2494b067b532ca0d9..a1010b02b993ccb1650aa3c7af19fa4db90a45e1 100644 |
| --- a/src/code-stubs.cc |
| +++ b/src/code-stubs.cc |
| @@ -407,44 +407,61 @@ void ICCompareStub::Generate(MacroAssembler* masm) { |
| } |
| } |
| - |
| -CompareNilICStub::Types CompareNilICStub::GetPatchedICFlags( |
| - Code::ExtraICState extra_ic_state, |
| - Handle<Object> object, |
| - bool* already_monomorphic) { |
| - Types types = TypesField::decode(extra_ic_state); |
| - NilValue nil = NilValueField::decode(extra_ic_state); |
| - EqualityKind kind = EqualityKindField::decode(extra_ic_state); |
| - ASSERT(types != CompareNilICStub::kFullCompare); |
| - *already_monomorphic = |
| - (types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0; |
| - if (kind == kStrictEquality) { |
| - if (nil == kNullValue) { |
| - return CompareNilICStub::kCompareAgainstNull; |
| +void CompareNilICStub::Record(Handle<Object> object) { |
| + ASSERT(!types_.IsFullCompare()); |
| + if (equality_kind_ == kStrictEquality) { |
| + if (nil_value_ == kNullValue) { |
|
Sven Panne
2013/05/14 09:18:42
Use a ternary. More importantly: Why do we *set* t
|
| + types_.SetTo(NULL_TYPE); |
| } else { |
| - return CompareNilICStub::kCompareAgainstUndefined; |
| + types_.SetTo(UNDEFINED); |
| } |
| } else { |
| if (object->IsNull()) { |
| - types = static_cast<CompareNilICStub::Types>( |
| - types | CompareNilICStub::kCompareAgainstNull); |
| + types_.Add(NULL_TYPE); |
| } else if (object->IsUndefined()) { |
| - types = static_cast<CompareNilICStub::Types>( |
| - types | CompareNilICStub::kCompareAgainstUndefined); |
| + types_.Add(UNDEFINED); |
| } else if (object->IsUndetectableObject() || |
| object->IsOddball() || |
| !object->IsHeapObject()) { |
| - types = CompareNilICStub::kFullCompare; |
| - } else if ((types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0) { |
| - types = CompareNilICStub::kFullCompare; |
| + types_ = Types::FullCompare(); |
| + } else if (IsMonomorphic()) { |
| + types_ = Types::FullCompare(); |
| } else { |
| - types = static_cast<CompareNilICStub::Types>( |
| - types | CompareNilICStub::kCompareAgainstMonomorphicMap); |
| + types_.Add(MONOMORPHIC_MAP); |
| } |
| } |
| - return types; |
| } |
| +void CompareNilICStub::Types::SetTo(Type type) { |
| + RemoveAll(); |
| + Add(type); |
| +} |
| + |
| +void CompareNilICStub::PrintName(StringStream* stream) { |
| + stream->Add("CompareNilICStub_"); |
| + types_.Print(stream); |
| + if (nil_value_ == kNullValue) { |
|
Sven Panne
2013/05/14 09:18:42
Use a ternary ?: here...
|
| + stream->Add("(NullValue|"); |
| + } else { |
| + stream->Add("(UndefinedValue|"); |
| + } |
| + if (equality_kind_ == kStrictEquality) { |
|
Sven Panne
2013/05/14 09:18:42
... and here, and merge the stream->Add() calls. M
|
| + stream->Add("StrictEquality)"); |
| + } else { |
| + stream->Add("NonStrictEquality)"); |
| + } |
| +} |
| + |
| +void CompareNilICStub::Types::Print(StringStream* stream) const { |
| + stream->Add("("); |
| + if (IsEmpty()) stream->Add("None,"); |
| + if (Contains(UNDEFINED)) stream->Add("Undefined,"); |
| + if (Contains(NULL_TYPE)) stream->Add("Null,"); |
| + if (Contains(MONOMORPHIC_MAP)) stream->Add("MonomorphicMap,"); |
| + if (Contains(UNDETECTABLE)) stream->Add("Undetectable,"); |
| + stream->Remove(1); |
|
Sven Panne
2013/05/14 09:18:42
Although it looks like a cunning idea at first, re
oliv
2013/05/14 13:28:11
ok, ic
|
| + stream->Add(")"); |
| +} |
| void InstanceofStub::PrintName(StringStream* stream) { |
| const char* args = ""; |
| @@ -552,15 +569,18 @@ void ToBooleanStub::PrintName(StringStream* stream) { |
| void ToBooleanStub::Types::Print(StringStream* stream) const { |
| - if (IsEmpty()) stream->Add("None"); |
| - if (Contains(UNDEFINED)) stream->Add("Undefined"); |
| - if (Contains(BOOLEAN)) stream->Add("Bool"); |
| - if (Contains(NULL_TYPE)) stream->Add("Null"); |
| - if (Contains(SMI)) stream->Add("Smi"); |
| - if (Contains(SPEC_OBJECT)) stream->Add("SpecObject"); |
| - if (Contains(STRING)) stream->Add("String"); |
| - if (Contains(SYMBOL)) stream->Add("Symbol"); |
| - if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber"); |
| + stream->Add("("); |
| + if (IsEmpty()) stream->Add("None,"); |
| + if (Contains(UNDEFINED)) stream->Add("Undefined,"); |
| + if (Contains(BOOLEAN)) stream->Add("Bool,"); |
| + if (Contains(NULL_TYPE)) stream->Add("Null,"); |
| + if (Contains(SMI)) stream->Add("Smi,"); |
| + if (Contains(SPEC_OBJECT)) stream->Add("SpecObject,"); |
| + if (Contains(STRING)) stream->Add("String,"); |
| + if (Contains(SYMBOL)) stream->Add("Symbol,"); |
| + if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber,"); |
| + stream->Remove(1); |
|
Sven Panne
2013/05/14 09:18:42
Same comment as in the other Print() function.
|
| + stream->Add(")"); |
| } |