__ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
__ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
__ mov(r1, Operand(constant_elements));
- if (expr->depth() > 1) {
+ if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ mov(r0, Operand(Smi::FromInt(flags)));
__ Push(r3, r2, r1, r0);
__ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset));
__ Mov(x2, Smi::FromInt(expr->literal_index()));
__ Mov(x1, Operand(constant_elements));
- if (expr->depth() > 1) {
+ if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ Mov(x0, Smi::FromInt(flags));
__ Push(x3, x2, x1, x0);
__ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
class FastCloneShallowArrayStub : public HydrogenCodeStub {
public:
- // Maximum length of copied elements array.
- static const int kMaximumInlinedCloneLength = 8;
-
FastCloneShallowArrayStub(Isolate* isolate,
AllocationSiteMode allocation_site_mode)
: HydrogenCodeStub(isolate),
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;
}
}
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);
allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
}
- if (expr->depth() > 1) {
+ if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
__ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
__ push(Immediate(Smi::FromInt(expr->literal_index())));
__ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset));
__ li(a2, Operand(Smi::FromInt(expr->literal_index())));
__ li(a1, Operand(constant_elements));
- if (expr->depth() > 1) {
+ if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ li(a0, Operand(Smi::FromInt(flags)));
__ Push(a3, a2, a1, a0);
__ CallRuntime(Runtime::kHiddenCreateArrayLiteral, 4);
allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
}
- if (expr->depth() > 1) {
+ if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ Push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
__ Push(Smi::FromInt(expr->literal_index()));
allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
}
- if (expr->depth() > 1) {
+ if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
__ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
__ push(Immediate(Smi::FromInt(expr->literal_index())));