OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 cls = object_store->double_class(); | 213 cls = object_store->double_class(); |
214 ASSERT(Double::InstanceSize() == cls.instance_size()); | 214 ASSERT(Double::InstanceSize() == cls.instance_size()); |
215 cls = object_store->bool_class(); | 215 cls = object_store->bool_class(); |
216 ASSERT(Bool::InstanceSize() == cls.instance_size()); | 216 ASSERT(Bool::InstanceSize() == cls.instance_size()); |
217 cls = object_store->array_class(); | 217 cls = object_store->array_class(); |
218 ASSERT(Array::InstanceSize() == cls.instance_size()); | 218 ASSERT(Array::InstanceSize() == cls.instance_size()); |
219 cls = object_store->immutable_array_class(); | 219 cls = object_store->immutable_array_class(); |
220 ASSERT(ImmutableArray::InstanceSize() == cls.instance_size()); | 220 ASSERT(ImmutableArray::InstanceSize() == cls.instance_size()); |
221 cls = object_store->uint8_array_class(); | 221 cls = object_store->uint8_array_class(); |
222 ASSERT(Uint8Array::InstanceSize() == cls.instance_size()); | 222 ASSERT(Uint8Array::InstanceSize() == cls.instance_size()); |
| 223 cls = object_store->uint8_clamped_array_class(); |
| 224 ASSERT(Uint8ClampedArray::InstanceSize() == cls.instance_size()); |
223 cls = object_store->int16_array_class(); | 225 cls = object_store->int16_array_class(); |
224 ASSERT(Int16Array::InstanceSize() == cls.instance_size()); | 226 ASSERT(Int16Array::InstanceSize() == cls.instance_size()); |
225 cls = object_store->uint16_array_class(); | 227 cls = object_store->uint16_array_class(); |
226 ASSERT(Uint16Array::InstanceSize() == cls.instance_size()); | 228 ASSERT(Uint16Array::InstanceSize() == cls.instance_size()); |
227 cls = object_store->int32_array_class(); | 229 cls = object_store->int32_array_class(); |
228 ASSERT(Int32Array::InstanceSize() == cls.instance_size()); | 230 ASSERT(Int32Array::InstanceSize() == cls.instance_size()); |
229 cls = object_store->uint32_array_class(); | 231 cls = object_store->uint32_array_class(); |
230 ASSERT(Uint32Array::InstanceSize() == cls.instance_size()); | 232 ASSERT(Uint32Array::InstanceSize() == cls.instance_size()); |
231 cls = object_store->int64_array_class(); | 233 cls = object_store->int64_array_class(); |
232 ASSERT(Int64Array::InstanceSize() == cls.instance_size()); | 234 ASSERT(Int64Array::InstanceSize() == cls.instance_size()); |
233 cls = object_store->uint64_array_class(); | 235 cls = object_store->uint64_array_class(); |
234 ASSERT(Uint64Array::InstanceSize() == cls.instance_size()); | 236 ASSERT(Uint64Array::InstanceSize() == cls.instance_size()); |
235 cls = object_store->float32_array_class(); | 237 cls = object_store->float32_array_class(); |
236 ASSERT(Float32Array::InstanceSize() == cls.instance_size()); | 238 ASSERT(Float32Array::InstanceSize() == cls.instance_size()); |
237 cls = object_store->float64_array_class(); | 239 cls = object_store->float64_array_class(); |
238 ASSERT(Float64Array::InstanceSize() == cls.instance_size()); | 240 ASSERT(Float64Array::InstanceSize() == cls.instance_size()); |
239 cls = object_store->external_int8_array_class(); | 241 cls = object_store->external_int8_array_class(); |
240 ASSERT(ExternalInt8Array::InstanceSize() == cls.instance_size()); | 242 ASSERT(ExternalInt8Array::InstanceSize() == cls.instance_size()); |
241 cls = object_store->external_uint8_array_class(); | 243 cls = object_store->external_uint8_clamped_array_class(); |
242 ASSERT(ExternalUint8Array::InstanceSize() == cls.instance_size()); | 244 ASSERT(ExternalUint8ClampedArray::InstanceSize() == cls.instance_size()); |
243 cls = object_store->external_int16_array_class(); | 245 cls = object_store->external_int16_array_class(); |
244 ASSERT(ExternalInt16Array::InstanceSize() == cls.instance_size()); | 246 ASSERT(ExternalInt16Array::InstanceSize() == cls.instance_size()); |
245 cls = object_store->external_uint16_array_class(); | 247 cls = object_store->external_uint16_array_class(); |
246 ASSERT(ExternalUint16Array::InstanceSize() == cls.instance_size()); | 248 ASSERT(ExternalUint16Array::InstanceSize() == cls.instance_size()); |
247 cls = object_store->external_int32_array_class(); | 249 cls = object_store->external_int32_array_class(); |
248 ASSERT(ExternalInt32Array::InstanceSize() == cls.instance_size()); | 250 ASSERT(ExternalInt32Array::InstanceSize() == cls.instance_size()); |
249 cls = object_store->external_uint32_array_class(); | 251 cls = object_store->external_uint32_array_class(); |
250 ASSERT(ExternalUint32Array::InstanceSize() == cls.instance_size()); | 252 ASSERT(ExternalUint32Array::InstanceSize() == cls.instance_size()); |
251 cls = object_store->external_int64_array_class(); | 253 cls = object_store->external_int64_array_class(); |
252 ASSERT(ExternalInt64Array::InstanceSize() == cls.instance_size()); | 254 ASSERT(ExternalInt64Array::InstanceSize() == cls.instance_size()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 316 } |
315 Type& super_type = Type::Handle(cls.super_type()); | 317 Type& super_type = Type::Handle(cls.super_type()); |
316 if (super_type.IsNull()) { | 318 if (super_type.IsNull()) { |
317 return; | 319 return; |
318 } | 320 } |
319 // Resolve failures lead to a longjmp. | 321 // Resolve failures lead to a longjmp. |
320 ResolveType(cls, super_type, kCanonicalizeWellFormed); | 322 ResolveType(cls, super_type, kCanonicalizeWellFormed); |
321 const Class& super_class = Class::Handle(super_type.type_class()); | 323 const Class& super_class = Class::Handle(super_type.type_class()); |
322 // If cls belongs to core lib or to core lib's implementation, restrictions | 324 // If cls belongs to core lib or to core lib's implementation, restrictions |
323 // about allowed interfaces are lifted. | 325 // about allowed interfaces are lifted. |
324 if (cls.library() != Library::CoreLibrary()) { | 326 if ((cls.library() != Library::CoreLibrary())) { |
325 // Prevent extending core implementation classes. | 327 // Prevent extending core implementation classes. |
326 bool is_error = false; | 328 bool is_error = false; |
327 switch (super_class.id()) { | 329 switch (super_class.id()) { |
328 case kNumberCid: | 330 case kNumberCid: |
329 case kIntegerCid: | 331 case kIntegerCid: |
330 case kSmiCid: | 332 case kSmiCid: |
331 case kMintCid: | 333 case kMintCid: |
332 case kBigintCid: | 334 case kBigintCid: |
333 case kDoubleCid: | 335 case kDoubleCid: |
334 case kOneByteStringCid: | 336 case kOneByteStringCid: |
335 case kTwoByteStringCid: | 337 case kTwoByteStringCid: |
336 case kExternalOneByteStringCid: | 338 case kExternalOneByteStringCid: |
337 case kExternalTwoByteStringCid: | 339 case kExternalTwoByteStringCid: |
338 case kBoolCid: | 340 case kBoolCid: |
339 case kArrayCid: | 341 case kArrayCid: |
340 case kImmutableArrayCid: | 342 case kImmutableArrayCid: |
341 case kGrowableObjectArrayCid: | 343 case kGrowableObjectArrayCid: |
342 case kInt8ArrayCid: | 344 case kInt8ArrayCid: |
343 case kExternalInt8ArrayCid: | 345 case kExternalInt8ArrayCid: |
344 case kUint8ArrayCid: | 346 case kUint8ArrayCid: |
| 347 case kUint8ClampedArrayCid: |
345 case kExternalUint8ArrayCid: | 348 case kExternalUint8ArrayCid: |
| 349 case kExternalUint8ClampedArrayCid: |
346 case kInt16ArrayCid: | 350 case kInt16ArrayCid: |
347 case kExternalInt16ArrayCid: | 351 case kExternalInt16ArrayCid: |
348 case kUint16ArrayCid: | 352 case kUint16ArrayCid: |
349 case kExternalUint16ArrayCid: | 353 case kExternalUint16ArrayCid: |
350 case kInt32ArrayCid: | 354 case kInt32ArrayCid: |
351 case kExternalInt32ArrayCid: | 355 case kExternalInt32ArrayCid: |
352 case kUint32ArrayCid: | 356 case kUint32ArrayCid: |
353 case kExternalUint32ArrayCid: | 357 case kExternalUint32ArrayCid: |
354 case kInt64ArrayCid: | 358 case kInt64ArrayCid: |
355 case kExternalInt64ArrayCid: | 359 case kExternalInt64ArrayCid: |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 void ClassFinalizer::ReportError(const char* format, ...) { | 1583 void ClassFinalizer::ReportError(const char* format, ...) { |
1580 va_list args; | 1584 va_list args; |
1581 va_start(args, format); | 1585 va_start(args, format); |
1582 const Error& error = Error::Handle( | 1586 const Error& error = Error::Handle( |
1583 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1587 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
1584 va_end(args); | 1588 va_end(args); |
1585 ReportError(error); | 1589 ReportError(error); |
1586 } | 1590 } |
1587 | 1591 |
1588 } // namespace dart | 1592 } // namespace dart |
OLD | NEW |