Revision: 2633
Author: [email protected]
Date: Thu Aug  6 04:14:48 2009
Log: Fix the debugger in multipass mode by introducing phantom instructions
marking statement boundaries.

Review URL: http://codereview.chromium.org/162007
http://code.google.com/p/v8/source/detail?r=2633

Modified:
  /branches/bleeding_edge/src/arm/cfg-arm.cc
  /branches/bleeding_edge/src/cfg.cc
  /branches/bleeding_edge/src/cfg.h
  /branches/bleeding_edge/src/ia32/cfg-ia32.cc
  /branches/bleeding_edge/src/x64/cfg-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/cfg-arm.cc  Wed Aug  5 05:52:31 2009
+++ /branches/bleeding_edge/src/arm/cfg-arm.cc  Thu Aug  6 04:14:48 2009
@@ -98,6 +98,14 @@
    __ add(sp, sp, Operand((count + 1) * kPointerSize));
    __ Jump(lr);
  }
+
+
+void PositionInstr::Compile(MacroAssembler* masm) {
+  if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
+    __ RecordStatementPosition(pos_);
+    __ RecordPosition(pos_);
+  }
+}


  void BinaryOpInstr::Compile(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/cfg.cc  Thu Aug  6 00:51:44 2009
+++ /branches/bleeding_edge/src/cfg.cc  Thu Aug  6 04:14:48 2009
@@ -436,6 +436,7 @@
      Instruction* instr = block->instructions()->last();
      instr->set_location(CfgGlobals::current()->effect_location());
    }
+  cfg_->Append(new PositionInstr(stmt->statement_pos()));
    cfg_->Concatenate(builder.cfg());
  }

@@ -467,6 +468,7 @@
      BAILOUT("unsupported expression in return statement");
    }

+  cfg_->Append(new PositionInstr(stmt->statement_pos()));
    cfg_->Concatenate(builder.cfg());
    cfg_->AppendReturnInstruction(builder.value());
  }
=======================================
--- /branches/bleeding_edge/src/cfg.h   Thu Aug  6 00:51:44 2009
+++ /branches/bleeding_edge/src/cfg.h   Thu Aug  6 04:14:48 2009
@@ -306,7 +306,9 @@
  class Instruction : public ZoneObject {
   public:
    // Every instruction has a location where its result is stored (which may
-  // be Effect).
+  // be Effect, the default).
+  Instruction() : loc_(CfgGlobals::current()->effect_location()) {}
+
    explicit Instruction(Location* loc) : loc_(loc) {}

    virtual ~Instruction() {}
@@ -334,6 +336,30 @@
  };


+// A phantom instruction that indicates the start of a statement.  It
+// causes the statement position to be recorded in the relocation
+// information but generates no code.
+class PositionInstr : public Instruction {
+ public:
+  explicit PositionInstr(int pos) : pos_(pos) {}
+
+  // Support for fast-compilation mode.
+  void Compile(MacroAssembler* masm);
+
+  // This should not be called.  The last instruction of the previous
+  // statement should not have a temporary as its location.
+  void FastAllocate(TempLocation* temp) { UNREACHABLE(); }
+
+#ifdef DEBUG
+  // Printing support.  Print nothing.
+  void Print() {}
+#endif
+
+ private:
+  int pos_;
+};
+
+
  // Perform a (non-short-circuited) binary operation on a pair of values,
  // leaving the result in a location.
  class BinaryOpInstr : public Instruction {
@@ -365,10 +391,7 @@
  class ReturnInstr : public Instruction {
   public:
    // Location is always Effect.
-  explicit ReturnInstr(Value* value)
-      : Instruction(CfgGlobals::current()->effect_location()),
-        value_(value) {
-  }
+  explicit ReturnInstr(Value* value) : value_(value) {}

    virtual ~ReturnInstr() {}

=======================================
--- /branches/bleeding_edge/src/ia32/cfg-ia32.cc        Wed Aug  5 05:52:31 2009
+++ /branches/bleeding_edge/src/ia32/cfg-ia32.cc        Thu Aug  6 04:14:48 2009
@@ -111,6 +111,14 @@
    int count = CfgGlobals::current()->fun()->scope()->num_parameters();
    __ ret((count + 1) * kPointerSize);
  }
+
+
+void PositionInstr::Compile(MacroAssembler* masm) {
+  if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
+    __ RecordStatementPosition(pos_);
+    __ RecordPosition(pos_);
+  }
+}


  void BinaryOpInstr::Compile(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/x64/cfg-x64.cc  Wed Aug  5 05:52:31 2009
+++ /branches/bleeding_edge/src/x64/cfg-x64.cc  Thu Aug  6 04:14:48 2009
@@ -121,6 +121,14 @@
      __ int3();
    }
  }
+
+
+void PositionInstr::Compile(MacroAssembler* masm) {
+  if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
+    __ RecordStatementPosition(pos_);
+    __ RecordPosition(pos_);
+  }
+}


  void BinaryOpInstr::Compile(MacroAssembler* masm) {

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

Reply via email to