Reviewers: Yang,
Description:
Consistently use CompilationInfo::AbortOptimization.
[email protected]
Please review this at https://codereview.chromium.org/22832002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/compiler.h
M src/compiler.cc
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index
5ed274a7a20f4ae734db91772bcdfb7d7e64e536..2072f0d980182de34b38f956db981d18472bf69d
100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -231,12 +231,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
// --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
@@ -322,8 +316,7 @@ OptimizingCompiler::Status
OptimizingCompiler::CreateGraph() {
// We should never arrive here if there is no code object on the
// shared function object.
- Handle<Code> code(info()->shared_info()->code());
- ASSERT(code->kind() == Code::FUNCTION);
+ ASSERT(info()->shared_info()->code()->kind() == Code::FUNCTION);
// We should never arrive here if optimization has been disabled on the
// shared function info.
@@ -333,7 +326,7 @@ OptimizingCompiler::Status
OptimizingCompiler::CreateGraph() {
// to use the Hydrogen-based optimizing compiler. We already have
// generated code for this from the shared function object.
if (AlwaysFullCompiler(isolate())) {
- info()->SetCode(code);
+ info()->AbortOptimization();
return SetLastStatus(BAILED_OUT);
}
@@ -369,8 +362,8 @@ OptimizingCompiler::Status
OptimizingCompiler::CreateGraph() {
// Take --hydrogen-filter into account.
if (!info()->closure()->PassesHydrogenFilter()) {
- info()->SetCode(code);
- return SetLastStatus(BAILED_OUT);
+ info()->AbortOptimization();
+ return SetLastStatus(BAILED_OUT);
}
// Recompile the unoptimized version of the code if the current version
@@ -410,7 +403,7 @@ OptimizingCompiler::Status
OptimizingCompiler::CreateGraph() {
// optimizable marker in the code object and optimize anyway. This
// is safe as long as the unoptimized code has deoptimization
// support.
- ASSERT(FLAG_always_opt || code->optimizable());
+ ASSERT(FLAG_always_opt || info()->shared_info()->code()->optimizable());
ASSERT(info()->shared_info()->has_deoptimization_support());
if (FLAG_trace_hydrogen) {
@@ -1088,7 +1081,7 @@ void
Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
PrintF(" installed.\n");
}
} else {
- info->SetCode(Handle<Code>(info->shared_info()->code()));
+ info->AbortOptimization();
InstallFullCode(*info);
}
// Optimized code is finally replacing unoptimized code. Reset the
latter's
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index
47d459a28206252581c9d4c35a2b0f42228864e8..d9f0fefa850e723ccaaa84be2913453f13f18541
100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -235,9 +235,10 @@ class CompilationInfo {
// Determines whether or not to insert a self-optimization header.
bool ShouldSelfOptimize();
- // Disable all optimization attempts of this info for the rest of the
- // current compilation pipeline.
- void AbortOptimization();
+ // Reset code to the unoptimized version when optimization is aborted.
+ void AbortOptimization() {
+ SetCode(handle(shared_info()->code()));
+ }
void set_deferred_handles(DeferredHandles* deferred_handles) {
ASSERT(deferred_handles_ == NULL);
--
--
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/groups/opt_out.