Commit f8fc5c44 authored by palfia@homejinni.com's avatar palfia@homejinni.com

Allow running mjsunit/manual-parallel-recompile on single-core systems.

- Add an %IsParallelSupported() builtin function to  make possible to check support of parallel processing from JavaScripts.
- Change the test script that if parallel recompilation is forced on a single core CPU, expect that it won't be recompiled in parallel.
- Change the  JSFunction::MarkForParallelRecompilation() to fall back gracefully if parallel recompilation is not supported.

BUG=v8:2733
TEST=mjsunit/manual-parallel-recompile

Review URL: https://codereview.chromium.org/17277002
Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15184 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7a229ccf
......@@ -9198,7 +9198,10 @@ void JSFunction::MarkForLazyRecompilation() {
void JSFunction::MarkForParallelRecompilation() {
ASSERT(is_compiled() && !IsOptimized());
ASSERT(shared()->allows_lazy_compilation() || code()->optimizable());
ASSERT(FLAG_parallel_recompilation);
if (!FLAG_parallel_recompilation) {
JSFunction::MarkForLazyRecompilation();
return;
}
if (FLAG_trace_parallel_recompilation) {
PrintF(" ** Marking ");
PrintName();
......
......@@ -8070,6 +8070,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) {
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsParallelRecompilationSupported) {
HandleScope scope(isolate);
return FLAG_parallel_recompilation
? isolate->heap()->true_value() : isolate->heap()->false_value();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
......
......@@ -95,6 +95,7 @@ namespace internal {
F(DeoptimizeFunction, 1, 1) \
F(ClearFunctionTypeFeedback, 1, 1) \
F(RunningInSimulator, 0, 1) \
F(IsParallelRecompilationSupported, 0, 1) \
F(OptimizeFunctionOnNextCall, -1, 1) \
F(CompleteOptimization, 1, 1) \
F(GetOptimizationStatus, 1, 1) \
......
......@@ -60,8 +60,10 @@ assertUnoptimized(g);
%OptimizeFunctionOnNextCall(g, "parallel");
f(g(2)); // Trigger optimization.
assertUnoptimized(f); // Not yet optimized.
assertUnoptimized(g);
if (%IsParallelRecompilationSupported()) {
assertUnoptimized(f); // Not yet optimized.
assertUnoptimized(g);
}
%CompleteOptimization(f); // Wait till optimized code is installed.
%CompleteOptimization(g);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment