Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 4afa65e74dd087325bf323a3b1cb180b0e5ed274..c1cb28f7b7e7f3f8111b5bebafb348f1efc1a885 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -2525,8 +2525,7 @@ void HGraphBuilder::BuildCopyElements(HValue* array, |
capacity->IsConstant() && |
HConstant::cast(capacity)->HasInteger32Value()) { |
int constant_candidate = HConstant::cast(capacity)->Integer32Value(); |
- if (constant_candidate <= |
- FastCloneShallowArrayStub::kMaximumInlinedCloneLength) { |
+ if (constant_candidate <= kElementLoopUnrollThreshold) { |
constant_capacity = constant_candidate; |
} |
} |
@@ -2701,6 +2700,12 @@ HValue* HGraphBuilder::BuildCloneShallowArrayNonEmpty(HValue* boilerplate, |
extra->ClearFlag(HValue::kCanOverflow); |
extra = AddUncasted<HAdd>(extra, Add<HConstant>(FixedArray::kHeaderSize)); |
extra->ClearFlag(HValue::kCanOverflow); |
+ // This function implicitly relies on the fact that the |
+ // FastCloneShallowArrayStub is called only for literals shorter than |
+ // JSObject::kInitialMaxFastElementArray and therefore the size of the |
+ // resulting folded allocation will always be in allowed range. |
+ // Can't add HBoundsCheck here because otherwise the stub will eager a frame. |
+ |
HValue* elements = NULL; |
HValue* result = BuildCloneShallowArrayCommon(boilerplate, |
allocation_site, extra, &elements, mode); |