Index: src/runtime-profiler.cc |
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc |
index 3c0490f8ded66615de1349f889a5f3b9a401a159..39e916f5f0f7e886c684987e7d6bc4ecedc16075 100644 |
--- a/src/runtime-profiler.cc |
+++ b/src/runtime-profiler.cc |
@@ -135,7 +135,8 @@ void PendingListNode::WeakCallback(v8::Persistent<v8::Value>, void* data) { |
static bool IsOptimizable(JSFunction* function) { |
Code* code = function->code(); |
- return code->kind() == Code::FUNCTION && code->optimizable(); |
+ return code->kind() == Code::FUNCTION && code->optimizable() |
+ && function->shared()->code() == code; |
} |
@@ -160,7 +161,8 @@ static void AttemptOnStackReplacement(JSFunction* function) { |
// See AlwaysFullCompiler (in compiler.cc) comment on why we need |
// Debug::has_break_points(). |
ASSERT(function->IsMarkedForLazyRecompilation()); |
- if (!FLAG_use_osr || Debug::has_break_points() || function->IsBuiltin()) { |
+ if (!FLAG_use_osr || Debug::has_break_points() || function->IsBuiltin() |
+ || !function->shared()->allows_lazy_compilation()) { |
return; |
} |