Revision: 21135
Author:   [email protected]
Date:     Mon May  5 07:10:38 2014 UTC
Log:      Always initialize the debugger eagerly.

There is no point doing it lazily, since compiling and executing the tiniest piece of code triggers lazy init.
Also removed some dead code.

[email protected]

Review URL: https://codereview.chromium.org/265593004
http://code.google.com/p/v8/source/detail?r=21135

Modified:
 /branches/bleeding_edge/src/arm/debug-arm.cc
 /branches/bleeding_edge/src/arm64/debug-arm64.cc
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/debug.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/ia32/debug-ia32.cc
 /branches/bleeding_edge/src/isolate-inl.h
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/liveedit.cc
 /branches/bleeding_edge/src/mips/debug-mips.cc
 /branches/bleeding_edge/src/serialize.cc
 /branches/bleeding_edge/src/x64/debug-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/debug-arm.cc Wed Apr 30 14:33:35 2014 UTC +++ /branches/bleeding_edge/src/arm/debug-arm.cc Mon May 5 07:10:38 2014 UTC
@@ -32,7 +32,7 @@
   patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
   patcher.masm()->blx(v8::internal::ip);
   patcher.Emit(
-      debug_info_->GetIsolate()->debug()->debug_break_return()->entry());
+      debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry());
   patcher.masm()->bkpt(0);
 }

@@ -73,7 +73,7 @@
   patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
   patcher.masm()->blx(v8::internal::ip);
   patcher.Emit(
-      debug_info_->GetIsolate()->debug()->debug_break_slot()->entry());
+      debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry());
 }


=======================================
--- /branches/bleeding_edge/src/arm64/debug-arm64.cc Wed Apr 30 14:33:35 2014 UTC +++ /branches/bleeding_edge/src/arm64/debug-arm64.cc Mon May 5 07:10:38 2014 UTC
@@ -42,7 +42,7 @@
   STATIC_ASSERT(Assembler::kJSRetSequenceInstructions >= 5);
PatchingAssembler patcher(reinterpret_cast<Instruction*>(rinfo()->pc()), 5);
   byte* entry =
-      debug_info_->GetIsolate()->debug()->debug_break_return()->entry();
+      debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry();

// The first instruction of a patched return sequence must be a load literal
   // loading the address of the debug break return code.
@@ -101,7 +101,7 @@
   STATIC_ASSERT(Assembler::kDebugBreakSlotInstructions >= 4);
PatchingAssembler patcher(reinterpret_cast<Instruction*>(rinfo()->pc()), 4);
   byte* entry =
-      debug_info_->GetIsolate()->debug()->debug_break_slot()->entry();
+      debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry();

// The first instruction of a patched debug break slot must be a load literal
   // loading the address of the debug break slot code.
=======================================
--- /branches/bleeding_edge/src/debug.cc        Wed Apr 30 15:17:51 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Mon May  5 07:10:38 2014 UTC
@@ -39,10 +39,9 @@
       break_on_uncaught_exception_(false),
       promise_catch_handlers_(0),
       promise_getters_(0),
-      debug_break_return_(NULL),
-      debug_break_slot_(NULL),
       isolate_(isolate) {
   memset(registers_, 0, sizeof(JSCallerSavedBuffer));
+  ThreadInit();
 }


@@ -663,21 +662,6 @@
   // Clear the weak handle.
   GlobalHandles::Destroy(location);
 }
-
-
-void Debug::SetUp(bool create_heap_objects) {
-  ThreadInit();
-  if (create_heap_objects) {
-    // Get code to handle debug break on return.
-    debug_break_return_ =
-        isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak);
-    ASSERT(debug_break_return_->IsCode());
-    // Get code to handle debug break in debug break slots.
-    debug_break_slot_ =
-        isolate_->builtins()->builtin(Builtins::kSlot_DebugBreak);
-    ASSERT(debug_break_slot_->IsCode());
-  }
-}


 void Debug::HandleWeakDebugInfo(
@@ -881,12 +865,6 @@
   ASSERT(InDebugger());
   Debug::set_interrupts_pending(PREEMPT);
 }
-
-
-void Debug::Iterate(ObjectVisitor* v) {
-  v->VisitPointer(BitCast<Object**>(&(debug_break_return_)));
-  v->VisitPointer(BitCast<Object**>(&(debug_break_slot_)));
-}


 Object* Debug::Break(Arguments args) {
=======================================
--- /branches/bleeding_edge/src/debug.h Wed Apr 30 15:17:51 2014 UTC
+++ /branches/bleeding_edge/src/debug.h Mon May  5 07:10:38 2014 UTC
@@ -212,13 +212,11 @@
 // DebugInfo.
 class Debug {
  public:
-  void SetUp(bool create_heap_objects);
   bool Load();
   void Unload();
   bool IsLoaded() { return !debug_context_.is_null(); }
   bool InDebugger() { return thread_local_.debugger_entry_ != NULL; }
   void PreemptionWhileInDebugger();
-  void Iterate(ObjectVisitor* v);

   Object* Break(Arguments args);
   void SetBreakPoint(Handle<JSFunction> function,
@@ -347,8 +345,6 @@

   enum AddressId {
     k_after_break_target_address,
-    k_debug_break_return_address,
-    k_debug_break_slot_address,
     k_restarter_frame_function_pointer
   };

@@ -365,18 +361,6 @@
   Object** register_address(int r) {
     return &registers_[r];
   }
-
-  // Access to the debug break on return code.
-  Code* debug_break_return() { return debug_break_return_; }
-  Code** debug_break_return_address() {
-    return &debug_break_return_;
-  }
-
-  // Access to the debug break in debug break slot code.
-  Code* debug_break_slot() { return debug_break_slot_; }
-  Code** debug_break_slot_address() {
-    return &debug_break_slot_;
-  }

   static const int kEstimatedNofDebugInfoEntries = 16;
   static const int kEstimatedNofBreakPointsInFunction = 16;
@@ -610,12 +594,6 @@
   ThreadLocal thread_local_;
   void ThreadInit();

-  // Code to call for handling debug break on return.
-  Code* debug_break_return_;
-
-  // Code to call for handling debug break in debug break slots.
-  Code* debug_break_slot_;
-
   Isolate* isolate_;

   friend class Isolate;
@@ -995,10 +973,6 @@
   static Debug_Address AfterBreakTarget() {
     return Debug_Address(Debug::k_after_break_target_address);
   }
-
-  static Debug_Address DebugBreakReturn() {
-    return Debug_Address(Debug::k_debug_break_return_address);
-  }

   static Debug_Address RestarterFrameFunctionPointer() {
     return Debug_Address(Debug::k_restarter_frame_function_pointer);
@@ -1009,10 +983,6 @@
     switch (id_) {
       case Debug::k_after_break_target_address:
return reinterpret_cast<Address>(debug->after_break_target_address());
-      case Debug::k_debug_break_return_address:
- return reinterpret_cast<Address>(debug->debug_break_return_address());
-      case Debug::k_debug_break_slot_address:
- return reinterpret_cast<Address>(debug->debug_break_slot_address());
       case Debug::k_restarter_frame_function_pointer:
         return reinterpret_cast<Address>(
             debug->restarter_frame_function_pointer_address());
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Apr 30 18:13:24 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon May  5 07:10:38 2014 UTC
@@ -4913,7 +4913,6 @@
   Relocatable::Iterate(isolate_, v);
   v->Synchronize(VisitorSynchronization::kRelocatable);

-  isolate_->debug()->Iterate(v);
   if (isolate_->deoptimizer_data() != NULL) {
     isolate_->deoptimizer_data()->Iterate(v);
   }
=======================================
--- /branches/bleeding_edge/src/ia32/debug-ia32.cc Wed Apr 30 14:33:35 2014 UTC +++ /branches/bleeding_edge/src/ia32/debug-ia32.cc Mon May 5 07:10:38 2014 UTC
@@ -25,7 +25,7 @@
   ASSERT(Assembler::kJSReturnSequenceLength >=
          Assembler::kCallInstructionLength);
   rinfo()->PatchCodeWithCall(
-      debug_info_->GetIsolate()->debug()->debug_break_return()->entry(),
+      debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(),
Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength);
 }

@@ -56,7 +56,7 @@
   ASSERT(IsDebugBreakSlot());
   Isolate* isolate = debug_info_->GetIsolate();
   rinfo()->PatchCodeWithCall(
-      isolate->debug()->debug_break_slot()->entry(),
+      isolate->builtins()->Slot_DebugBreak()->entry(),
Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength);
 }

=======================================
--- /branches/bleeding_edge/src/isolate-inl.h   Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/isolate-inl.h   Mon May  5 07:10:38 2014 UTC
@@ -31,7 +31,6 @@


 bool Isolate::IsDebuggerActive() {
-  if (!NoBarrier_Load(&debugger_initialized_)) return false;
   return debugger()->IsDebuggerActive();
 }

=======================================
--- /branches/bleeding_edge/src/isolate.cc      Fri May  2 19:30:54 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Mon May  5 07:10:38 2014 UTC
@@ -1422,7 +1422,6 @@
       compilation_cache_(NULL),
       counters_(NULL),
       code_range_(NULL),
-      debugger_initialized_(false),
       logger_(NULL),
       stats_table_(NULL),
       stub_cache_(NULL),
@@ -1483,9 +1482,6 @@
   memset(&js_spill_information_, 0, sizeof(js_spill_information_));
 #endif

-  debug_ = NULL;
-  debugger_ = NULL;
-
   handle_scope_data_.Initialize();

#define ISOLATE_INIT_EXECUTE(type, name, initial_value) \
@@ -1497,6 +1493,10 @@
   memset(name##_, 0, sizeof(type) * length);
   ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE)
 #undef ISOLATE_INIT_ARRAY_EXECUTE
+
+  InitializeLoggingAndCounters();
+  debug_ = new Debug(this);
+  debugger_ = new Debugger(this);
 }


@@ -1762,16 +1762,6 @@
     counters_ = new Counters(this);
   }
 }
-
-
-void Isolate::InitializeDebugger() {
-  LockGuard<RecursiveMutex> lock_guard(debugger_access());
-  if (NoBarrier_Load(&debugger_initialized_)) return;
-  InitializeLoggingAndCounters();
-  debug_ = new Debug(this);
-  debugger_ = new Debugger(this);
-  Release_Store(&debugger_initialized_, true);
-}


 bool Isolate::Init(Deserializer* des) {
@@ -1797,10 +1787,6 @@
   // The initialization process does not handle memory exhaustion.
   DisallowAllocationFailure disallow_allocation_failure(this);

-  InitializeLoggingAndCounters();
-
-  InitializeDebugger();
-
   memory_allocator_ = new MemoryAllocator(this);
   code_range_ = new CodeRange(this);

@@ -1914,8 +1900,6 @@
       sweeper_thread_[i]->Start();
     }
   }
-
-  debug_->SetUp(create_heap_objects);

   // If we are deserializing, read the state into the now-empty heap.
   if (!create_heap_objects) {
=======================================
--- /branches/bleeding_edge/src/isolate.h       Fri May  2 19:30:54 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h       Mon May  5 07:10:38 2014 UTC
@@ -928,14 +928,8 @@

   inline bool IsCodePreAgingActive();

-  Debugger* debugger() {
-    if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
-    return debugger_;
-  }
-  Debug* debug() {
-    if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
-    return debug_;
-  }
+  Debugger* debugger() {  return debugger_; }
+  Debug* debug() { return debug_; }

   inline bool IsDebuggerActive();
   inline bool DebuggerHasBreakPoints();
@@ -1182,8 +1176,6 @@

   void PropagatePendingExceptionToExternalTryCatch();

-  void InitializeDebugger();
-
// Traverse prototype chain to find out whether the object is derived from
   // the Error object.
   bool IsErrorObject(Handle<Object> obj);
=======================================
--- /branches/bleeding_edge/src/liveedit.cc     Wed Apr 30 14:33:35 2014 UTC
+++ /branches/bleeding_edge/src/liveedit.cc     Mon May  5 07:10:38 2014 UTC
@@ -1569,7 +1569,7 @@
     *mode = Debug::FRAME_DROPPED_IN_IC_CALL;
     frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
   } else if (pre_top_frame_code ==
-             isolate->debug()->debug_break_slot()) {
+             isolate->builtins()->builtin(Builtins::kSlot_DebugBreak)) {
     // OK, we can drop debug break slot.
     *mode = Debug::FRAME_DROPPED_IN_DEBUG_SLOT_CALL;
     frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
=======================================
--- /branches/bleeding_edge/src/mips/debug-mips.cc Wed Apr 30 20:19:45 2014 UTC +++ /branches/bleeding_edge/src/mips/debug-mips.cc Mon May 5 07:10:38 2014 UTC
@@ -33,9 +33,8 @@
   ASSERT(Assembler::kJSReturnSequenceInstructions == 7);
CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions);
   // li and Call pseudo-instructions emit two instructions each.
-  patcher.masm()->li(v8::internal::t9,
-      Operand(reinterpret_cast<int32_t>(
- debug_info_->GetIsolate()->debug()->debug_break_return()->entry())));
+  patcher.masm()->li(v8::internal::t9, Operand(reinterpret_cast<int32_t>(
+ debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry())));
   patcher.masm()->Call(v8::internal::t9);
   patcher.masm()->nop();
   patcher.masm()->nop();
@@ -80,7 +79,7 @@
   //   call t9          (jalr t9 / nop instruction pair)
CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions);
   patcher.masm()->li(v8::internal::t9, Operand(reinterpret_cast<int32_t>(
-      debug_info_->GetIsolate()->debug()->debug_break_slot()->entry())));
+      debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry())));
   patcher.masm()->Call(v8::internal::t9);
 }

=======================================
--- /branches/bleeding_edge/src/serialize.cc    Wed Apr 30 09:50:58 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc    Mon May  5 07:10:38 2014 UTC
@@ -190,14 +190,6 @@
       DEBUG_ADDRESS,
       Debug::k_after_break_target_address << kDebugIdShift,
       "Debug::after_break_target_address()");
-  Add(Debug_Address(Debug::k_debug_break_slot_address).address(isolate),
-      DEBUG_ADDRESS,
-      Debug::k_debug_break_slot_address << kDebugIdShift,
-      "Debug::debug_break_slot_address()");
-  Add(Debug_Address(Debug::k_debug_break_return_address).address(isolate),
-      DEBUG_ADDRESS,
-      Debug::k_debug_break_return_address << kDebugIdShift,
-      "Debug::debug_break_return_address()");
Add(Debug_Address(Debug::k_restarter_frame_function_pointer).address(isolate),
       DEBUG_ADDRESS,
       Debug::k_restarter_frame_function_pointer << kDebugIdShift,
=======================================
--- /branches/bleeding_edge/src/x64/debug-x64.cc Wed Apr 30 14:33:35 2014 UTC +++ /branches/bleeding_edge/src/x64/debug-x64.cc Mon May 5 07:10:38 2014 UTC
@@ -25,7 +25,7 @@
 void BreakLocationIterator::SetDebugBreakAtReturn()  {
ASSERT(Assembler::kJSReturnSequenceLength >= Assembler::kCallSequenceLength);
   rinfo()->PatchCodeWithCall(
-      debug_info_->GetIsolate()->debug()->debug_break_return()->entry(),
+      debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(),
       Assembler::kJSReturnSequenceLength - Assembler::kCallSequenceLength);
 }

@@ -55,7 +55,7 @@
 void BreakLocationIterator::SetDebugBreakAtSlot() {
   ASSERT(IsDebugBreakSlot());
   rinfo()->PatchCodeWithCall(
-      debug_info_->GetIsolate()->debug()->debug_break_slot()->entry(),
+      debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry(),
       Assembler::kDebugBreakSlotLength - Assembler::kCallSequenceLength);
 }

--
--
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