| 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/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); | 99 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); |
| 100 return Object::null(); | 100 return Object::null(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { | 104 DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { |
| 105 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 105 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 106 // Special handling for following types outside this native. | 106 // Special handling for following types outside this native. |
| 107 ASSERT(!instance.IsString() && !instance.IsInteger() && !instance.IsDouble()); | 107 ASSERT(!instance.IsString() && !instance.IsInteger() && !instance.IsDouble()); |
| 108 const Type& type = Type::Handle(instance.GetType()); | 108 return instance.GetType(); |
| 109 // The static type of null is specified to be the bottom type, however, the | |
| 110 // runtime type of null is the Null type, which we correctly return here. | |
| 111 return type.Canonicalize(); | |
| 112 } | 109 } |
| 113 | 110 |
| 114 | 111 |
| 115 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { | 112 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { |
| 116 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 113 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 117 // Instantiator at position 1 is not used. It is passed along so that the call | 114 // Instantiator at position 1 is not used. It is passed along so that the call |
| 118 // can be easily converted to an optimized implementation. Instantiator is | 115 // can be easily converted to an optimized implementation. Instantiator is |
| 119 // used to populate the subtype cache. | 116 // used to populate the subtype cache. |
| 120 const AbstractTypeArguments& instantiator_type_arguments = | 117 const AbstractTypeArguments& instantiator_type_arguments = |
| 121 AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(2)); | 118 AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(2)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 224 } |
| 228 | 225 |
| 229 | 226 |
| 230 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { | 227 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { |
| 231 const AbstractType& type = | 228 const AbstractType& type = |
| 232 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); | 229 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); |
| 233 return type.UserVisibleName(); | 230 return type.UserVisibleName(); |
| 234 } | 231 } |
| 235 | 232 |
| 236 } // namespace dart | 233 } // namespace dart |
| OLD | NEW |