Commit 67f20c4d authored by ricow@chromium.org's avatar ricow@chromium.org

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
parent 7a74560f
......@@ -203,6 +203,10 @@ static bool MakeCrankshaftCode(CompilationInfo* info) {
Handle<Code> 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> 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<JSFunction> 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment