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

Side by Side Diff: vm/object.h

Issue 10782016: Enforce length/size limits for variable size heap object in order to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
11 #include "vm/bitmap.h" 11 #include "vm/bitmap.h"
12 #include "vm/dart.h" 12 #include "vm/dart.h"
13 #include "vm/globals.h" 13 #include "vm/globals.h"
14 #include "vm/handles.h" 14 #include "vm/handles.h"
15 #include "vm/heap.h" 15 #include "vm/heap.h"
16 #include "vm/isolate.h" 16 #include "vm/isolate.h"
17 #include "vm/os.h" 17 #include "vm/os.h"
18 #include "vm/raw_object.h" 18 #include "vm/raw_object.h"
19 #include "vm/scanner.h" 19 #include "vm/scanner.h"
20 20
21 namespace dart { 21 namespace dart {
22 22
23 // Compute the maximum element count for a variable size type in order
24 // to avoid integer overflow. We take into account header size,
25 // rounding, and the bytes per element.
26 #define MAX_ELEMENTS(type) \
27 ((kIntptrMax - sizeof(Raw##type) - sizeof(RawObject)) / \
28 type::kBytesPerElement)
29
23 // Forward declarations. 30 // Forward declarations.
24 #define DEFINE_FORWARD_DECLARATION(clazz) \ 31 #define DEFINE_FORWARD_DECLARATION(clazz) \
25 class clazz; 32 class clazz;
26 CLASS_LIST(DEFINE_FORWARD_DECLARATION) 33 CLASS_LIST(DEFINE_FORWARD_DECLARATION)
27 #undef DEFINE_FORWARD_DECLARATION 34 #undef DEFINE_FORWARD_DECLARATION
28 class Api; 35 class Api;
29 class Assembler; 36 class Assembler;
30 class Code; 37 class Code;
31 class LocalScope; 38 class LocalScope;
32 39
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 1200 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1194 virtual bool IsResolved() const; 1201 virtual bool IsResolved() const;
1195 virtual bool IsInstantiated() const; 1202 virtual bool IsInstantiated() const;
1196 virtual bool IsUninstantiatedIdentity() const; 1203 virtual bool IsUninstantiatedIdentity() const;
1197 // Canonicalize only if instantiated, otherwise returns 'this'. 1204 // Canonicalize only if instantiated, otherwise returns 'this'.
1198 virtual RawAbstractTypeArguments* Canonicalize() const; 1205 virtual RawAbstractTypeArguments* Canonicalize() const;
1199 1206
1200 virtual RawAbstractTypeArguments* InstantiateFrom( 1207 virtual RawAbstractTypeArguments* InstantiateFrom(
1201 const AbstractTypeArguments& instantiator_type_arguments) const; 1208 const AbstractTypeArguments& instantiator_type_arguments) const;
1202 1209
1210 static const intptr_t kBytesPerElement = kWordSize;
1211 static const intptr_t kMaxElements = MAX_ELEMENTS(TypeArguments);
1212
1203 static intptr_t length_offset() { 1213 static intptr_t length_offset() {
1204 return OFFSET_OF(RawTypeArguments, length_); 1214 return OFFSET_OF(RawTypeArguments, length_);
1205 } 1215 }
1206 1216
1207 static intptr_t InstanceSize() { 1217 static intptr_t InstanceSize() {
1208 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_)); 1218 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_));
1209 return 0; 1219 return 0;
1210 } 1220 }
1211 1221
1212 static intptr_t InstanceSize(intptr_t len) { 1222 static intptr_t InstanceSize(intptr_t len) {
1213 // Ensure that the types_ is not adding to the object length. 1223 // Ensure that the types_ is not adding to the object length.
1214 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (1 * kWordSize))); 1224 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (1 * kWordSize)));
1215 return RoundedAllocationSize(sizeof(RawTypeArguments) + (len * kWordSize)); 1225 ASSERT(0 <= len && len <= kMaxElements);
1226 return RoundedAllocationSize(
1227 sizeof(RawTypeArguments) + (len * kBytesPerElement));
1216 } 1228 }
1217 1229
1218 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); 1230 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld);
1219 1231
1220 private: 1232 private:
1221 // Make sure that the array size cannot wrap around.
1222 static const intptr_t kMaxTypes = 512 * 1024 * 1024;
1223 RawAbstractType** TypeAddr(intptr_t index) const; 1233 RawAbstractType** TypeAddr(intptr_t index) const;
1224 void SetLength(intptr_t value) const; 1234 void SetLength(intptr_t value) const;
1225 1235
1226 HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments); 1236 HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments);
1227 friend class Class; 1237 friend class Class;
1228 }; 1238 };
1229 1239
1230 1240
1231 // An instance of InstantiatedTypeArguments is never encountered at compile 1241 // An instance of InstantiatedTypeArguments is never encountered at compile
1232 // time, but only at run time, when type parameters can be matched to actual 1242 // time, but only at run time, when type parameters can be matched to actual
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 public: 1710 public:
1701 inline intptr_t Length() const; 1711 inline intptr_t Length() const;
1702 1712
1703 RawArray* TokenObjects() const; 1713 RawArray* TokenObjects() const;
1704 void SetTokenObjects(const Array& value) const; 1714 void SetTokenObjects(const Array& value) const;
1705 1715
1706 RawString* GenerateSource() const; 1716 RawString* GenerateSource() const;
1707 intptr_t ComputeSourcePosition(intptr_t tok_pos) const; 1717 intptr_t ComputeSourcePosition(intptr_t tok_pos) const;
1708 intptr_t ComputeTokenPosition(intptr_t src_pos) const; 1718 intptr_t ComputeTokenPosition(intptr_t src_pos) const;
1709 1719
1720 static const intptr_t kBytesPerElement = 1;
1721 static const intptr_t kMaxElements = MAX_ELEMENTS(TokenStream);
1722
1710 static intptr_t InstanceSize() { 1723 static intptr_t InstanceSize() {
1711 ASSERT(sizeof(RawTokenStream) == OFFSET_OF(RawTokenStream, data_)); 1724 ASSERT(sizeof(RawTokenStream) == OFFSET_OF(RawTokenStream, data_));
1712 return 0; 1725 return 0;
1713 } 1726 }
1714 static intptr_t InstanceSize(intptr_t len) { 1727 static intptr_t InstanceSize(intptr_t len) {
1715 return RoundedAllocationSize(sizeof(RawTokenStream) + len); 1728 ASSERT(0 <= len && len <= kMaxElements);
1729 return RoundedAllocationSize(
1730 sizeof(RawTokenStream) + (len * kBytesPerElement));
1716 } 1731 }
1717 1732
1718 static RawTokenStream* New(intptr_t length); 1733 static RawTokenStream* New(intptr_t length);
1719 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens); 1734 static RawTokenStream* New(const Scanner::GrowableTokenStream& tokens);
1720 1735
1721 // The class Iterator encapsulates iteration over the tokens 1736 // The class Iterator encapsulates iteration over the tokens
1722 // in a TokenStream object. 1737 // in a TokenStream object.
1723 class Iterator : ValueObject { 1738 class Iterator : ValueObject {
1724 public: 1739 public:
1725 Iterator(const TokenStream& tokens, intptr_t token_pos); 1740 Iterator(const TokenStream& tokens, intptr_t token_pos);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 2055
2041 class Instructions : public Object { 2056 class Instructions : public Object {
2042 public: 2057 public:
2043 intptr_t size() const { return raw_ptr()->size_; } 2058 intptr_t size() const { return raw_ptr()->size_; }
2044 RawCode* code() const { return raw_ptr()->code_; } 2059 RawCode* code() const { return raw_ptr()->code_; }
2045 2060
2046 uword EntryPoint() const { 2061 uword EntryPoint() const {
2047 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); 2062 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize();
2048 } 2063 }
2049 2064
2065 static const intptr_t kMaxElements = (kIntptrMax -
2066 (sizeof(RawInstructions) +
2067 sizeof(RawObject) +
2068 (2 * OS::kMaxPreferredCodeAlignment)));
2069
2050 static intptr_t InstanceSize() { 2070 static intptr_t InstanceSize() {
2051 ASSERT(sizeof(RawInstructions) == OFFSET_OF(RawInstructions, data_)); 2071 ASSERT(sizeof(RawInstructions) == OFFSET_OF(RawInstructions, data_));
2052 return 0; 2072 return 0;
2053 } 2073 }
2054 2074
2055 static intptr_t InstanceSize(intptr_t size) { 2075 static intptr_t InstanceSize(intptr_t size) {
2056 intptr_t instructions_size = Utils::RoundUp(size, 2076 intptr_t instructions_size = Utils::RoundUp(size,
2057 OS::PreferredCodeAlignment()); 2077 OS::PreferredCodeAlignment());
2058 intptr_t result = instructions_size + HeaderSize(); 2078 intptr_t result = instructions_size + HeaderSize();
2059 ASSERT(result % OS::PreferredCodeAlignment() == 0); 2079 ASSERT(result % OS::PreferredCodeAlignment() == 0);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 intptr_t Length() const; 2115 intptr_t Length() const;
2096 2116
2097 RawString* GetName(intptr_t var_index) const; 2117 RawString* GetName(intptr_t var_index) const;
2098 2118
2099 void SetVar(intptr_t var_index, 2119 void SetVar(intptr_t var_index,
2100 const String& name, 2120 const String& name,
2101 RawLocalVarDescriptors::VarInfo* info) const; 2121 RawLocalVarDescriptors::VarInfo* info) const;
2102 2122
2103 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; 2123 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const;
2104 2124
2125 static const intptr_t kBytesPerElement =
2126 sizeof(RawLocalVarDescriptors::VarInfo);
2127 static const intptr_t kMaxElements = MAX_ELEMENTS(LocalVarDescriptors);
2128
2105 static intptr_t InstanceSize() { 2129 static intptr_t InstanceSize() {
2106 ASSERT(sizeof(RawLocalVarDescriptors) == 2130 ASSERT(sizeof(RawLocalVarDescriptors) ==
2107 OFFSET_OF(RawLocalVarDescriptors, data_)); 2131 OFFSET_OF(RawLocalVarDescriptors, data_));
2108 return 0; 2132 return 0;
2109 } 2133 }
2110 static intptr_t InstanceSize(intptr_t len) { 2134 static intptr_t InstanceSize(intptr_t len) {
2135 ASSERT(0 <= len && len <= kMaxElements);
2111 return RoundedAllocationSize( 2136 return RoundedAllocationSize(
2112 sizeof(RawLocalVarDescriptors) + 2137 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement));
2113 (len * sizeof(RawLocalVarDescriptors::VarInfo)));
2114 } 2138 }
2115 2139
2116 static RawLocalVarDescriptors* New(intptr_t num_variables); 2140 static RawLocalVarDescriptors* New(intptr_t num_variables);
2117 2141
2118 private: 2142 private:
2119 HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); 2143 HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object);
2120 friend class Class; 2144 friend class Class;
2121 }; 2145 };
2122 2146
2123 2147
2124 class PcDescriptors : public Object { 2148 class PcDescriptors : public Object {
2149 private:
2150 // Describes the layout of PC descriptor data.
2151 enum {
2152 kPcEntry = 0, // PC value of the descriptor, unique.
2153 kKindEntry,
2154 kNodeIdEntry, // AST node id.
2155 kTokenIndexEntry, // Token position in source of PC.
2156 kTryIndexEntry, // Try block index of PC.
2157 // We would potentially be adding other objects here like
2158 // pointer maps for optimized functions, local variables information etc.
2159 kNumberOfEntries
2160 };
2161
2125 public: 2162 public:
2126 enum Kind { 2163 enum Kind {
2127 kDeopt = 0, // Deoptimization cotinuation point. 2164 kDeopt = 0, // Deoptimization cotinuation point.
2128 kPatchCode, // Buffer for patching code entry. 2165 kPatchCode, // Buffer for patching code entry.
2129 kIcCall, // IC call. 2166 kIcCall, // IC call.
2130 kFuncCall, // Call to known target, e.g. static call, closure call. 2167 kFuncCall, // Call to known target, e.g. static call, closure call.
2131 kReturn, // Return from function. 2168 kReturn, // Return from function.
2132 kOther 2169 kOther
2133 }; 2170 };
2134 2171
(...skipping 12 matching lines...) Expand all
2147 intptr_t node_id, 2184 intptr_t node_id,
2148 intptr_t token_pos, 2185 intptr_t token_pos,
2149 intptr_t try_index) const { 2186 intptr_t try_index) const {
2150 SetPC(index, pc); 2187 SetPC(index, pc);
2151 SetKind(index, kind); 2188 SetKind(index, kind);
2152 SetNodeId(index, node_id); 2189 SetNodeId(index, node_id);
2153 SetTokenIndex(index, token_pos); 2190 SetTokenIndex(index, token_pos);
2154 SetTryIndex(index, try_index); 2191 SetTryIndex(index, try_index);
2155 } 2192 }
2156 2193
2194 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize);
2195 static const intptr_t kMaxElements = MAX_ELEMENTS(PcDescriptors);
2196
2157 static intptr_t InstanceSize() { 2197 static intptr_t InstanceSize() {
2158 ASSERT(sizeof(RawPcDescriptors) == OFFSET_OF(RawPcDescriptors, data_)); 2198 ASSERT(sizeof(RawPcDescriptors) == OFFSET_OF(RawPcDescriptors, data_));
2159 return 0; 2199 return 0;
2160 } 2200 }
2161 static intptr_t InstanceSize(intptr_t len) { 2201 static intptr_t InstanceSize(intptr_t len) {
2202 ASSERT(0 <= len && len <= kMaxElements);
2162 return RoundedAllocationSize( 2203 return RoundedAllocationSize(
2163 sizeof(RawPcDescriptors) + (len * kNumberOfEntries * kWordSize)); 2204 sizeof(RawPcDescriptors) + (len * kBytesPerElement));
2164 } 2205 }
2165 2206
2166 static RawPcDescriptors* New(intptr_t num_descriptors); 2207 static RawPcDescriptors* New(intptr_t num_descriptors);
2167 2208
2168 // Verify (assert) assumptions about pc descriptors in debug mode. 2209 // Verify (assert) assumptions about pc descriptors in debug mode.
2169 void Verify(bool check_ids) const; 2210 void Verify(bool check_ids) const;
2170 2211
2171 // We would have a VisitPointers function here to traverse the 2212 // We would have a VisitPointers function here to traverse the
2172 // pc descriptors table to visit objects if any in the table. 2213 // pc descriptors table to visit objects if any in the table.
2173 2214
2174 private: 2215 private:
2175 // Describes the layout of PC descriptor data.
2176 enum {
2177 kPcEntry = 0, // PC value of the descriptor, unique.
2178 kKindEntry,
2179 kNodeIdEntry, // AST node id.
2180 kTokenIndexEntry, // Token position in source of PC.
2181 kTryIndexEntry, // Try block index of PC.
2182 // We would potentially be adding other objects here like
2183 // pointer maps for optimized functions, local variables information etc.
2184 kNumberOfEntries
2185 };
2186
2187 void SetPC(intptr_t index, uword value) const; 2216 void SetPC(intptr_t index, uword value) const;
2188 void SetKind(intptr_t index, PcDescriptors::Kind kind) const; 2217 void SetKind(intptr_t index, PcDescriptors::Kind kind) const;
2189 void SetNodeId(intptr_t index, intptr_t value) const; 2218 void SetNodeId(intptr_t index, intptr_t value) const;
2190 void SetTokenIndex(intptr_t index, intptr_t value) const; 2219 void SetTokenIndex(intptr_t index, intptr_t value) const;
2191 void SetTryIndex(intptr_t index, intptr_t value) const; 2220 void SetTryIndex(intptr_t index, intptr_t value) const;
2192 2221
2193 void SetLength(intptr_t value) const; 2222 void SetLength(intptr_t value) const;
2194 2223
2195 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { 2224 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
2196 ASSERT((index >=0) && (index < Length())); 2225 ASSERT((index >=0) && (index < Length()));
(...skipping 22 matching lines...) Expand all
2219 2248
2220 RawCode* GetCode() const { return raw_ptr()->code_; } 2249 RawCode* GetCode() const { return raw_ptr()->code_; }
2221 void SetCode(const Code& code) const; 2250 void SetCode(const Code& code) const;
2222 2251
2223 // Return the offset of the highest stack slot that has an object. 2252 // Return the offset of the highest stack slot that has an object.
2224 intptr_t MaximumBitOffset() const { return raw_ptr()->max_set_bit_offset_; } 2253 intptr_t MaximumBitOffset() const { return raw_ptr()->max_set_bit_offset_; }
2225 2254
2226 // Return the offset of the lowest stack slot that has an object. 2255 // Return the offset of the lowest stack slot that has an object.
2227 intptr_t MinimumBitOffset() const { return raw_ptr()->min_set_bit_offset_; } 2256 intptr_t MinimumBitOffset() const { return raw_ptr()->min_set_bit_offset_; }
2228 2257
2258 static const intptr_t kBytesPerElement = kWordSize;
2259 static const intptr_t kMaxElements = MAX_ELEMENTS(Stackmap);
2260
2229 static intptr_t InstanceSize() { 2261 static intptr_t InstanceSize() {
2230 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); 2262 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_));
2231 return 0; 2263 return 0;
2232 } 2264 }
2233 static intptr_t InstanceSize(intptr_t size) { 2265 static intptr_t InstanceSize(intptr_t len) {
2234 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize)); 2266 ASSERT(0 <= len && len <= kMaxElements);
2267 return RoundedAllocationSize(
2268 sizeof(RawStackmap) + (len * kBytesPerElement));
2235 } 2269 }
2236 static RawStackmap* New(uword pc, BitmapBuilder* bmap); 2270 static RawStackmap* New(uword pc, BitmapBuilder* bmap);
2237 2271
2238 private: 2272 private:
2239 inline intptr_t SizeInBits() const; 2273 inline intptr_t SizeInBits() const;
2240 2274
2241 void SetMinBitOffset(intptr_t value) const { 2275 void SetMinBitOffset(intptr_t value) const {
2242 raw_ptr()->min_set_bit_offset_ = value; 2276 raw_ptr()->min_set_bit_offset_ = value;
2243 } 2277 }
2244 void SetMaxBitOffset(intptr_t value) const { 2278 void SetMaxBitOffset(intptr_t value) const {
2245 raw_ptr()->max_set_bit_offset_ = value; 2279 raw_ptr()->max_set_bit_offset_ = value;
2246 } 2280 }
2247 2281
2248 bool InRange(intptr_t offset) const { return offset < SizeInBits(); } 2282 bool InRange(intptr_t offset) const { return offset < SizeInBits(); }
2249 2283
2250 bool GetBit(intptr_t bit_offset) const; 2284 bool GetBit(intptr_t bit_offset) const;
2251 void SetBit(intptr_t bit_offset, bool value) const; 2285 void SetBit(intptr_t bit_offset, bool value) const;
2252 2286
2253 void set_bitmap_size_in_bytes(intptr_t value) const; 2287 void set_bitmap_size_in_bytes(intptr_t value) const;
2254 2288
2255 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); 2289 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
2256 friend class Class; 2290 friend class Class;
2257 friend class BitmapBuilder; 2291 friend class BitmapBuilder;
2258 }; 2292 };
2259 2293
2260 2294
2261 class ExceptionHandlers : public Object { 2295 class ExceptionHandlers : public Object {
2296 private:
2297 // Describes the layout of exception handler data.
2298 enum {
2299 kTryIndexEntry = 0, // Try block index associated with handler.
2300 kHandlerPcEntry, // PC value of handler.
2301 kNumberOfEntries
2302 };
2303
2262 public: 2304 public:
2263 intptr_t Length() const; 2305 intptr_t Length() const;
2264 2306
2265 intptr_t TryIndex(intptr_t index) const; 2307 intptr_t TryIndex(intptr_t index) const;
2266 intptr_t HandlerPC(intptr_t index) const; 2308 intptr_t HandlerPC(intptr_t index) const;
2267 2309
2268 void SetHandlerEntry(intptr_t index, 2310 void SetHandlerEntry(intptr_t index,
2269 intptr_t try_index, 2311 intptr_t try_index,
2270 intptr_t handler_pc) const { 2312 intptr_t handler_pc) const {
2271 SetTryIndex(index, try_index); 2313 SetTryIndex(index, try_index);
2272 SetHandlerPC(index, handler_pc); 2314 SetHandlerPC(index, handler_pc);
2273 } 2315 }
2274 2316
2317 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize);
2318 static const intptr_t kMaxElements = MAX_ELEMENTS(ExceptionHandlers);
2319
2275 static intptr_t InstanceSize() { 2320 static intptr_t InstanceSize() {
2276 ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers, 2321 ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers,
2277 data_)); 2322 data_));
2278 return 0; 2323 return 0;
2279 } 2324 }
2280 static intptr_t InstanceSize(intptr_t len) { 2325 static intptr_t InstanceSize(intptr_t len) {
2281 return RoundedAllocationSize(sizeof(RawExceptionHandlers) + 2326 ASSERT(0 <= len && len <= kMaxElements);
2282 (len * kNumberOfEntries * kWordSize)); 2327 return RoundedAllocationSize(
2328 sizeof(RawExceptionHandlers) + (len * kBytesPerElement));
2283 } 2329 }
2284 2330
2285 static RawExceptionHandlers* New(intptr_t num_handlers); 2331 static RawExceptionHandlers* New(intptr_t num_handlers);
2286 2332
2287 // We would have a VisitPointers function here to traverse the 2333 // We would have a VisitPointers function here to traverse the
2288 // exception handler table to visit objects if any in the table. 2334 // exception handler table to visit objects if any in the table.
2289 2335
2290 private: 2336 private:
2291 // Describes the layout of exception handler data.
2292 enum {
2293 kTryIndexEntry = 0, // Try block index associated with handler.
2294 kHandlerPcEntry, // PC value of handler.
2295 kNumberOfEntries
2296 };
2297
2298 void SetTryIndex(intptr_t index, intptr_t value) const; 2337 void SetTryIndex(intptr_t index, intptr_t value) const;
2299 void SetHandlerPC(intptr_t index, intptr_t value) const; 2338 void SetHandlerPC(intptr_t index, intptr_t value) const;
2300 2339
2301 void SetLength(intptr_t value) const; 2340 void SetLength(intptr_t value) const;
2302 2341
2303 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { 2342 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
2304 ASSERT((index >=0) && (index < Length())); 2343 ASSERT((index >=0) && (index < Length()));
2305 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; 2344 intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
2306 return &raw_ptr()->data_[data_index]; 2345 return &raw_ptr()->data_[data_index];
2307 } 2346 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 RawFunction* function() const { 2437 RawFunction* function() const {
2399 return raw_ptr()->function_; 2438 return raw_ptr()->function_;
2400 } 2439 }
2401 void set_function(const Function& function) const { 2440 void set_function(const Function& function) const {
2402 StorePointer(&raw_ptr()->function_, function.raw()); 2441 StorePointer(&raw_ptr()->function_, function.raw());
2403 } 2442 }
2404 2443
2405 // We would have a VisitPointers function here to traverse all the 2444 // We would have a VisitPointers function here to traverse all the
2406 // embedded objects in the instructions using pointer_offsets. 2445 // embedded objects in the instructions using pointer_offsets.
2407 2446
2447 static const intptr_t kBytesPerElement =
2448 sizeof(reinterpret_cast<RawCode*>(0)->data_[0]);
2449 static const intptr_t kMaxElements = MAX_ELEMENTS(Code);
2450
2408 static intptr_t InstanceSize() { 2451 static intptr_t InstanceSize() {
2409 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_)); 2452 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_));
2410 return 0; 2453 return 0;
2411 } 2454 }
2412 static intptr_t InstanceSize(intptr_t pointer_offsets_length) { 2455 static intptr_t InstanceSize(intptr_t len) {
2413 return RoundedAllocationSize( 2456 ASSERT(0 <= len && len <= kMaxElements);
2414 sizeof(RawCode) + (pointer_offsets_length * kEntrySize)); 2457 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement));
2415 } 2458 }
2416 static RawCode* FinalizeCode(const Function& function, Assembler* assembler); 2459 static RawCode* FinalizeCode(const Function& function, Assembler* assembler);
2417 static RawCode* FinalizeCode(const char* name, Assembler* assembler); 2460 static RawCode* FinalizeCode(const char* name, Assembler* assembler);
2418 static RawCode* LookupCode(uword pc); 2461 static RawCode* LookupCode(uword pc);
2419 2462
2420 int32_t GetPointerOffsetAt(int index) const { 2463 int32_t GetPointerOffsetAt(int index) const {
2421 return *PointerOffsetAddrAt(index); 2464 return *PointerOffsetAddrAt(index);
2422 } 2465 }
2423 intptr_t GetTokenIndexOfPC(uword pc) const; 2466 intptr_t GetTokenIndexOfPC(uword pc) const;
2424 2467
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 return &raw_ptr()->data_[index]; 2514 return &raw_ptr()->data_[index];
2472 } 2515 }
2473 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { 2516 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) {
2474 *PointerOffsetAddrAt(index) = offset_in_instructions; 2517 *PointerOffsetAddrAt(index) = offset_in_instructions;
2475 } 2518 }
2476 2519
2477 // New is a private method as RawInstruction and RawCode objects should 2520 // New is a private method as RawInstruction and RawCode objects should
2478 // only be created using the Code::FinalizeCode method. This method creates 2521 // only be created using the Code::FinalizeCode method. This method creates
2479 // the RawInstruction and RawCode objects, sets up the pointer offsets 2522 // the RawInstruction and RawCode objects, sets up the pointer offsets
2480 // and links the two in a GC safe manner. 2523 // and links the two in a GC safe manner.
2481 static RawCode* New(int pointer_offsets_length); 2524 static RawCode* New(intptr_t pointer_offsets_length);
2482 2525
2483 HEAP_OBJECT_IMPLEMENTATION(Code, Object); 2526 HEAP_OBJECT_IMPLEMENTATION(Code, Object);
2484 friend class Class; 2527 friend class Class;
2485 }; 2528 };
2486 2529
2487 2530
2488 class Context : public Object { 2531 class Context : public Object {
2489 public: 2532 public:
2490 RawContext* parent() const { return raw_ptr()->parent_; } 2533 RawContext* parent() const { return raw_ptr()->parent_; }
2491 void set_parent(const Context& parent) const { 2534 void set_parent(const Context& parent) const {
2492 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); 2535 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current());
2493 StorePointer(&raw_ptr()->parent_, parent.raw()); 2536 StorePointer(&raw_ptr()->parent_, parent.raw());
2494 } 2537 }
2495 static intptr_t parent_offset() { return OFFSET_OF(RawContext, parent_); } 2538 static intptr_t parent_offset() { return OFFSET_OF(RawContext, parent_); }
2496 2539
2497 Isolate* isolate() const { return raw_ptr()->isolate_; } 2540 Isolate* isolate() const { return raw_ptr()->isolate_; }
2498 static intptr_t isolate_offset() { return OFFSET_OF(RawContext, isolate_); } 2541 static intptr_t isolate_offset() { return OFFSET_OF(RawContext, isolate_); }
2499 2542
2500 intptr_t num_variables() const { return raw_ptr()->num_variables_; } 2543 intptr_t num_variables() const { return raw_ptr()->num_variables_; }
2501 static intptr_t num_variables_offset() { 2544 static intptr_t num_variables_offset() {
2502 return OFFSET_OF(RawContext, num_variables_); 2545 return OFFSET_OF(RawContext, num_variables_);
2503 } 2546 }
2504 2547
2505 RawInstance* At(intptr_t context_index) const { 2548 RawInstance* At(intptr_t context_index) const {
2506 return *InstanceAddr(context_index); 2549 return *InstanceAddr(context_index);
2507 } 2550 }
2508 inline void SetAt(intptr_t context_index, const Instance& value) const; 2551 inline void SetAt(intptr_t context_index, const Instance& value) const;
2509 2552
2553 static const intptr_t kBytesPerElement = kWordSize;
2554 static const intptr_t kMaxElements = MAX_ELEMENTS(Context);
2555
2510 static intptr_t variable_offset(intptr_t context_index) { 2556 static intptr_t variable_offset(intptr_t context_index) {
2511 return OFFSET_OF(RawContext, data_[context_index]); 2557 return OFFSET_OF(RawContext, data_[context_index]);
2512 } 2558 }
2513 2559
2514 static intptr_t InstanceSize() { 2560 static intptr_t InstanceSize() {
2515 ASSERT(sizeof(RawContext) == OFFSET_OF(RawContext, data_)); 2561 ASSERT(sizeof(RawContext) == OFFSET_OF(RawContext, data_));
2516 return 0; 2562 return 0;
2517 } 2563 }
2518 2564
2519 static intptr_t InstanceSize(intptr_t num_variables) { 2565 static intptr_t InstanceSize(intptr_t len) {
2520 return RoundedAllocationSize(sizeof(RawContext) + 2566 ASSERT(0 <= len && len <= kMaxElements);
2521 (num_variables * kWordSize)); 2567 return RoundedAllocationSize(sizeof(RawContext) + (len * kBytesPerElement));
2522 } 2568 }
2523 2569
2524 static RawContext* New(intptr_t num_variables, 2570 static RawContext* New(intptr_t num_variables,
2525 Heap::Space space = Heap::kNew); 2571 Heap::Space space = Heap::kNew);
2526 2572
2527 private: 2573 private:
2528 RawInstance** InstanceAddr(intptr_t context_index) const { 2574 RawInstance** InstanceAddr(intptr_t context_index) const {
2529 ASSERT((context_index >= 0) && (context_index < num_variables())); 2575 ASSERT((context_index >= 0) && (context_index < num_variables()));
2530 return &raw_ptr()->data_[context_index]; 2576 return &raw_ptr()->data_[context_index];
2531 } 2577 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 2613
2568 RawAbstractType* TypeAt(intptr_t scope_index) const; 2614 RawAbstractType* TypeAt(intptr_t scope_index) const;
2569 void SetTypeAt(intptr_t scope_index, const AbstractType& type) const; 2615 void SetTypeAt(intptr_t scope_index, const AbstractType& type) const;
2570 2616
2571 intptr_t ContextIndexAt(intptr_t scope_index) const; 2617 intptr_t ContextIndexAt(intptr_t scope_index) const;
2572 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const; 2618 void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const;
2573 2619
2574 intptr_t ContextLevelAt(intptr_t scope_index) const; 2620 intptr_t ContextLevelAt(intptr_t scope_index) const;
2575 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const; 2621 void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const;
2576 2622
2623 static const intptr_t kBytesPerElement =
2624 sizeof(RawContextScope::VariableDesc);
2625 static const intptr_t kMaxElements = MAX_ELEMENTS(ContextScope);
2626
2577 static intptr_t InstanceSize() { 2627 static intptr_t InstanceSize() {
2578 ASSERT(sizeof(RawContextScope) == OFFSET_OF(RawContextScope, data_)); 2628 ASSERT(sizeof(RawContextScope) == OFFSET_OF(RawContextScope, data_));
2579 return 0; 2629 return 0;
2580 } 2630 }
2581 2631
2582 static intptr_t InstanceSize(intptr_t num_variables) { 2632 static intptr_t InstanceSize(intptr_t len) {
2583 return RoundedAllocationSize(sizeof(RawContextScope) + 2633 ASSERT(0 <= len && len <= kMaxElements);
2584 (num_variables * sizeof(RawContextScope::VariableDesc))); 2634 return RoundedAllocationSize(
2635 sizeof(RawContextScope) + (len * kBytesPerElement));
2585 } 2636 }
2586 2637
2587 static RawContextScope* New(intptr_t num_variables); 2638 static RawContextScope* New(intptr_t num_variables);
2588 2639
2589 private: 2640 private:
2590 void set_num_variables(intptr_t num_variables) const { 2641 void set_num_variables(intptr_t num_variables) const {
2591 raw_ptr()->num_variables_ = num_variables; 2642 raw_ptr()->num_variables_ = num_variables;
2592 } 2643 }
2593 2644
2594 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { 2645 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 3096
3046 private: 3097 private:
3047 void set_value(int64_t value) const; 3098 void set_value(int64_t value) const;
3048 3099
3049 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); 3100 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer);
3050 friend class Class; 3101 friend class Class;
3051 }; 3102 };
3052 3103
3053 3104
3054 class Bigint : public Integer { 3105 class Bigint : public Integer {
3106 private:
3107 typedef uint32_t Chunk;
3108 typedef uint64_t DoubleChunk;
3109 static const int kChunkSize = sizeof(Chunk);
3110
3055 public: 3111 public:
3056 virtual bool IsZero() const { return raw_ptr()->signed_length_ == 0; } 3112 virtual bool IsZero() const { return raw_ptr()->signed_length_ == 0; }
3057 virtual bool IsNegative() const { return raw_ptr()->signed_length_ < 0; } 3113 virtual bool IsNegative() const { return raw_ptr()->signed_length_ < 0; }
3058 3114
3059 virtual bool Equals(const Instance& other) const; 3115 virtual bool Equals(const Instance& other) const;
3060 3116
3061 virtual double AsDoubleValue() const; 3117 virtual double AsDoubleValue() const;
3062 virtual int64_t AsInt64Value() const; 3118 virtual int64_t AsInt64Value() const;
3063 3119
3064 virtual int CompareWith(const Integer& other) const; 3120 virtual int CompareWith(const Integer& other) const;
3065 3121
3066 static intptr_t InstanceSize(intptr_t length) { 3122 static const intptr_t kBytesPerElement = kChunkSize;
3067 ASSERT(length >= 0); 3123 static const intptr_t kMaxElements = MAX_ELEMENTS(Bigint);
3068 return RoundedAllocationSize(sizeof(RawBigint) + (length * sizeof(Chunk))); 3124
3125 static intptr_t InstanceSize() { return 0; }
3126
3127 static intptr_t InstanceSize(intptr_t len) {
3128 ASSERT(0 <= len && len <= kMaxElements);
3129 return RoundedAllocationSize(sizeof(RawBigint) + (len * kBytesPerElement));
3069 } 3130 }
3070 static intptr_t InstanceSize() { return 0; }
3071 3131
3072 static RawBigint* New(const String& str, Heap::Space space = Heap::kNew); 3132 static RawBigint* New(const String& str, Heap::Space space = Heap::kNew);
3073 static RawBigint* New(int64_t value, Heap::Space space = Heap::kNew); 3133 static RawBigint* New(int64_t value, Heap::Space space = Heap::kNew);
3074 3134
3075 private: 3135 private:
3076 typedef uint32_t Chunk;
3077 typedef uint64_t DoubleChunk;
3078 static const int kChunkSize = sizeof(Chunk);
3079
3080 Chunk GetChunkAt(intptr_t i) const { 3136 Chunk GetChunkAt(intptr_t i) const {
3081 return *ChunkAddr(i); 3137 return *ChunkAddr(i);
3082 } 3138 }
3083 3139
3084 void SetChunkAt(intptr_t i, Chunk newValue) const { 3140 void SetChunkAt(intptr_t i, Chunk newValue) const {
3085 *ChunkAddr(i) = newValue; 3141 *ChunkAddr(i) = newValue;
3086 } 3142 }
3087 3143
3088 // Returns the number of chunks in use. 3144 // Returns the number of chunks in use.
3089 intptr_t Length() const { 3145 intptr_t Length() const {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3163 class String : public Instance { 3219 class String : public Instance {
3164 public: 3220 public:
3165 // We use 30 bits for the hash code so that we consistently use a 3221 // We use 30 bits for the hash code so that we consistently use a
3166 // 32bit Smi representation for the hash code on all architectures. 3222 // 32bit Smi representation for the hash code on all architectures.
3167 static const intptr_t kHashBits = 30; 3223 static const intptr_t kHashBits = 30;
3168 3224
3169 static const intptr_t kOneByteChar = 1; 3225 static const intptr_t kOneByteChar = 1;
3170 static const intptr_t kTwoByteChar = 2; 3226 static const intptr_t kTwoByteChar = 2;
3171 static const intptr_t kFourByteChar = 4; 3227 static const intptr_t kFourByteChar = 4;
3172 3228
3229 // All strings share the same maximum element count to keep things
3230 // simple. We choose a value that will prevent integer overflow for
3231 // 4 byte strings, since it is the worst case.
3232 static const intptr_t kSizeofRawString = sizeof(RawObject) + (2 * kWordSize);
3233 static const intptr_t kMaxElements =
3234 (kIntptrMax - kSizeofRawString - sizeof(RawObject)) / kFourByteChar;
3235
3173 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); } 3236 intptr_t Length() const { return Smi::Value(raw_ptr()->length_); }
3174 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); } 3237 static intptr_t length_offset() { return OFFSET_OF(RawString, length_); }
3175 3238
3176 virtual intptr_t Hash() const; 3239 virtual intptr_t Hash() const;
3177 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); } 3240 static intptr_t hash_offset() { return OFFSET_OF(RawString, hash_); }
3178 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); 3241 static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len);
3179 static intptr_t Hash(const uint8_t* characters, intptr_t len); 3242 static intptr_t Hash(const uint8_t* characters, intptr_t len);
3180 static intptr_t Hash(const uint16_t* characters, intptr_t len); 3243 static intptr_t Hash(const uint16_t* characters, intptr_t len);
3181 static intptr_t Hash(const uint32_t* characters, intptr_t len); 3244 static intptr_t Hash(const uint32_t* characters, intptr_t len);
3182 3245
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 virtual int32_t CharAt(intptr_t index) const { 3392 virtual int32_t CharAt(intptr_t index) const {
3330 return *CharAddr(index); 3393 return *CharAddr(index);
3331 } 3394 }
3332 3395
3333 virtual intptr_t CharSize() const { 3396 virtual intptr_t CharSize() const {
3334 return kOneByteChar; 3397 return kOneByteChar;
3335 } 3398 }
3336 3399
3337 RawOneByteString* EscapeDoubleQuotes() const; 3400 RawOneByteString* EscapeDoubleQuotes() const;
3338 3401
3402 // We use the same maximum elements for all strings.
3403 static const intptr_t kBytesPerElement = 1;
3404 static const intptr_t kMaxElements = String::kMaxElements;
3405
3339 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } 3406 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); }
3340 3407
3341 static intptr_t InstanceSize() { 3408 static intptr_t InstanceSize() {
3342 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); 3409 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_));
3343 return 0; 3410 return 0;
3344 } 3411 }
3345 3412
3346 static intptr_t InstanceSize(intptr_t len) { 3413 static intptr_t InstanceSize(intptr_t len) {
3347 return RoundedAllocationSize(sizeof(RawOneByteString) + len); 3414 ASSERT(sizeof(RawOneByteString) == kSizeofRawString);
3415 ASSERT(0 <= len && len <= kMaxElements);
3416 return RoundedAllocationSize(
3417 sizeof(RawOneByteString) + (len * kBytesPerElement));
3348 } 3418 }
3349 3419
3350 static RawOneByteString* New(intptr_t len, 3420 static RawOneByteString* New(intptr_t len,
3351 Heap::Space space); 3421 Heap::Space space);
3352 static RawOneByteString* New(const uint8_t* characters, 3422 static RawOneByteString* New(const uint8_t* characters,
3353 intptr_t len, 3423 intptr_t len,
3354 Heap::Space space); 3424 Heap::Space space);
3355 static RawOneByteString* New(const uint16_t* characters, 3425 static RawOneByteString* New(const uint16_t* characters,
3356 intptr_t len, 3426 intptr_t len,
3357 Heap::Space space); 3427 Heap::Space space);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 virtual int32_t CharAt(intptr_t index) const { 3460 virtual int32_t CharAt(intptr_t index) const {
3391 return *CharAddr(index); 3461 return *CharAddr(index);
3392 } 3462 }
3393 3463
3394 virtual intptr_t CharSize() const { 3464 virtual intptr_t CharSize() const {
3395 return kTwoByteChar; 3465 return kTwoByteChar;
3396 } 3466 }
3397 3467
3398 RawTwoByteString* EscapeDoubleQuotes() const; 3468 RawTwoByteString* EscapeDoubleQuotes() const;
3399 3469
3470 // We use the same maximum elements for all strings.
3471 static const intptr_t kBytesPerElement = 2;
3472 static const intptr_t kMaxElements = String::kMaxElements;
3473
3400 static intptr_t InstanceSize() { 3474 static intptr_t InstanceSize() {
3401 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); 3475 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_));
3402 return 0; 3476 return 0;
3403 } 3477 }
3404 3478
3405 static intptr_t InstanceSize(intptr_t len) { 3479 static intptr_t InstanceSize(intptr_t len) {
3406 return RoundedAllocationSize(sizeof(RawTwoByteString) + (2 * len)); 3480 ASSERT(sizeof(RawTwoByteString) == kSizeofRawString);
3481 ASSERT(0 <= len && len <= kMaxElements);
3482 return RoundedAllocationSize(
3483 sizeof(RawTwoByteString) + (len * kBytesPerElement));
3407 } 3484 }
3408 3485
3409 static RawTwoByteString* New(intptr_t len, 3486 static RawTwoByteString* New(intptr_t len,
3410 Heap::Space space); 3487 Heap::Space space);
3411 static RawTwoByteString* New(const uint16_t* characters, 3488 static RawTwoByteString* New(const uint16_t* characters,
3412 intptr_t len, 3489 intptr_t len,
3413 Heap::Space space); 3490 Heap::Space space);
3414 static RawTwoByteString* New(const uint32_t* characters, 3491 static RawTwoByteString* New(const uint32_t* characters,
3415 intptr_t len, 3492 intptr_t len,
3416 Heap::Space space); 3493 Heap::Space space);
(...skipping 28 matching lines...) Expand all
3445 virtual int32_t CharAt(intptr_t index) const { 3522 virtual int32_t CharAt(intptr_t index) const {
3446 return *CharAddr(index); 3523 return *CharAddr(index);
3447 } 3524 }
3448 3525
3449 virtual intptr_t CharSize() const { 3526 virtual intptr_t CharSize() const {
3450 return kFourByteChar; 3527 return kFourByteChar;
3451 } 3528 }
3452 3529
3453 RawFourByteString* EscapeDoubleQuotes() const; 3530 RawFourByteString* EscapeDoubleQuotes() const;
3454 3531
3532 static const intptr_t kBytesPerElement = 4;
3533 static const intptr_t kMaxElements = String::kMaxElements;
3534
3455 static intptr_t InstanceSize() { 3535 static intptr_t InstanceSize() {
3456 ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_)); 3536 ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_));
3457 return 0; 3537 return 0;
3458 } 3538 }
3459 3539
3460 static intptr_t InstanceSize(intptr_t len) { 3540 static intptr_t InstanceSize(intptr_t len) {
3461 return RoundedAllocationSize(sizeof(RawFourByteString) + (4 * len)); 3541 ASSERT(sizeof(RawTwoByteString) == kSizeofRawString);
3542 ASSERT(0 <= len && len <= kMaxElements);
3543 return RoundedAllocationSize(
3544 sizeof(RawFourByteString) + (len * kBytesPerElement));
3462 } 3545 }
3463 3546
3464 static RawFourByteString* New(intptr_t len, 3547 static RawFourByteString* New(intptr_t len,
3465 Heap::Space space); 3548 Heap::Space space);
3466 static RawFourByteString* New(const uint32_t* characters, 3549 static RawFourByteString* New(const uint32_t* characters,
3467 intptr_t len, 3550 intptr_t len,
3468 Heap::Space space); 3551 Heap::Space space);
3469 static RawFourByteString* New(const FourByteString& str, 3552 static RawFourByteString* New(const FourByteString& str,
3470 Heap::Space space); 3553 Heap::Space space);
3471 3554
(...skipping 28 matching lines...) Expand all
3500 3583
3501 virtual intptr_t CharSize() const { 3584 virtual intptr_t CharSize() const {
3502 return kOneByteChar; 3585 return kOneByteChar;
3503 } 3586 }
3504 3587
3505 virtual bool IsExternal() const { return true; } 3588 virtual bool IsExternal() const { return true; }
3506 virtual void* GetPeer() const { 3589 virtual void* GetPeer() const {
3507 return raw_ptr()->external_data_->peer(); 3590 return raw_ptr()->external_data_->peer();
3508 } 3591 }
3509 3592
3593 // We use the same maximum elements for all strings.
3594 static const intptr_t kBytesPerElement = 1;
3595 static const intptr_t kMaxElements = String::kMaxElements;
3596
3510 static intptr_t InstanceSize() { 3597 static intptr_t InstanceSize() {
3511 return RoundedAllocationSize(sizeof(RawExternalOneByteString)); 3598 return RoundedAllocationSize(sizeof(RawExternalOneByteString));
3512 } 3599 }
3513 3600
3514 static RawExternalOneByteString* New(const uint8_t* characters, 3601 static RawExternalOneByteString* New(const uint8_t* characters,
3515 intptr_t len, 3602 intptr_t len,
3516 void* peer, 3603 void* peer,
3517 Dart_PeerFinalizer callback, 3604 Dart_PeerFinalizer callback,
3518 Heap::Space space); 3605 Heap::Space space);
3519 3606
(...skipping 24 matching lines...) Expand all
3544 3631
3545 virtual intptr_t CharSize() const { 3632 virtual intptr_t CharSize() const {
3546 return kTwoByteChar; 3633 return kTwoByteChar;
3547 } 3634 }
3548 3635
3549 virtual bool IsExternal() const { return true; } 3636 virtual bool IsExternal() const { return true; }
3550 virtual void* GetPeer() const { 3637 virtual void* GetPeer() const {
3551 return raw_ptr()->external_data_->peer(); 3638 return raw_ptr()->external_data_->peer();
3552 } 3639 }
3553 3640
3641 // We use the same maximum elements for all strings.
3642 static const intptr_t kBytesPerElement = 2;
3643 static const intptr_t kMaxElements = String::kMaxElements;
3644
3554 static intptr_t InstanceSize() { 3645 static intptr_t InstanceSize() {
3555 return RoundedAllocationSize(sizeof(RawExternalTwoByteString)); 3646 return RoundedAllocationSize(sizeof(RawExternalTwoByteString));
3556 } 3647 }
3557 3648
3558 static RawExternalTwoByteString* New(const uint16_t* characters, 3649 static RawExternalTwoByteString* New(const uint16_t* characters,
3559 intptr_t len, 3650 intptr_t len,
3560 void* peer, 3651 void* peer,
3561 Dart_PeerFinalizer callback, 3652 Dart_PeerFinalizer callback,
3562 Heap::Space space = Heap::kNew); 3653 Heap::Space space = Heap::kNew);
3563 3654
(...skipping 24 matching lines...) Expand all
3588 3679
3589 virtual intptr_t CharSize() const { 3680 virtual intptr_t CharSize() const {
3590 return kFourByteChar; 3681 return kFourByteChar;
3591 } 3682 }
3592 3683
3593 virtual bool IsExternal() const { return true; } 3684 virtual bool IsExternal() const { return true; }
3594 virtual void* GetPeer() const { 3685 virtual void* GetPeer() const {
3595 return raw_ptr()->external_data_->peer(); 3686 return raw_ptr()->external_data_->peer();
3596 } 3687 }
3597 3688
3689 // We use the same maximum elements for all strings.
3690 static const intptr_t kBytesPerElement = 4;
3691 static const intptr_t kMaxElements = String::kMaxElements;
3692
3598 static intptr_t InstanceSize() { 3693 static intptr_t InstanceSize() {
3599 return RoundedAllocationSize(sizeof(RawExternalFourByteString)); 3694 return RoundedAllocationSize(sizeof(RawExternalFourByteString));
3600 } 3695 }
3601 3696
3602 static RawExternalFourByteString* New(const uint32_t* characters, 3697 static RawExternalFourByteString* New(const uint32_t* characters,
3603 intptr_t len, 3698 intptr_t len,
3604 void* peer, 3699 void* peer,
3605 Dart_PeerFinalizer callback, 3700 Dart_PeerFinalizer callback,
3606 Heap::Space space = Heap::kNew); 3701 Heap::Space space = Heap::kNew);
3607 3702
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3672 3767
3673 virtual RawAbstractTypeArguments* GetTypeArguments() const { 3768 virtual RawAbstractTypeArguments* GetTypeArguments() const {
3674 return raw_ptr()->type_arguments_; 3769 return raw_ptr()->type_arguments_;
3675 } 3770 }
3676 virtual void SetTypeArguments(const AbstractTypeArguments& value) const { 3771 virtual void SetTypeArguments(const AbstractTypeArguments& value) const {
3677 raw_ptr()->type_arguments_ = value.raw(); 3772 raw_ptr()->type_arguments_ = value.raw();
3678 } 3773 }
3679 3774
3680 virtual bool Equals(const Instance& other) const; 3775 virtual bool Equals(const Instance& other) const;
3681 3776
3777 static const intptr_t kBytesPerElement = kWordSize;
3778 static const intptr_t kMaxElements = MAX_ELEMENTS(Array);
3779
3682 static intptr_t type_arguments_offset() { 3780 static intptr_t type_arguments_offset() {
3683 return OFFSET_OF(RawArray, type_arguments_); 3781 return OFFSET_OF(RawArray, type_arguments_);
3684 } 3782 }
3685 3783
3686 static intptr_t InstanceSize() { 3784 static intptr_t InstanceSize() {
3687 ASSERT(sizeof(RawArray) == OFFSET_OF_RETURNED_VALUE(RawArray, data)); 3785 ASSERT(sizeof(RawArray) == OFFSET_OF_RETURNED_VALUE(RawArray, data));
3688 return 0; 3786 return 0;
3689 } 3787 }
3690 3788
3691 static intptr_t InstanceSize(intptr_t len) { 3789 static intptr_t InstanceSize(intptr_t len) {
3692 // Ensure that variable length data is not adding to the object length. 3790 // Ensure that variable length data is not adding to the object length.
3693 ASSERT(sizeof(RawArray) == (sizeof(RawObject) + (2 * kWordSize))); 3791 ASSERT(sizeof(RawArray) == (sizeof(RawObject) + (2 * kWordSize)));
3694 return RoundedAllocationSize(sizeof(RawArray) + (len * kWordSize)); 3792 ASSERT(0 <= len && len <= kMaxElements);
3793 return RoundedAllocationSize(sizeof(RawArray) + (len * kBytesPerElement));
3695 } 3794 }
3696 3795
3697 // Make the array immutable to Dart code by switching the class pointer 3796 // Make the array immutable to Dart code by switching the class pointer
3698 // to ImmutableArray. 3797 // to ImmutableArray.
3699 void MakeImmutable() const; 3798 void MakeImmutable() const;
3700 3799
3701 static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew); 3800 static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew);
3702 3801
3703 // Creates and returns a new array with 'new_length'. Copies all elements from 3802 // Creates and returns a new array with 'new_length'. Copies all elements from
3704 // 'source' to the new array. 'new_length' must be greater than or equal to 3803 // 'source' to the new array. 'new_length' must be greater than or equal to
(...skipping 14 matching lines...) Expand all
3719 // collection. The backing array of the original Growable Object Array is 3818 // collection. The backing array of the original Growable Object Array is
3720 // set to an empty array. 3819 // set to an empty array.
3721 static RawArray* MakeArray(const GrowableObjectArray& growable_array); 3820 static RawArray* MakeArray(const GrowableObjectArray& growable_array);
3722 3821
3723 protected: 3822 protected:
3724 static RawArray* New(const Class& cls, 3823 static RawArray* New(const Class& cls,
3725 intptr_t len, 3824 intptr_t len,
3726 Heap::Space space = Heap::kNew); 3825 Heap::Space space = Heap::kNew);
3727 3826
3728 private: 3827 private:
3729 // Make sure that the array size cannot wrap around.
3730 static const intptr_t kMaxArrayElements = 512 * 1024 * 1024;
3731
3732 RawObject** ObjectAddr(intptr_t index) const { 3828 RawObject** ObjectAddr(intptr_t index) const {
3733 // TODO(iposva): Determine if we should throw an exception here. 3829 // TODO(iposva): Determine if we should throw an exception here.
3734 ASSERT((index >= 0) && (index < Length())); 3830 ASSERT((index >= 0) && (index < Length()));
3735 return &raw_ptr()->data()[index]; 3831 return &raw_ptr()->data()[index];
3736 } 3832 }
3737 3833
3738 void SetLength(intptr_t value) const { 3834 void SetLength(intptr_t value) const {
3739 // This is only safe because we create a new Smi, which does not cause 3835 // This is only safe because we create a new Smi, which does not cause
3740 // heap allocation. 3836 // heap allocation.
3741 raw_ptr()->length_ = Smi::New(value); 3837 raw_ptr()->length_ = Smi::New(value);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3923 int8_t At(intptr_t index) const { 4019 int8_t At(intptr_t index) const {
3924 ASSERT((index >= 0) && (index < Length())); 4020 ASSERT((index >= 0) && (index < Length()));
3925 return raw_ptr()->data_[index]; 4021 return raw_ptr()->data_[index];
3926 } 4022 }
3927 4023
3928 void SetAt(intptr_t index, int8_t value) const { 4024 void SetAt(intptr_t index, int8_t value) const {
3929 ASSERT((index >= 0) && (index < Length())); 4025 ASSERT((index >= 0) && (index < Length()));
3930 raw_ptr()->data_[index] = value; 4026 raw_ptr()->data_[index] = value;
3931 } 4027 }
3932 4028
4029 static const intptr_t kBytesPerElement = 1;
4030 static const intptr_t kMaxElements = MAX_ELEMENTS(Int8Array);
4031
3933 static intptr_t data_offset() { 4032 static intptr_t data_offset() {
3934 return length_offset() + kWordSize; 4033 return length_offset() + kWordSize;
3935 } 4034 }
3936 4035
3937 static intptr_t InstanceSize() { 4036 static intptr_t InstanceSize() {
3938 ASSERT(sizeof(RawInt8Array) == OFFSET_OF(RawInt8Array, data_)); 4037 ASSERT(sizeof(RawInt8Array) == OFFSET_OF(RawInt8Array, data_));
3939 return 0; 4038 return 0;
3940 } 4039 }
3941 4040
3942 static intptr_t InstanceSize(intptr_t len) { 4041 static intptr_t InstanceSize(intptr_t len) {
3943 return RoundedAllocationSize(sizeof(RawInt8Array) + len); 4042 ASSERT(0 <= len && len <= kMaxElements);
4043 return RoundedAllocationSize(
4044 sizeof(RawInt8Array) + (len * kBytesPerElement));
3944 } 4045 }
3945 4046
3946 static RawInt8Array* New(intptr_t len, 4047 static RawInt8Array* New(intptr_t len,
3947 Heap::Space space = Heap::kNew); 4048 Heap::Space space = Heap::kNew);
3948 static RawInt8Array* New(const int8_t* data, 4049 static RawInt8Array* New(const int8_t* data,
3949 intptr_t len, 4050 intptr_t len,
3950 Heap::Space space = Heap::kNew); 4051 Heap::Space space = Heap::kNew);
3951 4052
3952 private: 4053 private:
3953 uint8_t* ByteAddr(intptr_t byte_offset) const { 4054 uint8_t* ByteAddr(intptr_t byte_offset) const {
(...skipping 16 matching lines...) Expand all
3970 uint8_t At(intptr_t index) const { 4071 uint8_t At(intptr_t index) const {
3971 ASSERT((index >= 0) && (index < Length())); 4072 ASSERT((index >= 0) && (index < Length()));
3972 return raw_ptr()->data_[index]; 4073 return raw_ptr()->data_[index];
3973 } 4074 }
3974 4075
3975 void SetAt(intptr_t index, uint8_t value) const { 4076 void SetAt(intptr_t index, uint8_t value) const {
3976 ASSERT((index >= 0) && (index < Length())); 4077 ASSERT((index >= 0) && (index < Length()));
3977 raw_ptr()->data_[index] = value; 4078 raw_ptr()->data_[index] = value;
3978 } 4079 }
3979 4080
4081 static const intptr_t kBytesPerElement = 1;
4082 static const intptr_t kMaxElements = MAX_ELEMENTS(Uint8Array);
4083
3980 static intptr_t data_offset() { 4084 static intptr_t data_offset() {
3981 return length_offset() + kWordSize; 4085 return length_offset() + kWordSize;
3982 } 4086 }
3983 4087
3984 static intptr_t InstanceSize() { 4088 static intptr_t InstanceSize() {
3985 ASSERT(sizeof(RawUint8Array) == OFFSET_OF(RawUint8Array, data_)); 4089 ASSERT(sizeof(RawUint8Array) == OFFSET_OF(RawUint8Array, data_));
3986 return 0; 4090 return 0;
3987 } 4091 }
3988 4092
3989 static intptr_t InstanceSize(intptr_t len) { 4093 static intptr_t InstanceSize(intptr_t len) {
3990 return RoundedAllocationSize(sizeof(RawUint8Array) + len); 4094 ASSERT(0 <= len && len <= kMaxElements);
4095 return RoundedAllocationSize(
4096 sizeof(RawUint8Array) + (len * kBytesPerElement));
3991 } 4097 }
3992 4098
3993 static RawUint8Array* New(intptr_t len, 4099 static RawUint8Array* New(intptr_t len,
3994 Heap::Space space = Heap::kNew); 4100 Heap::Space space = Heap::kNew);
3995 static RawUint8Array* New(const uint8_t* data, 4101 static RawUint8Array* New(const uint8_t* data,
3996 intptr_t len, 4102 intptr_t len,
3997 Heap::Space space = Heap::kNew); 4103 Heap::Space space = Heap::kNew);
3998 4104
3999 private: 4105 private:
4000 uint8_t* ByteAddr(intptr_t byte_offset) const { 4106 uint8_t* ByteAddr(intptr_t byte_offset) const {
(...skipping 16 matching lines...) Expand all
4017 int16_t At(intptr_t index) const { 4123 int16_t At(intptr_t index) const {
4018 ASSERT((index >= 0) && (index < Length())); 4124 ASSERT((index >= 0) && (index < Length()));
4019 return raw_ptr()->data_[index]; 4125 return raw_ptr()->data_[index];
4020 } 4126 }
4021 4127
4022 void SetAt(intptr_t index, int16_t value) const { 4128 void SetAt(intptr_t index, int16_t value) const {
4023 ASSERT((index >= 0) && (index < Length())); 4129 ASSERT((index >= 0) && (index < Length()));
4024 raw_ptr()->data_[index] = value; 4130 raw_ptr()->data_[index] = value;
4025 } 4131 }
4026 4132
4133 static const intptr_t kBytesPerElement = 2;
4134 static const intptr_t kMaxElements = MAX_ELEMENTS(Int16Array);
4135
4027 static intptr_t data_offset() { 4136 static intptr_t data_offset() {
4028 return length_offset() + kWordSize; 4137 return length_offset() + kWordSize;
4029 } 4138 }
4030 4139
4031 static intptr_t InstanceSize() { 4140 static intptr_t InstanceSize() {
4032 ASSERT(sizeof(RawInt16Array) == OFFSET_OF(RawInt16Array, data_)); 4141 ASSERT(sizeof(RawInt16Array) == OFFSET_OF(RawInt16Array, data_));
4033 return 0; 4142 return 0;
4034 } 4143 }
4035 4144
4036 static intptr_t InstanceSize(intptr_t len) { 4145 static intptr_t InstanceSize(intptr_t len) {
4037 intptr_t data_size = len * kBytesPerElement; 4146 ASSERT(0 <= len && len <= kMaxElements);
4038 return RoundedAllocationSize(sizeof(RawInt16Array) + data_size); 4147 return RoundedAllocationSize(
4148 sizeof(RawInt16Array) + (len * kBytesPerElement));
4039 } 4149 }
4040 4150
4041 static RawInt16Array* New(intptr_t len, 4151 static RawInt16Array* New(intptr_t len,
4042 Heap::Space space = Heap::kNew); 4152 Heap::Space space = Heap::kNew);
4043 static RawInt16Array* New(const int16_t* data, 4153 static RawInt16Array* New(const int16_t* data,
4044 intptr_t len, 4154 intptr_t len,
4045 Heap::Space space = Heap::kNew); 4155 Heap::Space space = Heap::kNew);
4046 4156
4047 private: 4157 private:
4048 static const intptr_t kBytesPerElement = 2;
4049
4050 uint8_t* ByteAddr(intptr_t byte_offset) const { 4158 uint8_t* ByteAddr(intptr_t byte_offset) const {
4051 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4159 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4052 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4160 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4053 } 4161 }
4054 4162
4055 HEAP_OBJECT_IMPLEMENTATION(Int16Array, ByteArray); 4163 HEAP_OBJECT_IMPLEMENTATION(Int16Array, ByteArray);
4056 friend class ByteArray; 4164 friend class ByteArray;
4057 friend class Class; 4165 friend class Class;
4058 }; 4166 };
4059 4167
4060 4168
4061 class Uint16Array : public ByteArray { 4169 class Uint16Array : public ByteArray {
4062 public: 4170 public:
4063 intptr_t ByteLength() const { 4171 intptr_t ByteLength() const {
4064 return Length() * kBytesPerElement; 4172 return Length() * kBytesPerElement;
4065 } 4173 }
4066 4174
4067 uint16_t At(intptr_t index) const { 4175 uint16_t At(intptr_t index) const {
4068 ASSERT((index >= 0) && (index < Length())); 4176 ASSERT((index >= 0) && (index < Length()));
4069 return raw_ptr()->data_[index]; 4177 return raw_ptr()->data_[index];
4070 } 4178 }
4071 4179
4072 void SetAt(intptr_t index, uint16_t value) const { 4180 void SetAt(intptr_t index, uint16_t value) const {
4073 ASSERT((index >= 0) && (index < Length())); 4181 ASSERT((index >= 0) && (index < Length()));
4074 raw_ptr()->data_[index] = value; 4182 raw_ptr()->data_[index] = value;
4075 } 4183 }
4076 4184
4185 static const intptr_t kBytesPerElement = 2;
4186 static const intptr_t kMaxElements = MAX_ELEMENTS(Uint16Array);
4187
4077 static intptr_t data_offset() { 4188 static intptr_t data_offset() {
4078 return length_offset() + kWordSize; 4189 return length_offset() + kWordSize;
4079 } 4190 }
4080 4191
4081 static intptr_t InstanceSize() { 4192 static intptr_t InstanceSize() {
4082 ASSERT(sizeof(RawUint16Array) == OFFSET_OF(RawUint16Array, data_)); 4193 ASSERT(sizeof(RawUint16Array) == OFFSET_OF(RawUint16Array, data_));
4083 return 0; 4194 return 0;
4084 } 4195 }
4085 4196
4086 static intptr_t InstanceSize(intptr_t len) { 4197 static intptr_t InstanceSize(intptr_t len) {
4087 intptr_t data_size = len * kBytesPerElement; 4198 ASSERT(0 <= len && len <= kMaxElements);
4088 return RoundedAllocationSize(sizeof(RawUint16Array) + data_size); 4199 return RoundedAllocationSize(
4200 sizeof(RawUint16Array) + (len * kBytesPerElement));
4089 } 4201 }
4090 4202
4091 static RawUint16Array* New(intptr_t len, 4203 static RawUint16Array* New(intptr_t len,
4092 Heap::Space space = Heap::kNew); 4204 Heap::Space space = Heap::kNew);
4093 static RawUint16Array* New(const uint16_t* data, 4205 static RawUint16Array* New(const uint16_t* data,
4094 intptr_t len, 4206 intptr_t len,
4095 Heap::Space space = Heap::kNew); 4207 Heap::Space space = Heap::kNew);
4096 4208
4097 private: 4209 private:
4098 static const intptr_t kBytesPerElement = 2;
4099
4100 uint8_t* ByteAddr(intptr_t byte_offset) const { 4210 uint8_t* ByteAddr(intptr_t byte_offset) const {
4101 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4211 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4102 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4212 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4103 } 4213 }
4104 4214
4105 HEAP_OBJECT_IMPLEMENTATION(Uint16Array, ByteArray); 4215 HEAP_OBJECT_IMPLEMENTATION(Uint16Array, ByteArray);
4106 friend class ByteArray; 4216 friend class ByteArray;
4107 friend class Class; 4217 friend class Class;
4108 }; 4218 };
4109 4219
4110 4220
4111 class Int32Array : public ByteArray { 4221 class Int32Array : public ByteArray {
4112 public: 4222 public:
4113 intptr_t ByteLength() const { 4223 intptr_t ByteLength() const {
4114 return Length() * kBytesPerElement; 4224 return Length() * kBytesPerElement;
4115 } 4225 }
4116 4226
4117 int32_t At(intptr_t index) const { 4227 int32_t At(intptr_t index) const {
4118 ASSERT((index >= 0) && (index < Length())); 4228 ASSERT((index >= 0) && (index < Length()));
4119 return raw_ptr()->data_[index]; 4229 return raw_ptr()->data_[index];
4120 } 4230 }
4121 4231
4122 void SetAt(intptr_t index, int32_t value) const { 4232 void SetAt(intptr_t index, int32_t value) const {
4123 ASSERT((index >= 0) && (index < Length())); 4233 ASSERT((index >= 0) && (index < Length()));
4124 raw_ptr()->data_[index] = value; 4234 raw_ptr()->data_[index] = value;
4125 } 4235 }
4126 4236
4237 static const intptr_t kBytesPerElement = 4;
4238 static const intptr_t kMaxElements = MAX_ELEMENTS(Int32Array);
4239
4127 static intptr_t data_offset() { 4240 static intptr_t data_offset() {
4128 return length_offset() + kWordSize; 4241 return length_offset() + kWordSize;
4129 } 4242 }
4130 4243
4131 static intptr_t InstanceSize() { 4244 static intptr_t InstanceSize() {
4132 ASSERT(sizeof(RawInt32Array) == OFFSET_OF(RawInt32Array, data_)); 4245 ASSERT(sizeof(RawInt32Array) == OFFSET_OF(RawInt32Array, data_));
4133 return 0; 4246 return 0;
4134 } 4247 }
4135 4248
4136 static intptr_t InstanceSize(intptr_t len) { 4249 static intptr_t InstanceSize(intptr_t len) {
4137 intptr_t data_size = len * kBytesPerElement; 4250 ASSERT(0 <= len && len <= kMaxElements);
4138 return RoundedAllocationSize(sizeof(RawInt32Array) + data_size); 4251 return RoundedAllocationSize(
4252 sizeof(RawInt32Array) + (len * kBytesPerElement));
4139 } 4253 }
4140 4254
4141 static RawInt32Array* New(intptr_t len, 4255 static RawInt32Array* New(intptr_t len,
4142 Heap::Space space = Heap::kNew); 4256 Heap::Space space = Heap::kNew);
4143 static RawInt32Array* New(const int32_t* data, 4257 static RawInt32Array* New(const int32_t* data,
4144 intptr_t len, 4258 intptr_t len,
4145 Heap::Space space = Heap::kNew); 4259 Heap::Space space = Heap::kNew);
4146 4260
4147 private: 4261 private:
4148 static const intptr_t kBytesPerElement = 4;
4149
4150 uint8_t* ByteAddr(intptr_t byte_offset) const { 4262 uint8_t* ByteAddr(intptr_t byte_offset) const {
4151 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4263 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4152 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4264 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4153 } 4265 }
4154 4266
4155 HEAP_OBJECT_IMPLEMENTATION(Int32Array, ByteArray); 4267 HEAP_OBJECT_IMPLEMENTATION(Int32Array, ByteArray);
4156 friend class ByteArray; 4268 friend class ByteArray;
4157 friend class Class; 4269 friend class Class;
4158 }; 4270 };
4159 4271
4160 4272
4161 class Uint32Array : public ByteArray { 4273 class Uint32Array : public ByteArray {
4162 public: 4274 public:
4163 intptr_t ByteLength() const { 4275 intptr_t ByteLength() const {
4164 return Length() * kBytesPerElement; 4276 return Length() * kBytesPerElement;
4165 } 4277 }
4166 4278
4167 uint32_t At(intptr_t index) const { 4279 uint32_t At(intptr_t index) const {
4168 ASSERT((index >= 0) && (index < Length())); 4280 ASSERT((index >= 0) && (index < Length()));
4169 return raw_ptr()->data_[index]; 4281 return raw_ptr()->data_[index];
4170 } 4282 }
4171 4283
4172 void SetAt(intptr_t index, uint32_t value) const { 4284 void SetAt(intptr_t index, uint32_t value) const {
4173 ASSERT((index >= 0) && (index < Length())); 4285 ASSERT((index >= 0) && (index < Length()));
4174 raw_ptr()->data_[index] = value; 4286 raw_ptr()->data_[index] = value;
4175 } 4287 }
4176 4288
4289 static const intptr_t kBytesPerElement = 4;
4290 static const intptr_t kMaxElements = MAX_ELEMENTS(Uint32Array);
4291
4177 static intptr_t data_offset() { 4292 static intptr_t data_offset() {
4178 return length_offset() + kWordSize; 4293 return length_offset() + kWordSize;
4179 } 4294 }
4180 4295
4181 static intptr_t InstanceSize() { 4296 static intptr_t InstanceSize() {
4182 ASSERT(sizeof(RawUint32Array) == OFFSET_OF(RawUint32Array, data_)); 4297 ASSERT(sizeof(RawUint32Array) == OFFSET_OF(RawUint32Array, data_));
4183 return 0; 4298 return 0;
4184 } 4299 }
4185 4300
4186 static intptr_t InstanceSize(intptr_t len) { 4301 static intptr_t InstanceSize(intptr_t len) {
4187 intptr_t data_size = len * kBytesPerElement; 4302 ASSERT(0 <= len && len <= kMaxElements);
4188 return RoundedAllocationSize(sizeof(RawUint32Array) + data_size); 4303 return RoundedAllocationSize(
4304 sizeof(RawUint32Array) + (len * kBytesPerElement));
4189 } 4305 }
4190 4306
4191 static RawUint32Array* New(intptr_t len, 4307 static RawUint32Array* New(intptr_t len,
4192 Heap::Space space = Heap::kNew); 4308 Heap::Space space = Heap::kNew);
4193 static RawUint32Array* New(const uint32_t* data, 4309 static RawUint32Array* New(const uint32_t* data,
4194 intptr_t len, 4310 intptr_t len,
4195 Heap::Space space = Heap::kNew); 4311 Heap::Space space = Heap::kNew);
4196 4312
4197 private: 4313 private:
4198 static const intptr_t kBytesPerElement = 4;
4199
4200 uint8_t* ByteAddr(intptr_t byte_offset) const { 4314 uint8_t* ByteAddr(intptr_t byte_offset) const {
4201 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4315 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4202 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4316 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4203 } 4317 }
4204 4318
4205 HEAP_OBJECT_IMPLEMENTATION(Uint32Array, ByteArray); 4319 HEAP_OBJECT_IMPLEMENTATION(Uint32Array, ByteArray);
4206 friend class ByteArray; 4320 friend class ByteArray;
4207 friend class Class; 4321 friend class Class;
4208 }; 4322 };
4209 4323
4210 4324
4211 class Int64Array : public ByteArray { 4325 class Int64Array : public ByteArray {
4212 public: 4326 public:
4213 intptr_t ByteLength() const { 4327 intptr_t ByteLength() const {
4214 return Length() * kBytesPerElement; 4328 return Length() * kBytesPerElement;
4215 } 4329 }
4216 4330
4217 int64_t At(intptr_t index) const { 4331 int64_t At(intptr_t index) const {
4218 ASSERT((index >= 0) && (index < Length())); 4332 ASSERT((index >= 0) && (index < Length()));
4219 return raw_ptr()->data_[index]; 4333 return raw_ptr()->data_[index];
4220 } 4334 }
4221 4335
4222 void SetAt(intptr_t index, int64_t value) const { 4336 void SetAt(intptr_t index, int64_t value) const {
4223 ASSERT((index >= 0) && (index < Length())); 4337 ASSERT((index >= 0) && (index < Length()));
4224 raw_ptr()->data_[index] = value; 4338 raw_ptr()->data_[index] = value;
4225 } 4339 }
4226 4340
4341 static const intptr_t kBytesPerElement = 8;
4342 static const intptr_t kMaxElements = MAX_ELEMENTS(Int64Array);
4343
4227 static intptr_t data_offset() { 4344 static intptr_t data_offset() {
4228 return length_offset() + kWordSize; 4345 return length_offset() + kWordSize;
4229 } 4346 }
4230 4347
4231 static intptr_t InstanceSize() { 4348 static intptr_t InstanceSize() {
4232 ASSERT(sizeof(RawInt64Array) == OFFSET_OF(RawInt64Array, data_)); 4349 ASSERT(sizeof(RawInt64Array) == OFFSET_OF(RawInt64Array, data_));
4233 return 0; 4350 return 0;
4234 } 4351 }
4235 4352
4236 static intptr_t InstanceSize(intptr_t len) { 4353 static intptr_t InstanceSize(intptr_t len) {
4237 intptr_t data_size = len * kBytesPerElement; 4354 ASSERT(0 <= len && len <= kMaxElements);
4238 return RoundedAllocationSize(sizeof(RawInt64Array) + data_size); 4355 return RoundedAllocationSize(
4356 sizeof(RawInt64Array) + (len * kBytesPerElement));
4239 } 4357 }
4240 4358
4241 static RawInt64Array* New(intptr_t len, 4359 static RawInt64Array* New(intptr_t len,
4242 Heap::Space space = Heap::kNew); 4360 Heap::Space space = Heap::kNew);
4243 static RawInt64Array* New(const int64_t* data, 4361 static RawInt64Array* New(const int64_t* data,
4244 intptr_t len, 4362 intptr_t len,
4245 Heap::Space space = Heap::kNew); 4363 Heap::Space space = Heap::kNew);
4246 4364
4247 private: 4365 private:
4248 static const intptr_t kBytesPerElement = 8;
4249
4250 uint8_t* ByteAddr(intptr_t byte_offset) const { 4366 uint8_t* ByteAddr(intptr_t byte_offset) const {
4251 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4367 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4252 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4368 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4253 } 4369 }
4254 4370
4255 HEAP_OBJECT_IMPLEMENTATION(Int64Array, ByteArray); 4371 HEAP_OBJECT_IMPLEMENTATION(Int64Array, ByteArray);
4256 friend class ByteArray; 4372 friend class ByteArray;
4257 friend class Class; 4373 friend class Class;
4258 }; 4374 };
4259 4375
4260 4376
4261 class Uint64Array : public ByteArray { 4377 class Uint64Array : public ByteArray {
4262 public: 4378 public:
4263 intptr_t ByteLength() const { 4379 intptr_t ByteLength() const {
4264 return Length() * sizeof(uint64_t); 4380 return Length() * sizeof(uint64_t);
4265 } 4381 }
4266 4382
4267 uint64_t At(intptr_t index) const { 4383 uint64_t At(intptr_t index) const {
4268 ASSERT((index >= 0) && (index < Length())); 4384 ASSERT((index >= 0) && (index < Length()));
4269 return raw_ptr()->data_[index]; 4385 return raw_ptr()->data_[index];
4270 } 4386 }
4271 4387
4272 void SetAt(intptr_t index, uint64_t value) const { 4388 void SetAt(intptr_t index, uint64_t value) const {
4273 ASSERT((index >= 0) && (index < Length())); 4389 ASSERT((index >= 0) && (index < Length()));
4274 raw_ptr()->data_[index] = value; 4390 raw_ptr()->data_[index] = value;
4275 } 4391 }
4276 4392
4393 static const intptr_t kBytesPerElement = 8;
4394 static const intptr_t kMaxElements = MAX_ELEMENTS(Uint64Array);
4395
4277 static intptr_t data_offset() { 4396 static intptr_t data_offset() {
4278 return length_offset() + kWordSize; 4397 return length_offset() + kWordSize;
4279 } 4398 }
4280 4399
4281 static intptr_t InstanceSize() { 4400 static intptr_t InstanceSize() {
4282 ASSERT(sizeof(RawUint64Array) == OFFSET_OF(RawUint64Array, data_)); 4401 ASSERT(sizeof(RawUint64Array) == OFFSET_OF(RawUint64Array, data_));
4283 return 0; 4402 return 0;
4284 } 4403 }
4285 4404
4286 static intptr_t InstanceSize(intptr_t len) { 4405 static intptr_t InstanceSize(intptr_t len) {
4287 intptr_t data_size = len * kBytesPerElement; 4406 ASSERT(0 <= len && len <= kMaxElements);
4288 return RoundedAllocationSize(sizeof(RawUint64Array) + data_size); 4407 return RoundedAllocationSize(
4408 sizeof(RawUint64Array) + (len * kBytesPerElement));
4289 } 4409 }
4290 4410
4291 static RawUint64Array* New(intptr_t len, 4411 static RawUint64Array* New(intptr_t len,
4292 Heap::Space space = Heap::kNew); 4412 Heap::Space space = Heap::kNew);
4293 static RawUint64Array* New(const uint64_t* data, 4413 static RawUint64Array* New(const uint64_t* data,
4294 intptr_t len, 4414 intptr_t len,
4295 Heap::Space space = Heap::kNew); 4415 Heap::Space space = Heap::kNew);
4296 4416
4297 private: 4417 private:
4298 static const intptr_t kBytesPerElement = 8;
4299
4300 uint8_t* ByteAddr(intptr_t byte_offset) const { 4418 uint8_t* ByteAddr(intptr_t byte_offset) const {
4301 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4419 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4302 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4420 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4303 } 4421 }
4304 4422
4305 HEAP_OBJECT_IMPLEMENTATION(Uint64Array, ByteArray); 4423 HEAP_OBJECT_IMPLEMENTATION(Uint64Array, ByteArray);
4306 friend class ByteArray; 4424 friend class ByteArray;
4307 friend class Class; 4425 friend class Class;
4308 }; 4426 };
4309 4427
4310 4428
4311 class Float32Array : public ByteArray { 4429 class Float32Array : public ByteArray {
4312 public: 4430 public:
4313 intptr_t ByteLength() const { 4431 intptr_t ByteLength() const {
4314 return Length() * kBytesPerElement; 4432 return Length() * kBytesPerElement;
4315 } 4433 }
4316 4434
4317 float At(intptr_t index) const { 4435 float At(intptr_t index) const {
4318 ASSERT((index >= 0) && (index < Length())); 4436 ASSERT((index >= 0) && (index < Length()));
4319 return raw_ptr()->data_[index]; 4437 return raw_ptr()->data_[index];
4320 } 4438 }
4321 4439
4322 void SetAt(intptr_t index, float value) const { 4440 void SetAt(intptr_t index, float value) const {
4323 ASSERT((index >= 0) && (index < Length())); 4441 ASSERT((index >= 0) && (index < Length()));
4324 raw_ptr()->data_[index] = value; 4442 raw_ptr()->data_[index] = value;
4325 } 4443 }
4326 4444
4445 static const intptr_t kBytesPerElement = 4;
4446 static const intptr_t kMaxElements = MAX_ELEMENTS(Float32Array);
4447
4327 static intptr_t data_offset() { 4448 static intptr_t data_offset() {
4328 return length_offset() + kWordSize; 4449 return length_offset() + kWordSize;
4329 } 4450 }
4330 4451
4331 static intptr_t InstanceSize() { 4452 static intptr_t InstanceSize() {
4332 ASSERT(sizeof(RawFloat32Array) == OFFSET_OF(RawFloat32Array, data_)); 4453 ASSERT(sizeof(RawFloat32Array) == OFFSET_OF(RawFloat32Array, data_));
4333 return 0; 4454 return 0;
4334 } 4455 }
4335 4456
4336 static intptr_t InstanceSize(intptr_t len) { 4457 static intptr_t InstanceSize(intptr_t len) {
4337 intptr_t data_size = len * kBytesPerElement; 4458 ASSERT(0 <= len && len <= kMaxElements);
4338 return RoundedAllocationSize(sizeof(RawFloat32Array) + data_size); 4459 return RoundedAllocationSize(
4460 sizeof(RawFloat32Array) + (len * kBytesPerElement));
4339 } 4461 }
4340 4462
4341 static RawFloat32Array* New(intptr_t len, 4463 static RawFloat32Array* New(intptr_t len,
4342 Heap::Space space = Heap::kNew); 4464 Heap::Space space = Heap::kNew);
4343 static RawFloat32Array* New(const float* data, 4465 static RawFloat32Array* New(const float* data,
4344 intptr_t len, 4466 intptr_t len,
4345 Heap::Space space = Heap::kNew); 4467 Heap::Space space = Heap::kNew);
4346 4468
4347 private: 4469 private:
4348 static const intptr_t kBytesPerElement = 4;
4349
4350 uint8_t* ByteAddr(intptr_t byte_offset) const { 4470 uint8_t* ByteAddr(intptr_t byte_offset) const {
4351 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4471 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4352 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4472 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4353 } 4473 }
4354 4474
4355 HEAP_OBJECT_IMPLEMENTATION(Float32Array, ByteArray); 4475 HEAP_OBJECT_IMPLEMENTATION(Float32Array, ByteArray);
4356 friend class ByteArray; 4476 friend class ByteArray;
4357 friend class Class; 4477 friend class Class;
4358 }; 4478 };
4359 4479
4360 4480
4361 class Float64Array : public ByteArray { 4481 class Float64Array : public ByteArray {
4362 public: 4482 public:
4363 intptr_t ByteLength() const { 4483 intptr_t ByteLength() const {
4364 return Length() * kBytesPerElement; 4484 return Length() * kBytesPerElement;
4365 } 4485 }
4366 4486
4367 double At(intptr_t index) const { 4487 double At(intptr_t index) const {
4368 ASSERT((index >= 0) && (index < Length())); 4488 ASSERT((index >= 0) && (index < Length()));
4369 return raw_ptr()->data_[index]; 4489 return raw_ptr()->data_[index];
4370 } 4490 }
4371 4491
4372 void SetAt(intptr_t index, double value) const { 4492 void SetAt(intptr_t index, double value) const {
4373 ASSERT((index >= 0) && (index < Length())); 4493 ASSERT((index >= 0) && (index < Length()));
4374 raw_ptr()->data_[index] = value; 4494 raw_ptr()->data_[index] = value;
4375 } 4495 }
4376 4496
4497 static const intptr_t kBytesPerElement = 8;
4498 static const intptr_t kMaxElements = MAX_ELEMENTS(Float64Array);
4499
4377 static intptr_t InstanceSize() { 4500 static intptr_t InstanceSize() {
4378 ASSERT(sizeof(RawFloat64Array) == OFFSET_OF(RawFloat64Array, data_)); 4501 ASSERT(sizeof(RawFloat64Array) == OFFSET_OF(RawFloat64Array, data_));
4379 return 0; 4502 return 0;
4380 } 4503 }
4381 4504
4382 static intptr_t data_offset() { 4505 static intptr_t data_offset() {
4383 return length_offset() + kWordSize; 4506 return length_offset() + kWordSize;
4384 } 4507 }
4385 4508
4386 static intptr_t InstanceSize(intptr_t len) { 4509 static intptr_t InstanceSize(intptr_t len) {
4387 intptr_t data_size = len * kBytesPerElement; 4510 ASSERT(0 <= len && len <= kMaxElements);
4388 return RoundedAllocationSize(sizeof(RawFloat64Array) + data_size); 4511 return RoundedAllocationSize(
4512 sizeof(RawFloat64Array) + (len * kBytesPerElement));
4389 } 4513 }
4390 4514
4391 static RawFloat64Array* New(intptr_t len, 4515 static RawFloat64Array* New(intptr_t len,
4392 Heap::Space space = Heap::kNew); 4516 Heap::Space space = Heap::kNew);
4393 static RawFloat64Array* New(const double* data, 4517 static RawFloat64Array* New(const double* data,
4394 intptr_t len, 4518 intptr_t len,
4395 Heap::Space space = Heap::kNew); 4519 Heap::Space space = Heap::kNew);
4396 4520
4397 private: 4521 private:
4398 static const intptr_t kBytesPerElement = 8;
4399
4400 uint8_t* ByteAddr(intptr_t byte_offset) const { 4522 uint8_t* ByteAddr(intptr_t byte_offset) const {
4401 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4523 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4402 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4524 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4403 } 4525 }
4404 4526
4405 HEAP_OBJECT_IMPLEMENTATION(Float64Array, ByteArray); 4527 HEAP_OBJECT_IMPLEMENTATION(Float64Array, ByteArray);
4406 friend class ByteArray; 4528 friend class ByteArray;
4407 friend class Class; 4529 friend class Class;
4408 }; 4530 };
4409 4531
(...skipping 11 matching lines...) Expand all
4421 4543
4422 void SetAt(intptr_t index, int8_t value) const { 4544 void SetAt(intptr_t index, int8_t value) const {
4423 ASSERT((index >= 0) && (index < Length())); 4545 ASSERT((index >= 0) && (index < Length()));
4424 raw_ptr()->external_data_->data()[index] = value; 4546 raw_ptr()->external_data_->data()[index] = value;
4425 } 4547 }
4426 4548
4427 void* GetPeer() const { 4549 void* GetPeer() const {
4428 return raw_ptr()->external_data_->peer(); 4550 return raw_ptr()->external_data_->peer();
4429 } 4551 }
4430 4552
4553 static const intptr_t kBytesPerElement = 1;
4554
4555 // Since external arrays may be serialized to non-external ones,
4556 // enforce the same maximum element count.
4557 static const intptr_t kMaxElements = Int8Array::kMaxElements;
4558
4431 static intptr_t InstanceSize() { 4559 static intptr_t InstanceSize() {
4432 return RoundedAllocationSize(sizeof(RawExternalInt8Array)); 4560 return RoundedAllocationSize(sizeof(RawExternalInt8Array));
4433 } 4561 }
4434 4562
4435 static RawExternalInt8Array* New(int8_t* data, 4563 static RawExternalInt8Array* New(int8_t* data,
4436 intptr_t len, 4564 intptr_t len,
4437 void* peer, 4565 void* peer,
4438 Dart_PeerFinalizer callback, 4566 Dart_PeerFinalizer callback,
4439 Heap::Space space = Heap::kNew); 4567 Heap::Space space = Heap::kNew);
4440 4568
4441 private: 4569 private:
4442 static const intptr_t kBytesPerElement = 1;
4443
4444 uint8_t* ByteAddr(intptr_t byte_offset) const { 4570 uint8_t* ByteAddr(intptr_t byte_offset) const {
4445 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4571 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4446 uint8_t* data = 4572 uint8_t* data =
4447 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4573 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4448 return data + byte_offset; 4574 return data + byte_offset;
4449 } 4575 }
4450 4576
4451 void SetExternalData(ExternalByteArrayData<int8_t>* data) { 4577 void SetExternalData(ExternalByteArrayData<int8_t>* data) {
4452 raw_ptr()->external_data_ = data; 4578 raw_ptr()->external_data_ = data;
4453 } 4579 }
(...skipping 17 matching lines...) Expand all
4471 4597
4472 void SetAt(intptr_t index, uint8_t value) const { 4598 void SetAt(intptr_t index, uint8_t value) const {
4473 ASSERT((index >= 0) && (index < Length())); 4599 ASSERT((index >= 0) && (index < Length()));
4474 raw_ptr()->external_data_->data()[index] = value; 4600 raw_ptr()->external_data_->data()[index] = value;
4475 } 4601 }
4476 4602
4477 void* GetPeer() const { 4603 void* GetPeer() const {
4478 return raw_ptr()->external_data_->peer(); 4604 return raw_ptr()->external_data_->peer();
4479 } 4605 }
4480 4606
4607 static const intptr_t kBytesPerElement = 1;
4608
4609 // Since external arrays may be serialized to non-external ones,
4610 // enforce the same maximum element count.
4611 static const intptr_t kMaxElements = Uint8Array::kMaxElements;
4612
4481 static intptr_t InstanceSize() { 4613 static intptr_t InstanceSize() {
4482 return RoundedAllocationSize(sizeof(RawExternalUint8Array)); 4614 return RoundedAllocationSize(sizeof(RawExternalUint8Array));
4483 } 4615 }
4484 4616
4485 static RawExternalUint8Array* New(uint8_t* data, 4617 static RawExternalUint8Array* New(uint8_t* data,
4486 intptr_t len, 4618 intptr_t len,
4487 void* peer, 4619 void* peer,
4488 Dart_PeerFinalizer callback, 4620 Dart_PeerFinalizer callback,
4489 Heap::Space space = Heap::kNew); 4621 Heap::Space space = Heap::kNew);
4490 4622
4491 private: 4623 private:
4492 static const intptr_t kBytesPerElement = 1;
4493
4494 uint8_t* ByteAddr(intptr_t byte_offset) const { 4624 uint8_t* ByteAddr(intptr_t byte_offset) const {
4495 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4625 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4496 uint8_t* data = 4626 uint8_t* data =
4497 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4627 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4498 return data + byte_offset; 4628 return data + byte_offset;
4499 } 4629 }
4500 4630
4501 void SetExternalData(ExternalByteArrayData<uint8_t>* data) { 4631 void SetExternalData(ExternalByteArrayData<uint8_t>* data) {
4502 raw_ptr()->external_data_ = data; 4632 raw_ptr()->external_data_ = data;
4503 } 4633 }
(...skipping 17 matching lines...) Expand all
4521 4651
4522 void SetAt(intptr_t index, int16_t value) const { 4652 void SetAt(intptr_t index, int16_t value) const {
4523 ASSERT((index >= 0) && (index < Length())); 4653 ASSERT((index >= 0) && (index < Length()));
4524 raw_ptr()->external_data_->data()[index] = value; 4654 raw_ptr()->external_data_->data()[index] = value;
4525 } 4655 }
4526 4656
4527 void* GetPeer() const { 4657 void* GetPeer() const {
4528 return raw_ptr()->external_data_->peer(); 4658 return raw_ptr()->external_data_->peer();
4529 } 4659 }
4530 4660
4661 static const intptr_t kBytesPerElement = 2;
4662
4663 // Since external arrays may be serialized to non-external ones,
4664 // enforce the same maximum element count.
4665 static const intptr_t kMaxElements = Int16Array::kMaxElements;
4666
4531 static intptr_t InstanceSize() { 4667 static intptr_t InstanceSize() {
4532 return RoundedAllocationSize(sizeof(RawExternalInt16Array)); 4668 return RoundedAllocationSize(sizeof(RawExternalInt16Array));
4533 } 4669 }
4534 4670
4535 static RawExternalInt16Array* New(int16_t* data, 4671 static RawExternalInt16Array* New(int16_t* data,
4536 intptr_t len, 4672 intptr_t len,
4537 void* peer, 4673 void* peer,
4538 Dart_PeerFinalizer callback, 4674 Dart_PeerFinalizer callback,
4539 Heap::Space space = Heap::kNew); 4675 Heap::Space space = Heap::kNew);
4540 4676
4541 private: 4677 private:
4542 static const intptr_t kBytesPerElement = 2;
4543
4544 uint8_t* ByteAddr(intptr_t byte_offset) const { 4678 uint8_t* ByteAddr(intptr_t byte_offset) const {
4545 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4679 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4546 uint8_t* data = 4680 uint8_t* data =
4547 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4681 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4548 return data + byte_offset; 4682 return data + byte_offset;
4549 } 4683 }
4550 4684
4551 void SetExternalData(ExternalByteArrayData<int16_t>* data) { 4685 void SetExternalData(ExternalByteArrayData<int16_t>* data) {
4552 raw_ptr()->external_data_ = data; 4686 raw_ptr()->external_data_ = data;
4553 } 4687 }
(...skipping 17 matching lines...) Expand all
4571 4705
4572 void SetAt(intptr_t index, int16_t value) const { 4706 void SetAt(intptr_t index, int16_t value) const {
4573 ASSERT((index >= 0) && (index < Length())); 4707 ASSERT((index >= 0) && (index < Length()));
4574 raw_ptr()->external_data_->data()[index] = value; 4708 raw_ptr()->external_data_->data()[index] = value;
4575 } 4709 }
4576 4710
4577 void* GetPeer() const { 4711 void* GetPeer() const {
4578 return raw_ptr()->external_data_->peer(); 4712 return raw_ptr()->external_data_->peer();
4579 } 4713 }
4580 4714
4715 static const intptr_t kBytesPerElement = 2;
4716
4717 // Since external arrays may be serialized to non-external ones,
4718 // enforce the same maximum element count.
4719 static const intptr_t kMaxElements = Uint16Array::kMaxElements;
4720
4581 static intptr_t InstanceSize() { 4721 static intptr_t InstanceSize() {
4582 return RoundedAllocationSize(sizeof(RawExternalUint16Array)); 4722 return RoundedAllocationSize(sizeof(RawExternalUint16Array));
4583 } 4723 }
4584 4724
4585 static RawExternalUint16Array* New(uint16_t* data, 4725 static RawExternalUint16Array* New(uint16_t* data,
4586 intptr_t len, 4726 intptr_t len,
4587 void* peer, 4727 void* peer,
4588 Dart_PeerFinalizer callback, 4728 Dart_PeerFinalizer callback,
4589 Heap::Space space = Heap::kNew); 4729 Heap::Space space = Heap::kNew);
4590 4730
4591 private: 4731 private:
4592 static const intptr_t kBytesPerElement = 2;
4593
4594 uint8_t* ByteAddr(intptr_t byte_offset) const { 4732 uint8_t* ByteAddr(intptr_t byte_offset) const {
4595 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4733 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4596 uint8_t* data = 4734 uint8_t* data =
4597 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4735 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4598 return data + byte_offset; 4736 return data + byte_offset;
4599 } 4737 }
4600 4738
4601 void SetExternalData(ExternalByteArrayData<uint16_t>* data) { 4739 void SetExternalData(ExternalByteArrayData<uint16_t>* data) {
4602 raw_ptr()->external_data_ = data; 4740 raw_ptr()->external_data_ = data;
4603 } 4741 }
(...skipping 17 matching lines...) Expand all
4621 4759
4622 void SetAt(intptr_t index, int32_t value) const { 4760 void SetAt(intptr_t index, int32_t value) const {
4623 ASSERT((index >= 0) && (index < Length())); 4761 ASSERT((index >= 0) && (index < Length()));
4624 raw_ptr()->external_data_->data()[index] = value; 4762 raw_ptr()->external_data_->data()[index] = value;
4625 } 4763 }
4626 4764
4627 void* GetPeer() const { 4765 void* GetPeer() const {
4628 return raw_ptr()->external_data_->peer(); 4766 return raw_ptr()->external_data_->peer();
4629 } 4767 }
4630 4768
4769 static const intptr_t kBytesPerElement = 4;
4770
4771 // Since external arrays may be serialized to non-external ones,
4772 // enforce the same maximum element count.
4773 static const intptr_t kMaxElements = Int32Array::kMaxElements;
4774
4631 static intptr_t InstanceSize() { 4775 static intptr_t InstanceSize() {
4632 return RoundedAllocationSize(sizeof(RawExternalInt32Array)); 4776 return RoundedAllocationSize(sizeof(RawExternalInt32Array));
4633 } 4777 }
4634 4778
4635 static RawExternalInt32Array* New(int32_t* data, 4779 static RawExternalInt32Array* New(int32_t* data,
4636 intptr_t len, 4780 intptr_t len,
4637 void* peer, 4781 void* peer,
4638 Dart_PeerFinalizer callback, 4782 Dart_PeerFinalizer callback,
4639 Heap::Space space = Heap::kNew); 4783 Heap::Space space = Heap::kNew);
4640 4784
4641 private: 4785 private:
4642 static const intptr_t kBytesPerElement = 4;
4643
4644 uint8_t* ByteAddr(intptr_t byte_offset) const { 4786 uint8_t* ByteAddr(intptr_t byte_offset) const {
4645 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4787 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4646 uint8_t* data = 4788 uint8_t* data =
4647 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4789 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4648 return data + byte_offset; 4790 return data + byte_offset;
4649 } 4791 }
4650 4792
4651 void SetExternalData(ExternalByteArrayData<int32_t>* data) { 4793 void SetExternalData(ExternalByteArrayData<int32_t>* data) {
4652 raw_ptr()->external_data_ = data; 4794 raw_ptr()->external_data_ = data;
4653 } 4795 }
(...skipping 17 matching lines...) Expand all
4671 4813
4672 void SetAt(intptr_t index, int32_t value) const { 4814 void SetAt(intptr_t index, int32_t value) const {
4673 ASSERT((index >= 0) && (index < Length())); 4815 ASSERT((index >= 0) && (index < Length()));
4674 raw_ptr()->external_data_->data()[index] = value; 4816 raw_ptr()->external_data_->data()[index] = value;
4675 } 4817 }
4676 4818
4677 void* GetPeer() const { 4819 void* GetPeer() const {
4678 return raw_ptr()->external_data_->peer(); 4820 return raw_ptr()->external_data_->peer();
4679 } 4821 }
4680 4822
4823 static const intptr_t kBytesPerElement = 4;
4824
4825 // Since external arrays may be serialized to non-external ones,
4826 // enforce the same maximum element count.
4827 static const intptr_t kMaxElements = Uint32Array::kMaxElements;
4828
4681 static intptr_t InstanceSize() { 4829 static intptr_t InstanceSize() {
4682 return RoundedAllocationSize(sizeof(RawExternalUint32Array)); 4830 return RoundedAllocationSize(sizeof(RawExternalUint32Array));
4683 } 4831 }
4684 4832
4685 static RawExternalUint32Array* New(uint32_t* data, 4833 static RawExternalUint32Array* New(uint32_t* data,
4686 intptr_t len, 4834 intptr_t len,
4687 void* peer, 4835 void* peer,
4688 Dart_PeerFinalizer callback, 4836 Dart_PeerFinalizer callback,
4689 Heap::Space space = Heap::kNew); 4837 Heap::Space space = Heap::kNew);
4690 4838
4691 private: 4839 private:
4692 static const intptr_t kBytesPerElement = 4;
4693
4694 uint8_t* ByteAddr(intptr_t byte_offset) const { 4840 uint8_t* ByteAddr(intptr_t byte_offset) const {
4695 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4841 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4696 uint8_t* data = 4842 uint8_t* data =
4697 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4843 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4698 return data + byte_offset; 4844 return data + byte_offset;
4699 } 4845 }
4700 4846
4701 void SetExternalData(ExternalByteArrayData<uint32_t>* data) { 4847 void SetExternalData(ExternalByteArrayData<uint32_t>* data) {
4702 raw_ptr()->external_data_ = data; 4848 raw_ptr()->external_data_ = data;
4703 } 4849 }
(...skipping 17 matching lines...) Expand all
4721 4867
4722 void SetAt(intptr_t index, int64_t value) const { 4868 void SetAt(intptr_t index, int64_t value) const {
4723 ASSERT((index >= 0) && (index < Length())); 4869 ASSERT((index >= 0) && (index < Length()));
4724 raw_ptr()->external_data_->data()[index] = value; 4870 raw_ptr()->external_data_->data()[index] = value;
4725 } 4871 }
4726 4872
4727 void* GetPeer() const { 4873 void* GetPeer() const {
4728 return raw_ptr()->external_data_->peer(); 4874 return raw_ptr()->external_data_->peer();
4729 } 4875 }
4730 4876
4877 static const intptr_t kBytesPerElement = 8;
4878
4879 // Since external arrays may be serialized to non-external ones,
4880 // enforce the same maximum element count.
4881 static const intptr_t kMaxElements = Int64Array::kMaxElements;
4882
4731 static intptr_t InstanceSize() { 4883 static intptr_t InstanceSize() {
4732 return RoundedAllocationSize(sizeof(RawExternalInt64Array)); 4884 return RoundedAllocationSize(sizeof(RawExternalInt64Array));
4733 } 4885 }
4734 4886
4735 static RawExternalInt64Array* New(int64_t* data, 4887 static RawExternalInt64Array* New(int64_t* data,
4736 intptr_t len, 4888 intptr_t len,
4737 void* peer, 4889 void* peer,
4738 Dart_PeerFinalizer callback, 4890 Dart_PeerFinalizer callback,
4739 Heap::Space space = Heap::kNew); 4891 Heap::Space space = Heap::kNew);
4740 4892
4741 private: 4893 private:
4742 static const intptr_t kBytesPerElement = 8;
4743
4744 uint8_t* ByteAddr(intptr_t byte_offset) const { 4894 uint8_t* ByteAddr(intptr_t byte_offset) const {
4745 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4895 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4746 uint8_t* data = 4896 uint8_t* data =
4747 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4897 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4748 return data + byte_offset; 4898 return data + byte_offset;
4749 } 4899 }
4750 4900
4751 void SetExternalData(ExternalByteArrayData<int64_t>* data) { 4901 void SetExternalData(ExternalByteArrayData<int64_t>* data) {
4752 raw_ptr()->external_data_ = data; 4902 raw_ptr()->external_data_ = data;
4753 } 4903 }
(...skipping 17 matching lines...) Expand all
4771 4921
4772 void SetAt(intptr_t index, int64_t value) const { 4922 void SetAt(intptr_t index, int64_t value) const {
4773 ASSERT((index >= 0) && (index < Length())); 4923 ASSERT((index >= 0) && (index < Length()));
4774 raw_ptr()->external_data_->data()[index] = value; 4924 raw_ptr()->external_data_->data()[index] = value;
4775 } 4925 }
4776 4926
4777 void* GetPeer() const { 4927 void* GetPeer() const {
4778 return raw_ptr()->external_data_->peer(); 4928 return raw_ptr()->external_data_->peer();
4779 } 4929 }
4780 4930
4931 static const intptr_t kBytesPerElement = 8;
4932
4933 // Since external arrays may be serialized to non-external ones,
4934 // enforce the same maximum element count.
4935 static const intptr_t kMaxElements = Uint64Array::kMaxElements;
4936
4781 static intptr_t InstanceSize() { 4937 static intptr_t InstanceSize() {
4782 return RoundedAllocationSize(sizeof(RawExternalUint64Array)); 4938 return RoundedAllocationSize(sizeof(RawExternalUint64Array));
4783 } 4939 }
4784 4940
4785 static RawExternalUint64Array* New(uint64_t* data, 4941 static RawExternalUint64Array* New(uint64_t* data,
4786 intptr_t len, 4942 intptr_t len,
4787 void* peer, 4943 void* peer,
4788 Dart_PeerFinalizer callback, 4944 Dart_PeerFinalizer callback,
4789 Heap::Space space = Heap::kNew); 4945 Heap::Space space = Heap::kNew);
4790 4946
4791 private: 4947 private:
4792 static const intptr_t kBytesPerElement = 8;
4793
4794 uint8_t* ByteAddr(intptr_t byte_offset) const { 4948 uint8_t* ByteAddr(intptr_t byte_offset) const {
4795 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4949 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4796 uint8_t* data = 4950 uint8_t* data =
4797 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 4951 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4798 return data + byte_offset; 4952 return data + byte_offset;
4799 } 4953 }
4800 4954
4801 void SetExternalData(ExternalByteArrayData<uint64_t>* data) { 4955 void SetExternalData(ExternalByteArrayData<uint64_t>* data) {
4802 raw_ptr()->external_data_ = data; 4956 raw_ptr()->external_data_ = data;
4803 } 4957 }
(...skipping 17 matching lines...) Expand all
4821 4975
4822 void SetAt(intptr_t index, float value) const { 4976 void SetAt(intptr_t index, float value) const {
4823 ASSERT((index >= 0) && (index < Length())); 4977 ASSERT((index >= 0) && (index < Length()));
4824 raw_ptr()->external_data_->data()[index] = value; 4978 raw_ptr()->external_data_->data()[index] = value;
4825 } 4979 }
4826 4980
4827 void* GetPeer() const { 4981 void* GetPeer() const {
4828 return raw_ptr()->external_data_->peer(); 4982 return raw_ptr()->external_data_->peer();
4829 } 4983 }
4830 4984
4985 static const intptr_t kBytesPerElement = 4;
4986
4987 // Since external arrays may be serialized to non-external ones,
4988 // enforce the same maximum element count.
4989 static const intptr_t kMaxElements = Float32Array::kMaxElements;
4990
4831 static intptr_t InstanceSize() { 4991 static intptr_t InstanceSize() {
4832 return RoundedAllocationSize(sizeof(RawExternalFloat32Array)); 4992 return RoundedAllocationSize(sizeof(RawExternalFloat32Array));
4833 } 4993 }
4834 4994
4835 static RawExternalFloat32Array* New(float* data, 4995 static RawExternalFloat32Array* New(float* data,
4836 intptr_t len, 4996 intptr_t len,
4837 void* peer, 4997 void* peer,
4838 Dart_PeerFinalizer callback, 4998 Dart_PeerFinalizer callback,
4839 Heap::Space space = Heap::kNew); 4999 Heap::Space space = Heap::kNew);
4840 5000
4841 private: 5001 private:
4842 static const intptr_t kBytesPerElement = 4;
4843
4844 uint8_t* ByteAddr(intptr_t byte_offset) const { 5002 uint8_t* ByteAddr(intptr_t byte_offset) const {
4845 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5003 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4846 uint8_t* data = 5004 uint8_t* data =
4847 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5005 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4848 return data + byte_offset; 5006 return data + byte_offset;
4849 } 5007 }
4850 5008
4851 void SetExternalData(ExternalByteArrayData<float>* data) { 5009 void SetExternalData(ExternalByteArrayData<float>* data) {
4852 raw_ptr()->external_data_ = data; 5010 raw_ptr()->external_data_ = data;
4853 } 5011 }
(...skipping 17 matching lines...) Expand all
4871 5029
4872 void SetAt(intptr_t index, double value) const { 5030 void SetAt(intptr_t index, double value) const {
4873 ASSERT((index >= 0) && (index < Length())); 5031 ASSERT((index >= 0) && (index < Length()));
4874 raw_ptr()->external_data_->data()[index] = value; 5032 raw_ptr()->external_data_->data()[index] = value;
4875 } 5033 }
4876 5034
4877 void* GetPeer() const { 5035 void* GetPeer() const {
4878 return raw_ptr()->external_data_->peer(); 5036 return raw_ptr()->external_data_->peer();
4879 } 5037 }
4880 5038
5039 static const intptr_t kBytesPerElement = 8;
5040
5041 // Since external arrays may be serialized to non-external ones,
5042 // enforce the same maximum element count.
5043 static const intptr_t kMaxElements = Float64Array::kMaxElements;
5044
4881 static intptr_t InstanceSize() { 5045 static intptr_t InstanceSize() {
4882 return RoundedAllocationSize(sizeof(RawExternalFloat64Array)); 5046 return RoundedAllocationSize(sizeof(RawExternalFloat64Array));
4883 } 5047 }
4884 5048
4885 static RawExternalFloat64Array* New(double* data, 5049 static RawExternalFloat64Array* New(double* data,
4886 intptr_t len, 5050 intptr_t len,
4887 void* peer, 5051 void* peer,
4888 Dart_PeerFinalizer callback, 5052 Dart_PeerFinalizer callback,
4889 Heap::Space space = Heap::kNew); 5053 Heap::Space space = Heap::kNew);
4890 5054
4891 private: 5055 private:
4892 static const intptr_t kBytesPerElement = 8;
4893
4894 uint8_t* ByteAddr(intptr_t byte_offset) const { 5056 uint8_t* ByteAddr(intptr_t byte_offset) const {
4895 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5057 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4896 uint8_t* data = 5058 uint8_t* data =
4897 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5059 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
4898 return data + byte_offset; 5060 return data + byte_offset;
4899 } 5061 }
4900 5062
4901 void SetExternalData(ExternalByteArrayData<double>* data) { 5063 void SetExternalData(ExternalByteArrayData<double>* data) {
4902 raw_ptr()->external_data_ = data; 5064 raw_ptr()->external_data_ = data;
4903 } 5065 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
5023 void set_is_multi_line() const { raw_ptr()->flags_ |= kMultiLine; } 5185 void set_is_multi_line() const { raw_ptr()->flags_ |= kMultiLine; }
5024 void set_is_simple() const { raw_ptr()->type_ = kSimple; } 5186 void set_is_simple() const { raw_ptr()->type_ = kSimple; }
5025 void set_is_complex() const { raw_ptr()->type_ = kComplex; } 5187 void set_is_complex() const { raw_ptr()->type_ = kComplex; }
5026 5188
5027 void* GetDataStartAddress() const; 5189 void* GetDataStartAddress() const;
5028 static RawJSRegExp* FromDataStartAddress(void* data); 5190 static RawJSRegExp* FromDataStartAddress(void* data);
5029 const char* Flags() const; 5191 const char* Flags() const;
5030 5192
5031 virtual bool Equals(const Instance& other) const; 5193 virtual bool Equals(const Instance& other) const;
5032 5194
5195 static const intptr_t kBytesPerElement = 1;
5196 static const intptr_t kMaxElements = MAX_ELEMENTS(JSRegExp);
5197
5033 static intptr_t InstanceSize() { 5198 static intptr_t InstanceSize() {
5034 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF(RawJSRegExp, data_)); 5199 ASSERT(sizeof(RawJSRegExp) == OFFSET_OF(RawJSRegExp, data_));
5035 return 0; 5200 return 0;
5036 } 5201 }
5037 5202
5038 static intptr_t InstanceSize(intptr_t len) { 5203 static intptr_t InstanceSize(intptr_t len) {
5039 return RoundedAllocationSize(sizeof(RawJSRegExp) + len); 5204 ASSERT(0 <= len && len <= kMaxElements);
5205 return RoundedAllocationSize(
5206 sizeof(RawJSRegExp) + (len * kBytesPerElement));
5040 } 5207 }
5041 5208
5042 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew); 5209 static RawJSRegExp* New(intptr_t length, Heap::Space space = Heap::kNew);
5043 5210
5044 private: 5211 private:
5045 void set_type(RegExType type) const { raw_ptr()->type_ = type; } 5212 void set_type(RegExType type) const { raw_ptr()->type_ = type; }
5046 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } 5213 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; }
5047 5214
5048 void SetLength(intptr_t value) const { 5215 void SetLength(intptr_t value) const {
5049 // This is only safe because we create a new Smi, which does not cause 5216 // This is only safe because we create a new Smi, which does not cause
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
5130 } 5297 }
5131 5298
5132 5299
5133 intptr_t Stackmap::SizeInBits() const { 5300 intptr_t Stackmap::SizeInBits() const {
5134 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 5301 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
5135 } 5302 }
5136 5303
5137 } // namespace dart 5304 } // namespace dart
5138 5305
5139 #endif // VM_OBJECT_H_ 5306 #endif // VM_OBJECT_H_
OLDNEW
« vm/dart_api_impl.cc ('K') | « vm/dart_api_impl_test.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698