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.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/21037004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15931 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
danno@chromium.org 2013-07-29 11:57:42 +00:00
parent 504f94fcbd
commit 837276829e
4 changed files with 12 additions and 12 deletions

View File

@ -268,7 +268,7 @@ class LInstruction: public ZoneObject {
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 @@ class LTemplateInstruction: public LInstruction {
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_;

View File

@ -271,7 +271,7 @@ class LInstruction: public ZoneObject {
}
virtual bool HasResult() const = 0;
virtual LOperand* result() = 0;
virtual LOperand* result() const = 0;
bool HasDoubleRegisterResult();
bool HasDoubleRegisterInput();
@ -311,9 +311,9 @@ class LTemplateInstruction: public LInstruction {
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_;

View File

@ -265,7 +265,7 @@ class LInstruction: public ZoneObject {
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 @@ class LTemplateInstruction: public LInstruction {
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_;

View File

@ -266,7 +266,7 @@ class LInstruction: public ZoneObject {
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 @@ class LTemplateInstruction: public LInstruction {
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_;