| Index: src/compiler.cc
|
| diff --git a/src/compiler.cc b/src/compiler.cc
|
| index 7b9f705bc36112af01f9e3fcb070f73bda6447a6..bc4e8cd265e58eb75a55ed93154f0afd5d9a1738 100644
|
| --- a/src/compiler.cc
|
| +++ b/src/compiler.cc
|
| @@ -1272,6 +1272,43 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
| }
|
|
|
|
|
| +void Compiler::Optimize(JSFunction* function, const char* reason) {
|
| + ASSERT(function->IsOptimizable());
|
| +
|
| + if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) {
|
| + PrintF("[marking ");
|
| + function->ShortPrint();
|
| + PrintF(" for recompilation, reason: %s", reason);
|
| + if (FLAG_type_info_threshold > 0) {
|
| + int typeinfo, total, percentage;
|
| + Code* code = function->shared()->code();
|
| + code->GetICCounts(&typeinfo, &total, &percentage);
|
| + PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage);
|
| + }
|
| + PrintF("]\n");
|
| + }
|
| +
|
| + Isolate* isolate = function->GetIsolate();
|
| +
|
| + if (isolate->concurrent_recompilation_enabled() &&
|
| + !isolate->bootstrapper()->IsActive()) {
|
| + if (isolate->concurrent_osr_enabled() &&
|
| + isolate->optimizing_compiler_thread()->IsQueuedForOSR(function)) {
|
| + // Do not attempt regular recompilation if we already queued this for OSR.
|
| + // TODO(yangguo): This is necessary so that we don't install optimized
|
| + // code on a function that is already optimized, since OSR and regular
|
| + // recompilation race. This goes away as soon as OSR becomes one-shot.
|
| + return;
|
| + }
|
| + ASSERT(!function->IsInOptimizationQueue());
|
| + function->MarkForConcurrentOptimization();
|
| + } else {
|
| + // The next call to the function will trigger optimization.
|
| + function->MarkForOptimization();
|
| + }
|
| +}
|
| +
|
| +
|
| CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
|
| : name_(name), info_(info), zone_(info->isolate()) {
|
| if (FLAG_hydrogen_stats) {
|
|
|