Chromium Code Reviews| Index: runtime/lib/object.cc |
| =================================================================== |
| --- runtime/lib/object.cc (revision 16547) |
| +++ runtime/lib/object.cc (working copy) |
| @@ -63,6 +63,28 @@ |
| } |
| +DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { |
| + const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| + // Instantiator at pos 1 is not used. |
|
regis
2012/12/28 19:46:49
Do you need it for type feedback? Also, a comment
srdjan
2013/01/02 20:38:46
Added comment:
// Instantiator at position 1 is
|
| + const AbstractTypeArguments& instantiator_type_arguments = |
| + AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(2)); |
| + const AbstractType& type = |
| + AbstractType::CheckedHandle(arguments->NativeArgAt(3)); |
| + const Bool& negate = Bool::CheckedHandle(arguments->NativeArgAt(4)); |
| + ASSERT(type.IsFinalized()); |
| + Error& malformed_error = Error::Handle(); |
| + const bool is_instance_of = instance.IsInstanceOf(type, |
| + instantiator_type_arguments, |
| + &malformed_error); |
| + ASSERT(malformed_error.IsNull()); |
|
regis
2012/12/28 19:46:49
Instantiating a type with a type argument that is
srdjan
2013/01/02 20:38:46
Fixed.
|
| + if (negate.value()) { |
| + return is_instance_of ? Bool::False() : Bool::True(); |
| + } else { |
| + return is_instance_of ? Bool::True() : Bool::False(); |
| + } |
| +} |
| + |
| + |
| DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { |
| const AbstractType& type = |
| AbstractType::CheckedHandle(arguments->NativeArgAt(0)); |