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

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, 2 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 | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/parser.h » ('j') | 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) 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 const AbstractType& sup_type = AbstractType::Handle(super_type());
1760 ReusableHandleScope reused_handles(isolate);
1761 AbstractType& sup_type = reused_handles.AbstractTypeHandle();
1762 sup_type ^= super_type();
1763 return sup_type.type_class(); 1759 return sup_type.type_class();
1764 } 1760 }
1765 1761
1766 1762
1767 void Class::set_super_type(const AbstractType& value) const { 1763 void Class::set_super_type(const AbstractType& value) const {
1768 ASSERT(value.IsNull() || 1764 ASSERT(value.IsNull() ||
1769 value.IsType() || 1765 value.IsType() ||
1770 value.IsBoundedType() || 1766 value.IsBoundedType() ||
1771 value.IsMixinAppType()); 1767 value.IsMixinAppType());
1772 StorePointer(&raw_ptr()->super_type_, value.raw()); 1768 StorePointer(&raw_ptr()->super_type_, value.raw());
(...skipping 10101 matching lines...) Expand 10 before | Expand all | Expand 10 after
11874 JSONObject jsobj(stream); 11870 JSONObject jsobj(stream);
11875 } 11871 }
11876 11872
11877 11873
11878 RawAbstractType* MixinAppType::SuperType() const { 11874 RawAbstractType* MixinAppType::SuperType() const {
11879 return Class::Handle(MixinAppAt(0)).super_type(); 11875 return Class::Handle(MixinAppAt(0)).super_type();
11880 } 11876 }
11881 11877
11882 11878
11883 RawClass* MixinAppType::MixinAppAt(intptr_t depth) const { 11879 RawClass* MixinAppType::MixinAppAt(intptr_t depth) const {
11884 Class& mixin_app = Class::Handle(); 11880 return Class::RawCast(Array::Handle(mixins()).At(depth));
11885 mixin_app ^= Array::Handle(mixins()).At(depth);
11886 return mixin_app.raw();
11887 } 11881 }
11888 11882
11889 11883
11890 void MixinAppType::set_mixins(const Array& value) const { 11884 void MixinAppType::set_mixins(const Array& value) const {
11891 StorePointer(&raw_ptr()->mixins_, value.raw()); 11885 StorePointer(&raw_ptr()->mixins_, value.raw());
11892 } 11886 }
11893 11887
11894 11888
11895 RawMixinAppType* MixinAppType::New() { 11889 RawMixinAppType* MixinAppType::New() {
11896 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() != 11890 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() !=
(...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after
15122 return "_MirrorReference"; 15116 return "_MirrorReference";
15123 } 15117 }
15124 15118
15125 15119
15126 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15120 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15127 JSONObject jsobj(stream); 15121 JSONObject jsobj(stream);
15128 } 15122 }
15129 15123
15130 15124
15131 } // namespace dart 15125 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698