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