| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 RawObject* raw_obj_; | 1164 RawObject* raw_obj_; |
| 1165 uword raw_value_; | 1165 uword raw_value_; |
| 1166 }; | 1166 }; |
| 1167 }; | 1167 }; |
| 1168 Entry* data() { OPEN_ARRAY_START(Entry, Entry); } | 1168 Entry* data() { OPEN_ARRAY_START(Entry, Entry); } |
| 1169 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); } | 1169 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); } |
| 1170 | 1170 |
| 1171 Entry* first_entry() { return &ptr()->data()[0]; } | 1171 Entry* first_entry() { return &ptr()->data()[0]; } |
| 1172 | 1172 |
| 1173 friend class Object; | 1173 friend class Object; |
| 1174 friend class SnapshotReader; | |
| 1175 }; | 1174 }; |
| 1176 | 1175 |
| 1177 | 1176 |
| 1178 class RawInstructions : public RawObject { | 1177 class RawInstructions : public RawObject { |
| 1179 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); | 1178 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); |
| 1180 | 1179 |
| 1181 int32_t size_; | 1180 int32_t size_; |
| 1182 | 1181 |
| 1183 // Variable length data follows here. | 1182 // Variable length data follows here. |
| 1184 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1183 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1247 private: | 1246 private: |
| 1248 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); | 1247 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); |
| 1249 | 1248 |
| 1250 int32_t length_; // Number of descriptors. | 1249 int32_t length_; // Number of descriptors. |
| 1251 | 1250 |
| 1252 // Variable length data follows here. | 1251 // Variable length data follows here. |
| 1253 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1252 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 1254 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1253 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 1255 | 1254 |
| 1256 friend class Object; | 1255 friend class Object; |
| 1257 friend class SnapshotReader; | |
| 1258 }; | 1256 }; |
| 1259 | 1257 |
| 1260 | 1258 |
| 1261 // CodeSourceMap stores a mapping between code PC ranges and source token | 1259 // CodeSourceMap stores a mapping between code PC ranges and source token |
| 1262 // positions. | 1260 // positions. |
| 1263 class RawCodeSourceMap : public RawObject { | 1261 class RawCodeSourceMap : public RawObject { |
| 1264 private: | 1262 private: |
| 1265 RAW_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap); | 1263 RAW_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap); |
| 1266 | 1264 |
| 1267 int32_t length_; // Number of entries. | 1265 int32_t length_; // Number of entries. |
| 1268 | 1266 |
| 1269 // Variable length data follows here. | 1267 // Variable length data follows here. |
| 1270 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1268 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 1271 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1269 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 1272 | 1270 |
| 1273 friend class Object; | 1271 friend class Object; |
| 1274 friend class SnapshotReader; | |
| 1275 }; | 1272 }; |
| 1276 | 1273 |
| 1277 | 1274 |
| 1278 // Stackmap is an immutable representation of the layout of the stack at a | 1275 // Stackmap is an immutable representation of the layout of the stack at a |
| 1279 // PC. The stack map representation consists of a bit map which marks each | 1276 // PC. The stack map representation consists of a bit map which marks each |
| 1280 // live object index starting from the base of the frame. | 1277 // live object index starting from the base of the frame. |
| 1281 // | 1278 // |
| 1282 // The bit map representation is optimized for dense and small bit maps, without | 1279 // The bit map representation is optimized for dense and small bit maps, without |
| 1283 // any upper bound. | 1280 // any upper bound. |
| 1284 class RawStackmap : public RawObject { | 1281 class RawStackmap : public RawObject { |
| 1285 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap); | 1282 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap); |
| 1286 | 1283 |
| 1287 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ | 1284 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ |
| 1288 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or | 1285 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or |
| 1289 // as large as ~33 million entries. If that is sufficient, then these two | 1286 // as large as ~33 million entries. If that is sufficient, then these two |
| 1290 // fields can be merged into a BitField. | 1287 // fields can be merged into a BitField. |
| 1291 int32_t length_; // Length of payload, in bits. | 1288 int32_t length_; // Length of payload, in bits. |
| 1292 int32_t slow_path_bit_count_; // Slow path live values, included in length_. | 1289 int32_t slow_path_bit_count_; // Slow path live values, included in length_. |
| 1293 | 1290 |
| 1294 // Offset from code entry point corresponding to this stack map | 1291 // Offset from code entry point corresponding to this stack map |
| 1295 // representation. | 1292 // representation. |
| 1296 uint32_t pc_offset_; | 1293 uint32_t pc_offset_; |
| 1297 | 1294 |
| 1298 // Variable length data follows here (bitmap of the stack layout). | 1295 // Variable length data follows here (bitmap of the stack layout). |
| 1299 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1296 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
| 1300 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1297 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } |
| 1301 | |
| 1302 friend class SnapshotReader; | |
| 1303 }; | 1298 }; |
| 1304 | 1299 |
| 1305 | 1300 |
| 1306 class RawLocalVarDescriptors : public RawObject { | 1301 class RawLocalVarDescriptors : public RawObject { |
| 1307 public: | 1302 public: |
| 1308 enum VarInfoKind { | 1303 enum VarInfoKind { |
| 1309 kStackVar = 1, | 1304 kStackVar = 1, |
| 1310 kContextVar, | 1305 kContextVar, |
| 1311 kContextLevel, | 1306 kContextLevel, |
| 1312 kSavedCurrentContext, | 1307 kSavedCurrentContext, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 RawObject** to(intptr_t num_entries) { | 1361 RawObject** to(intptr_t num_entries) { |
| 1367 return reinterpret_cast<RawObject**>(nameAddrAt(num_entries - 1)); | 1362 return reinterpret_cast<RawObject**>(nameAddrAt(num_entries - 1)); |
| 1368 } | 1363 } |
| 1369 | 1364 |
| 1370 // Variable info with [num_entries_] entries. | 1365 // Variable info with [num_entries_] entries. |
| 1371 VarInfo* data() { | 1366 VarInfo* data() { |
| 1372 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_)); | 1367 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_)); |
| 1373 } | 1368 } |
| 1374 | 1369 |
| 1375 friend class Object; | 1370 friend class Object; |
| 1376 friend class SnapshotReader; | |
| 1377 }; | 1371 }; |
| 1378 | 1372 |
| 1379 | 1373 |
| 1380 class RawExceptionHandlers : public RawObject { | 1374 class RawExceptionHandlers : public RawObject { |
| 1381 public: | 1375 public: |
| 1382 // The index into the ExceptionHandlers table corresponds to | 1376 // The index into the ExceptionHandlers table corresponds to |
| 1383 // the try_index of the handler. | 1377 // the try_index of the handler. |
| 1384 struct HandlerInfo { | 1378 struct HandlerInfo { |
| 1385 uint32_t handler_pc_offset; // PC offset value of handler. | 1379 uint32_t handler_pc_offset; // PC offset value of handler. |
| 1386 int16_t outer_try_index; // Try block index of enclosing try block. | 1380 int16_t outer_try_index; // Try block index of enclosing try block. |
| 1387 int8_t needs_stacktrace; // True if a stacktrace is needed. | 1381 int8_t needs_stacktrace; // True if a stacktrace is needed. |
| 1388 int8_t has_catch_all; // Catches all exceptions. | 1382 int8_t has_catch_all; // Catches all exceptions. |
| 1389 }; | 1383 }; |
| 1390 | 1384 |
| 1391 private: | 1385 private: |
| 1392 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); | 1386 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); |
| 1393 | 1387 |
| 1394 // Number of exception handler entries. | 1388 // Number of exception handler entries. |
| 1395 int32_t num_entries_; | 1389 int32_t num_entries_; |
| 1396 | 1390 |
| 1397 // Array with [num_entries_] entries. Each entry is an array of all handled | 1391 // Array with [num_entries_] entries. Each entry is an array of all handled |
| 1398 // exception types. | 1392 // exception types. |
| 1399 RawArray* handled_types_data_; | 1393 RawArray* handled_types_data_; |
| 1400 | 1394 |
| 1401 // Exception handler info of length [num_entries_]. | 1395 // Exception handler info of length [num_entries_]. |
| 1402 const HandlerInfo* data() const { OPEN_ARRAY_START(HandlerInfo, intptr_t); } | 1396 const HandlerInfo* data() const { OPEN_ARRAY_START(HandlerInfo, intptr_t); } |
| 1403 HandlerInfo* data() { OPEN_ARRAY_START(HandlerInfo, intptr_t); } | 1397 HandlerInfo* data() { OPEN_ARRAY_START(HandlerInfo, intptr_t); } |
| 1404 | 1398 |
| 1405 friend class Object; | 1399 friend class Object; |
| 1406 friend class SnapshotReader; | |
| 1407 }; | 1400 }; |
| 1408 | 1401 |
| 1409 | 1402 |
| 1410 class RawContext : public RawObject { | 1403 class RawContext : public RawObject { |
| 1411 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); | 1404 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); |
| 1412 | 1405 |
| 1413 int32_t num_variables_; | 1406 int32_t num_variables_; |
| 1414 | 1407 |
| 1415 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } | 1408 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } |
| 1416 RawContext* parent_; | 1409 RawContext* parent_; |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2419 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2427 kTypedDataInt8ArrayViewCid + 15); | 2420 kTypedDataInt8ArrayViewCid + 15); |
| 2428 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2421 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2429 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2422 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2430 return (kNullCid - kTypedDataInt8ArrayCid); | 2423 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2431 } | 2424 } |
| 2432 | 2425 |
| 2433 } // namespace dart | 2426 } // namespace dart |
| 2434 | 2427 |
| 2435 #endif // VM_RAW_OBJECT_H_ | 2428 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |