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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |