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
This commit is contained in:
parent
341d405301
commit
5b9569b574
@ -521,12 +521,19 @@ bool HValue::CanReplaceWithDummyUses() {
|
||||
|
||||
|
||||
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() {
|
||||
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> {
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)
|
||||
|
||||
protected:
|
||||
virtual int RedefinedOperandIndex() { return 0; }
|
||||
|
||||
private:
|
||||
HForceRepresentation(HValue* value, Representation required_representation) {
|
||||
SetOperandAt(0, value);
|
||||
|
@ -2209,15 +2209,12 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* elements,
|
||||
static const int kLoopUnfoldLimit = 8;
|
||||
STATIC_ASSERT(JSArray::kPreallocatedArrayElements <= kLoopUnfoldLimit);
|
||||
int initial_capacity = -1;
|
||||
if (from->ActualValue()->IsConstant() && to->ActualValue()->IsConstant()) {
|
||||
HConstant* constant_from = HConstant::cast(from->ActualValue());
|
||||
HConstant* constant_to = HConstant::cast(to->ActualValue());
|
||||
if (from->IsInteger32Constant() && to->IsInteger32Constant()) {
|
||||
int constant_from = from->GetInteger32Constant();
|
||||
int constant_to = to->GetInteger32Constant();
|
||||
|
||||
if (constant_from->HasInteger32Value() &&
|
||||
constant_from->Integer32Value() == 0 &&
|
||||
constant_to->HasInteger32Value() &&
|
||||
constant_to->Integer32Value() <= kLoopUnfoldLimit) {
|
||||
initial_capacity = constant_to->Integer32Value();
|
||||
if (constant_from == 0 && constant_to <= kLoopUnfoldLimit) {
|
||||
initial_capacity = constant_to;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user