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

Unified Diff: src/runtime.cc

Issue 10417010: Run Crankshaft on a separate thread. (Closed) Base URL: https://chromiumcodereview.appspot.com/10387157
Patch Set: Set optimize_in_parallel to false by default. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index a42f90cc7d98d2f5092b9af7322379160f4c2f07..0cbd62e10b0bcfe92b4fc2e19aee2ff8399a9857 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6507,6 +6507,46 @@ bool Runtime::IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch) {
}
+MaybeObject* Runtime::CompileJSFunction(Isolate* isolate,
+ Handle<JSFunction> function) {
+ // If the function is not compiled ignore the lazy
+ // recompilation. This can happen if the debugger is activated and
+ // the function is returned to the not compiled state.
+ if (!function->shared()->is_compiled()) {
+ function->ReplaceCode(function->shared()->code());
+ return function->code();
+ }
+
+ // If the function is not optimizable or debugger is active continue using the
+ // code from the full compiler.
+ if (!function->shared()->code()->optimizable() ||
+ isolate->DebuggerHasBreakPoints()) {
+ if (FLAG_trace_opt) {
+ PrintF("[failed to optimize ");
+ function->PrintName();
+ PrintF(": is code optimizable: %s, is debugger enabled: %s]\n",
+ function->shared()->code()->optimizable() ? "T" : "F",
+ isolate->DebuggerHasBreakPoints() ? "T" : "F");
+ }
+ function->ReplaceCode(function->shared()->code());
+ return function->code();
+ }
+ function->shared()->code()->set_profiler_ticks(0);
+ if (JSFunction::CompileOptimized(function,
+ AstNode::kNoNumber,
+ CLEAR_EXCEPTION)) {
+ return function->code();
+ }
+ if (FLAG_trace_opt) {
+ PrintF("[failed to optimize ");
+ function->PrintName();
+ PrintF(": optimized compilation failed]\n");
+ }
+ function->ReplaceCode(function->shared()->code());
+ return function->code();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToString) {
NoHandleAllocation ha;
ASSERT(args.length() == 1);
@@ -8101,41 +8141,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) {
ASSERT(args.length() == 1);
Handle<JSFunction> function = args.at<JSFunction>(0);
- // If the function is not compiled ignore the lazy
- // recompilation. This can happen if the debugger is activated and
- // the function is returned to the not compiled state.
- if (!function->shared()->is_compiled()) {
- function->ReplaceCode(function->shared()->code());
- return function->code();
- }
-
- // If the function is not optimizable or debugger is active continue using the
- // code from the full compiler.
- if (!function->shared()->code()->optimizable() ||
- isolate->DebuggerHasBreakPoints()) {
- if (FLAG_trace_opt) {
- PrintF("[failed to optimize ");
- function->PrintName();
- PrintF(": is code optimizable: %s, is debugger enabled: %s]\n",
- function->shared()->code()->optimizable() ? "T" : "F",
- isolate->DebuggerHasBreakPoints() ? "T" : "F");
- }
- function->ReplaceCode(function->shared()->code());
- return function->code();
- }
- function->shared()->code()->set_profiler_ticks(0);
- if (JSFunction::CompileOptimized(function,
- AstNode::kNoNumber,
- CLEAR_EXCEPTION)) {
- return function->code();
- }
- if (FLAG_trace_opt) {
- PrintF("[failed to optimize ");
- function->PrintName();
- PrintF(": optimized compilation failed]\n");
- }
- function->ReplaceCode(function->shared()->code());
- return function->code();
+ return Runtime::CompileJSFunction(isolate, function);
}
@@ -8329,6 +8335,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
if (!V8::UseCrankshaft()) {
return Smi::FromInt(4); // 4 == "never".
}
+ if (FLAG_optimize_in_parallel) {
+ return Smi::FromInt(5); // 5 == "indeterministic"
+ }
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
if (FLAG_always_opt) {
// We may have always opt, but that is more best-effort than a real
« 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