Commit a7d38e48 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Support grow-stub by >1 if the target is holey.

R=danno@chromium.org

Review URL: https://chromiumcodereview.appspot.com/18484006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15633 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9e7819fa
......@@ -1146,21 +1146,22 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
Zone* zone = this->zone();
IfBuilder length_checker(this);
length_checker.If<HCompareNumericAndBranch>(length, key, Token::EQ);
Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
length_checker.If<HCompareNumericAndBranch>(key, length, token);
length_checker.Then();
HValue* current_capacity = AddLoadFixedArrayLength(elements);
IfBuilder capacity_checker(this);
capacity_checker.If<HCompareNumericAndBranch>(length, current_capacity,
Token::EQ);
capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity,
Token::GTE);
capacity_checker.Then();
HValue* context = environment()->LookupContext();
HValue* new_capacity =
BuildNewElementsCapacity(context, current_capacity);
HValue* new_capacity = BuildNewElementsCapacity(context, key);
HValue* new_elements = BuildGrowElementsCapacity(object, elements,
kind, kind, length,
......@@ -1174,7 +1175,7 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
if (is_js_array) {
HValue* new_length = AddInstruction(
HAdd::New(zone, context, length, graph_->GetConstant1()));
HAdd::New(zone, context, key, graph_->GetConstant1()));
new_length->ClearFlag(HValue::kCanOverflow);
Representation representation = IsFastElementsKind(kind)
......@@ -1184,10 +1185,9 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
}
length_checker.Else();
Add<HBoundsCheck>(key, length);
environment()->Push(elements);
environment()->Push(elements);
length_checker.End();
return environment()->Pop();
......
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