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 function->shared()->set_optimize_next_closure(true); | 109 |
110 function->AttemptConcurrentOptimization(); | 110 if (isolate_->concurrent_recompilation_enabled() && |
| 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 } |
111 } | 126 } |
112 | 127 |
113 | 128 |
114 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, | 129 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, |
115 int loop_nesting_levels) { | 130 int loop_nesting_levels) { |
116 SharedFunctionInfo* shared = function->shared(); | 131 SharedFunctionInfo* shared = function->shared(); |
117 // See AlwaysFullCompiler (in compiler.cc) comment on why we need | 132 // See AlwaysFullCompiler (in compiler.cc) comment on why we need |
118 // Debug::has_break_points(). | 133 // Debug::has_break_points(). |
119 if (!FLAG_use_osr || | 134 if (!FLAG_use_osr || |
120 isolate_->DebuggerHasBreakPoints() || | 135 isolate_->DebuggerHasBreakPoints() || |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 277 } |
263 } else { | 278 } else { |
264 shared_code->set_profiler_ticks(ticks + 1); | 279 shared_code->set_profiler_ticks(ticks + 1); |
265 } | 280 } |
266 } | 281 } |
267 any_ic_changed_ = false; | 282 any_ic_changed_ = false; |
268 } | 283 } |
269 | 284 |
270 | 285 |
271 } } // namespace v8::internal | 286 } } // namespace v8::internal |
OLD | NEW |