OLD | NEW |
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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 Instance::null_instance()); | 732 Instance::null_instance()); |
733 } | 733 } |
734 | 734 |
735 | 735 |
736 DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { | 736 DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { |
737 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); | 737 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); |
738 return param.bound(); | 738 return param.bound(); |
739 } | 739 } |
740 | 740 |
741 | 741 |
| 742 DEFINE_NATIVE_ENTRY(InstanceMirror_identityHash, 1) { |
| 743 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); |
| 744 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 745 const Class& cls = Class::Handle(object_store->object_class()); |
| 746 const Function& function = |
| 747 Function::Handle(cls.LookupDynamicFunction(Symbols::hashCode())); |
| 748 const Array& args = Array::Handle(Array::New(1)); |
| 749 args.SetAt(0, reflectee); |
| 750 return DartEntry::InvokeFunction(function, args); |
| 751 } |
| 752 |
| 753 |
742 // Invoke the function, or noSuchMethod if it is null. Propagate any unhandled | 754 // Invoke the function, or noSuchMethod if it is null. Propagate any unhandled |
743 // exceptions. Wrap and propagate any compilation errors. | 755 // exceptions. Wrap and propagate any compilation errors. |
744 static RawObject* ReflectivelyInvokeDynamicFunction(const Instance& receiver, | 756 static RawObject* ReflectivelyInvokeDynamicFunction(const Instance& receiver, |
745 const Function& function, | 757 const Function& function, |
746 const String& target_name, | 758 const String& target_name, |
747 const Array& arguments) { | 759 const Array& arguments) { |
748 // Note "arguments" is already the internal arguments with the receiver as | 760 // Note "arguments" is already the internal arguments with the receiver as |
749 // the first element. | 761 // the first element. |
750 Object& result = Object::Handle(); | 762 Object& result = Object::Handle(); |
751 if (function.IsNull() || !function.is_visible()) { | 763 if (function.IsNull() || !function.is_visible()) { |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 } | 1373 } |
1362 | 1374 |
1363 | 1375 |
1364 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1376 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
1365 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1377 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1366 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1378 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1367 return field.type(); | 1379 return field.type(); |
1368 } | 1380 } |
1369 | 1381 |
1370 } // namespace dart | 1382 } // namespace dart |
OLD | NEW |