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
This commit is contained in:
rossberg@chromium.org 2013-07-08 13:07:41 +00:00
parent 7ab931ee62
commit 2461d2a540
2 changed files with 9 additions and 2 deletions

View File

@ -15850,8 +15850,8 @@ MaybeObject* PropertyCell::SetValueInferType(Object* value,
&PropertyCell::UpdateType, &PropertyCell::UpdateType,
Handle<PropertyCell>(this), Handle<PropertyCell>(this),
Handle<Object>(value, GetIsolate())); Handle<Object>(value, GetIsolate()));
if (maybe_type->IsFailure()) return maybe_type; Type* new_type;
Type* new_type = static_cast<Type*>(maybe_type); if (maybe_type->To(&new_type)) return maybe_type;
set_type(new_type); set_type(new_type);
} }
return value; return value;

View File

@ -184,6 +184,13 @@ class Type : public Object {
return Iterator<v8::internal::Object>(this->handle()); 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: private:
// A union is a fixed array containing types. Invariants: // A union is a fixed array containing types. Invariants:
// - its length is at least 2 // - its length is at least 2