From 67f20c4d95bf606e2c8a370282c2fc114adcfe6f Mon Sep 17 00:00:00 2001 From: "ricow@chromium.org" Date: Mon, 28 Mar 2011 05:57:27 +0000 Subject: [PATCH] Set optimizable to false on code object if shared function info says so. Because we might throw away code when doing code flushing we need to set the optimizable flag to false in CompileLaze if this has been set on the shared function info. This is the only place where this can happen, since we always exchange the code with the laze compile stub when doing code flushing. The comment in AbortAndDisable actually states that this is already the case (and that comment should now be ok). Review URL: http://codereview.chromium.org/6685044 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7378 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/compiler.cc b/src/compiler.cc index 05048bf..1ec4414 100755 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -203,6 +203,10 @@ static bool MakeCrankshaftCode(CompilationInfo* info) { Handle code(info->shared_info()->code()); ASSERT(code->kind() == Code::FUNCTION); + // We should never arrive here if optimization has been disabled on the + // shared function info. + ASSERT(!info->shared_info()->optimization_disabled()); + // Fall back to using the full code generator if it's not possible // to use the Hydrogen-based optimizing compiler. We already have // generated code for this from the shared function object. @@ -629,6 +633,11 @@ bool Compiler::CompileLazy(CompilationInfo* info) { } else { ASSERT(!info->code().is_null()); Handle code = info->code(); + // Set optimizable to false if this is disallowed by the shared + // function info, e.g., we might have flushed the code and must + // reset this bit when lazy compiling the code again. + if (shared->optimization_disabled()) code->set_optimizable(false); + Handle function = info->closure(); RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); @@ -665,7 +674,7 @@ bool Compiler::CompileLazy(CompilationInfo* info) { ASSERT(shared->is_compiled()); shared->set_code_age(0); - if (V8::UseCrankshaft() && info->AllowOptimize()) { + if (info->AllowOptimize() && !shared->optimization_disabled()) { // If we're asked to always optimize, we compile the optimized // version of the function right away - unless the debugger is // active as it makes no sense to compile optimized code then. -- 2.7.4