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

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

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/raw_object.h" 5 #include "vm/raw_object.h"
6 6
7 #include "vm/class_table.h" 7 #include "vm/class_table.h"
8 #include "vm/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 instance_size = OneByteString::InstanceSize(string_length); 94 instance_size = OneByteString::InstanceSize(string_length);
95 break; 95 break;
96 } 96 }
97 case kTwoByteStringCid: { 97 case kTwoByteStringCid: {
98 const RawTwoByteString* raw_string = 98 const RawTwoByteString* raw_string =
99 reinterpret_cast<const RawTwoByteString*>(this); 99 reinterpret_cast<const RawTwoByteString*>(this);
100 intptr_t string_length = Smi::Value(raw_string->ptr()->length_); 100 intptr_t string_length = Smi::Value(raw_string->ptr()->length_);
101 instance_size = TwoByteString::InstanceSize(string_length); 101 instance_size = TwoByteString::InstanceSize(string_length);
102 break; 102 break;
103 } 103 }
104 case kFourByteStringCid: {
105 const RawFourByteString* raw_string =
106 reinterpret_cast<const RawFourByteString*>(this);
107 intptr_t string_length = Smi::Value(raw_string->ptr()->length_);
108 instance_size = FourByteString::InstanceSize(string_length);
109 break;
110 }
111 case kArrayCid: 104 case kArrayCid:
112 case kImmutableArrayCid: { 105 case kImmutableArrayCid: {
113 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this); 106 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this);
114 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); 107 intptr_t array_length = Smi::Value(raw_array->ptr()->length_);
115 instance_size = Array::InstanceSize(array_length); 108 instance_size = Array::InstanceSize(array_length);
116 break; 109 break;
117 } 110 }
118 case kInt8ArrayCid: { 111 case kInt8ArrayCid: {
119 const RawInt8Array* raw_byte_array = 112 const RawInt8Array* raw_byte_array =
120 reinterpret_cast<const RawInt8Array*>(this); 113 reinterpret_cast<const RawInt8Array*>(this);
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 674
682 675
683 intptr_t RawTwoByteString::VisitTwoByteStringPointers( 676 intptr_t RawTwoByteString::VisitTwoByteStringPointers(
684 RawTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { 677 RawTwoByteString* raw_obj, ObjectPointerVisitor* visitor) {
685 intptr_t length = Smi::Value(raw_obj->ptr()->length_); 678 intptr_t length = Smi::Value(raw_obj->ptr()->length_);
686 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 679 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
687 return TwoByteString::InstanceSize(length); 680 return TwoByteString::InstanceSize(length);
688 } 681 }
689 682
690 683
691 intptr_t RawFourByteString::VisitFourByteStringPointers(
692 RawFourByteString* raw_obj, ObjectPointerVisitor* visitor) {
693 intptr_t length = Smi::Value(raw_obj->ptr()->length_);
694 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
695 return FourByteString::InstanceSize(length);
696 }
697
698
699 intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers( 684 intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers(
700 RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) { 685 RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) {
701 // Make sure that we got here with the tagged pointer as this. 686 // Make sure that we got here with the tagged pointer as this.
702 ASSERT(raw_obj->IsHeapObject()); 687 ASSERT(raw_obj->IsHeapObject());
703 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 688 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
704 return ExternalOneByteString::InstanceSize(); 689 return ExternalOneByteString::InstanceSize();
705 } 690 }
706 691
707 692
708 intptr_t RawExternalTwoByteString::VisitExternalTwoByteStringPointers( 693 intptr_t RawExternalTwoByteString::VisitExternalTwoByteStringPointers(
709 RawExternalTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { 694 RawExternalTwoByteString* raw_obj, ObjectPointerVisitor* visitor) {
710 // Make sure that we got here with the tagged pointer as this. 695 // Make sure that we got here with the tagged pointer as this.
711 ASSERT(raw_obj->IsHeapObject()); 696 ASSERT(raw_obj->IsHeapObject());
712 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 697 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
713 return ExternalTwoByteString::InstanceSize(); 698 return ExternalTwoByteString::InstanceSize();
714 } 699 }
715 700
716 701
717 intptr_t RawExternalFourByteString::VisitExternalFourByteStringPointers(
718 RawExternalFourByteString* raw_obj, ObjectPointerVisitor* visitor) {
719 // Make sure that we got here with the tagged pointer as this.
720 ASSERT(raw_obj->IsHeapObject());
721 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
722 return ExternalFourByteString::InstanceSize();
723 }
724
725
726 intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj, 702 intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj,
727 ObjectPointerVisitor* visitor) { 703 ObjectPointerVisitor* visitor) {
728 // Make sure that we got here with the tagged pointer as this. 704 // Make sure that we got here with the tagged pointer as this.
729 ASSERT(raw_obj->IsHeapObject()); 705 ASSERT(raw_obj->IsHeapObject());
730 return Bool::InstanceSize(); 706 return Bool::InstanceSize();
731 } 707 }
732 708
733 709
734 intptr_t RawArray::VisitArrayPointers(RawArray* raw_obj, 710 intptr_t RawArray::VisitArrayPointers(RawArray* raw_obj,
735 ObjectPointerVisitor* visitor) { 711 ObjectPointerVisitor* visitor) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 955
980 intptr_t RawWeakProperty::VisitWeakPropertyPointers( 956 intptr_t RawWeakProperty::VisitWeakPropertyPointers(
981 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { 957 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) {
982 // Make sure that we got here with the tagged pointer as this. 958 // Make sure that we got here with the tagged pointer as this.
983 ASSERT(raw_obj->IsHeapObject()); 959 ASSERT(raw_obj->IsHeapObject());
984 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 960 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
985 return WeakProperty::InstanceSize(); 961 return WeakProperty::InstanceSize();
986 } 962 }
987 963
988 } // namespace dart 964 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698