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 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2420 } | 2420 } |
2421 // A top level class is parsed eagerly so just finalize it. | 2421 // A top level class is parsed eagerly so just finalize it. |
2422 if (cls.IsTopLevel()) { | 2422 if (cls.IsTopLevel()) { |
2423 FinalizeClass(cls); | 2423 FinalizeClass(cls); |
2424 } else { | 2424 } else { |
2425 // This class should not contain any functions or user-defined fields yet, | 2425 // This class should not contain any functions or user-defined fields yet, |
2426 // because it has not been compiled yet. There may however be metadata | 2426 // because it has not been compiled yet. There may however be metadata |
2427 // fields because type parameters are parsed before the class body. Since | 2427 // fields because type parameters are parsed before the class body. Since |
2428 // 'ResolveAndFinalizeMemberTypes(cls)' has not been called yet, unfinalized | 2428 // 'ResolveAndFinalizeMemberTypes(cls)' has not been called yet, unfinalized |
2429 // member types could choke the snapshotter. | 2429 // member types could choke the snapshotter. |
2430 ASSERT(Array::Handle(cls.functions()).Length() == 0); | 2430 // or if the class is being refinalized because a patch is being applied |
regis
2016/03/31 18:16:49
or -> Or
siva
2016/03/31 23:48:08
Done.
| |
2431 // after the class has been finalized then it is ok for the class to have | |
2432 // functions. | |
2433 ASSERT((Array::Handle(cls.functions()).Length() == 0) || | |
2434 cls.is_refinalize()); | |
2431 } | 2435 } |
2432 } | 2436 } |
2433 | 2437 |
2434 | 2438 |
2435 void ClassFinalizer::FinalizeClass(const Class& cls) { | 2439 void ClassFinalizer::FinalizeClass(const Class& cls) { |
2436 Thread* thread = Thread::Current(); | 2440 Thread* thread = Thread::Current(); |
2437 HANDLESCOPE(thread); | 2441 HANDLESCOPE(thread); |
2438 ASSERT(cls.is_type_finalized()); | 2442 ASSERT(cls.is_type_finalized()); |
2439 if (cls.is_finalized()) { | 2443 if (cls.is_finalized()) { |
2440 return; | 2444 return; |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3305 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3309 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
3306 field ^= fields_array.At(0); | 3310 field ^= fields_array.At(0); |
3307 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3311 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
3308 name ^= field.name(); | 3312 name ^= field.name(); |
3309 expected_name ^= String::New("_data"); | 3313 expected_name ^= String::New("_data"); |
3310 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3314 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
3311 #endif | 3315 #endif |
3312 } | 3316 } |
3313 | 3317 |
3314 } // namespace dart | 3318 } // namespace dart |
OLD | NEW |