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

Unified Diff: src/runtime.cc

Issue 543643002: Fix %OptimizeFunctionOnNextCall to actually work when the function has not yet been compiled. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: --allow-natives-syntax Created 6 years, 3 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/objects-inl.h ('k') | test/mjsunit/compiler/opt-next-call.js » ('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 e6277060732e9d71feb9d592af657a3dff31e406..dc1e2a9a46ce77103cbaaaefeab66192886712df 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8457,15 +8457,9 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized) {
CONVERT_BOOLEAN_ARG_CHECKED(concurrent, 1);
Handle<Code> unoptimized(function->shared()->code());
- if (!function->shared()->is_compiled()) {
- // If the function is not compiled, do not optimize.
- // This can happen if the debugger is activated and
- // the function is returned to the not compiled state.
- // TODO(yangguo): reconsider this.
- function->ReplaceCode(function->shared()->code());
- } else if (!isolate->use_crankshaft() ||
- function->shared()->optimization_disabled() ||
- isolate->DebuggerHasBreakPoints()) {
+ if (!isolate->use_crankshaft() ||
+ function->shared()->optimization_disabled() ||
+ isolate->DebuggerHasBreakPoints()) {
// If the function is not optimizable or debugger is active continue
// using the code from the full compiler.
if (FLAG_trace_opt) {
@@ -8476,16 +8470,16 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized) {
isolate->DebuggerHasBreakPoints() ? "T" : "F");
}
function->ReplaceCode(*unoptimized);
+ return function->code();
+ }
+
+ Compiler::ConcurrencyMode mode =
+ concurrent ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT;
+ Handle<Code> code;
+ if (Compiler::GetOptimizedCode(function, unoptimized, mode).ToHandle(&code)) {
+ function->ReplaceCode(*code);
} else {
- Compiler::ConcurrencyMode mode = concurrent ? Compiler::CONCURRENT
- : Compiler::NOT_CONCURRENT;
- Handle<Code> code;
- if (Compiler::GetOptimizedCode(
- function, unoptimized, mode).ToHandle(&code)) {
- function->ReplaceCode(*code);
- } else {
- function->ReplaceCode(*unoptimized);
- }
+ function->ReplaceCode(*unoptimized);
}
DCHECK(function->code()->kind() == Code::FUNCTION ||
@@ -8641,11 +8635,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
- if (!function->IsOptimizable() &&
- !function->IsMarkedForConcurrentOptimization() &&
- !function->IsInOptimizationQueue()) {
- return isolate->heap()->undefined_value();
- }
+ if (function->IsOptimized()) return isolate->heap()->undefined_value();
function->MarkForOptimization();
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/compiler/opt-next-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698