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; |
921 int32_t deopt_id; | |
922 int32_t token_pos; // Or deopt reason. | |
923 int16_t try_index; // Or deopt index. | |
924 uint8_t kind_; | |
925 | 922 |
926 Kind kind() const { return static_cast<Kind>(kind_); } | 923 Kind kind() const { |
924 return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind); | |
925 } | |
926 void set_kind(Kind kind) { | |
927 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind; | |
928 } | |
929 | |
930 int16_t try_index() const { | |
931 if (is_compressed()) { | |
932 return -1; | |
933 } | |
934 return try_index_; | |
935 } | |
936 void set_try_index(int16_t value) { | |
937 if (is_compressed()) { | |
938 ASSERT(value == -1); | |
939 return; | |
940 } | |
941 try_index_ = value; | |
942 } | |
943 | |
944 intptr_t token_pos() const { return token_pos_ >> 1; } | |
945 void set_token_pos(int32_t value, bool compressed) { | |
946 int32_t bit = compressed ? 0x1 : 0x0; | |
947 token_pos_ = (value << 1) | bit; | |
948 } | |
949 | |
950 intptr_t deopt_id() const { return deopt_id_and_kind_ >> 8; } | |
951 void set_deopt_id(int32_t value) { | |
952 ASSERT(Utils::IsInt(24, value)); | |
953 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8); | |
954 } | |
955 | |
956 private: | |
957 bool is_compressed() const { | |
958 return (token_pos_ & 0x1) == 1; | |
959 } | |
960 | |
961 int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind. | |
962 int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag; | |
963 int16_t try_index_; | |
siva
2014/07/14 19:42:01
Might make sense to make 'pc' also private and pro
srdjan
2014/07/14 23:55:25
Done.
| |
927 }; | 964 }; |
928 | 965 |
966 static const intptr_t kFullRecSize = sizeof(PcDescriptorRec); | |
967 static const intptr_t kCompressedRecSize = kFullRecSize - sizeof(int16_t); | |
968 | |
929 private: | 969 private: |
930 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); | 970 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); |
931 | 971 |
972 intptr_t record_size_in_bytes_; | |
932 intptr_t length_; // Number of descriptors. | 973 intptr_t length_; // Number of descriptors. |
933 | 974 |
934 // Variable length data follows here. | 975 // Variable length data follows here. |
935 PcDescriptorRec* data() { OPEN_ARRAY_START(PcDescriptorRec, intptr_t); } | 976 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
936 | 977 |
937 friend class Object; | 978 friend class Object; |
938 }; | 979 }; |
939 | 980 |
940 | 981 |
941 // Stackmap is an immutable representation of the layout of the stack at a | 982 // 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 | 983 // PC. The stack map representation consists of a bit map which marks each |
943 // live object index starting from the base of the frame. | 984 // live object index starting from the base of the frame. |
944 // | 985 // |
945 // The Stackmap also consists of a link to the code object corresponding to | 986 // 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); | 1939 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
1899 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 1940 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
1900 kTypedDataInt8ArrayViewCid + 15); | 1941 kTypedDataInt8ArrayViewCid + 15); |
1901 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); | 1942 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); |
1902 return (kNullCid - kTypedDataInt8ArrayCid); | 1943 return (kNullCid - kTypedDataInt8ArrayCid); |
1903 } | 1944 } |
1904 | 1945 |
1905 } // namespace dart | 1946 } // namespace dart |
1906 | 1947 |
1907 #endif // VM_RAW_OBJECT_H_ | 1948 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |