| 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 } value_; | 914 } value_; |
| 915 union { | 915 union { |
| 916 // When precompiling we need to save the static initializer function here | 916 // When precompiling we need to save the static initializer function here |
| 917 // so that code for it can be generated. | 917 // so that code for it can be generated. |
| 918 RawFunction* precompiled_; // Static initializer function - precompiling. | 918 RawFunction* precompiled_; // Static initializer function - precompiling. |
| 919 // When generating script snapshots after running the application it is | 919 // When generating script snapshots after running the application it is |
| 920 // necessary to save the initial value of static fields so that we can | 920 // necessary to save the initial value of static fields so that we can |
| 921 // restore the value back to the original initial value. | 921 // restore the value back to the original initial value. |
| 922 RawInstance* saved_value_; // Saved initial value - static fields. | 922 RawInstance* saved_value_; // Saved initial value - static fields. |
| 923 } initializer_; | 923 } initializer_; |
| 924 RawObject** to_precompiled_snapshot() { | |
| 925 return reinterpret_cast<RawObject**>(&ptr()->initializer_); | |
| 926 } | |
| 927 RawArray* dependent_code_; | 924 RawArray* dependent_code_; |
| 928 RawSmi* guarded_list_length_; | 925 RawSmi* guarded_list_length_; |
| 929 RawObject** to() { | 926 RawObject** to() { |
| 930 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); | 927 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); |
| 931 } | 928 } |
| 929 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 930 switch (kind) { |
| 931 case Snapshot::kCore: |
| 932 case Snapshot::kScript: |
| 933 return to(); |
| 934 case Snapshot::kAppWithJIT: |
| 935 case Snapshot::kAppNoJIT: |
| 936 return reinterpret_cast<RawObject**>(&ptr()->initializer_); |
| 937 case Snapshot::kMessage: |
| 938 break; |
| 939 } |
| 940 UNREACHABLE(); |
| 941 return NULL; |
| 942 } |
| 932 | 943 |
| 933 TokenPosition token_pos_; | 944 TokenPosition token_pos_; |
| 934 classid_t guarded_cid_; | 945 classid_t guarded_cid_; |
| 935 classid_t is_nullable_; // kNullCid if field can contain null value and | 946 classid_t is_nullable_; // kNullCid if field can contain null value and |
| 936 // any other value otherwise. | 947 // any other value otherwise. |
| 937 // Offset to the guarded length field inside an instance of class matching | 948 // Offset to the guarded length field inside an instance of class matching |
| 938 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code | 949 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code |
| 939 // generated on platforms with weak addressing modes (ARM, MIPS). | 950 // generated on platforms with weak addressing modes (ARM, MIPS). |
| 940 int8_t guarded_list_length_in_object_offset_; | 951 int8_t guarded_list_length_in_object_offset_; |
| 941 | 952 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 kSourceTag, | 996 kSourceTag, |
| 986 kPatchTag, | 997 kPatchTag, |
| 987 kEvaluateTag, | 998 kEvaluateTag, |
| 988 }; | 999 }; |
| 989 | 1000 |
| 990 private: | 1001 private: |
| 991 RAW_HEAP_OBJECT_IMPLEMENTATION(Script); | 1002 RAW_HEAP_OBJECT_IMPLEMENTATION(Script); |
| 992 | 1003 |
| 993 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); } | 1004 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); } |
| 994 RawString* url_; | 1005 RawString* url_; |
| 995 RawObject** to_precompiled_snapshot() { | |
| 996 return reinterpret_cast<RawObject**>(&ptr()->url_); | |
| 997 } | |
| 998 RawTokenStream* tokens_; | 1006 RawTokenStream* tokens_; |
| 999 RawObject** to_snapshot() { | |
| 1000 return reinterpret_cast<RawObject**>(&ptr()->tokens_); | |
| 1001 } | |
| 1002 RawString* source_; | 1007 RawString* source_; |
| 1003 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->source_); } | 1008 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->source_); } |
| 1009 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 1010 switch (kind) { |
| 1011 case Snapshot::kAppNoJIT: |
| 1012 return reinterpret_cast<RawObject**>(&ptr()->url_); |
| 1013 case Snapshot::kCore: |
| 1014 case Snapshot::kAppWithJIT: |
| 1015 case Snapshot::kScript: |
| 1016 return reinterpret_cast<RawObject**>(&ptr()->tokens_); |
| 1017 case Snapshot::kMessage: |
| 1018 break; |
| 1019 } |
| 1020 UNREACHABLE(); |
| 1021 return NULL; |
| 1022 } |
| 1004 | 1023 |
| 1005 int32_t line_offset_; | 1024 int32_t line_offset_; |
| 1006 int32_t col_offset_; | 1025 int32_t col_offset_; |
| 1007 int8_t kind_; // Of type Kind. | 1026 int8_t kind_; // Of type Kind. |
| 1008 }; | 1027 }; |
| 1009 | 1028 |
| 1010 | 1029 |
| 1011 class RawLibrary : public RawObject { | 1030 class RawLibrary : public RawObject { |
| 1012 enum LibraryState { | 1031 enum LibraryState { |
| 1013 kAllocated, // Initial state. | 1032 kAllocated, // Initial state. |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 | 1483 |
| 1465 class RawICData : public RawObject { | 1484 class RawICData : public RawObject { |
| 1466 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); | 1485 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); |
| 1467 | 1486 |
| 1468 RawObject** from() { | 1487 RawObject** from() { |
| 1469 return reinterpret_cast<RawObject**>(&ptr()->ic_data_); | 1488 return reinterpret_cast<RawObject**>(&ptr()->ic_data_); |
| 1470 } | 1489 } |
| 1471 RawArray* ic_data_; // Contains class-ids, target and count. | 1490 RawArray* ic_data_; // Contains class-ids, target and count. |
| 1472 RawString* target_name_; // Name of target function. | 1491 RawString* target_name_; // Name of target function. |
| 1473 RawArray* args_descriptor_; // Arguments descriptor. | 1492 RawArray* args_descriptor_; // Arguments descriptor. |
| 1474 RawObject** to_precompiled_snapshot() { | |
| 1475 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); | |
| 1476 } | |
| 1477 RawObject* owner_; // Parent/calling function or original IC of cloned IC. | 1493 RawObject* owner_; // Parent/calling function or original IC of cloned IC. |
| 1478 RawObject** to() { | 1494 RawObject** to() { |
| 1479 return reinterpret_cast<RawObject**>(&ptr()->owner_); | 1495 return reinterpret_cast<RawObject**>(&ptr()->owner_); |
| 1480 } | 1496 } |
| 1497 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 1498 switch (kind) { |
| 1499 case Snapshot::kAppNoJIT: |
| 1500 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); |
| 1501 case Snapshot::kCore: |
| 1502 case Snapshot::kScript: |
| 1503 case Snapshot::kAppWithJIT: |
| 1504 return to(); |
| 1505 case Snapshot::kMessage: |
| 1506 break; |
| 1507 } |
| 1508 UNREACHABLE(); |
| 1509 return NULL; |
| 1510 } |
| 1481 int32_t deopt_id_; // Deoptimization id corresponding to this IC. | 1511 int32_t deopt_id_; // Deoptimization id corresponding to this IC. |
| 1482 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons, | 1512 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons, |
| 1483 // range feedback. | 1513 // range feedback. |
| 1484 #if defined(TAG_IC_DATA) | 1514 #if defined(TAG_IC_DATA) |
| 1485 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the | 1515 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the |
| 1486 // same instruction again. Store -1 or Instruction::Tag. | 1516 // same instruction again. Store -1 or Instruction::Tag. |
| 1487 #endif | 1517 #endif |
| 1488 }; | 1518 }; |
| 1489 | 1519 |
| 1490 | 1520 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); | 1612 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); |
| 1583 }; | 1613 }; |
| 1584 | 1614 |
| 1585 | 1615 |
| 1586 class RawLibraryPrefix : public RawInstance { | 1616 class RawLibraryPrefix : public RawInstance { |
| 1587 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); | 1617 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); |
| 1588 | 1618 |
| 1589 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 1619 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 1590 RawString* name_; // Library prefix name. | 1620 RawString* name_; // Library prefix name. |
| 1591 RawLibrary* importer_; // Library which declares this prefix. | 1621 RawLibrary* importer_; // Library which declares this prefix. |
| 1592 RawObject** to_precompiled_snapshot() { | |
| 1593 return reinterpret_cast<RawObject**>(&ptr()->importer_); | |
| 1594 } | |
| 1595 RawArray* imports_; // Libraries imported with this prefix. | 1622 RawArray* imports_; // Libraries imported with this prefix. |
| 1596 RawArray* dependent_code_; // Code that refers to deferred, unloaded | 1623 RawArray* dependent_code_; // Code that refers to deferred, unloaded |
| 1597 // library prefix. | 1624 // library prefix. |
| 1598 RawObject** to() { | 1625 RawObject** to() { |
| 1599 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); | 1626 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
| 1600 } | 1627 } |
| 1628 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 1629 switch (kind) { |
| 1630 case Snapshot::kCore: |
| 1631 case Snapshot::kScript: |
| 1632 return to(); |
| 1633 case Snapshot::kAppWithJIT: |
| 1634 case Snapshot::kAppNoJIT: |
| 1635 return reinterpret_cast<RawObject**>(&ptr()->importer_); |
| 1636 case Snapshot::kMessage: |
| 1637 break; |
| 1638 } |
| 1639 UNREACHABLE(); |
| 1640 return NULL; |
| 1641 } |
| 1601 uint16_t num_imports_; // Number of library entries in libraries_. | 1642 uint16_t num_imports_; // Number of library entries in libraries_. |
| 1602 bool is_deferred_load_; | 1643 bool is_deferred_load_; |
| 1603 bool is_loaded_; | 1644 bool is_loaded_; |
| 1604 }; | 1645 }; |
| 1605 | 1646 |
| 1606 | 1647 |
| 1607 class RawAbstractType : public RawInstance { | 1648 class RawAbstractType : public RawInstance { |
| 1608 protected: | 1649 protected: |
| 1609 enum TypeState { | 1650 enum TypeState { |
| 1610 kAllocated, // Initial state. | 1651 kAllocated, // Initial state. |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2374 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2415 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2375 kTypedDataInt8ArrayViewCid + 15); | 2416 kTypedDataInt8ArrayViewCid + 15); |
| 2376 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2417 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2377 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2418 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2378 return (kNullCid - kTypedDataInt8ArrayCid); | 2419 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2379 } | 2420 } |
| 2380 | 2421 |
| 2381 } // namespace dart | 2422 } // namespace dart |
| 2382 | 2423 |
| 2383 #endif // VM_RAW_OBJECT_H_ | 2424 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |