Revision: 3814
Author: [email protected]
Date: Mon Feb  8 05:44:49 2010
Log:
Review URL: http://codereview.chromium.org/561049
http://code.google.com/p/v8/source/detail?r=3814

Modified:
 /branches/bleeding_edge/src/arm/codegen-arm.cc
 /branches/bleeding_edge/src/arm/macro-assembler-arm.cc
 /branches/bleeding_edge/src/arm/macro-assembler-arm.h
 /branches/bleeding_edge/src/arm/virtual-frame-arm.cc
 /branches/bleeding_edge/src/arm/virtual-frame-arm.h
 /branches/bleeding_edge/src/assembler.cc
 /branches/bleeding_edge/src/assembler.h
 /branches/bleeding_edge/src/codegen.cc
 /branches/bleeding_edge/src/codegen.h
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/frames.cc
 /branches/bleeding_edge/src/full-codegen.cc
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h
 /branches/bleeding_edge/src/ia32/virtual-frame-ia32.cc
 /branches/bleeding_edge/src/ia32/virtual-frame-ia32.h
 /branches/bleeding_edge/src/x64/codegen-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h
 /branches/bleeding_edge/src/x64/virtual-frame-x64.cc
 /branches/bleeding_edge/src/x64/virtual-frame-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc      Fri Feb  5 04:00:42 2010
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc      Mon Feb  8 05:44:49 2010
@@ -2293,8 +2293,7 @@
   Comment cmnt(masm_, "[ DebuggerStatament");
   CodeForStatementPosition(node);
 #ifdef ENABLE_DEBUGGER_SUPPORT
-  DebuggerStatementStub ces;
-  frame_->CallStub(&ces, 0);
+  frame_->DebugBreak();
 #endif
   // Ignore the return value.
   ASSERT(frame_->height() == original_height);
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Fri Feb 5 05:57:18 2010 +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Mon Feb 8 05:44:49 2010
@@ -331,14 +331,10 @@

   // Push in reverse order: caller_fp, sp_on_exit, and caller_pc.
   stm(db_w, sp, fp.bit() | ip.bit() | lr.bit());
-  mov(fp, Operand(sp));  // setup new frame pointer
-
-  if (mode == ExitFrame::MODE_DEBUG) {
-    mov(ip, Operand(Smi::FromInt(0)));
-  } else {
-    mov(ip, Operand(CodeObject()));
-  }
-  push(ip);
+  mov(fp, Operand(sp));  // Setup new frame pointer.
+
+  mov(ip, Operand(CodeObject()));
+  push(ip);  // Accessed from ExitFrame::code_slot.

   // Save the frame pointer and the context in top.
   mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address)));
@@ -608,6 +604,15 @@
     }
   }
 }
+
+
+void MacroAssembler::DebugBreak() {
+  ASSERT(allow_stub_calls());
+  mov(r0, Operand(0));
+  mov(r1, Operand(ExternalReference(Runtime::kDebugBreak)));
+  CEntryStub ces(1);
+  Call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
+}
 #endif


=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.h Fri Feb 5 05:57:18 2010 +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.h Mon Feb 8 05:44:49 2010
@@ -146,6 +146,7 @@
   void CopyRegistersFromStackToMemory(Register base,
                                       Register scratch,
                                       RegList regs);
+  void DebugBreak();
 #endif

// ---------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/arm/virtual-frame-arm.cc Tue Feb 2 05:40:53 2010 +++ /branches/bleeding_edge/src/arm/virtual-frame-arm.cc Mon Feb 8 05:44:49 2010
@@ -231,6 +231,14 @@
   ASSERT(cgen()->HasValidEntryRegisters());
   __ CallRuntime(id, arg_count);
 }
+
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+void VirtualFrame::DebugBreak() {
+  ASSERT(cgen()->HasValidEntryRegisters());
+  __ DebugBreak();
+}
+#endif


 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id,
=======================================
--- /branches/bleeding_edge/src/arm/virtual-frame-arm.h Tue Feb 2 05:40:53 2010 +++ /branches/bleeding_edge/src/arm/virtual-frame-arm.h Mon Feb 8 05:44:49 2010
@@ -297,6 +297,10 @@
   void CallRuntime(Runtime::Function* f, int arg_count);
   void CallRuntime(Runtime::FunctionId id, int arg_count);

+#ifdef ENABLE_DEBUGGER_SUPPORT
+  void DebugBreak();
+#endif
+
   // Invoke builtin given the number of arguments it expects on (and
   // removes from) the stack.
   void InvokeBuiltin(Builtins::JavaScript id,
=======================================
--- /branches/bleeding_edge/src/assembler.cc    Fri Jan 29 02:33:27 2010
+++ /branches/bleeding_edge/src/assembler.cc    Mon Feb  8 05:44:49 2010
@@ -430,6 +430,11 @@
       return "code target (js construct call)";
     case RelocInfo::CODE_TARGET_CONTEXT:
       return "code target (context)";
+    case RelocInfo::DEBUG_BREAK:
+#ifndef ENABLE_DEBUGGER_SUPPORT
+      UNREACHABLE();
+#endif
+      return "debug break";
     case RelocInfo::CODE_TARGET:
       return "code target";
     case RelocInfo::RUNTIME_ENTRY:
@@ -485,6 +490,11 @@
     case EMBEDDED_OBJECT:
       Object::VerifyPointer(target_object());
       break;
+    case DEBUG_BREAK:
+#ifndef ENABLE_DEBUGGER_SUPPORT
+      UNREACHABLE();
+      break;
+#endif
     case CONSTRUCT_CALL:
     case CODE_TARGET_CONTEXT:
     case CODE_TARGET: {
=======================================
--- /branches/bleeding_edge/src/assembler.h     Thu Feb  4 12:36:58 2010
+++ /branches/bleeding_edge/src/assembler.h     Mon Feb  8 05:44:49 2010
@@ -119,6 +119,7 @@
// Please note the order is important (see IsCodeTarget, IsGCRelocMode). CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.
     CODE_TARGET_CONTEXT,  // code target used for contextual loads.
+    DEBUG_BREAK,
     CODE_TARGET,         // code target which is not any of the above.
     EMBEDDED_OBJECT,
     EMBEDDED_STRING,
=======================================
--- /branches/bleeding_edge/src/codegen.cc      Mon Feb  8 00:54:27 2010
+++ /branches/bleeding_edge/src/codegen.cc      Mon Feb  8 05:44:49 2010
@@ -524,13 +524,6 @@
 void ApiGetterEntryStub::SetCustomCache(Code* value) {
   info()->set_load_stub_cache(value);
 }
-
-#ifdef ENABLE_DEBUGGER_SUPPORT
-void DebuggerStatementStub::Generate(MacroAssembler* masm) {
-  Runtime::Function* f = Runtime::FunctionForId(Runtime::kDebugBreak);
-  masm->TailCallRuntime(ExternalReference(f), 0, f->result_size);
-}
-#endif


 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/codegen.h       Mon Feb  8 00:54:27 2010
+++ /branches/bleeding_edge/src/codegen.h       Mon Feb  8 05:44:49 2010
@@ -415,21 +415,6 @@
 };


-// Mark the debugger statement to be recognized by debugger (by the MajorKey)
-class DebuggerStatementStub : public CodeStub {
- public:
-  DebuggerStatementStub() { }
-
-  void Generate(MacroAssembler* masm);
-
- private:
-  Major MajorKey() { return DebuggerStatement; }
-  int MinorKey() { return 0; }
-
-  const char* GetName() { return "DebuggerStatementStub"; }
-};
-
-
 class JSEntryStub : public CodeStub {
  public:
   JSEntryStub() { }
=======================================
--- /branches/bleeding_edge/src/debug.cc        Fri Jan 29 04:41:11 2010
+++ /branches/bleeding_edge/src/debug.cc        Mon Feb  8 05:44:49 2010
@@ -453,15 +453,7 @@


 bool BreakLocationIterator::IsDebuggerStatement() {
-  if (RelocInfo::IsCodeTarget(rmode())) {
-    Address target = original_rinfo()->target_address();
-    Code* code = Code::GetCodeFromTargetAddress(target);
-    if (code->kind() == Code::STUB) {
-      CodeStub::Major major_key = code->major_key();
-      return (major_key == CodeStub::DebuggerStatement);
-    }
-  }
-  return false;
+  return RelocInfo::DEBUG_BREAK == rmode();
 }


=======================================
--- /branches/bleeding_edge/src/frames.cc       Tue Feb  2 10:35:53 2010
+++ /branches/bleeding_edge/src/frames.cc       Mon Feb  8 05:44:49 2010
@@ -408,12 +408,7 @@


 Code* ExitFrame::code() const {
-  Object* code = code_slot();
-  if (code->IsSmi()) {
-    return Heap::debugger_statement_code();
-  } else {
-    return Code::cast(code);
-  }
+  return Code::cast(code_slot());
 }


=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Wed Feb  3 08:12:55 2010
+++ /branches/bleeding_edge/src/full-codegen.cc Mon Feb  8 05:44:49 2010
@@ -986,8 +986,7 @@
   Comment cmnt(masm_, "[ DebuggerStatement");
   SetStatementPosition(stmt);

-  DebuggerStatementStub ces;
-  __ CallStub(&ces);
+  __ DebugBreak();
   // Ignore the return value.
 #endif
 }
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Feb  3 03:54:57 2010
+++ /branches/bleeding_edge/src/heap.cc Mon Feb  8 05:44:49 2010
@@ -1498,14 +1498,6 @@
 #endif


-#ifdef ENABLE_DEBUGGER_SUPPORT
-void Heap::CreateCEntryDebugBreakStub() {
-  DebuggerStatementStub stub;
-  set_debugger_statement_code(*stub.GetCode());
-}
-#endif
-
-
 void Heap::CreateJSEntryStub() {
   JSEntryStub stub;
   set_js_entry_code(*stub.GetCode());
@@ -1533,9 +1525,6 @@
   // }
   // To workaround the problem, make separate functions without inlining.
   Heap::CreateCEntryStub();
-#ifdef ENABLE_DEBUGGER_SUPPORT
-  Heap::CreateCEntryDebugBreakStub();
-#endif
   Heap::CreateJSEntryStub();
   Heap::CreateJSConstructEntryStub();
 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP
=======================================
--- /branches/bleeding_edge/src/heap.h  Tue Feb  2 10:35:53 2010
+++ /branches/bleeding_edge/src/heap.h  Mon Feb  8 05:44:49 2010
@@ -101,7 +101,6 @@
V(Code, js_entry_code, JsEntryCode) \ V(Code, js_construct_entry_code, JsConstructEntryCode) \ V(Code, c_entry_code, CEntryCode) \ - V(Code, debugger_statement_code, DebuggerStatementCode) \ V(FixedArray, number_string_cache, NumberStringCache) \ V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ V(FixedArray, natives_source_cache, NativesSourceCache) \
@@ -1046,7 +1045,6 @@
// These four Create*EntryStub functions are here because of a gcc-4.4 bug
   // that assigns wrong vtable entries.
   static void CreateCEntryStub();
-  static void CreateCEntryDebugBreakStub();
   static void CreateJSEntryStub();
   static void CreateJSConstructEntryStub();
   static void CreateRegExpCEntryStub();
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu Feb 4 01:11:43 2010 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Mon Feb 8 05:44:49 2010
@@ -3906,8 +3906,7 @@
   // Spill everything, even constants, to the frame.
   frame_->SpillAll();

-  DebuggerStatementStub ces;
-  frame_->CallStub(&ces, 0);
+  frame_->DebugBreak();
   // Ignore the return value.
 #endif
 }
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Fri Feb 5 05:57:18 2010 +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Mon Feb 8 05:44:49 2010
@@ -308,6 +308,13 @@
     }
   }
 }
+
+void MacroAssembler::DebugBreak() {
+  Set(eax, Immediate(0));
+  mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak)));
+  CEntryStub ces(1);
+  call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
+}
 #endif

 void MacroAssembler::Set(Register dst, const Immediate& x) {
@@ -409,12 +416,8 @@

   // Reserve room for entry stack pointer and push the debug marker.
   ASSERT(ExitFrameConstants::kSPOffset  == -1 * kPointerSize);
-  push(Immediate(0));  // saved entry sp, patched before call
-  if (mode == ExitFrame::MODE_DEBUG) {
-    push(Immediate(0));
-  } else {
-    push(Immediate(CodeObject()));
-  }
+  push(Immediate(0));  // Saved entry sp, patched before call.
+  push(Immediate(CodeObject()));  // Accessed from ExitFrame::code_slot.

   // Save the frame pointer and the context in top.
   ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Fri Feb 5 05:57:18 2010 +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Mon Feb 8 05:44:49 2010
@@ -69,6 +69,7 @@
   void CopyRegistersFromStackToMemory(Register base,
                                       Register scratch,
                                       RegList regs);
+  void DebugBreak();
 #endif

// ---------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/ia32/virtual-frame-ia32.cc Mon Feb 1 00:35:38 2010 +++ /branches/bleeding_edge/src/ia32/virtual-frame-ia32.cc Mon Feb 8 05:44:49 2010
@@ -851,6 +851,17 @@
   ASSERT(result.is_valid());
   return result;
 }
+
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+void VirtualFrame::DebugBreak() {
+  PrepareForCall(0, 0);
+  ASSERT(cgen()->HasValidEntryRegisters());
+  __ DebugBreak();
+  Result result = cgen()->allocator()->Allocate(eax);
+  ASSERT(result.is_valid());
+}
+#endif


 Result VirtualFrame::InvokeBuiltin(Builtins::JavaScript id,
=======================================
--- /branches/bleeding_edge/src/ia32/virtual-frame-ia32.h Fri Jan 8 01:54:11 2010 +++ /branches/bleeding_edge/src/ia32/virtual-frame-ia32.h Mon Feb 8 05:44:49 2010
@@ -324,6 +324,10 @@
   Result CallRuntime(Runtime::Function* f, int arg_count);
   Result CallRuntime(Runtime::FunctionId id, int arg_count);

+#ifdef ENABLE_DEBUGGER_SUPPORT
+  void DebugBreak();
+#endif
+
   // Invoke builtin given the number of arguments it expects on (and
   // removes from) the stack.
Result InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag, int arg_count);
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Wed Feb  3 08:12:55 2010
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Mon Feb  8 05:44:49 2010
@@ -2218,8 +2218,7 @@
   // Spill everything, even constants, to the frame.
   frame_->SpillAll();

-  DebuggerStatementStub ces;
-  frame_->CallStub(&ces, 0);
+  frame_->DebugBreak();
   // Ignore the return value.
 #endif
 }
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Fri Feb 5 05:57:18 2010 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Feb 8 05:44:49 2010
@@ -1774,6 +1774,13 @@
   }
 }

+void MacroAssembler::DebugBreak() {
+  ASSERT(allow_stub_calls());
+  xor_(rax, rax);  // no arguments
+  movq(rbx, ExternalReference(Runtime::kDebugBreak));
+  CEntryStub ces(1);
+  Call(ces.GetCode(), RelocInfo::DEBUG_BREAK);
+}
 #endif  // ENABLE_DEBUGGER_SUPPORT


@@ -1965,13 +1972,9 @@

   // Reserve room for entry stack pointer and push the debug marker.
   ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize);
-  push(Immediate(0));  // saved entry sp, patched before call
-  if (mode == ExitFrame::MODE_DEBUG) {
-    push(Immediate(0));
-  } else {
-    movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
-    push(kScratchRegister);
-  }
+  push(Immediate(0));  // Saved entry sp, patched before call.
+  movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
+  push(kScratchRegister);  // Accessed from EditFrame::code_slot.

   // Save the frame pointer and the context in top.
   ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Fri Feb 5 05:57:18 2010 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon Feb 8 05:44:49 2010
@@ -98,6 +98,7 @@
   void CopyRegistersFromStackToMemory(Register base,
                                       Register scratch,
                                       RegList regs);
+  void DebugBreak();
 #endif

// ---------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/x64/virtual-frame-x64.cc Tue Feb 2 01:20:19 2010 +++ /branches/bleeding_edge/src/x64/virtual-frame-x64.cc Mon Feb 8 05:44:49 2010
@@ -967,6 +967,17 @@
   ASSERT(result.is_valid());
   return result;
 }
+
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+void VirtualFrame::DebugBreak() {
+  PrepareForCall(0, 0);
+  ASSERT(cgen()->HasValidEntryRegisters());
+  __ DebugBreak();
+  Result result = cgen()->allocator()->Allocate(rax);
+  ASSERT(result.is_valid());
+}
+#endif


 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) {
=======================================
--- /branches/bleeding_edge/src/x64/virtual-frame-x64.h Mon Jan 18 08:23:24 2010 +++ /branches/bleeding_edge/src/x64/virtual-frame-x64.h Mon Feb 8 05:44:49 2010
@@ -321,6 +321,10 @@
   Result CallRuntime(Runtime::Function* f, int arg_count);
   Result CallRuntime(Runtime::FunctionId id, int arg_count);

+#ifdef ENABLE_DEBUGGER_SUPPORT
+  void DebugBreak();
+#endif
+
   // Invoke builtin given the number of arguments it expects on (and
   // removes from) the stack.
   Result InvokeBuiltin(Builtins::JavaScript id,

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to