Not consider the use representation in unintiliazed ArrayLiteral which always requires SMI

R=jkummerow@chromium.org

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

Patch from Weiliang Lin <weiliang.lin2@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15450 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 83fb6823
......@@ -5877,6 +5877,7 @@ class HStoreKeyed
: elements_kind_(elements_kind),
index_offset_(0),
is_dehoisted_(false),
is_uninitialized_(false),
new_space_dominator_(NULL) {
SetOperandAt(0, obj);
SetOperandAt(1, key);
......@@ -5937,6 +5938,9 @@ class HStoreKeyed
virtual Representation observed_input_representation(int index) {
if (index < 2) return RequiredInputRepresentation(index);
if (IsUninitialized()) {
return Representation::None();
}
if (IsFastSmiElementsKind(elements_kind())) {
return Representation::Smi();
}
......@@ -5963,6 +5967,10 @@ class HStoreKeyed
void SetKey(HValue* key) { SetOperandAt(1, key); }
bool IsDehoisted() { return is_dehoisted_; }
void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; }
bool IsUninitialized() { return is_uninitialized_; }
void SetUninitialized(bool is_uninitialized) {
is_uninitialized_ = is_uninitialized;
}
bool IsConstantHoleStore() {
return value()->IsConstant() && HConstant::cast(value())->IsTheHole();
......@@ -5993,7 +6001,8 @@ class HStoreKeyed
private:
ElementsKind elements_kind_;
uint32_t index_offset_;
bool is_dehoisted_;
bool is_dehoisted_ : 1;
bool is_uninitialized_ : 1;
HValue* new_space_dominator_;
};
......
......@@ -5544,7 +5544,9 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
Handle<Object> raw_boilerplate(literals->get(expr->literal_index()),
isolate());
bool uninitialized = false;
if (raw_boilerplate->IsUndefined()) {
uninitialized = true;
raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
isolate(), literals, expr->constant_elements());
if (raw_boilerplate.is_null()) {
......@@ -5640,10 +5642,12 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
case FAST_ELEMENTS:
case FAST_HOLEY_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS:
Add<HStoreKeyed>(elements, key, value,
boilerplate_elements_kind);
case FAST_HOLEY_DOUBLE_ELEMENTS: {
HStoreKeyed* instr = Add<HStoreKeyed>(elements, key, value,
boilerplate_elements_kind);
instr->SetUninitialized(uninitialized);
break;
}
default:
UNREACHABLE();
break;
......
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