Chromium Code Reviews| 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 | |
| 142 if (FLAG_concurrent_recompilation && !isolate_->bootstrapper()->IsActive()) { | 143 if (FLAG_concurrent_recompilation && !isolate_->bootstrapper()->IsActive()) { |
| 144 if (FLAG_concurrent_osr && | |
| 145 isolate_->optimizing_compiler_thread()->IsQueuedForOSR(function)) { | |
| 146 // Do not attempt regular recompilation if we already queued this for OSR. | |
| 147 // TODO(yangguo): This is necessary so that we don't install optimized | |
| 148 // code on a function that is already optimized, since OSR and regular | |
| 149 // recompilation race. This goes away as soon as OSR becomes one-shot. | |
| 150 return; | |
|
Yang
2013/09/10 14:27:50
This is not actually a change in heuristic. We use
| |
| 151 } | |
| 143 ASSERT(!function->IsMarkedForInstallingRecompiledCode()); | 152 ASSERT(!function->IsMarkedForInstallingRecompiledCode()); |
| 144 ASSERT(!function->IsInRecompileQueue()); | 153 ASSERT(!function->IsInRecompileQueue()); |
| 145 function->MarkForConcurrentRecompilation(); | 154 function->MarkForConcurrentRecompilation(); |
| 146 } else { | 155 } else { |
| 147 // The next call to the function will trigger optimization. | 156 // The next call to the function will trigger optimization. |
| 148 function->MarkForLazyRecompilation(); | 157 function->MarkForLazyRecompilation(); |
| 149 } | 158 } |
| 150 } | 159 } |
| 151 | 160 |
| 152 | 161 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 HandleScope scope(isolate_); | 226 HandleScope scope(isolate_); |
| 218 | 227 |
| 219 if (isolate_->DebuggerHasBreakPoints()) return; | 228 if (isolate_->DebuggerHasBreakPoints()) return; |
| 220 | 229 |
| 221 if (FLAG_concurrent_recompilation) { | 230 if (FLAG_concurrent_recompilation) { |
| 222 // Take this as opportunity to process the optimizing compiler thread's | 231 // Take this as opportunity to process the optimizing compiler thread's |
| 223 // output queue so that it does not unnecessarily keep objects alive. | 232 // output queue so that it does not unnecessarily keep objects alive. |
| 224 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 233 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 225 } | 234 } |
| 226 | 235 |
| 236 DisallowHeapAllocation no_gc; | |
| 237 | |
| 227 // Run through the JavaScript frames and collect them. If we already | 238 // Run through the JavaScript frames and collect them. If we already |
| 228 // have a sample of the function, we mark it for optimizations | 239 // have a sample of the function, we mark it for optimizations |
| 229 // (eagerly or lazily). | 240 // (eagerly or lazily). |
| 230 JSFunction* samples[kSamplerFrameCount]; | 241 JSFunction* samples[kSamplerFrameCount]; |
| 231 int sample_count = 0; | 242 int sample_count = 0; |
| 232 int frame_count = 0; | 243 int frame_count = 0; |
| 233 int frame_count_limit = FLAG_watch_ic_patching ? FLAG_frame_count | 244 int frame_count_limit = FLAG_watch_ic_patching ? FLAG_frame_count |
| 234 : kSamplerFrameCount; | 245 : kSamplerFrameCount; |
| 246 | |
|
titzer
2013/09/11 11:02:28
Whitespace change
| |
| 235 for (JavaScriptFrameIterator it(isolate_); | 247 for (JavaScriptFrameIterator it(isolate_); |
| 236 frame_count++ < frame_count_limit && !it.done(); | 248 frame_count++ < frame_count_limit && !it.done(); |
| 237 it.Advance()) { | 249 it.Advance()) { |
| 238 JavaScriptFrame* frame = it.frame(); | 250 JavaScriptFrame* frame = it.frame(); |
| 239 JSFunction* function = frame->function(); | 251 JSFunction* function = frame->function(); |
| 240 | 252 |
| 241 if (!FLAG_watch_ic_patching) { | 253 if (!FLAG_watch_ic_patching) { |
| 242 // Adjust threshold each time we have processed | 254 // Adjust threshold each time we have processed |
| 243 // a certain number of ticks. | 255 // a certain number of ticks. |
| 244 if (sampler_ticks_until_threshold_adjustment_ > 0) { | 256 if (sampler_ticks_until_threshold_adjustment_ > 0) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 | 437 |
| 426 | 438 |
| 427 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { | 439 void RuntimeProfiler::UpdateSamplesAfterCompact(ObjectVisitor* visitor) { |
| 428 for (int i = 0; i < kSamplerWindowSize; i++) { | 440 for (int i = 0; i < kSamplerWindowSize; i++) { |
| 429 visitor->VisitPointer(&sampler_window_[i]); | 441 visitor->VisitPointer(&sampler_window_[i]); |
| 430 } | 442 } |
| 431 } | 443 } |
| 432 | 444 |
| 433 | 445 |
| 434 } } // namespace v8::internal | 446 } } // namespace v8::internal |
| OLD | NEW |