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 8603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8614 IsQueuedForOSR(function, pc_offset)) { | 8614 IsQueuedForOSR(function, pc_offset)) { |
8615 // Still waiting for the optimizing compiler thread to finish. Carry on. | 8615 // Still waiting for the optimizing compiler thread to finish. Carry on. |
8616 if (FLAG_trace_osr) { | 8616 if (FLAG_trace_osr) { |
8617 PrintF("[COSR - polling recompile tasks for "); | 8617 PrintF("[COSR - polling recompile tasks for "); |
8618 function->PrintName(); | 8618 function->PrintName(); |
8619 PrintF("]\n"); | 8619 PrintF("]\n"); |
8620 } | 8620 } |
8621 return NULL; | 8621 return NULL; |
8622 } | 8622 } |
8623 | 8623 |
8624 OptimizingCompiler* compiler = isolate->optimizing_compiler_thread()-> | 8624 RecompileJob* job = isolate->optimizing_compiler_thread()-> |
8625 FindReadyOSRCandidate(function, pc_offset); | 8625 FindReadyOSRCandidate(function, pc_offset); |
8626 | 8626 |
8627 if (compiler == NULL) { | 8627 if (job == NULL) { |
8628 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) && | 8628 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) && |
8629 Compiler::RecompileConcurrent(function, pc_offset)) { | 8629 Compiler::RecompileConcurrent(function, pc_offset)) { |
8630 if (function->IsMarkedForLazyRecompilation() || | 8630 if (function->IsMarkedForLazyRecompilation() || |
8631 function->IsMarkedForConcurrentRecompilation()) { | 8631 function->IsMarkedForConcurrentRecompilation()) { |
8632 // Prevent regular recompilation if we queue this for OSR. | 8632 // Prevent regular recompilation if we queue this for OSR. |
8633 // TODO(yangguo): remove this as soon as OSR becomes one-shot. | 8633 // TODO(yangguo): remove this as soon as OSR becomes one-shot. |
8634 function->ReplaceCode(*unoptimized); | 8634 function->ReplaceCode(*unoptimized); |
8635 } | 8635 } |
8636 return NULL; | 8636 return NULL; |
8637 } | 8637 } |
8638 // Fall through to the end in case of failure. | 8638 // Fall through to the end in case of failure. |
8639 } else { | 8639 } else { |
8640 // TODO(titzer): don't install the OSR code into the function. | 8640 // TODO(titzer): don't install the OSR code into the function. |
8641 ast_id = compiler->info()->osr_ast_id(); | 8641 ast_id = job->info()->osr_ast_id(); |
8642 result = Compiler::InstallOptimizedCode(compiler); | 8642 result = Compiler::InstallOptimizedCode(job); |
8643 } | 8643 } |
8644 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { | 8644 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { |
8645 ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset); | 8645 ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset); |
8646 ASSERT(!ast_id.IsNone()); | 8646 ASSERT(!ast_id.IsNone()); |
8647 if (FLAG_trace_osr) { | 8647 if (FLAG_trace_osr) { |
8648 PrintF("[OSR - replacing at AST id %d in ", ast_id.ToInt()); | 8648 PrintF("[OSR - replacing at AST id %d in ", ast_id.ToInt()); |
8649 function->PrintName(); | 8649 function->PrintName(); |
8650 PrintF("]\n"); | 8650 PrintF("]\n"); |
8651 } | 8651 } |
8652 // Attempt OSR compilation. | 8652 // Attempt OSR compilation. |
(...skipping 6147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14800 // Handle last resort GC and make sure to allow future allocations | 14800 // Handle last resort GC and make sure to allow future allocations |
14801 // to grow the heap without causing GCs (if possible). | 14801 // to grow the heap without causing GCs (if possible). |
14802 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14802 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14803 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14803 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14804 "Runtime::PerformGC"); | 14804 "Runtime::PerformGC"); |
14805 } | 14805 } |
14806 } | 14806 } |
14807 | 14807 |
14808 | 14808 |
14809 } } // namespace v8::internal | 14809 } } // namespace v8::internal |
OLD | NEW |