Consistently use CompilationInfo::AbortOptimization.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/22832002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16240 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2013-08-20 08:53:34 +00:00
parent 943d5cc27a
commit 8a1abf6279
2 changed files with 10 additions and 16 deletions

View File

@ -232,12 +232,6 @@ bool CompilationInfo::ShouldSelfOptimize() {
} }
void CompilationInfo::AbortOptimization() {
Handle<Code> code(shared_info()->code());
SetCode(code);
}
// Determine whether to use the full compiler for all code. If the flag // Determine whether to use the full compiler for all code. If the flag
// --always-full-compiler is specified this is the case. For the virtual frame // --always-full-compiler is specified this is the case. For the virtual frame
// based compiler the full compiler is also used if a debugger is connected, as // based compiler the full compiler is also used if a debugger is connected, as
@ -323,8 +317,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
// We should never arrive here if there is no code object on the // We should never arrive here if there is no code object on the
// shared function object. // shared function object.
Handle<Code> code(info()->shared_info()->code()); ASSERT(info()->shared_info()->code()->kind() == Code::FUNCTION);
ASSERT(code->kind() == Code::FUNCTION);
// We should never arrive here if optimization has been disabled on the // We should never arrive here if optimization has been disabled on the
// shared function info. // shared function info.
@ -334,7 +327,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
// to use the Hydrogen-based optimizing compiler. We already have // to use the Hydrogen-based optimizing compiler. We already have
// generated code for this from the shared function object. // generated code for this from the shared function object.
if (AlwaysFullCompiler(isolate())) { if (AlwaysFullCompiler(isolate())) {
info()->SetCode(code); info()->AbortOptimization();
return SetLastStatus(BAILED_OUT); return SetLastStatus(BAILED_OUT);
} }
@ -370,8 +363,8 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
// Take --hydrogen-filter into account. // Take --hydrogen-filter into account.
if (!info()->closure()->PassesHydrogenFilter()) { if (!info()->closure()->PassesHydrogenFilter()) {
info()->SetCode(code); info()->AbortOptimization();
return SetLastStatus(BAILED_OUT); return SetLastStatus(BAILED_OUT);
} }
// Recompile the unoptimized version of the code if the current version // Recompile the unoptimized version of the code if the current version
@ -411,7 +404,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
// optimizable marker in the code object and optimize anyway. This // optimizable marker in the code object and optimize anyway. This
// is safe as long as the unoptimized code has deoptimization // is safe as long as the unoptimized code has deoptimization
// support. // support.
ASSERT(FLAG_always_opt || code->optimizable()); ASSERT(FLAG_always_opt || info()->shared_info()->code()->optimizable());
ASSERT(info()->shared_info()->has_deoptimization_support()); ASSERT(info()->shared_info()->has_deoptimization_support());
if (FLAG_trace_hydrogen) { if (FLAG_trace_hydrogen) {
@ -1099,7 +1092,7 @@ void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
PrintF(" installed.\n"); PrintF(" installed.\n");
} }
} else { } else {
info->SetCode(Handle<Code>(info->shared_info()->code())); info->AbortOptimization();
InstallFullCode(*info); InstallFullCode(*info);
} }
// Optimized code is finally replacing unoptimized code. Reset the latter's // Optimized code is finally replacing unoptimized code. Reset the latter's

View File

@ -235,9 +235,10 @@ class CompilationInfo {
// Determines whether or not to insert a self-optimization header. // Determines whether or not to insert a self-optimization header.
bool ShouldSelfOptimize(); bool ShouldSelfOptimize();
// Disable all optimization attempts of this info for the rest of the // Reset code to the unoptimized version when optimization is aborted.
// current compilation pipeline. void AbortOptimization() {
void AbortOptimization(); SetCode(handle(shared_info()->code()));
}
void set_deferred_handles(DeferredHandles* deferred_handles) { void set_deferred_handles(DeferredHandles* deferred_handles) {
ASSERT(deferred_handles_ == NULL); ASSERT(deferred_handles_ == NULL);