| 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 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3041 } | 3041 } |
| 3042 | 3042 |
| 3043 // Either report an error or mark the type as malformed. | 3043 // Either report an error or mark the type as malformed. |
| 3044 void ClassFinalizer::MarkTypeMalformed(const Error& prev_error, | 3044 void ClassFinalizer::MarkTypeMalformed(const Error& prev_error, |
| 3045 const Script& script, | 3045 const Script& script, |
| 3046 const Type& type, | 3046 const Type& type, |
| 3047 const char* format, | 3047 const char* format, |
| 3048 va_list args) { | 3048 va_list args) { |
| 3049 LanguageError& error = LanguageError::Handle( | 3049 LanguageError& error = LanguageError::Handle( |
| 3050 LanguageError::NewFormattedV( | 3050 LanguageError::NewFormattedV( |
| 3051 prev_error, script, type.token_pos(), | 3051 prev_error, script, type.token_pos(), Report::AtLocation, |
| 3052 Report::kMalformedType, Heap::kOld, | 3052 Report::kMalformedType, Heap::kOld, |
| 3053 format, args)); | 3053 format, args)); |
| 3054 if (Isolate::Current()->flags().error_on_bad_type()) { | 3054 if (Isolate::Current()->flags().error_on_bad_type()) { |
| 3055 ReportError(error); | 3055 ReportError(error); |
| 3056 } | 3056 } |
| 3057 type.set_error(error); | 3057 type.set_error(error); |
| 3058 // Make the type raw, since it may not be possible to | 3058 // Make the type raw, since it may not be possible to |
| 3059 // properly finalize its type arguments. | 3059 // properly finalize its type arguments. |
| 3060 type.set_type_class(Class::Handle(Object::dynamic_class())); | 3060 type.set_type_class(Class::Handle(Object::dynamic_class())); |
| 3061 type.set_arguments(Object::null_type_arguments()); | 3061 type.set_arguments(Object::null_type_arguments()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3102 | 3102 |
| 3103 | 3103 |
| 3104 void ClassFinalizer::FinalizeMalboundedType(const Error& prev_error, | 3104 void ClassFinalizer::FinalizeMalboundedType(const Error& prev_error, |
| 3105 const Script& script, | 3105 const Script& script, |
| 3106 const Type& type, | 3106 const Type& type, |
| 3107 const char* format, ...) { | 3107 const char* format, ...) { |
| 3108 va_list args; | 3108 va_list args; |
| 3109 va_start(args, format); | 3109 va_start(args, format); |
| 3110 LanguageError& error = LanguageError::Handle( | 3110 LanguageError& error = LanguageError::Handle( |
| 3111 LanguageError::NewFormattedV( | 3111 LanguageError::NewFormattedV( |
| 3112 prev_error, script, type.token_pos(), | 3112 prev_error, script, type.token_pos(), Report::AtLocation, |
| 3113 Report::kMalboundedType, Heap::kOld, | 3113 Report::kMalboundedType, Heap::kOld, |
| 3114 format, args)); | 3114 format, args)); |
| 3115 va_end(args); | 3115 va_end(args); |
| 3116 if (Isolate::Current()->flags().error_on_bad_type()) { | 3116 if (Isolate::Current()->flags().error_on_bad_type()) { |
| 3117 ReportError(error); | 3117 ReportError(error); |
| 3118 } | 3118 } |
| 3119 type.set_error(error); | 3119 type.set_error(error); |
| 3120 if (!type.IsFinalized()) { | 3120 if (!type.IsFinalized()) { |
| 3121 type.SetIsFinalized(); | 3121 type.SetIsFinalized(); |
| 3122 // Do not canonicalize malbounded types. | 3122 // Do not canonicalize malbounded types. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3142 UNREACHABLE(); | 3142 UNREACHABLE(); |
| 3143 } | 3143 } |
| 3144 | 3144 |
| 3145 | 3145 |
| 3146 void ClassFinalizer::ReportError(const Class& cls, | 3146 void ClassFinalizer::ReportError(const Class& cls, |
| 3147 intptr_t token_pos, | 3147 intptr_t token_pos, |
| 3148 const char* format, ...) { | 3148 const char* format, ...) { |
| 3149 va_list args; | 3149 va_list args; |
| 3150 va_start(args, format); | 3150 va_start(args, format); |
| 3151 const Script& script = Script::Handle(cls.script()); | 3151 const Script& script = Script::Handle(cls.script()); |
| 3152 Report::MessageV(Report::kError, script, token_pos, format, args); | 3152 Report::MessageV(Report::kError, |
| 3153 script, token_pos, Report::AtLocation, format, args); |
| 3153 va_end(args); | 3154 va_end(args); |
| 3154 UNREACHABLE(); | 3155 UNREACHABLE(); |
| 3155 } | 3156 } |
| 3156 | 3157 |
| 3157 | 3158 |
| 3158 void ClassFinalizer::VerifyImplicitFieldOffsets() { | 3159 void ClassFinalizer::VerifyImplicitFieldOffsets() { |
| 3159 #ifdef DEBUG | 3160 #ifdef DEBUG |
| 3160 Thread* thread = Thread::Current(); | 3161 Thread* thread = Thread::Current(); |
| 3161 Isolate* isolate = thread->isolate(); | 3162 Isolate* isolate = thread->isolate(); |
| 3162 Zone* zone = thread->zone(); | 3163 Zone* zone = thread->zone(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3223 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3224 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
| 3224 field ^= fields_array.At(0); | 3225 field ^= fields_array.At(0); |
| 3225 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3226 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
| 3226 name ^= field.name(); | 3227 name ^= field.name(); |
| 3227 expected_name ^= String::New("_data"); | 3228 expected_name ^= String::New("_data"); |
| 3228 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3229 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 3229 #endif | 3230 #endif |
| 3230 } | 3231 } |
| 3231 | 3232 |
| 3232 } // namespace dart | 3233 } // namespace dart |
| OLD | NEW |