OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 function->ShortPrint(); | 132 function->ShortPrint(); |
133 PrintF(" for recompilation, reason: %s", reason); | 133 PrintF(" for recompilation, reason: %s", reason); |
134 if (FLAG_type_info_threshold > 0) { | 134 if (FLAG_type_info_threshold > 0) { |
135 int typeinfo, total, percentage; | 135 int typeinfo, total, percentage; |
136 GetICCounts(function->shared()->code(), &typeinfo, &total, &percentage); | 136 GetICCounts(function->shared()->code(), &typeinfo, &total, &percentage); |
137 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); | 137 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); |
138 } | 138 } |
139 PrintF("]\n"); | 139 PrintF("]\n"); |
140 } | 140 } |
141 | 141 |
142 if (FLAG_parallel_recompilation && !isolate_->bootstrapper()->IsActive()) { | 142 if (FLAG_concurrent_recompilation && !isolate_->bootstrapper()->IsActive()) { |
143 ASSERT(!function->IsMarkedForInstallingRecompiledCode()); | 143 ASSERT(!function->IsMarkedForInstallingRecompiledCode()); |
144 ASSERT(!function->IsInRecompileQueue()); | 144 ASSERT(!function->IsInRecompileQueue()); |
145 function->MarkForParallelRecompilation(); | 145 function->MarkForConcurrentRecompilation(); |
146 } else { | 146 } else { |
147 // The next call to the function will trigger optimization. | 147 // The next call to the function will trigger optimization. |
148 function->MarkForLazyRecompilation(); | 148 function->MarkForLazyRecompilation(); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { | 153 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { |
154 // See AlwaysFullCompiler (in compiler.cc) comment on why we need | 154 // See AlwaysFullCompiler (in compiler.cc) comment on why we need |
155 // Debug::has_break_points(). | 155 // Debug::has_break_points(). |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 sampler_window_position_ = (sampler_window_position_ + 1) & | 222 sampler_window_position_ = (sampler_window_position_ + 1) & |
223 (kSamplerWindowSize - 1); | 223 (kSamplerWindowSize - 1); |
224 } | 224 } |
225 | 225 |
226 | 226 |
227 void RuntimeProfiler::OptimizeNow() { | 227 void RuntimeProfiler::OptimizeNow() { |
228 HandleScope scope(isolate_); | 228 HandleScope scope(isolate_); |
229 | 229 |
230 if (isolate_->DebuggerHasBreakPoints()) return; | 230 if (isolate_->DebuggerHasBreakPoints()) return; |
231 | 231 |
232 if (FLAG_parallel_recompilation) { | 232 if (FLAG_concurrent_recompilation) { |
233 // Take this as opportunity to process the optimizing compiler thread's | 233 // Take this as opportunity to process the optimizing compiler thread's |
234 // output queue so that it does not unnecessarily keep objects alive. | 234 // output queue so that it does not unnecessarily keep objects alive. |
235 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 235 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
236 } | 236 } |
237 | 237 |
238 // Run through the JavaScript frames and collect them. If we already | 238 // Run through the JavaScript frames and collect them. If we already |
239 // have a sample of the function, we mark it for optimizations | 239 // have a sample of the function, we mark it for optimizations |
240 // (eagerly or lazily). | 240 // (eagerly or lazily). |
241 JSFunction* samples[kSamplerFrameCount]; | 241 JSFunction* samples[kSamplerFrameCount]; |
242 int sample_count = 0; | 242 int sample_count = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 shared_code->allow_osr_at_loop_nesting_level() == 0) { | 276 shared_code->allow_osr_at_loop_nesting_level() == 0) { |
277 // Testing mode: always try an OSR compile for every function. | 277 // Testing mode: always try an OSR compile for every function. |
278 for (int i = 0; i < Code::kMaxLoopNestingMarker; i++) { | 278 for (int i = 0; i < Code::kMaxLoopNestingMarker; i++) { |
279 // TODO(titzer): fix AttemptOnStackReplacement to avoid this dumb loop. | 279 // TODO(titzer): fix AttemptOnStackReplacement to avoid this dumb loop. |
280 shared_code->set_allow_osr_at_loop_nesting_level(i); | 280 shared_code->set_allow_osr_at_loop_nesting_level(i); |
281 AttemptOnStackReplacement(function); | 281 AttemptOnStackReplacement(function); |
282 } | 282 } |
283 // Fall through and do a normal optimized compile as well. | 283 // Fall through and do a normal optimized compile as well. |
284 } else if (!frame->is_optimized() && | 284 } else if (!frame->is_optimized() && |
285 (function->IsMarkedForLazyRecompilation() || | 285 (function->IsMarkedForLazyRecompilation() || |
286 function->IsMarkedForParallelRecompilation() || | 286 function->IsMarkedForConcurrentRecompilation() || |
287 function->IsOptimized())) { | 287 function->IsOptimized())) { |
288 // Attempt OSR if we are still running unoptimized code even though the | 288 // Attempt OSR if we are still running unoptimized code even though the |
289 // the function has long been marked or even already been optimized. | 289 // the function has long been marked or even already been optimized. |
290 int ticks = shared_code->profiler_ticks(); | 290 int ticks = shared_code->profiler_ticks(); |
291 int allowance = kOSRCodeSizeAllowanceBase + | 291 int allowance = kOSRCodeSizeAllowanceBase + |
292 ticks * kOSRCodeSizeAllowancePerTick; | 292 ticks * kOSRCodeSizeAllowancePerTick; |
293 if (shared_code->CodeSize() > allowance) { | 293 if (shared_code->CodeSize() > allowance) { |
294 if (ticks < 255) shared_code->set_profiler_ticks(ticks + 1); | 294 if (ticks < 255) shared_code->set_profiler_ticks(ticks + 1); |
295 } else { | 295 } else { |
296 int nesting = shared_code->allow_osr_at_loop_nesting_level(); | 296 int nesting = shared_code->allow_osr_at_loop_nesting_level(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 | 437 |
438 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { | 438 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { |
439 for (int i = 0; i < kSamplerWindowSize; i++) { | 439 for (int i = 0; i < kSamplerWindowSize; i++) { |
440 visitor->VisitPointer(&sampler_window_[i]); | 440 visitor->VisitPointer(&sampler_window_[i]); |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 } } // namespace v8::internal | 445 } } // namespace v8::internal |
OLD | NEW |