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

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

Issue 23619026: Simplify VM internal representation of a mixin application clause (MixinAppType (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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('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 11575 matching lines...) Expand 10 before | Expand all | Expand 10 after
11586 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); 11586 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr);
11587 return chars; 11587 return chars;
11588 } 11588 }
11589 11589
11590 11590
11591 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { 11591 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const {
11592 JSONObject jsobj(stream); 11592 JSONObject jsobj(stream);
11593 } 11593 }
11594 11594
11595 11595
11596 intptr_t MixinAppType::token_pos() const {
11597 return Class::Handle(MixinAppAt(0)).token_pos();
11598 }
11599
11600
11601 intptr_t MixinAppType::Depth() const {
11602 const Array& mixin_apps = Array::Handle(mixins());
11603 return mixin_apps.Length();
11604 }
11605
11606
11596 RawString* MixinAppType::Name() const { 11607 RawString* MixinAppType::Name() const {
11597 return String::New("MixinApplication"); 11608 return String::New("MixinAppType");
11598 } 11609 }
11599 11610
11600 11611
11601 const char* MixinAppType::ToCString() const { 11612 const char* MixinAppType::ToCString() const {
11602 return "MixinAppType"; 11613 const char* format = "MixinAppType: super type: %s; first mixin app: %s";
11614 const char* super_type_cstr = String::Handle(AbstractType::Handle(
11615 SuperType()).Name()).ToCString();
11616 const char* first_mixin_app_cstr = String::Handle(Class::Handle(
11617 MixinAppAt(0)).Name()).ToCString();
11618 intptr_t len = OS::SNPrint(
11619 NULL, 0, format, super_type_cstr, first_mixin_app_cstr) + 1;
11620 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
11621 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_app_cstr);
11622 return chars;
11603 } 11623 }
11604 11624
11605 11625
11606 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { 11626 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const {
11607 JSONObject jsobj(stream); 11627 JSONObject jsobj(stream);
11608 } 11628 }
11609 11629
11610 11630
11611 void MixinAppType::set_super_type(const AbstractType& value) const { 11631 RawAbstractType* MixinAppType::SuperType() const {
11612 StorePointer(&raw_ptr()->super_type_, value.raw()); 11632 return Class::Handle(MixinAppAt(0)).super_type();
11613 } 11633 }
11614 11634
11615 11635
11616 void MixinAppType::set_mixin_types(const Array& value) const { 11636 RawClass* MixinAppType::MixinAppAt(intptr_t depth) const {
11617 StorePointer(&raw_ptr()->mixin_types_, value.raw()); 11637 Class& mixin_app = Class::Handle();
11638 mixin_app ^= Array::Handle(mixins()).At(depth);
11639 return mixin_app.raw();
11640 }
11641
11642
11643 void MixinAppType::set_mixins(const Array& value) const {
11644 StorePointer(&raw_ptr()->mixins_, value.raw());
11618 } 11645 }
11619 11646
11620 11647
11621 RawMixinAppType* MixinAppType::New() { 11648 RawMixinAppType* MixinAppType::New() {
11622 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() != 11649 ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() !=
11623 Class::null()); 11650 Class::null());
11624 // MixinAppType objects do not survive finalization, so allocate 11651 // MixinAppType objects do not survive finalization, so allocate
11625 // on new heap. 11652 // on new heap.
11626 RawObject* raw = Object::Allocate(MixinAppType::kClassId, 11653 RawObject* raw = Object::Allocate(MixinAppType::kClassId,
11627 MixinAppType::InstanceSize(), 11654 MixinAppType::InstanceSize(),
11628 Heap::kNew); 11655 Heap::kNew);
11629 return reinterpret_cast<RawMixinAppType*>(raw); 11656 return reinterpret_cast<RawMixinAppType*>(raw);
11630 } 11657 }
11631 11658
11632 11659
11633 RawMixinAppType* MixinAppType::New(const AbstractType& super_type, 11660 RawMixinAppType* MixinAppType::New(const Array& mixins) {
11634 const Array& mixin_types) {
11635 const MixinAppType& result = MixinAppType::Handle(MixinAppType::New()); 11661 const MixinAppType& result = MixinAppType::Handle(MixinAppType::New());
11636 result.set_super_type(super_type); 11662 result.set_mixins(mixins);
11637 result.set_mixin_types(mixin_types);
11638 return result.raw(); 11663 return result.raw();
11639 } 11664 }
11640 11665
11641 11666
11642 const char* Number::ToCString() const { 11667 const char* Number::ToCString() const {
11643 // Number is an interface. No instances of Number should exist. 11668 // Number is an interface. No instances of Number should exist.
11644 UNREACHABLE(); 11669 UNREACHABLE();
11645 return "Number"; 11670 return "Number";
11646 } 11671 }
11647 11672
(...skipping 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after
14850 return "_MirrorReference"; 14875 return "_MirrorReference";
14851 } 14876 }
14852 14877
14853 14878
14854 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14879 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14855 JSONObject jsobj(stream); 14880 JSONObject jsobj(stream);
14856 } 14881 }
14857 14882
14858 14883
14859 } // namespace dart 14884 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698