OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4273 | 4273 |
4274 __ bind(&need_incremental_pop_scratch); | 4274 __ bind(&need_incremental_pop_scratch); |
4275 __ Pop(regs_.object(), regs_.address()); | 4275 __ Pop(regs_.object(), regs_.address()); |
4276 | 4276 |
4277 __ bind(&need_incremental); | 4277 __ bind(&need_incremental); |
4278 | 4278 |
4279 // Fall through when we need to inform the incremental marker. | 4279 // Fall through when we need to inform the incremental marker. |
4280 } | 4280 } |
4281 | 4281 |
4282 | 4282 |
4283 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { | |
4284 // ----------- S t a t e ------------- | |
4285 // -- a0 : element value to store | |
4286 // -- a3 : element index as smi | |
4287 // -- sp[0] : array literal index in function as smi | |
4288 // -- sp[4] : array literal | |
4289 // clobbers a1, a2, t0 | |
4290 // ----------------------------------- | |
4291 | |
4292 Label element_done; | |
4293 Label double_elements; | |
4294 Label smi_element; | |
4295 Label slow_elements; | |
4296 Label fast_elements; | |
4297 | |
4298 // Get array literal index, array literal and its map. | |
4299 __ lw(t0, MemOperand(sp, 0 * kPointerSize)); | |
4300 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); | |
4301 __ lw(a2, FieldMemOperand(a1, JSObject::kMapOffset)); | |
4302 | |
4303 __ CheckFastElements(a2, t1, &double_elements); | |
4304 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements | |
4305 __ JumpIfSmi(a0, &smi_element); | |
4306 __ CheckFastSmiElements(a2, t1, &fast_elements); | |
4307 | |
4308 // Store into the array literal requires a elements transition. Call into | |
4309 // the runtime. | |
4310 __ bind(&slow_elements); | |
4311 // call. | |
4312 __ Push(a1, a3, a0); | |
4313 __ lw(t1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
4314 __ lw(t1, FieldMemOperand(t1, JSFunction::kLiteralsOffset)); | |
4315 __ Push(t1, t0); | |
4316 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | |
4317 | |
4318 // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object. | |
4319 __ bind(&fast_elements); | |
4320 __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); | |
4321 __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); | |
4322 __ Addu(t2, t1, t2); | |
4323 __ Addu(t2, t2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
4324 __ sw(a0, MemOperand(t2, 0)); | |
4325 // Update the write barrier for the array store. | |
4326 __ RecordWrite(t1, t2, a0, kRAHasNotBeenSaved, kDontSaveFPRegs, | |
4327 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
4328 __ Ret(USE_DELAY_SLOT); | |
4329 __ mov(v0, a0); | |
4330 | |
4331 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, | |
4332 // and value is Smi. | |
4333 __ bind(&smi_element); | |
4334 __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); | |
4335 __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); | |
4336 __ Addu(t2, t1, t2); | |
4337 __ sw(a0, FieldMemOperand(t2, FixedArray::kHeaderSize)); | |
4338 __ Ret(USE_DELAY_SLOT); | |
4339 __ mov(v0, a0); | |
4340 | |
4341 // Array literal has ElementsKind of FAST_*_DOUBLE_ELEMENTS. | |
4342 __ bind(&double_elements); | |
4343 __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); | |
4344 __ StoreNumberToDoubleElements(a0, a3, t1, t3, t5, a2, &slow_elements); | |
4345 __ Ret(USE_DELAY_SLOT); | |
4346 __ mov(v0, a0); | |
4347 } | |
4348 | |
4349 | |
4350 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 4283 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
4351 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 4284 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
4352 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 4285 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
4353 int parameter_count_offset = | 4286 int parameter_count_offset = |
4354 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 4287 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
4355 __ lw(a1, MemOperand(fp, parameter_count_offset)); | 4288 __ lw(a1, MemOperand(fp, parameter_count_offset)); |
4356 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 4289 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
4357 __ Addu(a1, a1, Operand(1)); | 4290 __ Addu(a1, a1, Operand(1)); |
4358 } | 4291 } |
4359 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4292 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5642 MemOperand(fp, 6 * kPointerSize), NULL); | 5575 MemOperand(fp, 6 * kPointerSize), NULL); |
5643 } | 5576 } |
5644 | 5577 |
5645 | 5578 |
5646 #undef __ | 5579 #undef __ |
5647 | 5580 |
5648 } // namespace internal | 5581 } // namespace internal |
5649 } // namespace v8 | 5582 } // namespace v8 |
5650 | 5583 |
5651 #endif // V8_TARGET_ARCH_MIPS | 5584 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |