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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 const Instance& instance = | 304 const Instance& instance = |
305 Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); | 305 Instance::CheckedHandle(zone, arguments->NativeArgAt(0)); |
306 const TypeArguments& instantiator_type_arguments = | 306 const TypeArguments& instantiator_type_arguments = |
307 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1)); | 307 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1)); |
308 AbstractType& type = | 308 AbstractType& type = |
309 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2)); | 309 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2)); |
310 ASSERT(type.IsFinalized()); | 310 ASSERT(type.IsFinalized()); |
311 ASSERT(!type.IsMalformed()); | 311 ASSERT(!type.IsMalformed()); |
312 ASSERT(!type.IsMalbounded()); | 312 ASSERT(!type.IsMalbounded()); |
313 Error& bound_error = Error::Handle(zone); | 313 Error& bound_error = Error::Handle(zone); |
314 if (instance.IsNull()) { | |
315 return instance.raw(); | |
316 } | |
317 const bool is_instance_of = | 314 const bool is_instance_of = |
| 315 instance.IsNull() || |
318 instance.IsInstanceOf(type, instantiator_type_arguments, &bound_error); | 316 instance.IsInstanceOf(type, instantiator_type_arguments, &bound_error); |
319 if (FLAG_trace_type_checks) { | 317 if (FLAG_trace_type_checks) { |
320 const char* result_str = is_instance_of ? "true" : "false"; | 318 const char* result_str = is_instance_of ? "true" : "false"; |
321 OS::Print("Object.as: result %s\n", result_str); | 319 OS::Print("Object.as: result %s\n", result_str); |
322 const AbstractType& instance_type = | 320 const AbstractType& instance_type = |
323 AbstractType::Handle(zone, instance.GetType(Heap::kNew)); | 321 AbstractType::Handle(zone, instance.GetType(Heap::kNew)); |
324 OS::Print(" instance type: %s\n", | 322 OS::Print(" instance type: %s\n", |
325 String::Handle(zone, instance_type.Name()).ToCString()); | 323 String::Handle(zone, instance_type.Name()).ToCString()); |
326 OS::Print(" cast type: %s\n", | 324 OS::Print(" cast type: %s\n", |
327 String::Handle(zone, type.Name()).ToCString()); | 325 String::Handle(zone, type.Name()).ToCString()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 402 |
405 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { | 403 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { |
406 #if defined(ARCH_IS_64_BIT) | 404 #if defined(ARCH_IS_64_BIT) |
407 return Bool::True().raw(); | 405 return Bool::True().raw(); |
408 #else | 406 #else |
409 return Bool::False().raw(); | 407 return Bool::False().raw(); |
410 #endif // defined(ARCH_IS_64_BIT) | 408 #endif // defined(ARCH_IS_64_BIT) |
411 } | 409 } |
412 | 410 |
413 } // namespace dart | 411 } // namespace dart |
OLD | NEW |