| 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/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
| 6 | 6 |
| 7 #include "vm/code_generator.h" | 7 #include "vm/code_generator.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 | 718 |
| 719 // Check the type argument vector 'arguments' against the corresponding bounds | 719 // Check the type argument vector 'arguments' against the corresponding bounds |
| 720 // of the type parameters of class 'cls' and, recursively, of its superclasses. | 720 // of the type parameters of class 'cls' and, recursively, of its superclasses. |
| 721 // Replace a type argument that cannot be checked at compile time by a | 721 // Replace a type argument that cannot be checked at compile time by a |
| 722 // BoundedType, thereby postponing the bound check to run time. | 722 // BoundedType, thereby postponing the bound check to run time. |
| 723 // Return a bound error if a type argument is not within bound at compile time. | 723 // Return a bound error if a type argument is not within bound at compile time. |
| 724 void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, | 724 void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, |
| 725 const TypeArguments& arguments, | 725 const TypeArguments& arguments, |
| 726 Error* bound_error) { | 726 Error* bound_error) { |
| 727 if (!cls.is_type_finalized()) { | 727 if (!cls.is_type_finalized()) { |
| 728 FinalizeTypeParameters(cls); |
| 728 FinalizeUpperBounds(cls); | 729 FinalizeUpperBounds(cls); |
| 729 } | 730 } |
| 730 // Note that when finalizing a type, we need to verify the bounds in both | 731 // Note that when finalizing a type, we need to verify the bounds in both |
| 731 // production mode and checked mode, because the finalized type may be written | 732 // production mode and checked mode, because the finalized type may be written |
| 732 // to a snapshot. It would be wrong to ignore bounds when generating the | 733 // to a snapshot. It would be wrong to ignore bounds when generating the |
| 733 // snapshot in production mode and then use the unchecked type in checked mode | 734 // snapshot in production mode and then use the unchecked type in checked mode |
| 734 // after reading it from the snapshot. | 735 // after reading it from the snapshot. |
| 735 // However, we do not immediately report a bound error, which would be wrong | 736 // However, we do not immediately report a bound error, which would be wrong |
| 736 // in production mode, but simply postpone the bound checking to runtime. | 737 // in production mode, but simply postpone the bound checking to runtime. |
| 737 const intptr_t num_type_params = cls.NumTypeParameters(); | 738 const intptr_t num_type_params = cls.NumTypeParameters(); |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 expected_name ^= String::New("_offset"); | 3029 expected_name ^= String::New("_offset"); |
| 3029 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3030 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 3030 field ^= fields_array.At(2); | 3031 field ^= fields_array.At(2); |
| 3031 ASSERT(field.Offset() == TypedDataView::length_offset()); | 3032 ASSERT(field.Offset() == TypedDataView::length_offset()); |
| 3032 name ^= field.name(); | 3033 name ^= field.name(); |
| 3033 ASSERT(name.Equals("length")); | 3034 ASSERT(name.Equals("length")); |
| 3034 #endif | 3035 #endif |
| 3035 } | 3036 } |
| 3036 | 3037 |
| 3037 } // namespace dart | 3038 } // namespace dart |
| OLD | NEW |