isolate->factory()->NewCode(desc, flags, masm->CodeObject(),
false, is_crankshafted,
info->prologue_offset(),
- info->is_debug());
+ info->is_debug() && !is_crankshafted);
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted,
// generated code for this from the shared function object.
if (FLAG_always_full_compiler) return AbortOptimization();
- // Do not use crankshaft if compiling for debugging.
- if (info()->is_debug()) return AbortOptimization(kDebuggerIsActive);
+ // Do not use crankshaft if we need to be able to set break points.
+ if (isolate()->DebuggerHasBreakPoints()) {
+ return AbortOptimization(kDebuggerHasBreakPoints);
+ }
// Limit the number of times we re-compile a functions with
// the optimizing compiler.
V(kCopyBuffersOverlap, "Copy buffers overlap") \
V(kCouldNotGenerateZero, "Could not generate +0.0") \
V(kCouldNotGenerateNegativeZero, "Could not generate -0.0") \
- V(kDebuggerIsActive, "Debugger is active") \
+ V(kDebuggerHasBreakPoints, "Debugger has break points") \
V(kDebuggerStatement, "DebuggerStatement") \
V(kDeclarationInCatchContext, "Declaration in catch context") \
V(kDeclarationInWithContext, "Declaration in with context") \
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-debug-as debug --allow-natives-syntax --crankshaft
+
+Debug = debug.Debug;
+
+Debug.setListener(function() {});
+
+function f() {}
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
+assertOptimized(f);
+
+Debug.setListener(null);