Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 23464073: Make Dart_IdentityEqual live up to its spec and not leak boxing implementation detail. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
}

Powered by Google App Engine
This is Rietveld 408576698