Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime.cc

Issue 12488006: Parallel recompilation: remove interrupt for code generation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7740 matching lines...) Expand 10 before | Expand all | Expand 10 after
7751 function->PrintName(); 7751 function->PrintName();
7752 PrintF(": optimized compilation failed]\n"); 7752 PrintF(": optimized compilation failed]\n");
7753 } 7753 }
7754 function->ReplaceCode(function->shared()->code()); 7754 function->ReplaceCode(function->shared()->code());
7755 return function->code(); 7755 return function->code();
7756 } 7756 }
7757 7757
7758 7758
7759 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) { 7759 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) {
7760 HandleScope handle_scope(isolate); 7760 HandleScope handle_scope(isolate);
7761 Handle<JSFunction> function = args.at<JSFunction>(0); 7761 ASSERT(args.length() == 1);
7762 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
7762 if (!AllowOptimization(isolate, function)) { 7763 if (!AllowOptimization(isolate, function)) {
7763 function->ReplaceCode(function->shared()->code()); 7764 function->ReplaceCode(function->shared()->code());
7764 return function->code(); 7765 return function->code();
7765 } 7766 }
7766 function->shared()->code()->set_profiler_ticks(0); 7767 function->shared()->code()->set_profiler_ticks(0);
7767 ASSERT(FLAG_parallel_recompilation); 7768 ASSERT(FLAG_parallel_recompilation);
7768 Compiler::RecompileParallel(function); 7769 Compiler::RecompileParallel(function);
7769 return isolate->heap()->undefined_value(); 7770 return isolate->heap()->undefined_value();
7770 } 7771 }
7771 7772
7772 7773
7773 RUNTIME_FUNCTION(MaybeObject*, Runtime_ForceParallelRecompile) {
7774 HandleScope handle_scope(isolate);
7775 if (!V8::UseCrankshaft()) return isolate->heap()->undefined_value();
7776 ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation);
7777 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
7778 return isolate->Throw(*isolate->factory()->InternalizeOneByteString(
7779 STATIC_ASCII_VECTOR("Recompile queue is full.")));
7780 }
7781 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
7782 fun->ReplaceCode(isolate->builtins()->builtin(Builtins::kParallelRecompile));
7783 Compiler::RecompileParallel(fun);
7784 return isolate->heap()->undefined_value();
7785 }
7786
7787
7788 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) { 7774 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) {
7789 HandleScope handle_scope(isolate); 7775 HandleScope handle_scope(isolate);
7776 ASSERT(args.length() == 1);
7777 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
7790 if (!V8::UseCrankshaft()) return isolate->heap()->undefined_value(); 7778 if (!V8::UseCrankshaft()) return isolate->heap()->undefined_value();
7791 ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation); 7779 ASSERT(FLAG_parallel_recompilation);
7792 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
7793 OptimizingCompilerThread* opt_thread = isolate->optimizing_compiler_thread(); 7780 OptimizingCompilerThread* opt_thread = isolate->optimizing_compiler_thread();
7794 Handle<SharedFunctionInfo> shared(fun->shared()); 7781 opt_thread->InstallOptimizedFunctions();
7795 while (*opt_thread->InstallNextOptimizedFunction() != *shared) { } 7782 return function->code();
7796 return isolate->heap()->undefined_value();
7797 } 7783 }
7798 7784
7799 7785
7800 class ActivationsFinder : public ThreadVisitor { 7786 class ActivationsFinder : public ThreadVisitor {
7801 public: 7787 public:
7802 explicit ActivationsFinder(JSFunction* function) 7788 explicit ActivationsFinder(JSFunction* function)
7803 : function_(function), has_activations_(false) {} 7789 : function_(function), has_activations_(false) {}
7804 7790
7805 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { 7791 void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
7806 if (has_activations_) return; 7792 if (has_activations_) return;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
7957 Code::kMaxLoopNestingMarker); 7943 Code::kMaxLoopNestingMarker);
7958 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("parallel"))) { 7944 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("parallel"))) {
7959 function->MarkForParallelRecompilation(); 7945 function->MarkForParallelRecompilation();
7960 } 7946 }
7961 } 7947 }
7962 7948
7963 return isolate->heap()->undefined_value(); 7949 return isolate->heap()->undefined_value();
7964 } 7950 }
7965 7951
7966 7952
7953 RUNTIME_FUNCTION(MaybeObject*, Runtime_WaitUntilOptimized) {
7954 HandleScope scope(isolate);
7955 ASSERT(args.length() == 1);
7956 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
7957 if (FLAG_parallel_recompilation) {
7958 if (V8::UseCrankshaft() && function->IsOptimizable()) {
7959 while (!function->IsOptimized()) OS::Sleep(50);
7960 }
7961 }
7962 return isolate->heap()->undefined_value();
7963 }
7964
7965
7967 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { 7966 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
7968 HandleScope scope(isolate); 7967 HandleScope scope(isolate);
7969 ASSERT(args.length() == 1); 7968 ASSERT(args.length() == 1);
7970 // The least significant bit (after untagging) indicates whether the 7969 // The least significant bit (after untagging) indicates whether the
7971 // function is currently optimized, regardless of reason. 7970 // function is currently optimized, regardless of reason.
7972 if (!V8::UseCrankshaft()) { 7971 if (!V8::UseCrankshaft()) {
7973 return Smi::FromInt(4); // 4 == "never". 7972 return Smi::FromInt(4); // 4 == "never".
7974 } 7973 }
7975 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 7974 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
7976 if (FLAG_parallel_recompilation) { 7975 if (FLAG_parallel_recompilation) {
(...skipping 5439 matching lines...) Expand 10 before | Expand all | Expand 10 after
13416 // Handle last resort GC and make sure to allow future allocations 13415 // Handle last resort GC and make sure to allow future allocations
13417 // to grow the heap without causing GCs (if possible). 13416 // to grow the heap without causing GCs (if possible).
13418 isolate->counters()->gc_last_resort_from_js()->Increment(); 13417 isolate->counters()->gc_last_resort_from_js()->Increment();
13419 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13418 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13420 "Runtime::PerformGC"); 13419 "Runtime::PerformGC");
13421 } 13420 }
13422 } 13421 }
13423 13422
13424 13423
13425 } } // namespace v8::internal 13424 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698