| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index c7f791cab4e685d1e7afd8edb5a0b5500c9ee393..a3bd3ce1ca6360626e6d2f4839eb552214238c05 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -100,6 +100,25 @@ PropertyDetails PropertyDetails::AsDeleted() {
|
| }
|
|
|
|
|
| +bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
|
| + // There is a constraint on the object; check.
|
| + if (!this->IsJSObject()) return false;
|
| + // Fetch the constructor function of the object.
|
| + Object* cons_obj = JSObject::cast(this)->map()->constructor();
|
| + if (!cons_obj->IsJSFunction()) return false;
|
| + JSFunction* fun = JSFunction::cast(cons_obj);
|
| + // Iterate through the chain of inheriting function templates to
|
| + // see if the required one occurs.
|
| + for (Object* type = fun->shared()->function_data();
|
| + type->IsFunctionTemplateInfo();
|
| + type = FunctionTemplateInfo::cast(type)->parent_template()) {
|
| + if (type == expected) return true;
|
| + }
|
| + // Didn't find the required type in the inheritance chain.
|
| + return false;
|
| +}
|
| +
|
| +
|
| bool Object::IsSmi() {
|
| return HAS_SMI_TAG(this);
|
| }
|
|
|