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

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

Issue 24397002: Support mixin application typedef as mixin in the VM (issues 9383, 12773). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
OLDNEW
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 !signature_fun.HasInstantiatedSignature()) { 1721 !signature_fun.HasInstantiatedSignature()) {
1722 cls = signature_fun.Owner(); 1722 cls = signature_fun.Owner();
1723 } 1723 }
1724 } 1724 }
1725 // Calling NumTypeParameters() on a mixin application class will setup the 1725 // Calling NumTypeParameters() on a mixin application class will setup the
1726 // type parameters if not already done. 1726 // type parameters if not already done.
1727 if (cls.NumTypeParameters() > 0) { 1727 if (cls.NumTypeParameters() > 0) {
1728 type_params ^= cls.type_parameters(); 1728 type_params ^= cls.type_parameters();
1729 num_type_args += type_params.Length(); 1729 num_type_args += type_params.Length();
1730 } 1730 }
1731
1732 // Super type of Object class is null. 1731 // Super type of Object class is null.
1733 if (cls.super_type() == AbstractType::null() || 1732 if (cls.super_type() == AbstractType::null() ||
1734 cls.super_type() == isolate->object_store()->object_type()) { 1733 cls.super_type() == isolate->object_store()->object_type()) {
1735 break; 1734 break;
1736 } 1735 }
1737 sup_type ^= cls.super_type(); 1736 sup_type ^= cls.super_type();
1738 cls = sup_type.type_class(); 1737 cls = sup_type.type_class();
1739 } while (true); 1738 } while (true);
1740 return num_type_args; 1739 return num_type_args;
1741 } 1740 }
1742 1741
1743 1742
1744 bool Class::HasTypeArguments() const { 1743 bool Class::HasTypeArguments() const {
1745 if (!IsSignatureClass() && (is_finalized() || is_prefinalized())) { 1744 if (!IsSignatureClass() && (is_finalized() || is_prefinalized())) {
1746 // More efficient than calling NumTypeArguments(). 1745 // More efficient than calling NumTypeArguments().
1747 return type_arguments_field_offset() != kNoTypeArguments; 1746 return type_arguments_field_offset() != kNoTypeArguments;
1748 } else { 1747 } else {
1749 // No need to check NumTypeArguments() if class has type parameters. 1748 // No need to check NumTypeArguments() if class has type parameters.
1750 return (NumTypeParameters() > 0) || (NumTypeArguments() > 0); 1749 return (NumTypeParameters() > 0) || (NumTypeArguments() > 0);
1751 } 1750 }
1752 } 1751 }
1753 1752
1754 1753
1755 RawClass* Class::SuperClass() const { 1754 RawClass* Class::SuperClass() const {
1756 if (super_type() == AbstractType::null()) { 1755 if (super_type() == AbstractType::null()) {
1757 return Class::null(); 1756 return Class::null();
1758 } 1757 }
1759 Isolate* isolate = Isolate::Current(); 1758 AbstractType& sup_type = AbstractType::Handle();
hausner 2013/09/24 00:15:35 const?
regis 2013/09/24 00:23:42 Done.
1760 ReusableHandleScope reused_handles(isolate);
1761 AbstractType& sup_type = reused_handles.AbstractTypeHandle();
1762 sup_type ^= super_type(); 1759 sup_type ^= super_type();
1763 return sup_type.type_class(); 1760 return sup_type.type_class();
1764 } 1761 }
1765 1762
1766 1763
1767 void Class::set_super_type(const AbstractType& value) const { 1764 void Class::set_super_type(const AbstractType& value) const {
1768 ASSERT(value.IsNull() || 1765 ASSERT(value.IsNull() ||
1769 value.IsType() || 1766 value.IsType() ||
1770 value.IsBoundedType() || 1767 value.IsBoundedType() ||
1771 value.IsMixinAppType()); 1768 value.IsMixinAppType());
(...skipping 10058 matching lines...) Expand 10 before | Expand all | Expand 10 after
11830 JSONObject jsobj(stream); 11827 JSONObject jsobj(stream);
11831 } 11828 }
11832 11829
11833 11830
11834 RawAbstractType* MixinAppType::SuperType() const { 11831 RawAbstractType* MixinAppType::SuperType() const {
11835 return Class::Handle(MixinAppAt(0)).super_type(); 11832 return Class::Handle(MixinAppAt(0)).super_type();
11836 } 11833 }
11837 11834
11838 11835
11839 RawClass* MixinAppType::MixinAppAt(intptr_t depth) const { 11836 RawClass* MixinAppType::MixinAppAt(intptr_t depth) const {
11840 Class& mixin_app = Class::Handle(); 11837 return Class::RawCast(Array::Handle(mixins()).At(depth));
11841 mixin_app ^= Array::Handle(mixins()).At(depth);
11842 return mixin_app.raw();
11843 } 11838 }
11844 11839
11845 11840
11846 void MixinAppType::set_mixins(const Array& value) const { 11841 void MixinAppType::set_mixins(const Array& value) const {
11847 StorePointer(&raw_ptr()->mixins_, value.raw()); 11842 StorePointer(&raw_ptr()->mixins_, value.raw());
11848 } 11843 }
11849 11844
11850 11845
11851 RawMixinAppType* MixinAppType::New() { 11846 RawMixinAppType* MixinAppType::New() {
11852 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() != 11847 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() !=
(...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after
15078 return "_MirrorReference"; 15073 return "_MirrorReference";
15079 } 15074 }
15080 15075
15081 15076
15082 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15077 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15083 JSONObject jsobj(stream); 15078 JSONObject jsobj(stream);
15084 } 15079 }
15085 15080
15086 15081
15087 } // namespace dart 15082 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698