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

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

Issue 333773006: Removes open arrays (e.g. data[0]) from raw objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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.cc ('k') | runtime/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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 private: \ 216 private: \
217 RAW_OBJECT_IMPLEMENTATION(object); \ 217 RAW_OBJECT_IMPLEMENTATION(object); \
218 Raw##object* ptr() const { \ 218 Raw##object* ptr() const { \
219 ASSERT(IsHeapObject()); \ 219 ASSERT(IsHeapObject()); \
220 return reinterpret_cast<Raw##object*>( \ 220 return reinterpret_cast<Raw##object*>( \
221 reinterpret_cast<uword>(this) - kHeapObjectTag); \ 221 reinterpret_cast<uword>(this) - kHeapObjectTag); \
222 } \ 222 } \
223 SNAPSHOT_WRITER_SUPPORT() \ 223 SNAPSHOT_WRITER_SUPPORT() \
224 HEAP_PROFILER_SUPPORT() \ 224 HEAP_PROFILER_SUPPORT() \
225 225
226 #define OPEN_ARRAY_START(type, align) \
227 do { \
228 const uword result = reinterpret_cast<uword>(this) + sizeof(*this); \
229 ASSERT(Utils::IsAligned(result, sizeof(align))); \
230 return reinterpret_cast<type*>(result); \
231 } while (0)
226 232
227 // RawObject is the base class of all raw objects, even though it carries the 233 // RawObject is the base class of all raw objects, even though it carries the
228 // class_ field not all raw objects are allocated in the heap and thus cannot 234 // class_ field not all raw objects are allocated in the heap and thus cannot
229 // be dereferenced (e.g. RawSmi). 235 // be dereferenced (e.g. RawSmi).
230 class RawObject { 236 class RawObject {
231 public: 237 public:
232 // The tags field which is a part of the object header uses the following 238 // The tags field which is a part of the object header uses the following
233 // bit fields for storing tags. 239 // bit fields for storing tags.
234 enum TagBits { 240 enum TagBits {
235 kWatchedBit = 0, 241 kWatchedBit = 0,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); 557 return reinterpret_cast<RawObject**>(&ptr()->instantiations_);
552 } 558 }
553 // The instantiations_ array remains empty for instantiated type arguments. 559 // The instantiations_ array remains empty for instantiated type arguments.
554 RawArray* instantiations_; // Array of paired canonical vectors: 560 RawArray* instantiations_; // Array of paired canonical vectors:
555 // Even index: instantiator. 561 // Even index: instantiator.
556 // Odd index: instantiated (without bound error). 562 // Odd index: instantiated (without bound error).
557 // Instantiations leading to bound errors do not get cached. 563 // Instantiations leading to bound errors do not get cached.
558 RawSmi* length_; 564 RawSmi* length_;
559 565
560 // Variable length data follows here. 566 // Variable length data follows here.
561 RawAbstractType* types_[0]; 567 RawAbstractType** types() {
568 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*);
569 }
562 RawObject** to(intptr_t length) { 570 RawObject** to(intptr_t length) {
563 return reinterpret_cast<RawObject**>(&ptr()->types_[length - 1]); 571 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]);
564 } 572 }
565 573
566 friend class SnapshotReader; 574 friend class SnapshotReader;
567 }; 575 };
568 576
569 577
570 class RawPatchClass : public RawObject { 578 class RawPatchClass : public RawObject {
571 private: 579 private:
572 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); 580 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass);
573 581
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 // Alive: If true, the embedded object pointers will be visited during GC. 856 // Alive: If true, the embedded object pointers will be visited during GC.
849 // This field cannot be shorter because of alignment issues on x64 857 // This field cannot be shorter because of alignment issues on x64
850 // architectures. 858 // architectures.
851 intptr_t state_bits_; // state, is_optimized, is_alive. 859 intptr_t state_bits_; // state, is_optimized, is_alive.
852 860
853 // PC offsets for code patching. 861 // PC offsets for code patching.
854 intptr_t entry_patch_pc_offset_; 862 intptr_t entry_patch_pc_offset_;
855 intptr_t patch_code_pc_offset_; 863 intptr_t patch_code_pc_offset_;
856 intptr_t lazy_deopt_pc_offset_; 864 intptr_t lazy_deopt_pc_offset_;
857 865
858 intptr_t dummy_alignment_;
859
860 // Variable length data follows here. 866 // Variable length data follows here.
861 int32_t data_[0]; 867 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); }
862 868
863 friend class StackFrame; 869 friend class StackFrame;
864 friend class MarkingVisitor; 870 friend class MarkingVisitor;
865 friend class Function; 871 friend class Function;
866 }; 872 };
867 873
868 874
869 class RawInstructions : public RawObject { 875 class RawInstructions : public RawObject {
870 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); 876 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions);
871 877
872 RawObject** from() { 878 RawObject** from() {
873 return reinterpret_cast<RawObject**>(&ptr()->code_); 879 return reinterpret_cast<RawObject**>(&ptr()->code_);
874 } 880 }
875 RawCode* code_; 881 RawCode* code_;
876 RawArray* object_pool_; 882 RawArray* object_pool_;
877 RawObject** to() { 883 RawObject** to() {
878 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); 884 return reinterpret_cast<RawObject**>(&ptr()->object_pool_);
879 } 885 }
880 intptr_t size_; 886 intptr_t size_;
881 887
882 // Variable length data follows here. 888 // Variable length data follows here.
883 uint8_t data_[0]; 889 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
884 890
885 // Private helper function used while visiting stack frames. The 891 // Private helper function used while visiting stack frames. The
886 // code which iterates over dart frames is also called during GC and 892 // code which iterates over dart frames is also called during GC and
887 // is not allowed to create handles. 893 // is not allowed to create handles.
888 static bool ContainsPC(RawObject* raw_obj, uword pc); 894 static bool ContainsPC(RawObject* raw_obj, uword pc);
889 895
890 friend class RawCode; 896 friend class RawCode;
891 friend class Code; 897 friend class Code;
892 friend class StackFrame; 898 friend class StackFrame;
893 friend class MarkingVisitor; 899 friend class MarkingVisitor;
894 friend class Function; 900 friend class Function;
895 }; 901 };
896 902
897 903
898 class RawPcDescriptors : public RawObject { 904 class RawPcDescriptors : public RawObject {
899 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); 905 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
900 906
901 intptr_t length_; // Number of descriptors. 907 intptr_t length_; // Number of descriptors.
902 908
903 // Variable length data follows here. 909 // Variable length data follows here.
904 intptr_t data_[0]; 910 intptr_t* data() { OPEN_ARRAY_START(intptr_t, intptr_t); }
905 911
906 friend class Object; 912 friend class Object;
907 }; 913 };
908 914
909 915
910 // Stackmap is an immutable representation of the layout of the stack at a 916 // Stackmap is an immutable representation of the layout of the stack at a
911 // PC. The stack map representation consists of a bit map which marks each 917 // PC. The stack map representation consists of a bit map which marks each
912 // live object index starting from the base of the frame. 918 // live object index starting from the base of the frame.
913 // 919 //
914 // The Stackmap also consists of a link to the code object corresponding to 920 // The Stackmap also consists of a link to the code object corresponding to
915 // the frame which the stack map is describing. The bit map representation 921 // the frame which the stack map is describing. The bit map representation
916 // is optimized for dense and small bit maps, without any upper bound. 922 // is optimized for dense and small bit maps, without any upper bound.
917 class RawStackmap : public RawObject { 923 class RawStackmap : public RawObject {
918 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap); 924 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap);
919 925
920 // TODO(kmillikin): We need a small number of bits to encode the register 926 // TODO(kmillikin): We need a small number of bits to encode the register
921 // count. Consider packing them in with the length. 927 // count. Consider packing them in with the length.
922 intptr_t length_; // Length of payload, in bits. 928 intptr_t length_; // Length of payload, in bits.
923 intptr_t register_bit_count_; // Live register bits, included in length_. 929 intptr_t register_bit_count_; // Live register bits, included in length_.
924 930
925 uword pc_; // PC corresponding to this stack map representation. 931 uword pc_; // PC corresponding to this stack map representation.
926 932
927 // Variable length data follows here (bitmap of the stack layout). 933 // Variable length data follows here (bitmap of the stack layout).
928 uint8_t data_[0]; 934 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
929 }; 935 };
930 936
931 937
932 class RawLocalVarDescriptors : public RawObject { 938 class RawLocalVarDescriptors : public RawObject {
933 public: 939 public:
934 enum VarInfoKind { 940 enum VarInfoKind {
935 kStackVar = 1, 941 kStackVar = 1,
936 kContextVar, 942 kContextVar,
937 kContextLevel, 943 kContextLevel,
938 kSavedEntryContext, 944 kSavedEntryContext,
939 kSavedCurrentContext 945 kSavedCurrentContext
940 }; 946 };
941 947
942 struct VarInfo { 948 struct VarInfo {
943 intptr_t index; // Slot index on stack or in context. 949 intptr_t index; // Slot index on stack or in context.
944 int8_t kind; // Entry kind of type VarInfoKind. 950 int8_t kind; // Entry kind of type VarInfoKind.
945 int16_t scope_id; // Scope to which the variable belongs. 951 int16_t scope_id; // Scope to which the variable belongs.
946 intptr_t begin_pos; // Token position of scope start. 952 intptr_t begin_pos; // Token position of scope start.
947 intptr_t end_pos; // Token position of scope end. 953 intptr_t end_pos; // Token position of scope end.
948 }; 954 };
949 955
950 private: 956 private:
951 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); 957 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors);
952 intptr_t length_; // Number of descriptors. 958 intptr_t length_; // Number of descriptors.
953 RawArray* names_; // Array of [length_] variable names. 959 RawArray* names_; // Array of [length_] variable names.
954 960
955 VarInfo data_[0]; // Variable info with [length_] entries. 961 // Variable info with [length_] entries.
962 VarInfo* data() { OPEN_ARRAY_START(VarInfo, intptr_t); }
956 }; 963 };
957 964
958 965
959 class RawExceptionHandlers : public RawObject { 966 class RawExceptionHandlers : public RawObject {
960 public: 967 public:
961 // The index into the ExceptionHandlers table corresponds to 968 // The index into the ExceptionHandlers table corresponds to
962 // the try_index of the handler. 969 // the try_index of the handler.
963 struct HandlerInfo { 970 struct HandlerInfo {
964 intptr_t handler_pc; // PC value of handler. 971 intptr_t handler_pc; // PC value of handler.
965 int16_t outer_try_index; // Try block index of enclosing try block. 972 int16_t outer_try_index; // Try block index of enclosing try block.
966 int8_t needs_stacktrace; // True if a stacktrace is needed. 973 int8_t needs_stacktrace; // True if a stacktrace is needed.
967 int8_t has_catch_all; // Catches all exceptions. 974 int8_t has_catch_all; // Catches all exceptions.
968 }; 975 };
976
969 private: 977 private:
970 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); 978 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers);
971 979
972 // Number of exception handler entries. 980 // Number of exception handler entries.
973 intptr_t length_; 981 intptr_t length_;
974 982
975 // Array with [length_] entries. Each entry is an array of all handled 983 // Array with [length_] entries. Each entry is an array of all handled
976 // exception types. 984 // exception types.
977 RawArray* handled_types_data_; 985 RawArray* handled_types_data_;
978 986
979 // Exception handler info of length [length_]. 987 // Exception handler info of length [length_].
980 HandlerInfo data_[0]; 988 HandlerInfo* data() { OPEN_ARRAY_START(HandlerInfo, intptr_t); }
981 }; 989 };
982 990
983 991
984 // Contains an array of deoptimization commands, e.g., move a specific register 992 // Contains an array of deoptimization commands, e.g., move a specific register
985 // into a specific slot of unoptimized frame. 993 // into a specific slot of unoptimized frame.
986 class RawDeoptInfo : public RawObject { 994 class RawDeoptInfo : public RawObject {
987 RAW_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo); 995 RAW_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo);
988 996
989 RawSmi* length_; // Number of deoptimization commands 997 RawSmi* length_; // Number of deoptimization commands
990 998
991 // Variable length data follows here. 999 // Variable length data follows here.
992 intptr_t data_[0]; 1000 intptr_t* data() { OPEN_ARRAY_START(intptr_t, intptr_t); }
993 }; 1001 };
994 1002
995 1003
996 class RawContext : public RawObject { 1004 class RawContext : public RawObject {
997 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); 1005 RAW_HEAP_OBJECT_IMPLEMENTATION(Context);
998 1006
999 intptr_t num_variables_; 1007 intptr_t num_variables_;
1000 Isolate* isolate_; 1008 Isolate* isolate_;
1001 1009
1002 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } 1010 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); }
1003 RawContext* parent_; 1011 RawContext* parent_;
1004 1012
1005 // Variable length data follows here. 1013 // Variable length data follows here.
1006 RawInstance* data_[0]; 1014 RawInstance** data() { OPEN_ARRAY_START(RawInstance*, RawInstance*); }
1007 RawObject** to(intptr_t num_vars) { 1015 RawObject** to(intptr_t num_vars) {
1008 return reinterpret_cast<RawObject**>(&ptr()->data_[num_vars - 1]); 1016 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]);
1009 } 1017 }
1010 1018
1011 friend class SnapshotReader; 1019 friend class SnapshotReader;
1012 }; 1020 };
1013 1021
1014 1022
1015 class RawContextScope : public RawObject { 1023 class RawContextScope : public RawObject {
1016 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); 1024 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope);
1017 1025
1018 // TODO(iposva): Switch to convential enum offset based structure to avoid 1026 // TODO(iposva): Switch to convential enum offset based structure to avoid
1019 // alignment mishaps. 1027 // alignment mishaps.
1020 struct VariableDesc { 1028 struct VariableDesc {
1021 RawSmi* token_pos; 1029 RawSmi* token_pos;
1022 RawString* name; 1030 RawString* name;
1023 RawBool* is_final; 1031 RawBool* is_final;
1024 RawBool* is_const; 1032 RawBool* is_const;
1025 union { 1033 union {
1026 RawAbstractType* type; 1034 RawAbstractType* type;
1027 RawInstance* value; // iff is_const is true 1035 RawInstance* value; // iff is_const is true
1028 }; 1036 };
1029 RawSmi* context_index; 1037 RawSmi* context_index;
1030 RawSmi* context_level; 1038 RawSmi* context_level;
1031 }; 1039 };
1032 1040
1033 intptr_t num_variables_; 1041 intptr_t num_variables_;
1034 1042
1043 RawObject** from() {
1044 return reinterpret_cast<RawObject**>(&ptr()->data()[0]);
1045 }
1035 // Variable length data follows here. 1046 // Variable length data follows here.
1036 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->data_[0]); } 1047 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); }
1037 RawObject* data_[0];
1038 RawObject** to(intptr_t num_vars) { 1048 RawObject** to(intptr_t num_vars) {
1039 intptr_t data_length = num_vars * (sizeof(VariableDesc)/kWordSize); 1049 const intptr_t data_length = num_vars * (sizeof(VariableDesc)/kWordSize);
1040 return reinterpret_cast<RawObject**>(&ptr()->data_[data_length - 1]); 1050 return reinterpret_cast<RawObject**>(&ptr()->data()[data_length - 1]);
1041 } 1051 }
1042 }; 1052 };
1043 1053
1044 1054
1045 class RawICData : public RawObject { 1055 class RawICData : public RawObject {
1046 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); 1056 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData);
1047 1057
1048 RawObject** from() { 1058 RawObject** from() {
1049 return reinterpret_cast<RawObject**>(&ptr()->owner_); 1059 return reinterpret_cast<RawObject**>(&ptr()->owner_);
1050 } 1060 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 // object length so that the object can be traversed during GC). 1309 // object length so that the object can be traversed during GC).
1300 intptr_t allocated_length_; 1310 intptr_t allocated_length_;
1301 1311
1302 // Operational length in chunks of the bigint object, clamping can 1312 // Operational length in chunks of the bigint object, clamping can
1303 // cause this length to be reduced. If the signed_length_ is 1313 // cause this length to be reduced. If the signed_length_ is
1304 // negative then the number is negative. 1314 // negative then the number is negative.
1305 intptr_t signed_length_; 1315 intptr_t signed_length_;
1306 1316
1307 // A sequence of Chunks (typedef in Bignum) representing bignum digits. 1317 // A sequence of Chunks (typedef in Bignum) representing bignum digits.
1308 // Bignum::Chunk chunks_[Utils::Abs(signed_length_)]; 1318 // Bignum::Chunk chunks_[Utils::Abs(signed_length_)];
1309 uint8_t data_[0]; 1319 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1310 1320
1311 friend class SnapshotReader; 1321 friend class SnapshotReader;
1312 }; 1322 };
1313 1323
1314 1324
1315 class RawDouble : public RawNumber { 1325 class RawDouble : public RawNumber {
1316 RAW_HEAP_OBJECT_IMPLEMENTATION(Double); 1326 RAW_HEAP_OBJECT_IMPLEMENTATION(Double);
1317 1327
1318 double value_; 1328 double value_;
1319 1329
(...skipping 10 matching lines...) Expand all
1330 RawSmi* length_; 1340 RawSmi* length_;
1331 RawSmi* hash_; 1341 RawSmi* hash_;
1332 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } 1342 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); }
1333 }; 1343 };
1334 1344
1335 1345
1336 class RawOneByteString : public RawString { 1346 class RawOneByteString : public RawString {
1337 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); 1347 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString);
1338 1348
1339 // Variable length data follows here. 1349 // Variable length data follows here.
1340 uint8_t data_[0]; 1350 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1341 1351
1342 friend class ApiMessageReader; 1352 friend class ApiMessageReader;
1343 friend class SnapshotReader; 1353 friend class SnapshotReader;
1344 }; 1354 };
1345 1355
1346 1356
1347 class RawTwoByteString : public RawString { 1357 class RawTwoByteString : public RawString {
1348 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); 1358 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString);
1349 1359
1350 // Variable length data follows here. 1360 // Variable length data follows here.
1351 uint16_t data_[0]; 1361 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); }
1352 1362
1353 friend class SnapshotReader; 1363 friend class SnapshotReader;
1354 }; 1364 };
1355 1365
1356 1366
1357 template<typename T> 1367 template<typename T>
1358 class ExternalStringData { 1368 class ExternalStringData {
1359 public: 1369 public:
1360 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : 1370 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) :
1361 data_(data), peer_(peer), callback_(callback) { 1371 data_(data), peer_(peer), callback_(callback) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 1413
1404 class RawArray : public RawInstance { 1414 class RawArray : public RawInstance {
1405 RAW_HEAP_OBJECT_IMPLEMENTATION(Array); 1415 RAW_HEAP_OBJECT_IMPLEMENTATION(Array);
1406 1416
1407 RawObject** from() { 1417 RawObject** from() {
1408 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); 1418 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_);
1409 } 1419 }
1410 RawTypeArguments* type_arguments_; 1420 RawTypeArguments* type_arguments_;
1411 RawSmi* length_; 1421 RawSmi* length_;
1412 // Variable length data follows here. 1422 // Variable length data follows here.
1413 RawObject** data() { 1423 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); }
1414 uword address_of_length = reinterpret_cast<uword>(&length_);
1415 return reinterpret_cast<RawObject**>(address_of_length + kWordSize);
1416 }
1417 RawObject** to(intptr_t length) { 1424 RawObject** to(intptr_t length) {
1418 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]); 1425 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]);
1419 } 1426 }
1420 1427
1421 friend class RawCode; 1428 friend class RawCode;
1422 friend class RawImmutableArray; 1429 friend class RawImmutableArray;
1423 friend class SnapshotReader; 1430 friend class SnapshotReader;
1424 friend class GrowableObjectArray; 1431 friend class GrowableObjectArray;
1425 friend class Object; 1432 friend class Object;
1426 friend class ICData; // For high performance access. 1433 friend class ICData; // For high performance access.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 #error Architecture is not 32-bit or 64-bit. 1510 #error Architecture is not 32-bit or 64-bit.
1504 #endif // ARCH_IS_32_BIT 1511 #endif // ARCH_IS_32_BIT
1505 1512
1506 1513
1507 class RawTypedData : public RawInstance { 1514 class RawTypedData : public RawInstance {
1508 RAW_HEAP_OBJECT_IMPLEMENTATION(TypedData); 1515 RAW_HEAP_OBJECT_IMPLEMENTATION(TypedData);
1509 1516
1510 protected: 1517 protected:
1511 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1518 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1512 RawSmi* length_; 1519 RawSmi* length_;
1520 // Variable length data follows here.
1521 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1513 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1522 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1514 1523
1515 // Variable length data follows here.
1516 uint8_t data_[0];
1517
1518 friend class Api; 1524 friend class Api;
1519 friend class Object; 1525 friend class Object;
1520 friend class Instance; 1526 friend class Instance;
1521 }; 1527 };
1522 1528
1523 1529
1524 class RawExternalTypedData : public RawInstance { 1530 class RawExternalTypedData : public RawInstance {
1525 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); 1531 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData);
1526 1532
1527 protected: 1533 protected:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 RawSmi* num_bracket_expressions_; 1603 RawSmi* num_bracket_expressions_;
1598 RawString* pattern_; // Pattern to be used for matching. 1604 RawString* pattern_; // Pattern to be used for matching.
1599 RawObject** to() { 1605 RawObject** to() {
1600 return reinterpret_cast<RawObject**>(&ptr()->pattern_); 1606 return reinterpret_cast<RawObject**>(&ptr()->pattern_);
1601 } 1607 }
1602 1608
1603 intptr_t type_; // Uninitialized, simple or complex. 1609 intptr_t type_; // Uninitialized, simple or complex.
1604 intptr_t flags_; // Represents global/local, case insensitive, multiline. 1610 intptr_t flags_; // Represents global/local, case insensitive, multiline.
1605 1611
1606 // Variable length data follows here. 1612 // Variable length data follows here.
1607 uint8_t data_[0]; 1613 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1608 }; 1614 };
1609 1615
1610 1616
1611 class RawWeakProperty : public RawInstance { 1617 class RawWeakProperty : public RawInstance {
1612 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); 1618 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty);
1613 1619
1614 RawObject** from() { 1620 RawObject** from() {
1615 return reinterpret_cast<RawObject**>(&ptr()->key_); 1621 return reinterpret_cast<RawObject**>(&ptr()->key_);
1616 } 1622 }
1617 RawObject* key_; 1623 RawObject* key_;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); 1873 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14);
1868 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 1874 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
1869 kTypedDataInt8ArrayViewCid + 15); 1875 kTypedDataInt8ArrayViewCid + 15);
1870 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); 1876 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14);
1871 return (kNullCid - kTypedDataInt8ArrayCid); 1877 return (kNullCid - kTypedDataInt8ArrayCid);
1872 } 1878 }
1873 1879
1874 } // namespace dart 1880 } // namespace dart
1875 1881
1876 #endif // VM_RAW_OBJECT_H_ 1882 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698