| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 CHECK_CALLBACK_STATE(isolate); | 490 CHECK_CALLBACK_STATE(isolate); |
| 491 // This is a VM internal object. Call the C++ method of printing. | 491 // This is a VM internal object. Call the C++ method of printing. |
| 492 return Api::NewHandle(isolate, String::New(obj.ToCString())); | 492 return Api::NewHandle(isolate, String::New(obj.ToCString())); |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 | 495 |
| 496 | 496 |
| 497 DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { | 497 DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2) { |
| 498 Isolate* isolate = Isolate::Current(); | 498 Isolate* isolate = Isolate::Current(); |
| 499 CHECK_ISOLATE(isolate); | 499 CHECK_ISOLATE(isolate); |
| 500 { | 500 NoGCScope ngc; |
| 501 NoGCScope ngc; | 501 return Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2); |
| 502 if (Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2)) { | |
| 503 return true; | |
| 504 } | |
| 505 } | |
| 506 const Object& object1 = Object::Handle(isolate, Api::UnwrapHandle(obj1)); | |
| 507 const Object& object2 = Object::Handle(isolate, Api::UnwrapHandle(obj2)); | |
| 508 if (object1.IsInstance() && object2.IsInstance()) { | |
| 509 return Instance::Cast(object1).IsIdenticalTo(Instance::Cast(object2)); | |
| 510 } | |
| 511 return false; | |
| 512 } | 502 } |
| 513 | 503 |
| 514 | 504 |
| 515 DART_EXPORT Dart_Handle Dart_HandleFromPersistent( | 505 DART_EXPORT Dart_Handle Dart_HandleFromPersistent( |
| 516 Dart_PersistentHandle object) { | 506 Dart_PersistentHandle object) { |
| 517 Isolate* isolate = Isolate::Current(); | 507 Isolate* isolate = Isolate::Current(); |
| 518 CHECK_ISOLATE(isolate); | 508 CHECK_ISOLATE(isolate); |
| 519 ApiState* state = isolate->api_state(); | 509 ApiState* state = isolate->api_state(); |
| 520 ASSERT(state != NULL); | 510 ASSERT(state != NULL); |
| 521 ASSERT(state->IsValidPersistentHandle(object)); | 511 ASSERT(state->IsValidPersistentHandle(object)); |
| (...skipping 3825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4347 } | 4337 } |
| 4348 { | 4338 { |
| 4349 NoGCScope no_gc; | 4339 NoGCScope no_gc; |
| 4350 RawObject* raw_obj = obj.raw(); | 4340 RawObject* raw_obj = obj.raw(); |
| 4351 isolate->heap()->SetPeer(raw_obj, peer); | 4341 isolate->heap()->SetPeer(raw_obj, peer); |
| 4352 } | 4342 } |
| 4353 return Api::Success(); | 4343 return Api::Success(); |
| 4354 } | 4344 } |
| 4355 | 4345 |
| 4356 } // namespace dart | 4346 } // namespace dart |
| OLD | NEW |