| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 // Return value: true or false, or may throw a type error in checked mode. | 442 // Return value: true or false, or may throw a type error in checked mode. |
| 443 DEFINE_RUNTIME_ENTRY(Instanceof, 4) { | 443 DEFINE_RUNTIME_ENTRY(Instanceof, 4) { |
| 444 const Instance& instance = Instance::CheckedHandle(zone, arguments.ArgAt(0)); | 444 const Instance& instance = Instance::CheckedHandle(zone, arguments.ArgAt(0)); |
| 445 const AbstractType& type = | 445 const AbstractType& type = |
| 446 AbstractType::CheckedHandle(zone, arguments.ArgAt(1)); | 446 AbstractType::CheckedHandle(zone, arguments.ArgAt(1)); |
| 447 const TypeArguments& instantiator_type_arguments = | 447 const TypeArguments& instantiator_type_arguments = |
| 448 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2)); | 448 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2)); |
| 449 const SubtypeTestCache& cache = | 449 const SubtypeTestCache& cache = |
| 450 SubtypeTestCache::CheckedHandle(zone, arguments.ArgAt(3)); | 450 SubtypeTestCache::CheckedHandle(zone, arguments.ArgAt(3)); |
| 451 ASSERT(type.IsFinalized()); | 451 ASSERT(type.IsFinalized()); |
| 452 ASSERT(!type.IsDynamicType()); // No need to check assignment. | |
| 453 ASSERT(!type.IsMalformed()); // Already checked in code generator. | 452 ASSERT(!type.IsMalformed()); // Already checked in code generator. |
| 454 ASSERT(!type.IsMalbounded()); // Already checked in code generator. | 453 ASSERT(!type.IsMalbounded()); // Already checked in code generator. |
| 454 ASSERT(!type.IsDynamicType()); // No need to check assignment. |
| 455 Error& bound_error = Error::Handle(zone); | 455 Error& bound_error = Error::Handle(zone); |
| 456 const Bool& result = | 456 const Bool& result = |
| 457 Bool::Get(instance.IsInstanceOf(type, | 457 Bool::Get(instance.IsInstanceOf(type, |
| 458 instantiator_type_arguments, | 458 instantiator_type_arguments, |
| 459 &bound_error)); | 459 &bound_error)); |
| 460 if (FLAG_trace_type_checks) { | 460 if (FLAG_trace_type_checks) { |
| 461 PrintTypeCheck("InstanceOf", | 461 PrintTypeCheck("InstanceOf", |
| 462 instance, type, instantiator_type_arguments, result); | 462 instance, type, instantiator_type_arguments, result); |
| 463 } | 463 } |
| 464 if (!result.value() && !bound_error.IsNull()) { | 464 if (!result.value() && !bound_error.IsNull()) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 488 DEFINE_RUNTIME_ENTRY(TypeCheck, 5) { | 488 DEFINE_RUNTIME_ENTRY(TypeCheck, 5) { |
| 489 const Instance& src_instance = | 489 const Instance& src_instance = |
| 490 Instance::CheckedHandle(zone, arguments.ArgAt(0)); | 490 Instance::CheckedHandle(zone, arguments.ArgAt(0)); |
| 491 AbstractType& dst_type = | 491 AbstractType& dst_type = |
| 492 AbstractType::CheckedHandle(zone, arguments.ArgAt(1)); | 492 AbstractType::CheckedHandle(zone, arguments.ArgAt(1)); |
| 493 const TypeArguments& instantiator_type_arguments = | 493 const TypeArguments& instantiator_type_arguments = |
| 494 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2)); | 494 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2)); |
| 495 const String& dst_name = String::CheckedHandle(zone, arguments.ArgAt(3)); | 495 const String& dst_name = String::CheckedHandle(zone, arguments.ArgAt(3)); |
| 496 const SubtypeTestCache& cache = | 496 const SubtypeTestCache& cache = |
| 497 SubtypeTestCache::CheckedHandle(zone, arguments.ArgAt(4)); | 497 SubtypeTestCache::CheckedHandle(zone, arguments.ArgAt(4)); |
| 498 ASSERT(!dst_type.IsDynamicType()); // No need to check assignment. | |
| 499 ASSERT(!dst_type.IsMalformed()); // Already checked in code generator. | 498 ASSERT(!dst_type.IsMalformed()); // Already checked in code generator. |
| 500 ASSERT(!dst_type.IsMalbounded()); // Already checked in code generator. | 499 ASSERT(!dst_type.IsMalbounded()); // Already checked in code generator. |
| 500 ASSERT(!dst_type.IsDynamicType()); // No need to check assignment. |
| 501 ASSERT(!src_instance.IsNull()); // Already checked in inlined code. | 501 ASSERT(!src_instance.IsNull()); // Already checked in inlined code. |
| 502 | 502 |
| 503 Error& bound_error = Error::Handle(zone); | 503 Error& bound_error = Error::Handle(zone); |
| 504 const bool is_instance_of = src_instance.IsInstanceOf( | 504 const bool is_instance_of = src_instance.IsInstanceOf( |
| 505 dst_type, instantiator_type_arguments, &bound_error); | 505 dst_type, instantiator_type_arguments, &bound_error); |
| 506 | 506 |
| 507 if (FLAG_trace_type_checks) { | 507 if (FLAG_trace_type_checks) { |
| 508 PrintTypeCheck("TypeCheck", | 508 PrintTypeCheck("TypeCheck", |
| 509 src_instance, dst_type, instantiator_type_arguments, | 509 src_instance, dst_type, instantiator_type_arguments, |
| 510 Bool::Get(is_instance_of)); | 510 Bool::Get(is_instance_of)); |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1850 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1851 const TypedData& new_data = | 1851 const TypedData& new_data = |
| 1852 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1852 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1853 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1853 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1854 typed_data_cell.SetAt(0, new_data); | 1854 typed_data_cell.SetAt(0, new_data); |
| 1855 arguments.SetReturn(new_data); | 1855 arguments.SetReturn(new_data); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 | 1858 |
| 1859 } // namespace dart | 1859 } // namespace dart |
| OLD | NEW |