| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 GET_NON_NULL_NATIVE_ARGUMENT(Instance, func_args, arguments->NativeArgAt(4)); | 75 GET_NON_NULL_NATIVE_ARGUMENT(Instance, func_args, arguments->NativeArgAt(4)); |
| 76 GET_NON_NULL_NATIVE_ARGUMENT(Instance, func_named_args, | 76 GET_NON_NULL_NATIVE_ARGUMENT(Instance, func_named_args, |
| 77 arguments->NativeArgAt(5)); | 77 arguments->NativeArgAt(5)); |
| 78 const Array& dart_arguments = Array::Handle(Array::New(6)); | 78 const Array& dart_arguments = Array::Handle(Array::New(6)); |
| 79 dart_arguments.SetAt(0, instance); | 79 dart_arguments.SetAt(0, instance); |
| 80 dart_arguments.SetAt(1, member_name); | 80 dart_arguments.SetAt(1, member_name); |
| 81 dart_arguments.SetAt(2, invocation_type); | 81 dart_arguments.SetAt(2, invocation_type); |
| 82 dart_arguments.SetAt(3, func_args); | 82 dart_arguments.SetAt(3, func_args); |
| 83 dart_arguments.SetAt(4, func_named_args); | 83 dart_arguments.SetAt(4, func_named_args); |
| 84 | 84 |
| 85 if (is_method.value() && | 85 if (is_method.value()) { |
| 86 (((invocation_type.Value() >> InvocationMirror::kCallShift) & | |
| 87 InvocationMirror::kCallMask) != InvocationMirror::kSuper)) { | |
| 88 // Report if a function with same name (but different arguments) has been | 86 // Report if a function with same name (but different arguments) has been |
| 89 // found. | 87 // found. |
| 90 Function& function = Function::Handle(); | 88 Function& function = Function::Handle(); |
| 91 if (instance.IsClosure()) { | 89 if (instance.IsClosure()) { |
| 92 function = Closure::Cast(instance).function(); | 90 function = Closure::Cast(instance).function(); |
| 93 } else { | 91 } else { |
| 94 Class& instance_class = Class::Handle(instance.clazz()); | 92 Class& instance_class = Class::Handle(instance.clazz()); |
| 95 function = instance_class.LookupDynamicFunction(member_name); | 93 const bool is_super_call = |
| 94 ((invocation_type.Value() >> InvocationMirror::kCallShift) & |
| 95 InvocationMirror::kCallMask) == InvocationMirror::kSuper; |
| 96 if (!is_super_call) { |
| 97 function = instance_class.LookupDynamicFunction(member_name); |
| 98 } |
| 96 while (function.IsNull()) { | 99 while (function.IsNull()) { |
| 97 instance_class = instance_class.SuperClass(); | 100 instance_class = instance_class.SuperClass(); |
| 98 if (instance_class.IsNull()) break; | 101 if (instance_class.IsNull()) break; |
| 99 function = instance_class.LookupDynamicFunction(member_name); | 102 function = instance_class.LookupDynamicFunction(member_name); |
| 100 } | 103 } |
| 101 } | 104 } |
| 102 if (!function.IsNull()) { | 105 if (!function.IsNull()) { |
| 103 const intptr_t total_num_parameters = function.NumParameters(); | 106 const intptr_t total_num_parameters = function.NumParameters(); |
| 104 const Array& array = Array::Handle(Array::New(total_num_parameters - 1)); | 107 const Array& array = Array::Handle(Array::New(total_num_parameters - 1)); |
| 105 // Skip receiver. | 108 // Skip receiver. |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 405 |
| 403 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { | 406 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { |
| 404 #if defined(ARCH_IS_64_BIT) | 407 #if defined(ARCH_IS_64_BIT) |
| 405 return Bool::True().raw(); | 408 return Bool::True().raw(); |
| 406 #else | 409 #else |
| 407 return Bool::False().raw(); | 410 return Bool::False().raw(); |
| 408 #endif // defined(ARCH_IS_64_BIT) | 411 #endif // defined(ARCH_IS_64_BIT) |
| 409 } | 412 } |
| 410 | 413 |
| 411 } // namespace dart | 414 } // namespace dart |
| OLD | NEW |