Compile optimized code with active debugger but no break points.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 26 Jun 2014 06:32:51 +0000 (06:32 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 26 Jun 2014 06:32:51 +0000 (06:32 +0000)
R=ulan@chromium.org
BUG=386492
LOG=Y

Review URL: https://codereview.chromium.org/356713004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22029 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/codegen.cc
src/compiler.cc
src/objects.h
test/mjsunit/debug-compile-optimized.js [new file with mode: 0644]

index 753d522..c039e40 100644 (file)
@@ -151,7 +151,7 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
       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,
index f471224..2b68ef1 100644 (file)
@@ -306,8 +306,10 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
   // 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.
index a0cee46..50499db 100644 (file)
@@ -1043,7 +1043,7 @@ template <class C> inline bool Is(Object* obj);
   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")                 \
diff --git a/test/mjsunit/debug-compile-optimized.js b/test/mjsunit/debug-compile-optimized.js
new file mode 100644 (file)
index 0000000..468605a
--- /dev/null
@@ -0,0 +1,18 @@
+// 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);