Chromium Code Reviews| Index: runtime/vm/dart_api_impl.cc |
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
| index 7a673f913b86f93b3aec09d7b24d034f0e9e0013..fc652ecbdfeb4bef5512997be47393d3e28114a9 100644 |
| --- a/runtime/vm/dart_api_impl.cc |
| +++ b/runtime/vm/dart_api_impl.cc |
| @@ -7,6 +7,7 @@ |
| #include "include/dart_native_api.h" |
| #include "platform/assert.h" |
| +#include "lib/identical.h" |
|
siva
2013/09/17 00:06:24
I don't think we want to include stuff from "lib/.
|
| #include "vm/bigint_operations.h" |
| #include "vm/class_finalizer.h" |
| #include "vm/compiler.h" |
| @@ -497,8 +498,18 @@ DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object) { |
| DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { |
| Isolate* isolate = Isolate::Current(); |
| CHECK_ISOLATE(isolate); |
| + |
| + const Object& object1 = Object::Handle(isolate, Api::UnwrapHandle(obj1)); |
| + const Object& object2 = Object::Handle(isolate, Api::UnwrapHandle(obj2)); |
| + if (object1.IsInstance() && object2.IsInstance()) { |
| + const Bool& result = |
| + Bool::Handle(isolate, Identical(Instance::Cast(object1), |
| + Instance::Cast(object2))); |
| + return result.value(); |
| + } |
| + |
| NoGCScope ngc; |
| - return Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2); |
| + return object1.raw() == object2.raw(); |
|
siva
2013/09/17 00:06:24
Wouldn't it be more efficient to first compare the
|
| } |