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

Side by Side 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: weaken nogc claim 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/identical.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 NoGCScope ngc; 500 {
501 return Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2); 501 NoGCScope ngc;
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;
502 } 512 }
503 513
504 514
505 DART_EXPORT Dart_Handle Dart_HandleFromPersistent( 515 DART_EXPORT Dart_Handle Dart_HandleFromPersistent(
506 Dart_PersistentHandle object) { 516 Dart_PersistentHandle object) {
507 Isolate* isolate = Isolate::Current(); 517 Isolate* isolate = Isolate::Current();
508 DARTSCOPE(isolate); 518 DARTSCOPE(isolate);
509 ApiState* state = isolate->api_state(); 519 ApiState* state = isolate->api_state();
510 ASSERT(state != NULL); 520 ASSERT(state != NULL);
511 ASSERT(state->IsValidPersistentHandle(object)); 521 ASSERT(state->IsValidPersistentHandle(object));
(...skipping 3825 matching lines...) Expand 10 before | Expand all | Expand 10 after
4337 } 4347 }
4338 { 4348 {
4339 NoGCScope no_gc; 4349 NoGCScope no_gc;
4340 RawObject* raw_obj = obj.raw(); 4350 RawObject* raw_obj = obj.raw();
4341 isolate->heap()->SetPeer(raw_obj, peer); 4351 isolate->heap()->SetPeer(raw_obj, peer);
4342 } 4352 }
4343 return Api::Success(); 4353 return Api::Success();
4344 } 4354 }
4345 4355
4346 } // namespace dart 4356 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/identical.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698