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

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

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/deopt_instructions.h ('k') | runtime/vm/flow_graph_inliner.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 #include "vm/deopt_instructions.h" 5 #include "vm/deopt_instructions.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/intermediate_language.h" 10 #include "vm/intermediate_language.h"
11 #include "vm/locations.h" 11 #include "vm/locations.h"
12 #include "vm/parser.h" 12 #include "vm/parser.h"
13 #include "vm/stack_frame.h" 13 #include "vm/stack_frame.h"
14 #include "vm/thread.h" 14 #include "vm/thread.h"
15 #include "vm/timeline.h" 15 #include "vm/timeline.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 DEFINE_FLAG(bool, compress_deopt_info, true, 19 DEFINE_FLAG(bool, compress_deopt_info, true,
20 "Compress the size of the deoptimization info for optimized code."); 20 "Compress the size of the deoptimization info for optimized code.");
21 DECLARE_FLAG(bool, trace_deoptimization); 21 DECLARE_FLAG(bool, trace_deoptimization);
22 DECLARE_FLAG(bool, trace_deoptimization_verbose); 22 DECLARE_FLAG(bool, trace_deoptimization_verbose);
23 23
24 24
25 DeoptContext::DeoptContext(const StackFrame* frame, 25 DeoptContext::DeoptContext(const StackFrame* frame,
26 const Code& code, 26 const Code& code,
27 DestFrameOptions dest_options, 27 DestFrameOptions dest_options,
28 fpu_register_t* fpu_registers, 28 fpu_register_t* fpu_registers,
29 intptr_t* cpu_registers, 29 intptr_t* cpu_registers,
30 bool is_lazy_deopt) 30 bool is_lazy_deopt,
31 bool deoptimizing_code)
31 : code_(code.raw()), 32 : code_(code.raw()),
32 object_pool_(code.GetObjectPool()), 33 object_pool_(code.GetObjectPool()),
33 deopt_info_(TypedData::null()), 34 deopt_info_(TypedData::null()),
34 dest_frame_is_allocated_(false), 35 dest_frame_is_allocated_(false),
35 dest_frame_(NULL), 36 dest_frame_(NULL),
36 dest_frame_size_(0), 37 dest_frame_size_(0),
37 source_frame_is_allocated_(false), 38 source_frame_is_allocated_(false),
38 source_frame_(NULL), 39 source_frame_(NULL),
39 source_frame_size_(0), 40 source_frame_size_(0),
40 cpu_registers_(cpu_registers), 41 cpu_registers_(cpu_registers),
41 fpu_registers_(fpu_registers), 42 fpu_registers_(fpu_registers),
42 num_args_(0), 43 num_args_(0),
43 deopt_reason_(ICData::kDeoptUnknown), 44 deopt_reason_(ICData::kDeoptUnknown),
44 deopt_flags_(0), 45 deopt_flags_(0),
45 thread_(Thread::Current()), 46 thread_(Thread::Current()),
46 deopt_start_micros_(0), 47 deopt_start_micros_(0),
47 deferred_slots_(NULL), 48 deferred_slots_(NULL),
48 deferred_objects_count_(0), 49 deferred_objects_count_(0),
49 deferred_objects_(NULL), 50 deferred_objects_(NULL),
50 is_lazy_deopt_(is_lazy_deopt) { 51 is_lazy_deopt_(is_lazy_deopt),
52 deoptimizing_code_(deoptimizing_code) {
51 const TypedData& deopt_info = TypedData::Handle( 53 const TypedData& deopt_info = TypedData::Handle(
52 code.GetDeoptInfoAtPc(frame->pc(), &deopt_reason_, &deopt_flags_)); 54 code.GetDeoptInfoAtPc(frame->pc(), &deopt_reason_, &deopt_flags_));
53 ASSERT(!deopt_info.IsNull()); 55 ASSERT(!deopt_info.IsNull());
54 deopt_info_ = deopt_info.raw(); 56 deopt_info_ = deopt_info.raw();
55 57
56 const Function& function = Function::Handle(code.function()); 58 const Function& function = Function::Handle(code.function());
57 59
58 // Do not include incoming arguments if there are optional arguments 60 // Do not include incoming arguments if there are optional arguments
59 // (they are copied into local space at method entry). 61 // (they are copied into local space at method entry).
60 num_args_ = 62 num_args_ =
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 dest_frame_is_allocated_ = true; 98 dest_frame_is_allocated_ = true;
97 } 99 }
98 100
99 if (dest_options != kDestIsAllocated) { 101 if (dest_options != kDestIsAllocated) {
100 // kDestIsAllocated is used by the debugger to generate a stack trace 102 // kDestIsAllocated is used by the debugger to generate a stack trace
101 // and does not signal a real deopt. 103 // and does not signal a real deopt.
102 deopt_start_micros_ = OS::GetCurrentMonotonicMicros(); 104 deopt_start_micros_ = OS::GetCurrentMonotonicMicros();
103 } 105 }
104 106
105 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 107 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
106 OS::PrintErr( 108 THR_Print(
107 "Deoptimizing (reason %d '%s') at pc %#" Px " '%s' (count %d)\n", 109 "Deoptimizing (reason %d '%s') at pc %#" Px " '%s' (count %d)\n",
108 deopt_reason(), 110 deopt_reason(),
109 DeoptReasonToCString(deopt_reason()), 111 DeoptReasonToCString(deopt_reason()),
110 frame->pc(), 112 frame->pc(),
111 function.ToFullyQualifiedCString(), 113 function.ToFullyQualifiedCString(),
112 function.deoptimization_counter()); 114 function.deoptimization_counter());
113 } 115 }
114 } 116 }
115 117
116 118
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 Smi* offset, 1304 Smi* offset,
1303 TypedData* info, 1305 TypedData* info,
1304 Smi* reason) { 1306 Smi* reason) {
1305 intptr_t i = index * kEntrySize; 1307 intptr_t i = index * kEntrySize;
1306 *offset ^= table.At(i); 1308 *offset ^= table.At(i);
1307 *info ^= table.At(i + 1); 1309 *info ^= table.At(i + 1);
1308 *reason ^= table.At(i + 2); 1310 *reason ^= table.At(i + 2);
1309 } 1311 }
1310 1312
1311 } // namespace dart 1313 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698