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

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

Issue 1557533002: Eliminate excessive increment of deoptimization counters (e.g., with deep recursion of deoptimized … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: r Created 4 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
« no previous file with comments | « runtime/vm/deferred_objects.cc ('k') | runtime/vm/deopt_instructions.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_DEOPT_INSTRUCTIONS_H_ 5 #ifndef VM_DEOPT_INSTRUCTIONS_H_
6 #define VM_DEOPT_INSTRUCTIONS_H_ 6 #define VM_DEOPT_INSTRUCTIONS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
11 #include "vm/deferred_objects.h" 11 #include "vm/deferred_objects.h"
12 #include "vm/growable_array.h" 12 #include "vm/growable_array.h"
13 #include "vm/locations.h" 13 #include "vm/locations.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/thread.h" 15 #include "vm/thread.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 class Location; 19 class Location;
20 class Value; 20 class Value;
21 class MaterializeObjectInstr; 21 class MaterializeObjectInstr;
22 class StackFrame; 22 class StackFrame;
23 class TimelineEvent; 23 class TimelineEvent;
24 24
25 // Holds all data relevant for execution of deoptimization instructions. 25 // Holds all data relevant for execution of deoptimization instructions.
26 // Structure is allocated in C-heap.
26 class DeoptContext { 27 class DeoptContext {
27 public: 28 public:
28 enum DestFrameOptions { 29 enum DestFrameOptions {
29 kDestIsOriginalFrame, // Replace the original frame with deopt frame. 30 kDestIsOriginalFrame, // Replace the original frame with deopt frame.
30 kDestIsAllocated // Write deopt frame to a buffer. 31 kDestIsAllocated // Write deopt frame to a buffer.
31 }; 32 };
32 33
34 // If 'deoptimizing_code' is false, only frame is being deoptimized.
33 DeoptContext(const StackFrame* frame, 35 DeoptContext(const StackFrame* frame,
34 const Code& code, 36 const Code& code,
35 DestFrameOptions dest_options, 37 DestFrameOptions dest_options,
36 fpu_register_t* fpu_registers, 38 fpu_register_t* fpu_registers,
37 intptr_t* cpu_registers, 39 intptr_t* cpu_registers,
38 bool is_lazy_deopt); 40 bool is_lazy_deopt,
41 bool deoptimizing_code);
39 virtual ~DeoptContext(); 42 virtual ~DeoptContext();
40 43
41 // Returns the offset of the dest fp from the dest sp. Used in 44 // Returns the offset of the dest fp from the dest sp. Used in
42 // runtime code to adjust the stack size before deoptimization. 45 // runtime code to adjust the stack size before deoptimization.
43 intptr_t DestStackAdjustment() const; 46 intptr_t DestStackAdjustment() const;
44 47
45 intptr_t* GetSourceFrameAddressAt(intptr_t index) const { 48 intptr_t* GetSourceFrameAddressAt(intptr_t index) const {
46 ASSERT(source_frame_ != NULL); 49 ASSERT(source_frame_ != NULL);
47 ASSERT((0 <= index) && (index < source_frame_size_)); 50 ASSERT((0 <= index) && (index < source_frame_size_));
48 return &source_frame_[index]; 51 return &source_frame_[index];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 Thread* thread() const { return thread_; } 93 Thread* thread() const { return thread_; }
91 Zone* zone() const { return thread_->zone(); } 94 Zone* zone() const { return thread_->zone(); }
92 95
93 intptr_t source_frame_size() const { return source_frame_size_; } 96 intptr_t source_frame_size() const { return source_frame_size_; }
94 intptr_t dest_frame_size() const { return dest_frame_size_; } 97 intptr_t dest_frame_size() const { return dest_frame_size_; }
95 98
96 RawCode* code() const { return code_; } 99 RawCode* code() const { return code_; }
97 100
98 bool is_lazy_deopt() const { return is_lazy_deopt_; } 101 bool is_lazy_deopt() const { return is_lazy_deopt_; }
99 102
103 bool deoptimizing_code() const { return deoptimizing_code_; }
104
100 ICData::DeoptReasonId deopt_reason() const { return deopt_reason_; } 105 ICData::DeoptReasonId deopt_reason() const { return deopt_reason_; }
101 bool HasDeoptFlag(ICData::DeoptFlags flag) { 106 bool HasDeoptFlag(ICData::DeoptFlags flag) {
102 return (deopt_flags_ & flag) != 0; 107 return (deopt_flags_ & flag) != 0;
103 } 108 }
104 109
105 RawTypedData* deopt_info() const { return deopt_info_; } 110 RawTypedData* deopt_info() const { return deopt_info_; }
106 111
107 // Fills the destination frame but defers materialization of 112 // Fills the destination frame but defers materialization of
108 // objects. 113 // objects.
109 void FillDestFrame(); 114 void FillDestFrame();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 intptr_t caller_fp_; 230 intptr_t caller_fp_;
226 Thread* thread_; 231 Thread* thread_;
227 int64_t deopt_start_micros_; 232 int64_t deopt_start_micros_;
228 233
229 DeferredSlot* deferred_slots_; 234 DeferredSlot* deferred_slots_;
230 235
231 intptr_t deferred_objects_count_; 236 intptr_t deferred_objects_count_;
232 DeferredObject** deferred_objects_; 237 DeferredObject** deferred_objects_;
233 238
234 const bool is_lazy_deopt_; 239 const bool is_lazy_deopt_;
240 const bool deoptimizing_code_;
235 241
236 DISALLOW_COPY_AND_ASSIGN(DeoptContext); 242 DISALLOW_COPY_AND_ASSIGN(DeoptContext);
237 }; 243 };
238 244
239 245
240 246
241 // Represents one deopt instruction, e.g, setup return address, store object, 247 // Represents one deopt instruction, e.g, setup return address, store object,
242 // store register, etc. The target is defined by instruction's position in 248 // store register, etc. The target is defined by instruction's position in
243 // the deopt-info array. 249 // the deopt-info array.
244 class DeoptInstr : public ZoneAllocated { 250 class DeoptInstr : public ZoneAllocated {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 class ReasonField : public BitField<ICData::DeoptReasonId, 0, 8> { }; 546 class ReasonField : public BitField<ICData::DeoptReasonId, 0, 8> { };
541 class FlagsField : public BitField<uint32_t, 8, 8> { }; 547 class FlagsField : public BitField<uint32_t, 8, 8> { };
542 548
543 private: 549 private:
544 static const intptr_t kEntrySize = 3; 550 static const intptr_t kEntrySize = 3;
545 }; 551 };
546 552
547 } // namespace dart 553 } // namespace dart
548 554
549 #endif // VM_DEOPT_INSTRUCTIONS_H_ 555 #endif // VM_DEOPT_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « runtime/vm/deferred_objects.cc ('k') | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698