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

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

Issue 604553003: Don't use the size-zero array hack to access variable data in Snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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/globals.h ('k') | runtime/vm/snapshot.h » ('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/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 private: \ 220 private: \
221 RAW_OBJECT_IMPLEMENTATION(object); \ 221 RAW_OBJECT_IMPLEMENTATION(object); \
222 Raw##object* ptr() const { \ 222 Raw##object* ptr() const { \
223 ASSERT(IsHeapObject()); \ 223 ASSERT(IsHeapObject()); \
224 return reinterpret_cast<Raw##object*>( \ 224 return reinterpret_cast<Raw##object*>( \
225 reinterpret_cast<uword>(this) - kHeapObjectTag); \ 225 reinterpret_cast<uword>(this) - kHeapObjectTag); \
226 } \ 226 } \
227 SNAPSHOT_WRITER_SUPPORT() \ 227 SNAPSHOT_WRITER_SUPPORT() \
228 HEAP_PROFILER_SUPPORT() \ 228 HEAP_PROFILER_SUPPORT() \
229 229
230 #define OPEN_ARRAY_START(type, align) \
231 do { \
232 const uword result = reinterpret_cast<uword>(this) + sizeof(*this); \
233 ASSERT(Utils::IsAligned(result, sizeof(align))); \
234 return reinterpret_cast<type*>(result); \
235 } while (0)
236
237 // RawObject is the base class of all raw objects, even though it carries the 230 // RawObject is the base class of all raw objects, even though it carries the
238 // class_ field not all raw objects are allocated in the heap and thus cannot 231 // class_ field not all raw objects are allocated in the heap and thus cannot
239 // be dereferenced (e.g. RawSmi). 232 // be dereferenced (e.g. RawSmi).
240 class RawObject { 233 class RawObject {
241 public: 234 public:
242 // The tags field which is a part of the object header uses the following 235 // The tags field which is a part of the object header uses the following
243 // bit fields for storing tags. 236 // bit fields for storing tags.
244 enum TagBits { 237 enum TagBits {
245 kWatchedBit = 0, 238 kWatchedBit = 0,
246 kMarkBit = 1, 239 kMarkBit = 1,
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2050 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2058 kTypedDataInt8ArrayViewCid + 15); 2051 kTypedDataInt8ArrayViewCid + 15);
2059 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2052 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2060 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2053 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2061 return (kNullCid - kTypedDataInt8ArrayCid); 2054 return (kNullCid - kTypedDataInt8ArrayCid);
2062 } 2055 }
2063 2056
2064 } // namespace dart 2057 } // namespace dart
2065 2058
2066 #endif // VM_RAW_OBJECT_H_ 2059 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/globals.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698