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

Side by Side Diff: vm/raw_object.h

Issue 9594028: Add a first class GrowableObjectArray type in the VM and use it internally in the VM at all spots w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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 | « vm/parser.cc ('k') | vm/raw_object.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 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 V(String) \ 54 V(String) \
55 V(OneByteString) \ 55 V(OneByteString) \
56 V(TwoByteString) \ 56 V(TwoByteString) \
57 V(FourByteString) \ 57 V(FourByteString) \
58 V(ExternalOneByteString) \ 58 V(ExternalOneByteString) \
59 V(ExternalTwoByteString) \ 59 V(ExternalTwoByteString) \
60 V(ExternalFourByteString) \ 60 V(ExternalFourByteString) \
61 V(Bool) \ 61 V(Bool) \
62 V(Array) \ 62 V(Array) \
63 V(ImmutableArray) \ 63 V(ImmutableArray) \
64 V(GrowableObjectArray) \
64 V(ByteArray) \ 65 V(ByteArray) \
65 V(InternalByteArray) \ 66 V(InternalByteArray) \
66 V(ExternalByteArray) \ 67 V(ExternalByteArray) \
67 V(Closure) \ 68 V(Closure) \
68 V(Stacktrace) \ 69 V(Stacktrace) \
69 V(JSRegExp) \ 70 V(JSRegExp) \
70 V(ICData) \ 71 V(ICData) \
71 72
72 #define CLASS_LIST(V) \ 73 #define CLASS_LIST(V) \
73 V(Object) \ 74 V(Object) \
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 RawObject** data() { 980 RawObject** data() {
980 uword address_of_length = reinterpret_cast<uword>(&length_); 981 uword address_of_length = reinterpret_cast<uword>(&length_);
981 return reinterpret_cast<RawObject**>(address_of_length + kWordSize); 982 return reinterpret_cast<RawObject**>(address_of_length + kWordSize);
982 } 983 }
983 RawObject** to(intptr_t length) { 984 RawObject** to(intptr_t length) {
984 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]); 985 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]);
985 } 986 }
986 987
987 friend class RawImmutableArray; 988 friend class RawImmutableArray;
988 friend class SnapshotReader; 989 friend class SnapshotReader;
990 friend class GrowableObjectArray;
989 }; 991 };
990 992
991 993
992 class RawImmutableArray : public RawArray { 994 class RawImmutableArray : public RawArray {
993 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); 995 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray);
994 996
995 friend class SnapshotReader; 997 friend class SnapshotReader;
996 }; 998 };
997 999
998 1000
1001 class RawGrowableObjectArray : public RawInstance {
1002 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray);
1003
1004 RawObject** from() {
1005 return reinterpret_cast<RawObject**>(&ptr()->data_);
1006 }
1007 RawSmi* length_;
1008 RawArray* data_;
1009 RawObject** to() {
1010 return reinterpret_cast<RawObject**>(&ptr()->data_);
1011 }
1012
1013 friend class SnapshotReader;
1014 };
1015
1016
999 class RawByteArray : public RawInstance { 1017 class RawByteArray : public RawInstance {
1000 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray); 1018 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray);
1001 1019
1002 protected: 1020 protected:
1003 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1021 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1004 RawSmi* length_; 1022 RawSmi* length_;
1005 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1023 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1006 }; 1024 };
1007 1025
1008 1026
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 RawString* target_name_; // Name of target function. 1138 RawString* target_name_; // Name of target function.
1121 RawArray* ic_data_; // Contains test classes and target function. 1139 RawArray* ic_data_; // Contains test classes and target function.
1122 intptr_t id_; // Parser node id corresponding to this IC. 1140 intptr_t id_; // Parser node id corresponding to this IC.
1123 intptr_t num_args_tested_; // Number of arguments tested in IC. 1141 intptr_t num_args_tested_; // Number of arguments tested in IC.
1124 }; 1142 };
1125 1143
1126 1144
1127 } // namespace dart 1145 } // namespace dart
1128 1146
1129 #endif // VM_RAW_OBJECT_H_ 1147 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/parser.cc ('k') | vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698