From 2461d2a540f1968d971449b2ebc2a072f9c583ae Mon Sep 17 00:00:00 2001 From: "rossberg@chromium.org" Date: Mon, 8 Jul 2013 13:07:41 +0000 Subject: [PATCH] Add Type::cast R=danno@chromium.org BUG= Review URL: https://codereview.chromium.org/18843002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15551 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects.cc | 4 ++-- src/types.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/objects.cc b/src/objects.cc index 4c00cb853e..589828e129 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -15850,8 +15850,8 @@ MaybeObject* PropertyCell::SetValueInferType(Object* value, &PropertyCell::UpdateType, Handle(this), Handle(value, GetIsolate())); - if (maybe_type->IsFailure()) return maybe_type; - Type* new_type = static_cast(maybe_type); + Type* new_type; + if (maybe_type->To(&new_type)) return maybe_type; set_type(new_type); } return value; diff --git a/src/types.h b/src/types.h index a2bcda6579..31aa9512f4 100644 --- a/src/types.h +++ b/src/types.h @@ -184,6 +184,13 @@ class Type : public Object { return Iterator(this->handle()); } + static Type* cast(v8::internal::Object* object) { + Type* t = static_cast(object); + ASSERT(t->is_bitset() || t->is_class() || + t->is_constant() || t->is_union()); + return t; + } + private: // A union is a fixed array containing types. Invariants: // - its length is at least 2