Regression fix: HForceRepresentation shouldn't be an idef.

Instead, code sites that are interested in underlying constant integer values
should use HValue::IsInteger32Constant(). The issue is that the infer representation phase shouldn't "see through" HForceRepresentation nodes to an underlying, and less specific representation.

R=mstarzinger@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17787 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 341d4053
...@@ -521,12 +521,19 @@ bool HValue::CanReplaceWithDummyUses() { ...@@ -521,12 +521,19 @@ bool HValue::CanReplaceWithDummyUses() {
bool HValue::IsInteger32Constant() { bool HValue::IsInteger32Constant() {
return IsConstant() && HConstant::cast(this)->HasInteger32Value(); HValue* value_to_check = IsForceRepresentation()
? HForceRepresentation::cast(this)->value()
: this;
return value_to_check->IsConstant() &&
HConstant::cast(value_to_check)->HasInteger32Value();
} }
int32_t HValue::GetInteger32Constant() { int32_t HValue::GetInteger32Constant() {
return HConstant::cast(this)->Integer32Value(); HValue* constant_value = IsForceRepresentation()
? HForceRepresentation::cast(this)->value()
: this;
return HConstant::cast(constant_value)->Integer32Value();
} }
......
...@@ -1579,9 +1579,6 @@ class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> { ...@@ -1579,9 +1579,6 @@ class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> {
DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)
protected:
virtual int RedefinedOperandIndex() { return 0; }
private: private:
HForceRepresentation(HValue* value, Representation required_representation) { HForceRepresentation(HValue* value, Representation required_representation) {
SetOperandAt(0, value); SetOperandAt(0, value);
......
...@@ -2209,15 +2209,12 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* elements, ...@@ -2209,15 +2209,12 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* elements,
static const int kLoopUnfoldLimit = 8; static const int kLoopUnfoldLimit = 8;
STATIC_ASSERT(JSArray::kPreallocatedArrayElements <= kLoopUnfoldLimit); STATIC_ASSERT(JSArray::kPreallocatedArrayElements <= kLoopUnfoldLimit);
int initial_capacity = -1; int initial_capacity = -1;
if (from->ActualValue()->IsConstant() && to->ActualValue()->IsConstant()) { if (from->IsInteger32Constant() && to->IsInteger32Constant()) {
HConstant* constant_from = HConstant::cast(from->ActualValue()); int constant_from = from->GetInteger32Constant();
HConstant* constant_to = HConstant::cast(to->ActualValue()); int constant_to = to->GetInteger32Constant();
if (constant_from->HasInteger32Value() && if (constant_from == 0 && constant_to <= kLoopUnfoldLimit) {
constant_from->Integer32Value() == 0 && initial_capacity = constant_to;
constant_to->HasInteger32Value() &&
constant_to->Integer32Value() <= kLoopUnfoldLimit) {
initial_capacity = constant_to->Integer32Value();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment