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/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/hash_table.h" | 8 #include "vm/hash_table.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 const Function& getter = Function::Handle( | 1624 const Function& getter = Function::Handle( |
1625 zone, Function::New( | 1625 zone, Function::New( |
1626 getter_name, RawFunction::kImplicitStaticFinalGetter, | 1626 getter_name, RawFunction::kImplicitStaticFinalGetter, |
1627 /* is_static = */ true, | 1627 /* is_static = */ true, |
1628 /* is_const = */ field.is_const(), | 1628 /* is_const = */ field.is_const(), |
1629 /* is_abstract = */ false, | 1629 /* is_abstract = */ false, |
1630 /* is_external = */ false, | 1630 /* is_external = */ false, |
1631 /* is_native = */ false, cls, field.token_pos())); | 1631 /* is_native = */ false, cls, field.token_pos())); |
1632 getter.set_result_type(type); | 1632 getter.set_result_type(type); |
1633 getter.set_is_debuggable(false); | 1633 getter.set_is_debuggable(false); |
1634 getter.set_kernel_function(field.kernel_field()); | 1634 getter.set_kernel_offset(field.kernel_offset()); |
1635 cls.AddFunction(getter); | 1635 cls.AddFunction(getter); |
1636 field.SetStaticValue(Object::sentinel(), true); | 1636 field.SetStaticValue(Object::sentinel(), true); |
1637 } | 1637 } |
1638 } | 1638 } |
1639 } | 1639 } |
1640 } | 1640 } |
1641 // If we check for bad overrides, collect interfaces, super interfaces, and | 1641 // If we check for bad overrides, collect interfaces, super interfaces, and |
1642 // super classes of this class. | 1642 // super classes of this class. |
1643 GrowableArray<const Class*> interfaces(zone, 4); | 1643 GrowableArray<const Class*> interfaces(zone, 4); |
1644 if (Isolate::Current()->error_on_bad_override()) { | 1644 if (Isolate::Current()->error_on_bad_override()) { |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 // But the Kernel frontend will generate mixin classes with only | 2382 // But the Kernel frontend will generate mixin classes with only |
2383 // constructors inside them, which forward to the base class constructors. | 2383 // constructors inside them, which forward to the base class constructors. |
2384 // | 2384 // |
2385 // => We generate the constructors if they are not already there. | 2385 // => We generate the constructors if they are not already there. |
2386 functions = cls.functions(); | 2386 functions = cls.functions(); |
2387 if (functions.Length() == 0) { | 2387 if (functions.Length() == 0) { |
2388 CreateForwardingConstructors(cls, mixin_cls, cloned_funcs); | 2388 CreateForwardingConstructors(cls, mixin_cls, cloned_funcs); |
2389 } else { | 2389 } else { |
2390 for (intptr_t i = 0; i < functions.Length(); i++) { | 2390 for (intptr_t i = 0; i < functions.Length(); i++) { |
2391 func ^= functions.At(i); | 2391 func ^= functions.At(i); |
2392 ASSERT(func.kernel_function() != 0); | 2392 ASSERT(func.kernel_offset() > 0); |
2393 cloned_funcs.Add(func); | 2393 cloned_funcs.Add(func); |
2394 } | 2394 } |
2395 } | 2395 } |
2396 | 2396 |
2397 // Now clone the functions from the mixin class. | 2397 // Now clone the functions from the mixin class. |
2398 functions = mixin_cls.functions(); | 2398 functions = mixin_cls.functions(); |
2399 const intptr_t num_functions = functions.Length(); | 2399 const intptr_t num_functions = functions.Length(); |
2400 for (intptr_t i = 0; i < num_functions; i++) { | 2400 for (intptr_t i = 0; i < num_functions; i++) { |
2401 func ^= functions.At(i); | 2401 func ^= functions.At(i); |
2402 if (func.IsGenerativeConstructor()) { | 2402 if (func.IsGenerativeConstructor()) { |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 ProgramVisitor::VisitFunctions(&function_visitor); | 3800 ProgramVisitor::VisitFunctions(&function_visitor); |
3801 | 3801 |
3802 class ClearCodeClassVisitor : public ClassVisitor { | 3802 class ClearCodeClassVisitor : public ClassVisitor { |
3803 void Visit(const Class& cls) { cls.DisableAllocationStub(); } | 3803 void Visit(const Class& cls) { cls.DisableAllocationStub(); } |
3804 }; | 3804 }; |
3805 ClearCodeClassVisitor class_visitor; | 3805 ClearCodeClassVisitor class_visitor; |
3806 ProgramVisitor::VisitClasses(&class_visitor); | 3806 ProgramVisitor::VisitClasses(&class_visitor); |
3807 } | 3807 } |
3808 | 3808 |
3809 } // namespace dart | 3809 } // namespace dart |
OLD | NEW |