OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/runtime-profiler.h" | 7 #include "src/runtime-profiler.h" |
8 | 8 |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 int typeinfo, generic, total, type_percentage, generic_percentage; | 99 int typeinfo, generic, total, type_percentage, generic_percentage; |
100 GetICCounts(function->shared(), &typeinfo, &generic, &total, | 100 GetICCounts(function->shared(), &typeinfo, &generic, &total, |
101 &type_percentage, &generic_percentage); | 101 &type_percentage, &generic_percentage); |
102 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, | 102 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, |
103 type_percentage); | 103 type_percentage); |
104 PrintF(", generic ICs: %d/%d (%d%%)", generic, total, generic_percentage); | 104 PrintF(", generic ICs: %d/%d (%d%%)", generic, total, generic_percentage); |
105 } | 105 } |
106 PrintF("]\n"); | 106 PrintF("]\n"); |
107 } | 107 } |
108 | 108 |
109 | 109 function->shared()->set_optimize_next_closure(true); |
110 if (isolate_->concurrent_recompilation_enabled() && | 110 function->AttemptConcurrentOptimization(); |
111 !isolate_->bootstrapper()->IsActive()) { | |
112 if (isolate_->concurrent_osr_enabled() && | |
113 isolate_->optimizing_compiler_thread()->IsQueuedForOSR(function)) { | |
114 // Do not attempt regular recompilation if we already queued this for OSR. | |
115 // TODO(yangguo): This is necessary so that we don't install optimized | |
116 // code on a function that is already optimized, since OSR and regular | |
117 // recompilation race. This goes away as soon as OSR becomes one-shot. | |
118 return; | |
119 } | |
120 DCHECK(!function->IsInOptimizationQueue()); | |
121 function->MarkForConcurrentOptimization(); | |
122 } else { | |
123 // The next call to the function will trigger optimization. | |
124 function->MarkForOptimization(); | |
125 } | |
126 } | 111 } |
127 | 112 |
128 | 113 |
129 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, | 114 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, |
130 int loop_nesting_levels) { | 115 int loop_nesting_levels) { |
131 SharedFunctionInfo* shared = function->shared(); | 116 SharedFunctionInfo* shared = function->shared(); |
132 // See AlwaysFullCompiler (in compiler.cc) comment on why we need | 117 // See AlwaysFullCompiler (in compiler.cc) comment on why we need |
133 // Debug::has_break_points(). | 118 // Debug::has_break_points(). |
134 if (!FLAG_use_osr || | 119 if (!FLAG_use_osr || |
135 isolate_->DebuggerHasBreakPoints() || | 120 isolate_->DebuggerHasBreakPoints() || |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 262 } |
278 } else { | 263 } else { |
279 shared_code->set_profiler_ticks(ticks + 1); | 264 shared_code->set_profiler_ticks(ticks + 1); |
280 } | 265 } |
281 } | 266 } |
282 any_ic_changed_ = false; | 267 any_ic_changed_ = false; |
283 } | 268 } |
284 | 269 |
285 | 270 |
286 } } // namespace v8::internal | 271 } } // namespace v8::internal |
OLD | NEW |