| 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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 Instance::null_instance()); | 1057 Instance::null_instance()); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 | 1060 |
| 1061 DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { | 1061 DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { |
| 1062 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); | 1062 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0)); |
| 1063 return param.bound(); | 1063 return param.bound(); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 | 1066 |
| 1067 DEFINE_NATIVE_ENTRY(InstanceMirror_identityHash, 1) { | |
| 1068 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); | |
| 1069 ObjectStore* object_store = isolate->object_store(); | |
| 1070 const Class& cls = Class::Handle(isolate, object_store->object_class()); | |
| 1071 const Function& function = | |
| 1072 Function::Handle(isolate, cls.LookupDynamicFunction(Symbols::hashCode())); | |
| 1073 const Array& args = Array::Handle(isolate, Array::New(1)); | |
| 1074 args.SetAt(0, reflectee); | |
| 1075 return DartEntry::InvokeFunction(function, args); | |
| 1076 } | |
| 1077 | |
| 1078 | |
| 1079 DEFINE_NATIVE_ENTRY(InstanceMirror_invoke, 5) { | 1067 DEFINE_NATIVE_ENTRY(InstanceMirror_invoke, 5) { |
| 1080 // Argument 0 is the mirror, which is unused by the native. It exists | 1068 // Argument 0 is the mirror, which is unused by the native. It exists |
| 1081 // because this native is an instance method in order to be polymorphic | 1069 // because this native is an instance method in order to be polymorphic |
| 1082 // with its cousins. | 1070 // with its cousins. |
| 1083 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1)); | 1071 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1)); |
| 1084 GET_NON_NULL_NATIVE_ARGUMENT( | 1072 GET_NON_NULL_NATIVE_ARGUMENT( |
| 1085 String, function_name, arguments->NativeArgAt(2)); | 1073 String, function_name, arguments->NativeArgAt(2)); |
| 1086 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); | 1074 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); |
| 1087 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); | 1075 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); |
| 1088 | 1076 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 } | 1683 } |
| 1696 | 1684 |
| 1697 | 1685 |
| 1698 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1686 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
| 1699 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1687 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 1700 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1688 const Field& field = Field::Handle(ref.GetFieldReferent()); |
| 1701 return field.type(); | 1689 return field.type(); |
| 1702 } | 1690 } |
| 1703 | 1691 |
| 1704 } // namespace dart | 1692 } // namespace dart |
| OLD | NEW |