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

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

Issue 23460013: Implement InstanceMirror.== in dart2js and InstanceMirror.hashCode in the VM and … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use isolate parameter to native 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 | « no previous file | runtime/lib/mirrors_impl.dart » ('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) 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 "lib/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 Instance::null_instance()); 744 Instance::null_instance());
745 } 745 }
746 746
747 747
748 DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { 748 DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) {
749 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); 749 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0));
750 return param.bound(); 750 return param.bound();
751 } 751 }
752 752
753 753
754 DEFINE_NATIVE_ENTRY(InstanceMirror_identityHash, 1) {
755 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0));
756 ObjectStore* object_store = isolate->object_store();
757 const Class& cls = Class::Handle(isolate, object_store->object_class());
758 const Function& function =
759 Function::Handle(isolate, cls.LookupDynamicFunction(Symbols::hashCode()));
760 const Array& args = Array::Handle(isolate, Array::New(1));
761 args.SetAt(0, reflectee);
762 return DartEntry::InvokeFunction(function, args);
763 }
764
765
754 // Invoke the function, or noSuchMethod if it is null. Propagate any unhandled 766 // Invoke the function, or noSuchMethod if it is null. Propagate any unhandled
755 // exceptions. Wrap and propagate any compilation errors. 767 // exceptions. Wrap and propagate any compilation errors.
756 static RawObject* ReflectivelyInvokeDynamicFunction(const Instance& receiver, 768 static RawObject* ReflectivelyInvokeDynamicFunction(const Instance& receiver,
757 const Function& function, 769 const Function& function,
758 const String& target_name, 770 const String& target_name,
759 const Array& arguments) { 771 const Array& arguments) {
760 // Note "arguments" is already the internal arguments with the receiver as 772 // Note "arguments" is already the internal arguments with the receiver as
761 // the first element. 773 // the first element.
762 Object& result = Object::Handle(); 774 Object& result = Object::Handle();
763 if (function.IsNull() || !function.is_visible()) { 775 if (function.IsNull() || !function.is_visible()) {
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 } 1389 }
1378 1390
1379 1391
1380 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1392 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1381 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1393 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1382 const Field& field = Field::Handle(ref.GetFieldReferent()); 1394 const Field& field = Field::Handle(ref.GetFieldReferent());
1383 return field.type(); 1395 return field.type();
1384 } 1396 }
1385 1397
1386 } // namespace dart 1398 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698