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

Side by Side Diff: runtime/vm/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/debugger.cc ('k') | runtime/vm/object.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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 private: 3175 private:
3176 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); 3176 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object);
3177 friend class Class; 3177 friend class Class;
3178 friend class Object; 3178 friend class Object;
3179 }; 3179 };
3180 3180
3181 3181
3182 class PcDescriptors : public Object { 3182 class PcDescriptors : public Object {
3183 public: 3183 public:
3184 void AddDescriptor(intptr_t index, 3184 void AddDescriptor(intptr_t index,
3185 uword pc, 3185 uword pc_offset,
3186 RawPcDescriptors::Kind kind, 3186 RawPcDescriptors::Kind kind,
3187 int64_t deopt_id, 3187 int64_t deopt_id,
3188 int64_t token_pos, // Or deopt reason. 3188 int64_t token_pos, // Or deopt reason.
3189 intptr_t try_index) const { // Or deopt index. 3189 intptr_t try_index) const { // Or deopt index.
3190 NoGCScope no_gc; 3190 NoGCScope no_gc;
3191 RawPcDescriptors::PcDescriptorRec* rec = recAt(index); 3191 RawPcDescriptors::PcDescriptorRec* rec = recAt(index);
3192 rec->set_pc(pc); 3192 rec->set_pc_offset(pc_offset);
3193 rec->set_kind(kind); 3193 rec->set_kind(kind);
3194 ASSERT(Utils::IsInt(32, deopt_id)); 3194 ASSERT(Utils::IsInt(32, deopt_id));
3195 rec->set_deopt_id(static_cast<int32_t>(deopt_id)); 3195 rec->set_deopt_id(static_cast<int32_t>(deopt_id));
3196 ASSERT(Utils::IsInt(32, token_pos)); 3196 ASSERT(Utils::IsInt(32, token_pos));
3197 rec->set_token_pos(static_cast<int32_t>(token_pos), 3197 rec->set_token_pos(static_cast<int32_t>(token_pos),
3198 RecordSizeInBytes() == RawPcDescriptors::kCompressedRecSize); 3198 RecordSizeInBytes() == RawPcDescriptors::kCompressedRecSize);
3199 ASSERT(Utils::IsInt(16, try_index)); 3199 ASSERT(Utils::IsInt(16, try_index));
3200 rec->set_try_index(try_index); 3200 rec->set_try_index(try_index);
3201 ASSERT(rec->try_index() == try_index); 3201 ASSERT(rec->try_index() == try_index);
3202 ASSERT(rec->token_pos() == token_pos); 3202 ASSERT(rec->token_pos() == token_pos);
3203 } 3203 }
3204 3204
3205 static const intptr_t kMaxBytesPerElement = 3205 static const intptr_t kMaxBytesPerElement =
3206 sizeof(RawPcDescriptors::PcDescriptorRec); 3206 sizeof(RawPcDescriptors::PcDescriptorRec);
3207 static const intptr_t kMaxElements = kMaxInt32 / kMaxBytesPerElement; 3207 static const intptr_t kMaxElements = kMaxInt32 / kMaxBytesPerElement;
3208 3208
3209 static intptr_t InstanceSize() { 3209 static intptr_t InstanceSize() {
3210 ASSERT(sizeof(RawPcDescriptors) == 3210 ASSERT(sizeof(RawPcDescriptors) ==
3211 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data)); 3211 OFFSET_OF_RETURNED_VALUE(RawPcDescriptors, data));
3212 return 0; 3212 return 0;
3213 } 3213 }
3214 static intptr_t InstanceSize(intptr_t len, intptr_t record_size_in_bytes) { 3214 static intptr_t InstanceSize(intptr_t len, intptr_t record_size_in_bytes) {
3215 ASSERT(0 <= len && len <= kMaxElements); 3215 ASSERT(0 <= len && len <= kMaxElements);
3216 return RoundedAllocationSize( 3216 return RoundedAllocationSize(
3217 sizeof(RawPcDescriptors) + (len * record_size_in_bytes)); 3217 sizeof(RawPcDescriptors) + (len * record_size_in_bytes));
3218 } 3218 }
3219 3219
3220 static RawPcDescriptors* New(intptr_t num_descriptors, bool has_try_index); 3220 static RawPcDescriptors* New(intptr_t num_descriptors, bool has_try_index);
3221 3221
3222 // Returns 0 if not found.
3223 uword GetPcForKind(RawPcDescriptors::Kind kind) const;
3224
3225 // Verify (assert) assumptions about pc descriptors in debug mode. 3222 // Verify (assert) assumptions about pc descriptors in debug mode.
3226 void Verify(const Function& function) const; 3223 void Verify(const Function& function) const;
3227 3224
3228 static void PrintHeaderString(); 3225 static void PrintHeaderString();
3229 3226
3230 void PrintToJSONObject(JSONObject* jsobj, bool ref) const; 3227 void PrintToJSONObject(JSONObject* jsobj, bool ref) const;
3231 3228
3232 // We would have a VisitPointers function here to traverse the 3229 // We would have a VisitPointers function here to traverse the
3233 // pc descriptors table to visit objects if any in the table. 3230 // pc descriptors table to visit objects if any in the table.
3234 // Note: never return a reference to a RawPcDescriptors::PcDescriptorRec 3231 // Note: never return a reference to a RawPcDescriptors::PcDescriptorRec
(...skipping 11 matching lines...) Expand all
3246 bool MoveNext() { 3243 bool MoveNext() {
3247 if (HasNext()) { 3244 if (HasNext()) {
3248 current_ix_ = next_ix_++; 3245 current_ix_ = next_ix_++;
3249 MoveToMatching(); 3246 MoveToMatching();
3250 return true; 3247 return true;
3251 } else { 3248 } else {
3252 return false; 3249 return false;
3253 } 3250 }
3254 } 3251 }
3255 3252
3256 uword Pc() const { 3253 uword PcOffset() const {
3257 NoGCScope no_gc; 3254 NoGCScope no_gc;
3258 return descriptors_.recAt(current_ix_)->pc(); 3255 return descriptors_.recAt(current_ix_)->pc_offset();
3259 } 3256 }
3260 intptr_t DeoptId() const { 3257 intptr_t DeoptId() const {
3261 NoGCScope no_gc; 3258 NoGCScope no_gc;
3262 return descriptors_.recAt(current_ix_)->deopt_id(); 3259 return descriptors_.recAt(current_ix_)->deopt_id();
3263 } 3260 }
3264 intptr_t TokenPos() const { 3261 intptr_t TokenPos() const {
3265 NoGCScope no_gc; 3262 NoGCScope no_gc;
3266 return descriptors_.recAt(current_ix_)->token_pos(); 3263 return descriptors_.recAt(current_ix_)->token_pos();
3267 } 3264 }
3268 intptr_t TryIndex() const { 3265 intptr_t TryIndex() const {
(...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after
7700 7697
7701 7698
7702 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7699 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7703 intptr_t index) { 7700 intptr_t index) {
7704 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7701 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7705 } 7702 }
7706 7703
7707 } // namespace dart 7704 } // namespace dart
7708 7705
7709 #endif // VM_OBJECT_H_ 7706 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698