Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index be85fa15be8d3888bf27b28f0c2faaf788eccb12..e89545e98293a95b8a3152a0bdb16a726eff98df 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -6885,6 +6885,8 @@ struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { |
// ElementsTransitionGenerator::GenerateDoubleToObject |
{ r6, r2, r0, EMIT_REMEMBERED_SET }, |
{ r2, r6, r9, EMIT_REMEMBERED_SET }, |
+ // StoreArrayLiteralElementStub::Generate |
+ { r5, r0, r6, EMIT_REMEMBERED_SET }, |
// Null termination. |
{ no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} |
}; |
@@ -7121,6 +7123,64 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker( |
// Fall through when we need to inform the incremental marker. |
} |
+ |
+void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- r0 : element value to store |
+ // -- r1 : array literal |
+ // -- r2 : map of array literal |
+ // -- r3 : element index as smi |
+ // -- r4 : array literal index in function as smi |
+ // ----------------------------------- |
+ |
+ Label element_done; |
+ Label double_elements; |
+ Label smi_element; |
+ Label slow_elements; |
+ Label fast_elements; |
+ |
+ __ CheckFastElements(r2, r5, &double_elements); |
+ // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS |
+ __ JumpIfSmi(r0, &smi_element); |
+ __ CheckFastSmiOnlyElements(r2, r5, &fast_elements); |
+ |
+ // Store into the array literal requires a elements transition. Call into |
+ // the runtime. |
+ __ bind(&slow_elements); |
+ // call. |
+ __ Push(r1, r3, r0); |
+ __ ldr(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ __ ldr(r5, FieldMemOperand(r5, JSFunction::kLiteralsOffset)); |
+ __ Push(r5, r4); |
+ __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); |
+ |
+ // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. |
+ __ bind(&fast_elements); |
+ __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); |
+ __ add(r6, r5, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize)); |
+ __ add(r6, r6, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
+ __ str(r0, MemOperand(r6, 0)); |
+ // Update the write barrier for the array store. |
+ __ RecordWrite(r5, r6, r0, kLRHasNotBeenSaved, kDontSaveFPRegs, |
+ EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
+ __ Ret(); |
+ |
+ // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or |
+ // FAST_ELEMENTS, and value is Smi. |
+ __ bind(&smi_element); |
+ __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); |
+ __ add(r6, r5, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize)); |
+ __ str(r0, FieldMemOperand(r6, FixedArray::kHeaderSize)); |
+ __ Ret(); |
+ |
+ // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |
+ __ bind(&double_elements); |
+ __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); |
+ __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, |
+ &slow_elements); |
+ __ Ret(); |
+} |
+ |
#undef __ |
} } // namespace v8::internal |