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 8590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8601 ASSERT(pc_offset == | 8601 ASSERT(pc_offset == |
8602 static_cast<uint32_t>(frame->pc() - unoptimized->instruction_start())); | 8602 static_cast<uint32_t>(frame->pc() - unoptimized->instruction_start())); |
8603 #endif // DEBUG | 8603 #endif // DEBUG |
8604 | 8604 |
8605 // We're not prepared to handle a function with arguments object. | 8605 // We're not prepared to handle a function with arguments object. |
8606 ASSERT(!function->shared()->uses_arguments()); | 8606 ASSERT(!function->shared()->uses_arguments()); |
8607 | 8607 |
8608 Handle<Code> result = Handle<Code>::null(); | 8608 Handle<Code> result = Handle<Code>::null(); |
8609 BailoutId ast_id = BailoutId::None(); | 8609 BailoutId ast_id = BailoutId::None(); |
8610 | 8610 |
8611 if (FLAG_concurrent_recompilation && FLAG_concurrent_osr) { | 8611 if (FLAG_concurrent_osr) { |
8612 if (isolate->optimizing_compiler_thread()-> | 8612 if (isolate->optimizing_compiler_thread()-> |
8613 IsQueuedForOSR(function, pc_offset)) { | 8613 IsQueuedForOSR(function, pc_offset)) { |
8614 // Still waiting for the optimizing compiler thread to finish. Carry on. | 8614 // Still waiting for the optimizing compiler thread to finish. Carry on. |
8615 if (FLAG_trace_osr) { | 8615 if (FLAG_trace_osr) { |
8616 PrintF("[COSR - polling recompile tasks for "); | 8616 PrintF("[COSR - polling recompile tasks for "); |
8617 function->PrintName(); | 8617 function->PrintName(); |
8618 PrintF("]\n"); | 8618 PrintF("]\n"); |
8619 } | 8619 } |
8620 return NULL; | 8620 return NULL; |
8621 } | 8621 } |
8622 | 8622 |
8623 OptimizingCompiler* compiler = isolate->optimizing_compiler_thread()-> | 8623 OptimizingCompiler* compiler = isolate->optimizing_compiler_thread()-> |
8624 FindReadyOSRCandidate(function, pc_offset); | 8624 FindReadyOSRCandidate(function, pc_offset); |
8625 | 8625 |
8626 if (compiler == NULL) { | 8626 if (compiler == NULL) { |
8627 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) && | 8627 if (IsSuitableForOnStackReplacement(isolate, function, unoptimized) && |
8628 Compiler::RecompileConcurrent(function, pc_offset)) { | 8628 Compiler::RecompileConcurrent(function, pc_offset)) { |
8629 if (function->IsMarkedForLazyRecompilation() || | 8629 if (function->IsMarkedForLazyRecompilation() || |
8630 function->IsMarkedForConcurrentRecompilation()) { | 8630 function->IsMarkedForConcurrentRecompilation()) { |
8631 // Prevent regular recompilation if we queue this for OSR. | 8631 // Prevent regular recompilation if we queue this for OSR. |
8632 // TODO(yangguo): remove this as soon as OSR becomes one-shot. | 8632 // TODO(yangguo): remove this as soon as OSR becomes one-shot. |
8633 function->ReplaceCode(function->shared()->code()); | 8633 function->ReplaceCode(*unoptimized); |
8634 } | 8634 } |
8635 return NULL; | 8635 return NULL; |
8636 } | 8636 } |
8637 // Fall through to the end in case of failure. | 8637 // Fall through to the end in case of failure. |
8638 } else { | 8638 } else { |
8639 // TODO(titzer): don't install the OSR code into the function. | 8639 // TODO(titzer): don't install the OSR code into the function. |
8640 ast_id = compiler->info()->osr_ast_id(); | 8640 ast_id = compiler->info()->osr_ast_id(); |
8641 result = Compiler::InstallOptimizedCode(compiler); | 8641 result = Compiler::InstallOptimizedCode(compiler); |
8642 } | 8642 } |
8643 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { | 8643 } else if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { |
(...skipping 6155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14799 // Handle last resort GC and make sure to allow future allocations | 14799 // Handle last resort GC and make sure to allow future allocations |
14800 // to grow the heap without causing GCs (if possible). | 14800 // to grow the heap without causing GCs (if possible). |
14801 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14801 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14802 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14802 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14803 "Runtime::PerformGC"); | 14803 "Runtime::PerformGC"); |
14804 } | 14804 } |
14805 } | 14805 } |
14806 | 14806 |
14807 | 14807 |
14808 } } // namespace v8::internal | 14808 } } // namespace v8::internal |
OLD | NEW |