| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count; | 81 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count; |
| 82 *generic_percentage = 100 * *ic_generic_count / *ic_total_count; | 82 *generic_percentage = 100 * *ic_generic_count / *ic_total_count; |
| 83 } else { | 83 } else { |
| 84 *type_info_percentage = 100; // Compared against lower bound. | 84 *type_info_percentage = 100; // Compared against lower bound. |
| 85 *generic_percentage = 0; // Compared against upper bound. | 85 *generic_percentage = 0; // Compared against upper bound. |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { | 90 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { |
| 91 DCHECK(function->IsOptimizable()); |
| 92 |
| 91 if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) { | 93 if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) { |
| 92 PrintF("[marking "); | 94 PrintF("[marking "); |
| 93 function->ShortPrint(); | 95 function->ShortPrint(); |
| 94 PrintF(" for recompilation, reason: %s", reason); | 96 PrintF(" for recompilation, reason: %s", reason); |
| 95 if (FLAG_type_info_threshold > 0) { | 97 if (FLAG_type_info_threshold > 0) { |
| 96 int typeinfo, generic, total, type_percentage, generic_percentage; | 98 int typeinfo, generic, total, type_percentage, generic_percentage; |
| 97 GetICCounts(function->shared(), &typeinfo, &generic, &total, | 99 GetICCounts(function->shared(), &typeinfo, &generic, &total, |
| 98 &type_percentage, &generic_percentage); | 100 &type_percentage, &generic_percentage); |
| 99 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, | 101 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, |
| 100 type_percentage); | 102 type_percentage); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 int ticks = shared_code->profiler_ticks(); | 210 int ticks = shared_code->profiler_ticks(); |
| 209 if (ticks >= kProfilerTicksBeforeReenablingOptimization) { | 211 if (ticks >= kProfilerTicksBeforeReenablingOptimization) { |
| 210 shared_code->set_profiler_ticks(0); | 212 shared_code->set_profiler_ticks(0); |
| 211 shared->TryReenableOptimization(); | 213 shared->TryReenableOptimization(); |
| 212 } else { | 214 } else { |
| 213 shared_code->set_profiler_ticks(ticks + 1); | 215 shared_code->set_profiler_ticks(ticks + 1); |
| 214 } | 216 } |
| 215 } | 217 } |
| 216 continue; | 218 continue; |
| 217 } | 219 } |
| 218 if (function->IsOptimized()) continue; | 220 if (!function->IsOptimizable()) continue; |
| 219 | 221 |
| 220 int ticks = shared_code->profiler_ticks(); | 222 int ticks = shared_code->profiler_ticks(); |
| 221 | 223 |
| 222 if (ticks >= kProfilerTicksBeforeOptimization) { | 224 if (ticks >= kProfilerTicksBeforeOptimization) { |
| 223 int typeinfo, generic, total, type_percentage, generic_percentage; | 225 int typeinfo, generic, total, type_percentage, generic_percentage; |
| 224 GetICCounts(shared, &typeinfo, &generic, &total, &type_percentage, | 226 GetICCounts(shared, &typeinfo, &generic, &total, &type_percentage, |
| 225 &generic_percentage); | 227 &generic_percentage); |
| 226 if (type_percentage >= FLAG_type_info_threshold && | 228 if (type_percentage >= FLAG_type_info_threshold && |
| 227 generic_percentage <= FLAG_generic_ic_threshold) { | 229 generic_percentage <= FLAG_generic_ic_threshold) { |
| 228 // If this particular function hasn't had any ICs patched for enough | 230 // If this particular function hasn't had any ICs patched for enough |
| (...skipping 25 matching lines...) Expand all Loading... |
| 254 } | 256 } |
| 255 } else { | 257 } else { |
| 256 shared_code->set_profiler_ticks(ticks + 1); | 258 shared_code->set_profiler_ticks(ticks + 1); |
| 257 } | 259 } |
| 258 } | 260 } |
| 259 any_ic_changed_ = false; | 261 any_ic_changed_ = false; |
| 260 } | 262 } |
| 261 | 263 |
| 262 | 264 |
| 263 } } // namespace v8::internal | 265 } } // namespace v8::internal |
| OLD | NEW |