Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 8b845077a5de0110b593eaf191111840c6f07b29..423a2e9eaf0be92f9a8da169c2156f3a2b850e8d 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -7162,6 +7162,8 @@ struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { |
// ElementsTransitionGenerator::GenerateDoubleToObject |
{ t2, a2, a0, EMIT_REMEMBERED_SET }, |
{ a2, t2, t5, EMIT_REMEMBERED_SET }, |
+ // StoreArrayLiteralElementStub::Generate |
+ { t1, a0, t2, EMIT_REMEMBERED_SET }, |
// Null termination. |
{ no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} |
}; |
@@ -7401,6 +7403,66 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker( |
} |
+void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- a0 : element value to store |
+ // -- a1 : array literal |
+ // -- a2 : map of array literal |
+ // -- a3 : element index as smi |
+ // -- t0 : array literal index in function as smi |
+ // ----------------------------------- |
+ |
+ Label element_done; |
+ Label double_elements; |
+ Label smi_element; |
+ Label slow_elements; |
+ Label fast_elements; |
+ |
+ __ CheckFastElements(a2, t1, &double_elements); |
+ // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS |
+ __ JumpIfSmi(a0, &smi_element); |
+ __ CheckFastSmiOnlyElements(a2, t1, &fast_elements); |
+ |
+ // Store into the array literal requires a elements transition. Call into |
+ // the runtime. |
+ __ bind(&slow_elements); |
+ // call. |
+ __ Push(a1, a3, a0); |
+ __ lw(t1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ __ lw(t1, FieldMemOperand(t1, JSFunction::kLiteralsOffset)); |
+ __ Push(t1, t0); |
+ __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); |
+ |
+ // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. |
+ __ bind(&fast_elements); |
+ __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); |
+ __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); |
+ __ Addu(t2, t1, t2); |
+ __ Addu(t2, t2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
+ __ sw(a0, MemOperand(t2, 0)); |
+ // Update the write barrier for the array store. |
+ __ RecordWrite(t1, t2, a0, kRAHasNotBeenSaved, 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); |
+ __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); |
+ __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); |
+ __ Addu(t2, t1, t2); |
+ __ sw(a0, FieldMemOperand(t2, FixedArray::kHeaderSize)); |
+ __ Ret(); |
+ |
+ // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |
+ __ bind(&double_elements); |
+ __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); |
+ __ StoreNumberToDoubleElements(a0, a3, a1, t1, t2, t3, t5, t6, |
+ &slow_elements); |
+ __ Ret(); |
+} |
+ |
+ |
#undef __ |
} } // namespace v8::internal |