Revision: 15931
Author:   [email protected]
Date:     Mon Jul 29 04:57:42 2013
Log: Fix HasResult method of LTemplateInstruction to properly handle LCheckSmi

LCheckSmi sometimes has a result register and sometimes not, even though its
LTemplateInstruction alwasys has room for one. Debug output use HasResult to
determine whether it was ok to de-ref result(), but HasResult doesn't check for
the case where LTemplateInstruction has a result but it's NULL.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.h
 /branches/bleeding_edge/src/ia32/lithium-ia32.h
 /branches/bleeding_edge/src/mips/lithium-mips.h
 /branches/bleeding_edge/src/x64/lithium-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h       Mon Jul 29 02:12:16 2013
+++ /branches/bleeding_edge/src/arm/lithium-arm.h       Mon Jul 29 04:57:42 2013
@@ -268,7 +268,7 @@
   bool IsMarkedAsCall() const { return is_call_; }

   virtual bool HasResult() const = 0;
-  virtual LOperand* result() = 0;
+  virtual LOperand* result() const = 0;

   LOperand* FirstInput() { return InputAt(0); }
   LOperand* Output() { return HasResult() ? result() : NULL; }
@@ -304,9 +304,9 @@
  public:
   // Allow 0 or 1 output operands.
   STATIC_ASSERT(R == 0 || R == 1);
-  virtual bool HasResult() const { return R != 0; }
+  virtual bool HasResult() const { return R != 0 && result() != NULL; }
   void set_result(LOperand* operand) { results_[0] = operand; }
-  LOperand* result() { return results_[0]; }
+  LOperand* result() const { return results_[0]; }

  protected:
   EmbeddedContainer<LOperand*, R> results_;
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h     Wed Jul 24 03:48:16 2013
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h     Mon Jul 29 04:57:42 2013
@@ -271,7 +271,7 @@
   }

   virtual bool HasResult() const = 0;
-  virtual LOperand* result() = 0;
+  virtual LOperand* result() const = 0;

   bool HasDoubleRegisterResult();
   bool HasDoubleRegisterInput();
@@ -311,9 +311,9 @@
  public:
   // Allow 0 or 1 output operands.
   STATIC_ASSERT(R == 0 || R == 1);
-  virtual bool HasResult() const { return R != 0; }
+  virtual bool HasResult() const { return R != 0 && result() != NULL; }
   void set_result(LOperand* operand) { results_[0] = operand; }
-  LOperand* result() { return results_[0]; }
+  LOperand* result() const { return results_[0]; }

  protected:
   EmbeddedContainer<LOperand*, R> results_;
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h     Mon Jul 29 02:12:16 2013
+++ /branches/bleeding_edge/src/mips/lithium-mips.h     Mon Jul 29 04:57:42 2013
@@ -265,7 +265,7 @@
   bool IsMarkedAsCall() const { return is_call_; }

   virtual bool HasResult() const = 0;
-  virtual LOperand* result() = 0;
+  virtual LOperand* result() const = 0;

   LOperand* FirstInput() { return InputAt(0); }
   LOperand* Output() { return HasResult() ? result() : NULL; }
@@ -301,9 +301,9 @@
  public:
   // Allow 0 or 1 output operands.
   STATIC_ASSERT(R == 0 || R == 1);
-  virtual bool HasResult() const { return R != 0; }
+  virtual bool HasResult() const { return R != 0 && result() != NULL; }
   void set_result(LOperand* operand) { results_[0] = operand; }
-  LOperand* result() { return results_[0]; }
+  LOperand* result() const { return results_[0]; }

  protected:
   EmbeddedContainer<LOperand*, R> results_;
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h       Wed Jul 24 03:48:16 2013
+++ /branches/bleeding_edge/src/x64/lithium-x64.h       Mon Jul 29 04:57:42 2013
@@ -266,7 +266,7 @@
   bool IsMarkedAsCall() const { return is_call_; }

   virtual bool HasResult() const = 0;
-  virtual LOperand* result() = 0;
+  virtual LOperand* result() const = 0;

   LOperand* FirstInput() { return InputAt(0); }
   LOperand* Output() { return HasResult() ? result() : NULL; }
@@ -302,9 +302,9 @@
  public:
   // Allow 0 or 1 output operands.
   STATIC_ASSERT(R == 0 || R == 1);
-  virtual bool HasResult() const { return R != 0; }
+  virtual bool HasResult() const { return R != 0 && result() != NULL; }
   void set_result(LOperand* operand) { results_[0] = operand; }
-  LOperand* result() { return results_[0]; }
+  LOperand* result() const { return results_[0]; }

  protected:
   EmbeddedContainer<LOperand*, R> results_;

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