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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 21381002: Implement mirror equality on the VM. Resolves issue 12026. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_debugger_api.h" 6 #include "include/dart_debugger_api.h"
7 #include "include/dart_mirrors_api.h" 7 #include "include/dart_mirrors_api.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_api_state.h" // TODO(11742): Remove with CreateMirrorRef. 9 #include "vm/dart_api_state.h" // TODO(11742): Remove with CreateMirrorRef.
10 #include "vm/bootstrap_natives.h" 10 #include "vm/bootstrap_natives.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 const LanguageError& compilation_error = LanguageError::Cast(error); 447 const LanguageError& compilation_error = LanguageError::Cast(error);
448 String& message = String::Handle(compilation_error.message()); 448 String& message = String::Handle(compilation_error.message());
449 ThrowMirroredCompilationError(message); 449 ThrowMirroredCompilationError(message);
450 UNREACHABLE(); 450 UNREACHABLE();
451 } 451 }
452 Exceptions::PropagateError(error); 452 Exceptions::PropagateError(error);
453 UNREACHABLE(); 453 UNREACHABLE();
454 } 454 }
455 455
456 456
457 DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) {
458 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0));
459 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1));
460 return Bool::Get(a.referent() == b.referent());
rmacnak 2013/07/31 18:38:01 Assert no GC? Identical_comparison doesn't.
siva 2013/08/01 00:05:06 Sure you can add a NoGCScope here if you want. On
461 }
462
463
457 DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { 464 DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) {
458 const MirrorReference& decl_ref = 465 const MirrorReference& decl_ref =
459 MirrorReference::CheckedHandle(arguments->NativeArgAt(0)); 466 MirrorReference::CheckedHandle(arguments->NativeArgAt(0));
460 const Object& decl = Object::Handle(decl_ref.referent()); 467 const Object& decl = Object::Handle(decl_ref.referent());
461 468
462 Class& klass = Class::Handle(); 469 Class& klass = Class::Handle();
463 if (decl.IsClass()) { 470 if (decl.IsClass()) {
464 klass ^= decl.raw(); 471 klass ^= decl.raw();
465 } else if (decl.IsFunction()) { 472 } else if (decl.IsFunction()) {
466 klass = Function::Cast(decl).origin(); 473 klass = Function::Cast(decl).origin();
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1321
1315 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1322 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1316 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1323 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1317 const Field& field = Field::Handle(ref.GetFieldReferent()); 1324 const Field& field = Field::Handle(ref.GetFieldReferent());
1318 1325
1319 const AbstractType& type = AbstractType::Handle(field.type()); 1326 const AbstractType& type = AbstractType::Handle(field.type());
1320 return CreateTypeMirror(type); 1327 return CreateTypeMirror(type);
1321 } 1328 }
1322 1329
1323 } // namespace dart 1330 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698