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 7711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7722 return function->code(); | 7722 return function->code(); |
7723 } | 7723 } |
7724 | 7724 |
7725 | 7725 |
7726 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) { | 7726 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) { |
7727 HandleScope handle_scope(isolate); | 7727 HandleScope handle_scope(isolate); |
7728 ASSERT(args.length() == 1); | 7728 ASSERT(args.length() == 1); |
7729 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 7729 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
7730 if (!AllowOptimization(isolate, function)) { | 7730 if (!AllowOptimization(isolate, function)) { |
7731 function->ReplaceCode(function->shared()->code()); | 7731 function->ReplaceCode(function->shared()->code()); |
7732 return function->code(); | 7732 return isolate->heap()->undefined_value(); |
7733 } | 7733 } |
7734 function->shared()->code()->set_profiler_ticks(0); | 7734 function->shared()->code()->set_profiler_ticks(0); |
7735 ASSERT(FLAG_parallel_recompilation); | 7735 ASSERT(FLAG_parallel_recompilation); |
7736 Compiler::RecompileParallel(function); | 7736 Compiler::RecompileParallel(function); |
7737 return isolate->heap()->undefined_value(); | 7737 return isolate->heap()->undefined_value(); |
7738 } | 7738 } |
7739 | 7739 |
7740 | 7740 |
7741 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) { | 7741 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) { |
7742 HandleScope handle_scope(isolate); | 7742 HandleScope handle_scope(isolate); |
7743 ASSERT(args.length() == 1); | 7743 ASSERT(args.length() == 1); |
7744 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 7744 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
7745 if (!V8::UseCrankshaft()) return isolate->heap()->undefined_value(); | 7745 ASSERT(V8::UseCrankshaft() && FLAG_parallel_recompilation); |
7746 ASSERT(FLAG_parallel_recompilation); | |
7747 OptimizingCompilerThread* opt_thread = isolate->optimizing_compiler_thread(); | 7746 OptimizingCompilerThread* opt_thread = isolate->optimizing_compiler_thread(); |
7748 opt_thread->InstallOptimizedFunctions(); | 7747 do { |
| 7748 // The function could have been marked for installing, but not queued just |
| 7749 // yet. In this case, retry until installed. |
| 7750 opt_thread->InstallOptimizedFunctions(); |
| 7751 } while (function->IsMarkedForInstallingRecompiledCode()); |
7749 return function->code(); | 7752 return function->code(); |
7750 } | 7753 } |
7751 | 7754 |
7752 | 7755 |
7753 class ActivationsFinder : public ThreadVisitor { | 7756 class ActivationsFinder : public ThreadVisitor { |
7754 public: | 7757 public: |
7755 explicit ActivationsFinder(JSFunction* function) | 7758 explicit ActivationsFinder(JSFunction* function) |
7756 : function_(function), has_activations_(false) {} | 7759 : function_(function), has_activations_(false) {} |
7757 | 7760 |
7758 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { | 7761 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { |
(...skipping 5644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13403 // Handle last resort GC and make sure to allow future allocations | 13406 // Handle last resort GC and make sure to allow future allocations |
13404 // to grow the heap without causing GCs (if possible). | 13407 // to grow the heap without causing GCs (if possible). |
13405 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13408 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13406 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13409 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13407 "Runtime::PerformGC"); | 13410 "Runtime::PerformGC"); |
13408 } | 13411 } |
13409 } | 13412 } |
13410 | 13413 |
13411 | 13414 |
13412 } } // namespace v8::internal | 13415 } } // namespace v8::internal |
OLD | NEW |