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

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

Issue 9195031: Add ByteArray interface and provide internal and external implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fewer templates Created 8 years, 11 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/snapshot.h" 10 #include "vm/snapshot.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 V(String) \ 52 V(String) \
53 V(OneByteString) \ 53 V(OneByteString) \
54 V(TwoByteString) \ 54 V(TwoByteString) \
55 V(FourByteString) \ 55 V(FourByteString) \
56 V(ExternalOneByteString) \ 56 V(ExternalOneByteString) \
57 V(ExternalTwoByteString) \ 57 V(ExternalTwoByteString) \
58 V(ExternalFourByteString) \ 58 V(ExternalFourByteString) \
59 V(Bool) \ 59 V(Bool) \
60 V(Array) \ 60 V(Array) \
61 V(ImmutableArray) \ 61 V(ImmutableArray) \
62 V(ByteBuffer) \ 62 V(ByteArray) \
63 V(InternalByteArray) \
64 V(ExternalByteArray) \
63 V(Closure) \ 65 V(Closure) \
64 V(Stacktrace) \ 66 V(Stacktrace) \
65 V(JSRegExp) \ 67 V(JSRegExp) \
66 68
67 #define CLASS_LIST(V) \ 69 #define CLASS_LIST(V) \
68 V(Object) \ 70 V(Object) \
69 CLASS_LIST_NO_OBJECT(V) 71 CLASS_LIST_NO_OBJECT(V)
70 72
71 73
72 // Forward declarations. 74 // Forward declarations.
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 }; 951 };
950 952
951 953
952 class RawImmutableArray : public RawArray { 954 class RawImmutableArray : public RawArray {
953 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); 955 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray);
954 956
955 friend class SnapshotReader; 957 friend class SnapshotReader;
956 }; 958 };
957 959
958 960
959 class RawByteBuffer : public RawInstance { 961 class RawByteArray : public RawInstance {
960 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteBuffer); 962 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray);
961 963
964 protected:
962 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 965 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
963 RawSmi* length_; 966 RawSmi* length_;
964 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 967 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
968 };
969
970
971 class RawInternalByteArray : public RawByteArray {
972 RAW_HEAP_OBJECT_IMPLEMENTATION(InternalByteArray);
973
974 // Variable length data follows here.
975 uint8_t* data() {
976 uword address_of_length = reinterpret_cast<uword>(&length_);
977 return reinterpret_cast<uint8_t*>(address_of_length + kWordSize);
978 }
979 };
980
981
982 class RawExternalByteArray : public RawByteArray {
983 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalByteArray);
984
965 uint8_t* data_; 985 uint8_t* data_;
966 }; 986 };
967 987
968 988
969 class RawClosure : public RawInstance { 989 class RawClosure : public RawInstance {
970 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); 990 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure);
971 991
972 RawObject** from() { 992 RawObject** from() {
973 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); 993 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_);
974 } 994 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 intptr_t type_; // Uninitialized, simple or complex. 1037 intptr_t type_; // Uninitialized, simple or complex.
1018 intptr_t flags_; // Represents global/local, case insensitive, multiline. 1038 intptr_t flags_; // Represents global/local, case insensitive, multiline.
1019 1039
1020 // Variable length data follows here. 1040 // Variable length data follows here.
1021 uint8_t data_[0]; 1041 uint8_t data_[0];
1022 }; 1042 };
1023 1043
1024 } // namespace dart 1044 } // namespace dart
1025 1045
1026 #endif // VM_RAW_OBJECT_H_ 1046 #endif // VM_RAW_OBJECT_H_
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698