Prohibit moving instructions with side effects via 'EmitAtUses'.

It's not generally safe to decide to delay the evaluation of an expression
with side effects until it is used.

BUG=v8:1138

Review URL: http://codereview.chromium.org/6474035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6742 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2011-02-11 10:17:52 +00:00
parent 505b46753e
commit 7bb857db19

View File

@ -2208,7 +2208,11 @@ class HCompare: public HBinaryOperation {
} }
void SetInputRepresentation(Representation r); void SetInputRepresentation(Representation r);
virtual bool EmitAtUses() const { return uses()->length() <= 1; }
virtual bool EmitAtUses() const {
return !HasSideEffects() && (uses()->length() <= 1);
}
virtual Representation RequiredInputRepresentation(int index) const { virtual Representation RequiredInputRepresentation(int index) const {
return input_representation_; return input_representation_;
} }
@ -2246,7 +2250,10 @@ class HCompareJSObjectEq: public HBinaryOperation {
SetFlag(kUseGVN); SetFlag(kUseGVN);
} }
virtual bool EmitAtUses() const { return uses()->length() <= 1; } virtual bool EmitAtUses() const {
return !HasSideEffects() && (uses()->length() <= 1);
}
virtual Representation RequiredInputRepresentation(int index) const { virtual Representation RequiredInputRepresentation(int index) const {
return Representation::Tagged(); return Representation::Tagged();
} }
@ -2265,7 +2272,11 @@ class HUnaryPredicate: public HUnaryOperation {
set_representation(Representation::Tagged()); set_representation(Representation::Tagged());
SetFlag(kUseGVN); SetFlag(kUseGVN);
} }
virtual bool EmitAtUses() const { return uses()->length() <= 1; }
virtual bool EmitAtUses() const {
return !HasSideEffects() && (uses()->length() <= 1);
}
virtual Representation RequiredInputRepresentation(int index) const { virtual Representation RequiredInputRepresentation(int index) const {
return Representation::Tagged(); return Representation::Tagged();
} }
@ -2322,7 +2333,9 @@ class HIsConstructCall: public HInstruction {
SetFlag(kUseGVN); SetFlag(kUseGVN);
} }
virtual bool EmitAtUses() const { return uses()->length() <= 1; } virtual bool EmitAtUses() const {
return !HasSideEffects() && (uses()->length() <= 1);
}
DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call") DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call")
@ -2427,7 +2440,9 @@ class HInstanceOf: public HInstruction {
HValue* left() const { return operands_[1]; } HValue* left() const { return operands_[1]; }
HValue* right() const { return operands_[2]; } HValue* right() const { return operands_[2]; }
virtual bool EmitAtUses() const { return uses()->length() <= 1; } virtual bool EmitAtUses() const {
return !HasSideEffects() && (uses()->length() <= 1);
}
virtual Representation RequiredInputRepresentation(int index) const { virtual Representation RequiredInputRepresentation(int index) const {
return Representation::Tagged(); return Representation::Tagged();