| 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/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/token.h" | 10 #include "vm/token.h" |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 kIcCall = kDeopt << 1, // IC call. | 909 kIcCall = kDeopt << 1, // IC call. |
| 910 kOptStaticCall = kIcCall << 1, // Call directly to known target. | 910 kOptStaticCall = kIcCall << 1, // Call directly to known target. |
| 911 kUnoptStaticCall = kOptStaticCall << 1, // Call to a known target via stub. | 911 kUnoptStaticCall = kOptStaticCall << 1, // Call to a known target via stub. |
| 912 kClosureCall = kUnoptStaticCall << 1, // Closure call. | 912 kClosureCall = kUnoptStaticCall << 1, // Closure call. |
| 913 kRuntimeCall = kClosureCall << 1, // Runtime call. | 913 kRuntimeCall = kClosureCall << 1, // Runtime call. |
| 914 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. | 914 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. |
| 915 kOther = kOsrEntry << 1, | 915 kOther = kOsrEntry << 1, |
| 916 kAnyKind = 0xFF | 916 kAnyKind = 0xFF |
| 917 }; | 917 }; |
| 918 | 918 |
| 919 // Compressed version assumes try_index is always -1 and does not store it. |
| 919 struct PcDescriptorRec { | 920 struct PcDescriptorRec { |
| 920 uword pc; | 921 uword pc() const { return pc_; } |
| 921 int32_t deopt_id; | 922 void set_pc(uword value) { pc_ = value; } |
| 922 int32_t token_pos; // Or deopt reason. | |
| 923 int16_t try_index; // Or deopt index. | |
| 924 uint8_t kind_; | |
| 925 | 923 |
| 926 Kind kind() const { return static_cast<Kind>(kind_); } | 924 Kind kind() const { |
| 925 return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind); |
| 926 } |
| 927 void set_kind(Kind kind) { |
| 928 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind; |
| 929 } |
| 930 |
| 931 int16_t try_index() const { return is_compressed() ? -1 : try_index_; } |
| 932 void set_try_index(int16_t value) { |
| 933 if (is_compressed()) { |
| 934 ASSERT(value == -1); |
| 935 return; |
| 936 } |
| 937 try_index_ = value; |
| 938 } |
| 939 |
| 940 intptr_t token_pos() const { return token_pos_ >> 1; } |
| 941 void set_token_pos(int32_t value, bool compressed) { |
| 942 int32_t bit = compressed ? 0x1 : 0x0; |
| 943 token_pos_ = (value << 1) | bit; |
| 944 } |
| 945 |
| 946 intptr_t deopt_id() const { return deopt_id_and_kind_ >> 8; } |
| 947 void set_deopt_id(int32_t value) { |
| 948 ASSERT(Utils::IsInt(24, value)); |
| 949 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8); |
| 950 } |
| 951 |
| 952 private: |
| 953 bool is_compressed() const { |
| 954 return (token_pos_ & 0x1) == 1; |
| 955 } |
| 956 |
| 957 uword pc_; |
| 958 int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind. |
| 959 int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag; |
| 960 int16_t try_index_; |
| 927 }; | 961 }; |
| 928 | 962 |
| 963 static const intptr_t kFullRecSize = sizeof(PcDescriptorRec); |
| 964 static const intptr_t kCompressedRecSize = kFullRecSize - sizeof(int16_t); |
| 965 |
| 929 private: | 966 private: |
| 930 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); | 967 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); |
| 931 | 968 |
| 969 intptr_t record_size_in_bytes_; |
| 932 intptr_t length_; // Number of descriptors. | 970 intptr_t length_; // Number of descriptors. |
| 933 | 971 |
| 934 // Variable length data follows here. | 972 // Variable length data follows here. |
| 935 PcDescriptorRec* data() { OPEN_ARRAY_START(PcDescriptorRec, intptr_t); } | 973 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 936 | 974 |
| 937 friend class Object; | 975 friend class Object; |
| 938 }; | 976 }; |
| 939 | 977 |
| 940 | 978 |
| 941 // Stackmap is an immutable representation of the layout of the stack at a | 979 // Stackmap is an immutable representation of the layout of the stack at a |
| 942 // PC. The stack map representation consists of a bit map which marks each | 980 // PC. The stack map representation consists of a bit map which marks each |
| 943 // live object index starting from the base of the frame. | 981 // live object index starting from the base of the frame. |
| 944 // | 982 // |
| 945 // The Stackmap also consists of a link to the code object corresponding to | 983 // The Stackmap also consists of a link to the code object corresponding to |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 1936 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
| 1899 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 1937 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 1900 kTypedDataInt8ArrayViewCid + 15); | 1938 kTypedDataInt8ArrayViewCid + 15); |
| 1901 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); | 1939 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); |
| 1902 return (kNullCid - kTypedDataInt8ArrayCid); | 1940 return (kNullCid - kTypedDataInt8ArrayCid); |
| 1903 } | 1941 } |
| 1904 | 1942 |
| 1905 } // namespace dart | 1943 } // namespace dart |
| 1906 | 1944 |
| 1907 #endif // VM_RAW_OBJECT_H_ | 1945 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |