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

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
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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 }; 990 };
990 991
991 992
992 class RawImmutableArray : public RawArray { 993 class RawImmutableArray : public RawArray {
993 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); 994 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray);
994 995
995 friend class SnapshotReader; 996 friend class SnapshotReader;
996 }; 997 };
997 998
998 999
1000 class RawGrowableObjectArray : public RawInstance {
1001 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray);
1002
1003 RawObject** from() {
1004 return reinterpret_cast<RawObject**>(&ptr()->data_);
1005 }
1006 RawArray* data_;
1007 RawObject** to() {
1008 return reinterpret_cast<RawObject**>(&ptr()->data_);
1009 }
1010
1011 intptr_t capacity_;
cshapiro 2012/03/06 00:56:31 I am not sure why we need a separate capacity_ mem
siva 2012/03/06 23:32:33 Removed the capacity_ field and made length_ a Smi
1012 intptr_t length_;
1013
1014 friend class SnapshotReader;
1015 };
1016
1017
999 class RawByteArray : public RawInstance { 1018 class RawByteArray : public RawInstance {
1000 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray); 1019 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray);
1001 1020
1002 protected: 1021 protected:
1003 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1022 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1004 RawSmi* length_; 1023 RawSmi* length_;
1005 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1024 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1006 }; 1025 };
1007 1026
1008 1027
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 RawString* target_name_; // Name of target function. 1139 RawString* target_name_; // Name of target function.
1121 RawArray* ic_data_; // Contains test classes and target function. 1140 RawArray* ic_data_; // Contains test classes and target function.
1122 intptr_t id_; // Parser node id corresponding to this IC. 1141 intptr_t id_; // Parser node id corresponding to this IC.
1123 intptr_t num_args_tested_; // Number of arguments tested in IC. 1142 intptr_t num_args_tested_; // Number of arguments tested in IC.
1124 }; 1143 };
1125 1144
1126 1145
1127 } // namespace dart 1146 } // namespace dart
1128 1147
1129 #endif // VM_RAW_OBJECT_H_ 1148 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698