Index: src/code-stubs.cc |
diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
index b56beb8d524bf449d67bc9bf34705e586f97727a..4e5efcd8e02bd115a9c303cba78619d552a07198 100644 |
--- a/src/code-stubs.cc |
+++ b/src/code-stubs.cc |
@@ -451,6 +451,28 @@ |
} |
+void CompareNilICStub::UpdateStatus(Handle<Object> object) { |
+ State state = this->state(); |
+ DCHECK(!state.Contains(GENERIC)); |
+ State old_state = state; |
+ if (object->IsNull()) { |
+ state.Add(NULL_TYPE); |
+ } else if (object->IsUndefined()) { |
+ state.Add(UNDEFINED); |
+ } else if (object->IsUndetectableObject() || object->IsSmi()) { |
+ state.RemoveAll(); |
+ state.Add(GENERIC); |
+ } else if (IsMonomorphic()) { |
+ state.RemoveAll(); |
+ state.Add(GENERIC); |
+ } else { |
+ state.Add(MONOMORPHIC_MAP); |
+ } |
+ TraceTransition(old_state, state); |
+ set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral())); |
+} |
+ |
+ |
Handle<Code> TurboFanCodeStub::GenerateCode() { |
const char* name = CodeStub::MajorName(MajorKey()); |
Zone zone; |
@@ -486,6 +508,17 @@ |
} |
+void CompareNilICStub::PrintBaseName(std::ostream& os) const { // NOLINT |
+ CodeStub::PrintBaseName(os); |
+ os << ((nil_value() == kNullValue) ? "(NullValue)" : "(UndefinedValue)"); |
+} |
+ |
+ |
+void CompareNilICStub::PrintState(std::ostream& os) const { // NOLINT |
+ os << state(); |
+} |
+ |
+ |
// TODO(svenpanne) Make this a real infix_ostream_iterator. |
class SimpleListPrinter { |
public: |
@@ -504,6 +537,45 @@ |
std::ostream& os_; |
bool first_; |
}; |
+ |
+ |
+std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s) { |
+ os << "("; |
+ SimpleListPrinter p(os); |
+ if (s.IsEmpty()) p.Add("None"); |
+ if (s.Contains(CompareNilICStub::UNDEFINED)) p.Add("Undefined"); |
+ if (s.Contains(CompareNilICStub::NULL_TYPE)) p.Add("Null"); |
+ if (s.Contains(CompareNilICStub::MONOMORPHIC_MAP)) p.Add("MonomorphicMap"); |
+ if (s.Contains(CompareNilICStub::GENERIC)) p.Add("Generic"); |
+ return os << ")"; |
+} |
+ |
+ |
+Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) { |
+ State state = this->state(); |
+ if (state.Contains(CompareNilICStub::GENERIC)) return Type::Any(); |
+ |
+ Type* result = Type::None(); |
+ if (state.Contains(CompareNilICStub::UNDEFINED)) { |
+ result = Type::Union(result, Type::Undefined(), zone); |
+ } |
+ if (state.Contains(CompareNilICStub::NULL_TYPE)) { |
+ result = Type::Union(result, Type::Null(), zone); |
+ } |
+ if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) { |
+ Type* type = map.is_null() ? Type::Detectable() : Type::Class(map, zone); |
+ result = Type::Union(result, type, zone); |
+ } |
+ |
+ return result; |
+} |
+ |
+ |
+Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) { |
+ Type* output_type = GetType(zone, map); |
+ Type* nil_type = nil_value() == kNullValue ? Type::Null() : Type::Undefined(); |
+ return Type::Union(output_type, nil_type, zone); |
+} |
void CallICStub::PrintState(std::ostream& os) const { // NOLINT |
@@ -664,6 +736,13 @@ |
void AllocateInNewSpaceStub::InitializeDescriptor( |
CodeStubDescriptor* descriptor) { |
descriptor->Initialize(); |
+} |
+ |
+ |
+void CompareNilICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
+ descriptor->Initialize(FUNCTION_ADDR(Runtime_CompareNilIC_Miss)); |
+ descriptor->SetMissHandler(ExternalReference( |
+ Runtime::FunctionForId(Runtime::kCompareNilIC_Miss), isolate())); |
} |