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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 kIndexBias = 1 << (kIndexSize - 1), | 1346 kIndexBias = 1 << (kIndexSize - 1), |
1347 kMaxIndex = (1 << (kIndexSize - 1)) - 1, | 1347 kMaxIndex = (1 << (kIndexSize - 1)) - 1, |
1348 }; | 1348 }; |
1349 | 1349 |
1350 class IndexBits : public BitField<int32_t, int32_t, kIndexPos, kIndexSize> {}; | 1350 class IndexBits : public BitField<int32_t, int32_t, kIndexPos, kIndexSize> {}; |
1351 class KindBits : public BitField<int32_t, int8_t, kKindPos, kKindSize>{}; | 1351 class KindBits : public BitField<int32_t, int8_t, kKindPos, kKindSize>{}; |
1352 | 1352 |
1353 struct VarInfo { | 1353 struct VarInfo { |
1354 int32_t index_kind; // Bitfield for slot index on stack or in context, | 1354 int32_t index_kind; // Bitfield for slot index on stack or in context, |
1355 // and Entry kind of type VarInfoKind. | 1355 // and Entry kind of type VarInfoKind. |
| 1356 TokenPosition declaration_pos; // Token position of declaration. |
1356 TokenPosition begin_pos; // Token position of scope start. | 1357 TokenPosition begin_pos; // Token position of scope start. |
1357 TokenPosition end_pos; // Token position of scope end. | 1358 TokenPosition end_pos; // Token position of scope end. |
1358 int16_t scope_id; // Scope to which the variable belongs. | 1359 int16_t scope_id; // Scope to which the variable belongs. |
1359 | 1360 |
1360 VarInfoKind kind() const { | 1361 VarInfoKind kind() const { |
1361 return static_cast<VarInfoKind>(KindBits::decode(index_kind)); | 1362 return static_cast<VarInfoKind>(KindBits::decode(index_kind)); |
1362 } | 1363 } |
1363 void set_kind(VarInfoKind kind) { | 1364 void set_kind(VarInfoKind kind) { |
1364 index_kind = KindBits::update(kind, index_kind); | 1365 index_kind = KindBits::update(kind, index_kind); |
1365 } | 1366 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 friend class SnapshotReader; | 1449 friend class SnapshotReader; |
1449 }; | 1450 }; |
1450 | 1451 |
1451 | 1452 |
1452 class RawContextScope : public RawObject { | 1453 class RawContextScope : public RawObject { |
1453 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); | 1454 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); |
1454 | 1455 |
1455 // TODO(iposva): Switch to conventional enum offset based structure to avoid | 1456 // TODO(iposva): Switch to conventional enum offset based structure to avoid |
1456 // alignment mishaps. | 1457 // alignment mishaps. |
1457 struct VariableDesc { | 1458 struct VariableDesc { |
| 1459 RawSmi* declaration_token_pos; |
1458 RawSmi* token_pos; | 1460 RawSmi* token_pos; |
1459 RawString* name; | 1461 RawString* name; |
1460 RawBool* is_final; | 1462 RawBool* is_final; |
1461 RawBool* is_const; | 1463 RawBool* is_const; |
1462 union { | 1464 union { |
1463 RawAbstractType* type; | 1465 RawAbstractType* type; |
1464 RawInstance* value; // iff is_const is true | 1466 RawInstance* value; // iff is_const is true |
1465 }; | 1467 }; |
1466 RawSmi* context_index; | 1468 RawSmi* context_index; |
1467 RawSmi* context_level; | 1469 RawSmi* context_level; |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2485 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2484 kTypedDataInt8ArrayViewCid + 15); | 2486 kTypedDataInt8ArrayViewCid + 15); |
2485 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2487 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2486 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2488 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2487 return (kNullCid - kTypedDataInt8ArrayCid); | 2489 return (kNullCid - kTypedDataInt8ArrayCid); |
2488 } | 2490 } |
2489 | 2491 |
2490 } // namespace dart | 2492 } // namespace dart |
2491 | 2493 |
2492 #endif // VM_RAW_OBJECT_H_ | 2494 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |