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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 kOptStaticCall = kIcCall << 1, // Call directly to known target. | 914 kOptStaticCall = kIcCall << 1, // Call directly to known target. |
915 kUnoptStaticCall = kOptStaticCall << 1, // Call to a known target via stub. | 915 kUnoptStaticCall = kOptStaticCall << 1, // Call to a known target via stub. |
916 kClosureCall = kUnoptStaticCall << 1, // Closure call. | 916 kClosureCall = kUnoptStaticCall << 1, // Closure call. |
917 kRuntimeCall = kClosureCall << 1, // Runtime call. | 917 kRuntimeCall = kClosureCall << 1, // Runtime call. |
918 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. | 918 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. |
919 kOther = kOsrEntry << 1, | 919 kOther = kOsrEntry << 1, |
920 kAnyKind = 0xFF | 920 kAnyKind = 0xFF |
921 }; | 921 }; |
922 | 922 |
923 // Compressed version assumes try_index is always -1 and does not store it. | 923 // Compressed version assumes try_index is always -1 and does not store it. |
924 class PcDescriptorRec { | 924 struct PcDescriptorRec { |
925 public: | |
926 PcDescriptorRec() | |
927 : pc_(0), deopt_id_and_kind_(0), token_pos_(0), try_index_(0) {} | |
928 | |
929 uword pc() const { return pc_; } | 925 uword pc() const { return pc_; } |
930 void set_pc(uword value) { pc_ = value; } | 926 void set_pc(uword value) { pc_ = value; } |
931 | 927 |
932 Kind kind() const { | 928 Kind kind() const { |
933 return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind); | 929 return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind); |
934 } | 930 } |
935 void set_kind(Kind kind) { | 931 void set_kind(Kind kind) { |
936 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind; | 932 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind; |
937 } | 933 } |
938 | 934 |
(...skipping 11 matching lines...) Expand all Loading... |
950 int32_t bit = compressed ? 0x1 : 0x0; | 946 int32_t bit = compressed ? 0x1 : 0x0; |
951 token_pos_ = (value << 1) | bit; | 947 token_pos_ = (value << 1) | bit; |
952 } | 948 } |
953 | 949 |
954 intptr_t deopt_id() const { return deopt_id_and_kind_ >> 8; } | 950 intptr_t deopt_id() const { return deopt_id_and_kind_ >> 8; } |
955 void set_deopt_id(int32_t value) { | 951 void set_deopt_id(int32_t value) { |
956 ASSERT(Utils::IsInt(24, value)); | 952 ASSERT(Utils::IsInt(24, value)); |
957 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8); | 953 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8); |
958 } | 954 } |
959 | 955 |
960 void CopyTo(PcDescriptorRec* other) const { | |
961 other->set_pc(pc()); | |
962 other->set_deopt_id(deopt_id()); | |
963 other->set_kind(kind()); | |
964 other->set_token_pos(token_pos(), false); | |
965 other->set_try_index(try_index()); | |
966 } | |
967 | |
968 private: | 956 private: |
969 bool is_compressed() const { | 957 bool is_compressed() const { |
970 return (token_pos_ & 0x1) == 1; | 958 return (token_pos_ & 0x1) == 1; |
971 } | 959 } |
972 | 960 |
973 uword pc_; | 961 uword pc_; |
974 int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind. | 962 int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind. |
975 int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag; | 963 int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag; |
976 int16_t try_index_; | 964 int16_t try_index_; |
977 }; | 965 }; |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 1951 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
1964 kTypedDataInt8ArrayViewCid + 15); | 1952 kTypedDataInt8ArrayViewCid + 15); |
1965 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 1953 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
1966 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 1954 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
1967 return (kNullCid - kTypedDataInt8ArrayCid); | 1955 return (kNullCid - kTypedDataInt8ArrayCid); |
1968 } | 1956 } |
1969 | 1957 |
1970 } // namespace dart | 1958 } // namespace dart |
1971 | 1959 |
1972 #endif // VM_RAW_OBJECT_H_ | 1960 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |