Reviewers: danno,

Description:
Add Type::cast

[email protected]
BUG=

Please review this at https://codereview.chromium.org/18843002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/objects.cc
  M src/types.h


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 8147106aaab168b8bbfa825f92ee5c310ace1359..a148c21e76d1901b2fa3b86cf6ca44fd059df968 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -15865,8 +15865,8 @@ MaybeObject* PropertyCell::SetValueInferType(Object* value,
         &PropertyCell::UpdateType,
         Handle<PropertyCell>(this),
         Handle<Object>(value, GetIsolate()));
-    if (maybe_type->IsFailure()) return maybe_type;
-    Type* new_type = static_cast<Type*>(maybe_type);
+    Type* new_type;
+    if (maybe_type->To(&new_type)) return maybe_type;
     set_type(new_type);
   }
   return value;
Index: src/types.h
diff --git a/src/types.h b/src/types.h
index a2bcda65791646c57464a5d85a908564efc5587a..31aa9512f4c3a44433412fc836df800ea5efe524 100644
--- a/src/types.h
+++ b/src/types.h
@@ -184,6 +184,13 @@ class Type : public Object {
     return Iterator<v8::internal::Object>(this->handle());
   }

+  static Type* cast(v8::internal::Object* object) {
+    Type* t = static_cast<Type*>(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


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to