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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 *ic_with_type_info_count = info->ic_with_type_info_count(); | 69 *ic_with_type_info_count = info->ic_with_type_info_count(); |
70 *ic_total_count = info->ic_total_count(); | 70 *ic_total_count = info->ic_total_count(); |
71 } | 71 } |
72 *percentage = *ic_total_count > 0 | 72 *percentage = *ic_total_count > 0 |
73 ? 100 * *ic_with_type_info_count / *ic_total_count | 73 ? 100 * *ic_with_type_info_count / *ic_total_count |
74 : 100; | 74 : 100; |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { | 78 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { |
79 ASSERT(function->IsOptimizable()); | 79 DCHECK(function->IsOptimizable()); |
80 | 80 |
81 if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) { | 81 if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) { |
82 PrintF("[marking "); | 82 PrintF("[marking "); |
83 function->ShortPrint(); | 83 function->ShortPrint(); |
84 PrintF(" for recompilation, reason: %s", reason); | 84 PrintF(" for recompilation, reason: %s", reason); |
85 if (FLAG_type_info_threshold > 0) { | 85 if (FLAG_type_info_threshold > 0) { |
86 int typeinfo, total, percentage; | 86 int typeinfo, total, percentage; |
87 GetICCounts(function->shared()->code(), &typeinfo, &total, &percentage); | 87 GetICCounts(function->shared()->code(), &typeinfo, &total, &percentage); |
88 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); | 88 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); |
89 } | 89 } |
90 PrintF("]\n"); | 90 PrintF("]\n"); |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 if (isolate_->concurrent_recompilation_enabled() && | 94 if (isolate_->concurrent_recompilation_enabled() && |
95 !isolate_->bootstrapper()->IsActive()) { | 95 !isolate_->bootstrapper()->IsActive()) { |
96 if (isolate_->concurrent_osr_enabled() && | 96 if (isolate_->concurrent_osr_enabled() && |
97 isolate_->optimizing_compiler_thread()->IsQueuedForOSR(function)) { | 97 isolate_->optimizing_compiler_thread()->IsQueuedForOSR(function)) { |
98 // Do not attempt regular recompilation if we already queued this for OSR. | 98 // Do not attempt regular recompilation if we already queued this for OSR. |
99 // TODO(yangguo): This is necessary so that we don't install optimized | 99 // TODO(yangguo): This is necessary so that we don't install optimized |
100 // code on a function that is already optimized, since OSR and regular | 100 // code on a function that is already optimized, since OSR and regular |
101 // recompilation race. This goes away as soon as OSR becomes one-shot. | 101 // recompilation race. This goes away as soon as OSR becomes one-shot. |
102 return; | 102 return; |
103 } | 103 } |
104 ASSERT(!function->IsInOptimizationQueue()); | 104 DCHECK(!function->IsInOptimizationQueue()); |
105 function->MarkForConcurrentOptimization(); | 105 function->MarkForConcurrentOptimization(); |
106 } else { | 106 } else { |
107 // The next call to the function will trigger optimization. | 107 // The next call to the function will trigger optimization. |
108 function->MarkForOptimization(); | 108 function->MarkForOptimization(); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, | 113 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function, |
114 int loop_nesting_levels) { | 114 int loop_nesting_levels) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 Optimize(function, "small function"); | 251 Optimize(function, "small function"); |
252 } else { | 252 } else { |
253 shared_code->set_profiler_ticks(ticks + 1); | 253 shared_code->set_profiler_ticks(ticks + 1); |
254 } | 254 } |
255 } | 255 } |
256 any_ic_changed_ = false; | 256 any_ic_changed_ = false; |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 } } // namespace v8::internal | 260 } } // namespace v8::internal |
OLD | NEW |