OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 CHECK_CALLBACK_STATE(isolate); | 492 CHECK_CALLBACK_STATE(isolate); |
493 // This is a VM internal object. Call the C++ method of printing. | 493 // This is a VM internal object. Call the C++ method of printing. |
494 return Api::NewHandle(isolate, String::New(obj.ToCString())); | 494 return Api::NewHandle(isolate, String::New(obj.ToCString())); |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 | 498 |
499 DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { | 499 DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { |
500 Isolate* isolate = Isolate::Current(); | 500 Isolate* isolate = Isolate::Current(); |
501 CHECK_ISOLATE(isolate); | 501 CHECK_ISOLATE(isolate); |
502 NoGCScope ngc; | 502 { |
503 return Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2); | 503 NoGCScope ngc; |
| 504 if (Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2)) { |
| 505 return true; |
| 506 } |
| 507 } |
| 508 const Object& object1 = Object::Handle(isolate, Api::UnwrapHandle(obj1)); |
| 509 const Object& object2 = Object::Handle(isolate, Api::UnwrapHandle(obj2)); |
| 510 if (object1.IsInstance() && object2.IsInstance()) { |
| 511 return Instance::Cast(object1).IsIdenticalTo(Instance::Cast(object2)); |
| 512 } |
| 513 return false; |
504 } | 514 } |
505 | 515 |
506 | 516 |
507 DART_EXPORT Dart_Handle Dart_HandleFromPersistent( | 517 DART_EXPORT Dart_Handle Dart_HandleFromPersistent( |
508 Dart_PersistentHandle object) { | 518 Dart_PersistentHandle object) { |
509 Isolate* isolate = Isolate::Current(); | 519 Isolate* isolate = Isolate::Current(); |
510 CHECK_ISOLATE(isolate); | 520 CHECK_ISOLATE(isolate); |
511 ApiState* state = isolate->api_state(); | 521 ApiState* state = isolate->api_state(); |
512 ASSERT(state != NULL); | 522 ASSERT(state != NULL); |
513 ASSERT(state->IsValidPersistentHandle(object)); | 523 ASSERT(state->IsValidPersistentHandle(object)); |
(...skipping 3761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4275 } | 4285 } |
4276 { | 4286 { |
4277 NoGCScope no_gc; | 4287 NoGCScope no_gc; |
4278 RawObject* raw_obj = obj.raw(); | 4288 RawObject* raw_obj = obj.raw(); |
4279 isolate->heap()->SetPeer(raw_obj, peer); | 4289 isolate->heap()->SetPeer(raw_obj, peer); |
4280 } | 4290 } |
4281 return Api::Success(); | 4291 return Api::Success(); |
4282 } | 4292 } |
4283 | 4293 |
4284 } // namespace dart | 4294 } // namespace dart |
OLD | NEW |