Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: runtime/vm/raw_object.h

Issue 875443002: Store pc offset instead of absolute pc in the pc descriptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed arm/mips/arm64 build Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 kUnoptStaticCall = kOptStaticCall << 1, // Call to a known target via stub. 1014 kUnoptStaticCall = kOptStaticCall << 1, // Call to a known target via stub.
1015 kClosureCall = kUnoptStaticCall << 1, // Closure call. 1015 kClosureCall = kUnoptStaticCall << 1, // Closure call.
1016 kRuntimeCall = kClosureCall << 1, // Runtime call. 1016 kRuntimeCall = kClosureCall << 1, // Runtime call.
1017 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. 1017 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code.
1018 kOther = kOsrEntry << 1, 1018 kOther = kOsrEntry << 1,
1019 kAnyKind = 0xFF 1019 kAnyKind = 0xFF
1020 }; 1020 };
1021 1021
1022 // Compressed version assumes try_index is always -1 and does not store it. 1022 // Compressed version assumes try_index is always -1 and does not store it.
1023 struct PcDescriptorRec { 1023 struct PcDescriptorRec {
1024 uword pc() const { return pc_; } 1024 uword pc_offset() const { return pc_offset_; }
1025 void set_pc(uword value) { pc_ = value; } 1025 void set_pc_offset(uword value) {
1026 ASSERT((sizeof(value) == 4) || Utils::IsUint(32, value));
1027 pc_offset_ = value;
1028 }
1026 1029
1027 Kind kind() const { 1030 Kind kind() const {
1028 return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind); 1031 return static_cast<Kind>(deopt_id_and_kind_ & kAnyKind);
1029 } 1032 }
1030 void set_kind(Kind kind) { 1033 void set_kind(Kind kind) {
1031 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind; 1034 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFFFFFF00) | kind;
1032 } 1035 }
1033 1036
1034 int16_t try_index() const { return is_compressed() ? -1 : try_index_; } 1037 int16_t try_index() const { return is_compressed() ? -1 : try_index_; }
1035 void set_try_index(int16_t value) { 1038 void set_try_index(int16_t value) {
(...skipping 14 matching lines...) Expand all
1050 void set_deopt_id(int32_t value) { 1053 void set_deopt_id(int32_t value) {
1051 ASSERT(Utils::IsInt(24, value)); 1054 ASSERT(Utils::IsInt(24, value));
1052 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8); 1055 deopt_id_and_kind_ = (deopt_id_and_kind_ & 0xFF) | (value << 8);
1053 } 1056 }
1054 1057
1055 private: 1058 private:
1056 bool is_compressed() const { 1059 bool is_compressed() const {
1057 return (token_pos_ & 0x1) == 1; 1060 return (token_pos_ & 0x1) == 1;
1058 } 1061 }
1059 1062
1060 uword pc_; 1063 uint32_t pc_offset_;
1061 int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind. 1064 int32_t deopt_id_and_kind_; // Bits 31..8 -> deopt_id, bits 7..0 kind.
1062 int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag; 1065 int32_t token_pos_; // Bits 31..1 -> token_pos, bit 1 -> compressed flag;
1063 int16_t try_index_; 1066 int16_t try_index_;
1064 }; 1067 };
1065 1068
1066 // This structure is only used to compute what the size of PcDescriptorRec 1069 // This structure is only used to compute what the size of PcDescriptorRec
1067 // should be when the try_index_ field is omitted. 1070 // should be when the try_index_ field is omitted.
1068 struct CompressedPcDescriptorRec { 1071 struct CompressedPcDescriptorRec {
1069 uword pc_; 1072 uint32_t pc_offset_;
1070 int32_t deopt_id_and_kind_; 1073 int32_t deopt_id_and_kind_;
1071 int32_t token_pos_; 1074 int32_t token_pos_;
1072 }; 1075 };
1073 1076
1074 static intptr_t RecordSize(bool has_try_index); 1077 static intptr_t RecordSize(bool has_try_index);
1075 1078
1076 private: 1079 private:
1077 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); 1080 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
1078 1081
1079 static const intptr_t kFullRecSize; 1082 static const intptr_t kFullRecSize;
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2156 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2154 kTypedDataInt8ArrayViewCid + 15); 2157 kTypedDataInt8ArrayViewCid + 15);
2155 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2158 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2156 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2159 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2157 return (kNullCid - kTypedDataInt8ArrayCid); 2160 return (kNullCid - kTypedDataInt8ArrayCid);
2158 } 2161 }
2159 2162
2160 } // namespace dart 2163 } // namespace dart
2161 2164
2162 #endif // VM_RAW_OBJECT_H_ 2165 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698