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/runtime-profiler.h" | 5 #include "src/runtime-profiler.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/ast/scopeinfo.h" | 8 #include "src/ast/scopeinfo.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.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 function->AttemptConcurrentOptimization(); | 109 if (function->shared()->HasBytecodeArray()) { |
| 110 function->MarkForBaseline(); |
| 111 } else { |
| 112 function->AttemptConcurrentOptimization(); |
| 113 } |
110 } | 114 } |
111 | 115 |
112 | 116 |
113 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, | 117 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, |
114 int loop_nesting_levels) { | 118 int loop_nesting_levels) { |
115 SharedFunctionInfo* shared = function->shared(); | 119 SharedFunctionInfo* shared = function->shared(); |
116 if (!FLAG_use_osr || function->shared()->IsBuiltin()) { | 120 if (!FLAG_use_osr || function->shared()->IsBuiltin()) { |
117 return; | 121 return; |
118 } | 122 } |
119 | 123 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 if (function->IsInOptimizationQueue()) return; | 244 if (function->IsInOptimizationQueue()) return; |
241 | 245 |
242 SharedFunctionInfo* shared = function->shared(); | 246 SharedFunctionInfo* shared = function->shared(); |
243 int ticks = shared->profiler_ticks(); | 247 int ticks = shared->profiler_ticks(); |
244 | 248 |
245 // TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller | 249 // TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller |
246 // than kMaxToplevelSourceSize. | 250 // than kMaxToplevelSourceSize. |
247 // TODO(rmcilroy): Consider whether we should optimize small functions when | 251 // TODO(rmcilroy): Consider whether we should optimize small functions when |
248 // they are first seen on the stack (e.g., kMaxSizeEarlyOpt). | 252 // they are first seen on the stack (e.g., kMaxSizeEarlyOpt). |
249 | 253 |
250 if (!frame_optimized && (function->IsMarkedForOptimization() || | 254 if (!frame_optimized && (function->IsMarkedForBaseline() || |
| 255 function->IsMarkedForOptimization() || |
251 function->IsMarkedForConcurrentOptimization() || | 256 function->IsMarkedForConcurrentOptimization() || |
252 function->IsOptimized())) { | 257 function->IsOptimized())) { |
253 // TODO(rmcilroy): Support OSR in these cases. | 258 // TODO(rmcilroy): Support OSR in these cases. |
254 | 259 |
255 return; | 260 return; |
256 } | 261 } |
257 | 262 |
258 // Do not optimize non-optimizable functions. | 263 // Do not optimize non-optimizable functions. |
259 if (shared->optimization_disabled()) { | 264 if (shared->optimization_disabled()) { |
260 if (shared->deopt_count() >= FLAG_max_opt_count) { | 265 if (shared->deopt_count() >= FLAG_max_opt_count) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 List<JSFunction*> functions(4); | 318 List<JSFunction*> functions(4); |
314 frame->GetFunctions(&functions); | 319 frame->GetFunctions(&functions); |
315 for (int i = functions.length(); --i >= 0; ) { | 320 for (int i = functions.length(); --i >= 0; ) { |
316 SharedFunctionInfo* shared_function_info = functions[i]->shared(); | 321 SharedFunctionInfo* shared_function_info = functions[i]->shared(); |
317 int ticks = shared_function_info->profiler_ticks(); | 322 int ticks = shared_function_info->profiler_ticks(); |
318 if (ticks < Smi::kMaxValue) { | 323 if (ticks < Smi::kMaxValue) { |
319 shared_function_info->set_profiler_ticks(ticks + 1); | 324 shared_function_info->set_profiler_ticks(ticks + 1); |
320 } | 325 } |
321 } | 326 } |
322 | 327 |
323 if (FLAG_ignition) { | 328 if (frame->is_interpreted()) { |
324 MaybeOptimizeIgnition(function, frame->is_optimized()); | 329 MaybeOptimizeIgnition(function, frame->is_optimized()); |
325 } else { | 330 } else { |
326 MaybeOptimizeFullCodegen(function, frame_count, frame->is_optimized()); | 331 MaybeOptimizeFullCodegen(function, frame_count, frame->is_optimized()); |
327 } | 332 } |
328 } | 333 } |
329 any_ic_changed_ = false; | 334 any_ic_changed_ = false; |
330 } | 335 } |
331 | 336 |
332 | 337 |
333 } // namespace internal | 338 } // namespace internal |
334 } // namespace v8 | 339 } // namespace v8 |
OLD | NEW |