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