Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Unified Diff: src/hydrogen.cc

Issue 18484006: Support grow-stub by >1 if the target is holey. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 8587e30f557ce460d104e673dc5e5488ee48ab8d..8a1023b1e43fc57b6de1b0921a99977322f0af9f 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1145,21 +1145,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,
@@ -1173,7 +1174,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)
@@ -1183,10 +1184,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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698