Make sure that the context argument of HAdd is never NULL.

Although this doesn't hurt currently, it hurts any future compiler
pass relying on the invariant that no operand is NULL.

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12681 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2012-10-09 13:53:24 +00:00
parent 012ae4761c
commit f81b06dde5
2 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,7 @@ class LChunkBuilder;
#define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \
V(BinaryOperation) \
V(BitwiseBinaryOperation) \
V(ControlInstruction) \
V(Instruction) \
@ -2677,6 +2678,8 @@ class HBinaryOperation: public HTemplateInstruction<3> {
virtual bool IsCommutative() const { return false; }
virtual void PrintDataTo(StringStream* stream);
DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)
};

View File

@ -3567,7 +3567,10 @@ class BoundsCheckBbData: public ZoneObject {
HConstant(new_offset, Representation::Integer32());
if (*add == NULL) {
new_constant->InsertBefore(check);
*add = new(BasicBlock()->zone()) HAdd(NULL,
// Because of the bounds checks elimination algorithm, the index is always
// an HAdd or an HSub here, so we can safely cast to an HBinaryOperation.
HValue* context = HBinaryOperation::cast(check->index())->context();
*add = new(BasicBlock()->zone()) HAdd(context,
original_value,
new_constant);
(*add)->AssumeRepresentation(representation);