| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 4049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 | 4060 |
| 4061 __ bind(&need_incremental_pop_scratch); | 4061 __ bind(&need_incremental_pop_scratch); |
| 4062 __ Pop(regs_.object(), regs_.address()); | 4062 __ Pop(regs_.object(), regs_.address()); |
| 4063 | 4063 |
| 4064 __ bind(&need_incremental); | 4064 __ bind(&need_incremental); |
| 4065 | 4065 |
| 4066 // Fall through when we need to inform the incremental marker. | 4066 // Fall through when we need to inform the incremental marker. |
| 4067 } | 4067 } |
| 4068 | 4068 |
| 4069 | 4069 |
| 4070 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { | |
| 4071 // ----------- S t a t e ------------- | |
| 4072 // -- r0 : element value to store | |
| 4073 // -- r3 : element index as smi | |
| 4074 // -- sp[0] : array literal index in function as smi | |
| 4075 // -- sp[4] : array literal | |
| 4076 // clobbers r1, r2, r4 | |
| 4077 // ----------------------------------- | |
| 4078 | |
| 4079 Label element_done; | |
| 4080 Label double_elements; | |
| 4081 Label smi_element; | |
| 4082 Label slow_elements; | |
| 4083 Label fast_elements; | |
| 4084 | |
| 4085 // Get array literal index, array literal and its map. | |
| 4086 __ ldr(r4, MemOperand(sp, 0 * kPointerSize)); | |
| 4087 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); | |
| 4088 __ ldr(r2, FieldMemOperand(r1, JSObject::kMapOffset)); | |
| 4089 | |
| 4090 __ CheckFastElements(r2, r5, &double_elements); | |
| 4091 // FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS | |
| 4092 __ JumpIfSmi(r0, &smi_element); | |
| 4093 __ CheckFastSmiElements(r2, r5, &fast_elements); | |
| 4094 | |
| 4095 // Store into the array literal requires a elements transition. Call into | |
| 4096 // the runtime. | |
| 4097 __ bind(&slow_elements); | |
| 4098 // call. | |
| 4099 __ Push(r1, r3, r0); | |
| 4100 __ ldr(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 4101 __ ldr(r5, FieldMemOperand(r5, JSFunction::kLiteralsOffset)); | |
| 4102 __ Push(r5, r4); | |
| 4103 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | |
| 4104 | |
| 4105 // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object. | |
| 4106 __ bind(&fast_elements); | |
| 4107 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); | |
| 4108 __ add(r6, r5, Operand::PointerOffsetFromSmiKey(r3)); | |
| 4109 __ add(r6, r6, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 4110 __ str(r0, MemOperand(r6, 0)); | |
| 4111 // Update the write barrier for the array store. | |
| 4112 __ RecordWrite(r5, r6, r0, kLRHasNotBeenSaved, kDontSaveFPRegs, | |
| 4113 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
| 4114 __ Ret(); | |
| 4115 | |
| 4116 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, | |
| 4117 // and value is Smi. | |
| 4118 __ bind(&smi_element); | |
| 4119 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); | |
| 4120 __ add(r6, r5, Operand::PointerOffsetFromSmiKey(r3)); | |
| 4121 __ str(r0, FieldMemOperand(r6, FixedArray::kHeaderSize)); | |
| 4122 __ Ret(); | |
| 4123 | |
| 4124 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. | |
| 4125 __ bind(&double_elements); | |
| 4126 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); | |
| 4127 __ StoreNumberToDoubleElements(r0, r3, r5, r6, d0, &slow_elements); | |
| 4128 __ Ret(); | |
| 4129 } | |
| 4130 | |
| 4131 | |
| 4132 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 4070 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
| 4133 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 4071 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
| 4134 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 4072 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 4135 int parameter_count_offset = | 4073 int parameter_count_offset = |
| 4136 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 4074 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 4137 __ ldr(r1, MemOperand(fp, parameter_count_offset)); | 4075 __ ldr(r1, MemOperand(fp, parameter_count_offset)); |
| 4138 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 4076 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
| 4139 __ add(r1, r1, Operand(1)); | 4077 __ add(r1, r1, Operand(1)); |
| 4140 } | 4078 } |
| 4141 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4079 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5447 MemOperand(fp, 6 * kPointerSize), NULL); | 5385 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5448 } | 5386 } |
| 5449 | 5387 |
| 5450 | 5388 |
| 5451 #undef __ | 5389 #undef __ |
| 5452 | 5390 |
| 5453 } // namespace internal | 5391 } // namespace internal |
| 5454 } // namespace v8 | 5392 } // namespace v8 |
| 5455 | 5393 |
| 5456 #endif // V8_TARGET_ARCH_ARM | 5394 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |