Reviewers: Michael Starzinger,

Description:
Add a trap_on_abort flag

By setting this flag assertions behind --debug-code will trigger a
breakpoint instead of a call into Abort. This eases debugging, as the
call site is less cluttered and the backtrace starts where it should.

BUG=

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/macro-assembler-arm.cc
  M src/flag-definitions.h
  M src/ia32/macro-assembler-ia32.cc
  M src/x64/macro-assembler-x64.cc


Index: src/arm/macro-assembler-arm.cc
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
index 190e8682f711c4c9c8046b85897d485ee5d4f200..a396ac1b50a08282defe2565dd276d158611b0c3 100644
--- a/src/arm/macro-assembler-arm.cc
+++ b/src/arm/macro-assembler-arm.cc
@@ -2847,6 +2847,11 @@ void MacroAssembler::Abort(BailoutReason reason) {
     RecordComment("Abort message: ");
     RecordComment(msg);
   }
+
+  if (FLAG_trap_on_abort) {
+    DebugBreak();
+    return;
+  }
 #endif

   mov(r0, Operand(p0));
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index f5f2ef37f0223a487e5ce745efba813b89fbb1a7..0a1687f866157bcf70031e47771345747bc7bcba 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -264,6 +264,8 @@ DEFINE_bool(print_deopt_stress, false, "print number of possible deopt points")
 DEFINE_bool(trap_on_deopt, false, "put a break point before deoptimizing")
 DEFINE_bool(trap_on_stub_deopt, false,
             "put a break point before deoptimizing a stub")
+DEFINE_bool(trap_on_abort, false,
+            "replace aborts by breakpoints")
 DEFINE_bool(deoptimize_uncommon_cases, true, "deoptimize uncommon cases")
 DEFINE_bool(polymorphic_inlining, true, "polymorphic inlining")
 DEFINE_bool(use_osr, true, "use on-stack replacement")
Index: src/ia32/macro-assembler-ia32.cc
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index f86820cba6469876d73c63c397cb72c1ea0ed448..bf785df53070b4ded4d11e90691f78911a379737 100644
--- a/src/ia32/macro-assembler-ia32.cc
+++ b/src/ia32/macro-assembler-ia32.cc
@@ -2774,6 +2774,11 @@ void MacroAssembler::Abort(BailoutReason reason) {
     RecordComment("Abort message: ");
     RecordComment(msg);
   }
+
+  if (FLAG_trap_on_abort) {
+    int3();
+    return;
+  }
 #endif

   push(eax);
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 74e3fcc33a1701d4a1836090188de51776bc22f5..5180e6b051c0382855ed55c0df16c03780379290 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -524,7 +524,13 @@ void MacroAssembler::Abort(BailoutReason reason) {
     RecordComment("Abort message: ");
     RecordComment(msg);
   }
+
+  if (FLAG_trap_on_abort) {
+    int3();
+    return;
+  }
 #endif
+
   push(rax);
   movq(kScratchRegister, p0, RelocInfo::NONE64);
   push(kScratchRegister);


--
--
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/groups/opt_out.

Reply via email to