| 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 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 ASSERT(Array::Handle(cls.functions()).Length() == 0); | 2325 ASSERT(Array::Handle(cls.functions()).Length() == 0); |
| 2326 } | 2326 } |
| 2327 } | 2327 } |
| 2328 | 2328 |
| 2329 | 2329 |
| 2330 void ClassFinalizer::FinalizeClass(const Class& cls) { | 2330 void ClassFinalizer::FinalizeClass(const Class& cls) { |
| 2331 HANDLESCOPE(Isolate::Current()); | 2331 HANDLESCOPE(Isolate::Current()); |
| 2332 if (cls.is_finalized()) { | 2332 if (cls.is_finalized()) { |
| 2333 return; | 2333 return; |
| 2334 } | 2334 } |
| 2335 if (FLAG_trace_class_finalization) { |
| 2336 OS::Print("Finalize %s\n", cls.ToCString()); |
| 2337 } |
| 2335 if (cls.is_patch()) { | 2338 if (cls.is_patch()) { |
| 2336 // The fields and functions of a patch class are copied to the | 2339 // The fields and functions of a patch class are copied to the |
| 2337 // patched class after parsing. There is nothing to finalize. | 2340 // patched class after parsing. There is nothing to finalize. |
| 2338 ASSERT(Array::Handle(cls.functions()).Length() == 0); | 2341 ASSERT(Array::Handle(cls.functions()).Length() == 0); |
| 2339 ASSERT(Array::Handle(cls.fields()).Length() == 0); | 2342 ASSERT(Array::Handle(cls.fields()).Length() == 0); |
| 2340 cls.set_is_finalized(); | 2343 cls.set_is_finalized(); |
| 2341 return; | 2344 return; |
| 2342 } | 2345 } |
| 2343 if (FLAG_trace_class_finalization) { | |
| 2344 OS::Print("Finalize %s\n", cls.ToCString()); | |
| 2345 } | |
| 2346 if (cls.IsMixinApplication()) { | 2346 if (cls.IsMixinApplication()) { |
| 2347 // Copy instance methods and fields from the mixin class. | 2347 // Copy instance methods and fields from the mixin class. |
| 2348 // This has to happen before the check whether the methods of | 2348 // This has to happen before the check whether the methods of |
| 2349 // the class conflict with inherited methods. | 2349 // the class conflict with inherited methods. |
| 2350 ApplyMixinMembers(cls); | 2350 ApplyMixinMembers(cls); |
| 2351 } | 2351 } |
| 2352 // Ensure super class is finalized. | 2352 // Ensure super class is finalized. |
| 2353 const Class& super = Class::Handle(cls.SuperClass()); | 2353 const Class& super = Class::Handle(cls.SuperClass()); |
| 2354 if (!super.IsNull()) { | 2354 if (!super.IsNull()) { |
| 2355 FinalizeClass(super); | 2355 FinalizeClass(super); |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3184 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3184 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
| 3185 field ^= fields_array.At(0); | 3185 field ^= fields_array.At(0); |
| 3186 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3186 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
| 3187 name ^= field.name(); | 3187 name ^= field.name(); |
| 3188 expected_name ^= String::New("_data"); | 3188 expected_name ^= String::New("_data"); |
| 3189 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3189 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 3190 #endif | 3190 #endif |
| 3191 } | 3191 } |
| 3192 | 3192 |
| 3193 } // namespace dart | 3193 } // namespace dart |
| OLD | NEW |