Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 828353002: Patch classes do not need to be finalized (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 ASSERT(Array::Handle(cls.functions()).Length() == 0); 2299 ASSERT(Array::Handle(cls.functions()).Length() == 0);
2300 } 2300 }
2301 } 2301 }
2302 2302
2303 2303
2304 void ClassFinalizer::FinalizeClass(const Class& cls) { 2304 void ClassFinalizer::FinalizeClass(const Class& cls) {
2305 HANDLESCOPE(Isolate::Current()); 2305 HANDLESCOPE(Isolate::Current());
2306 if (cls.is_finalized()) { 2306 if (cls.is_finalized()) {
2307 return; 2307 return;
2308 } 2308 }
2309 if (cls.is_patch()) {
2310 // The fields and functions of a patch class are copied to the
2311 // patched class after parsing. There is nothing to finalize.
Ivan Posva 2015/01/03 01:14:19 We should also make sure that we do not waste a cl
hausner 2015/01/05 20:56:29 As per our off-line conversation, I'm leaving this
2312 ASSERT(Array::Handle(cls.functions()).Length() == 0);
2313 ASSERT(Array::Handle(cls.fields()).Length() == 0);
2314 cls.set_is_finalized();
2315 return;
2316 }
2309 if (FLAG_trace_class_finalization) { 2317 if (FLAG_trace_class_finalization) {
2310 OS::Print("Finalize %s\n", cls.ToCString()); 2318 OS::Print("Finalize %s\n", cls.ToCString());
2311 } 2319 }
2312 if (cls.IsMixinApplication()) { 2320 if (cls.IsMixinApplication()) {
2313 // Copy instance methods and fields from the mixin class. 2321 // Copy instance methods and fields from the mixin class.
2314 // This has to happen before the check whether the methods of 2322 // This has to happen before the check whether the methods of
2315 // the class conflict with inherited methods. 2323 // the class conflict with inherited methods.
2316 ApplyMixinMembers(cls); 2324 ApplyMixinMembers(cls);
2317 } 2325 }
2318 // Ensure super class is finalized. 2326 // Ensure super class is finalized.
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
3150 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3158 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3151 field ^= fields_array.At(0); 3159 field ^= fields_array.At(0);
3152 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3160 ASSERT(field.Offset() == ByteBuffer::data_offset());
3153 name ^= field.name(); 3161 name ^= field.name();
3154 expected_name ^= String::New("_data"); 3162 expected_name ^= String::New("_data");
3155 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3163 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3156 #endif 3164 #endif
3157 } 3165 }
3158 3166
3159 } // namespace dart 3167 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698