Reviewers: Yang,

Description:
Remove exorbitant duplication of DebuggerHasBreakpoints.

[email protected]

Please review this at https://codereview.chromium.org/804713006/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+13, -29 lines):
  M src/compiler.cc
  M src/factory.cc
  M src/isolate.h
  M src/isolate-inl.h
  M src/objects.cc
  M src/runtime-profiler.cc
  M src/runtime/runtime-compiler.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index f8825686e2e3ce72a318aba7999e0928be3efa0d..bcae3b90b4db5fe2c8879c3f64d99c820e0e3ea8 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -345,7 +345,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
   DCHECK(!info()->IsCompilingForDebugging());

// Do not use Crankshaft/TurboFan if we need to be able to set break points.
-  if (isolate()->DebuggerHasBreakPoints()) {
+  if (isolate()->debug()->has_break_points()) {
     return RetryOptimization(kDebuggerHasBreakPoints);
   }

@@ -967,8 +967,7 @@ MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) { ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCodeCommon(&info),
                              Code);

-  if (FLAG_always_opt && isolate->use_crankshaft() &&
-      !isolate->DebuggerHasBreakPoints()) {
+  if (FLAG_always_opt && isolate->use_crankshaft()) {
     Handle<Code> opt_code;
     if (Compiler::GetOptimizedCode(
             function, result,
@@ -1520,7 +1519,7 @@ Handle<Code> Compiler::GetConcurrentlyOptimizedCode(OptimizedCompileJob* job) {
       job->RetryOptimization(kOptimizationDisabled);
     } else if (info->HasAbortedDueToDependencyChange()) {
       job->RetryOptimization(kBailedOutDueToDependencyChange);
-    } else if (isolate->DebuggerHasBreakPoints()) {
+    } else if (isolate->debug()->has_break_points()) {
       job->RetryOptimization(kDebuggerHasBreakPoints);
     } else if (job->GenerateCode() == OptimizedCompileJob::SUCCEEDED) {
RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info.get(), shared);
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 1f210bf7429419bc4a8e9062978d0f4906dc2689..d6d15c68fed41ca6faad67436758ff106b84a057 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1361,8 +1361,7 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
 static bool ShouldOptimizeNewClosure(Isolate* isolate,
                                      Handle<SharedFunctionInfo> info) {
   return isolate->use_crankshaft() && !info->is_toplevel() &&
-         info->is_compiled() && info->allows_lazy_compilation() &&
-         !isolate->DebuggerHasBreakPoints();
+         info->is_compiled() && info->allows_lazy_compilation();
 }


Index: src/isolate-inl.h
diff --git a/src/isolate-inl.h b/src/isolate-inl.h
index b44c4d6d723606764d4a9bdebba38d893598710d..d2342794eebe4f91ad12965396e3e6067969c85c 100644
--- a/src/isolate-inl.h
+++ b/src/isolate-inl.h
@@ -25,11 +25,6 @@ SaveContext::SaveContext(Isolate* isolate)
 }


-bool Isolate::DebuggerHasBreakPoints() {
-  return debug()->has_break_points();
-}
-
-
 base::RandomNumberGenerator* Isolate::random_number_generator() {
   if (random_number_generator_ == NULL) {
     if (FLAG_random_seed != 0) {
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 27e6377012bb7f9819b34b58d99173047a1c3a31..cac1d91cdfd2effc866f34c1815909d4f12a88a2 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -978,8 +978,6 @@ class Isolate {

   Debug* debug() { return debug_; }

-  inline bool DebuggerHasBreakPoints();
-
   CpuProfiler* cpu_profiler() const { return cpu_profiler_; }
   HeapProfiler* heap_profiler() const { return heap_profiler_; }

Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index cbca81753b59b90ec9f25ae4e7e6607bec5a2dc2..38e95cbf1838d412e5b51f9a4121452987cfea37 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9461,7 +9461,7 @@ void JSFunction::AttemptConcurrentOptimization() {
   }
   DCHECK(isolate->use_crankshaft());
   DCHECK(!IsInOptimizationQueue());
-  DCHECK(is_compiled() || isolate->DebuggerHasBreakPoints());
+  DCHECK(is_compiled() || isolate->debug()->has_break_points());
   DCHECK(!IsOptimized());
   DCHECK(shared()->allows_lazy_compilation() || code()->optimizable());
   DCHECK(isolate->concurrent_recompilation_enabled());
Index: src/runtime-profiler.cc
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
index 6c997145937043e9088c3e4f19c44fd9ba85ab57..109c1a52a98cc805705ecfaeefe50aa83460c7d3 100644
--- a/src/runtime-profiler.cc
+++ b/src/runtime-profiler.cc
@@ -113,11 +113,7 @@ void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) {
 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function,
                                                 int loop_nesting_levels) {
   SharedFunctionInfo* shared = function->shared();
-  // See AlwaysFullCompiler (in compiler.cc) comment on why we need
-  // Debug::has_break_points().
-  if (!FLAG_use_osr ||
-      isolate_->DebuggerHasBreakPoints() ||
-      function->IsBuiltin()) {
+  if (!FLAG_use_osr || function->IsBuiltin()) {
     return;
   }

@@ -147,7 +143,7 @@ void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function,
 void RuntimeProfiler::OptimizeNow() {
   HandleScope scope(isolate_);

- if (!isolate_->use_crankshaft() || isolate_->DebuggerHasBreakPoints()) return;
+  if (!isolate_->use_crankshaft()) return;

   DisallowHeapAllocation no_gc;

Index: src/runtime/runtime-compiler.cc
diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc index f132d986f5eb4f689c92ae340881df9d804bbbf3..7ef287d2a1669433dfee8d34facea444f0936de4 100644
--- a/src/runtime/runtime-compiler.cc
+++ b/src/runtime/runtime-compiler.cc
@@ -50,16 +50,13 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized) {
   DCHECK(isolate->use_crankshaft());

   Handle<Code> unoptimized(function->shared()->code());
-  if (function->shared()->optimization_disabled() ||
-      isolate->DebuggerHasBreakPoints()) {
-    // If the function is not optimizable or debugger is active continue
-    // using the code from the full compiler.
+  if (function->shared()->optimization_disabled()) {
+ // If the function is not optimizable continue using the code from the full
+    // compiler.
     if (FLAG_trace_opt) {
-      PrintF("[failed to optimize ");
-      function->PrintName();
-      PrintF(": is code optimizable: %s, is debugger enabled: %s]\n",
-             function->shared()->optimization_disabled() ? "F" : "T",
-             isolate->DebuggerHasBreakPoints() ? "T" : "F");
+      OFStream os(stdout);
+      os << "[failed to optimize " << Brief(*function)
+         << ", code is not optimizable]" << std::endl;
     }
     function->ReplaceCode(*unoptimized);
     return function->code();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to