Reviewers: Yang,
Description:
Abort optimization in corner case.
The %OptimizeFunctionOnNextCall sledgehammer can cause a function to be
marked for optimization before it's ever been compiled by fullcode.
This can lead to the situation where a function doesn't have optimization
disabled until we try to compile it optimized.
Basically, the assert should just handle this case more gracefully.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/760063002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+11, -4 lines):
M src/compiler.cc
M src/runtime/runtime-test.cc
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index
0540d96688e8b366f38208310cf58ae5a2166d3c..205d98a70be06ff71cba312f73769ddf8f2c5263
100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -344,9 +344,11 @@ OptimizedCompileJob::Status
OptimizedCompileJob::CreateGraph() {
DCHECK(info()->IsOptimizing());
DCHECK(!info()->IsCompilingForDebugging());
- // We should never arrive here if optimization has been disabled on the
- // shared function info.
- DCHECK(!info()->shared_info()->optimization_disabled());
+ // Optimization could have been disabled by the parser.
+ if (info()->shared_info()->optimization_disabled()) {
+ return AbortOptimization(
+ info()->shared_info()->disable_optimization_reason());
+ }
// Do not use crankshaft if we need to be able to set break points.
if (isolate()->DebuggerHasBreakPoints()) {
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index
bd6182a93d54035feb54bd35f4636203abd0e692..7aa280917c3192ec2261596ac8c7bcde034a79a8
100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -62,9 +62,14 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
if (!isolate->use_crankshaft()) return
isolate->heap()->undefined_value();
- // If the function is optimized, just return.
+ // If the function is already optimized, just return.
if (function->IsOptimized()) return isolate->heap()->undefined_value();
+ // If the function cannot optimized, just return.
+ if (function->shared()->optimization_disabled()) {
+ return isolate->heap()->undefined_value();
+ }
+
function->MarkForOptimization();
Code* unoptimized = function->shared()->code();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.