Reviewers: Jakob,
Message:
Comment added, landing...
Description:
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.
[email protected]
Please review this at https://codereview.chromium.org/11088026/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen-instructions.h
M src/hydrogen.cc
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
e7dc81a803135d676f74172eafa5476fa1811b7f..a4e9ed72b1505026de7592a09d9cbe493f848598
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -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)
};
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
8e9fe00034964da47b342582dec75cea8cedc16a..1afa6603aaa31a308969e9f7a15ba92e67e7d61f
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev