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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 4099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4110 | 4110 |
4111 __ bind(&need_incremental_pop_object); | 4111 __ bind(&need_incremental_pop_object); |
4112 __ pop(regs_.object()); | 4112 __ pop(regs_.object()); |
4113 | 4113 |
4114 __ bind(&need_incremental); | 4114 __ bind(&need_incremental); |
4115 | 4115 |
4116 // Fall through when we need to inform the incremental marker. | 4116 // Fall through when we need to inform the incremental marker. |
4117 } | 4117 } |
4118 | 4118 |
4119 | 4119 |
4120 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { | |
4121 // ----------- S t a t e ------------- | |
4122 // -- eax : element value to store | |
4123 // -- ecx : element index as smi | |
4124 // -- esp[0] : return address | |
4125 // -- esp[4] : array literal index in function | |
4126 // -- esp[8] : array literal | |
4127 // clobbers ebx, edx, edi | |
4128 // ----------------------------------- | |
4129 | |
4130 Label element_done; | |
4131 Label double_elements; | |
4132 Label smi_element; | |
4133 Label slow_elements; | |
4134 Label slow_elements_from_double; | |
4135 Label fast_elements; | |
4136 | |
4137 // Get array literal index, array literal and its map. | |
4138 __ mov(edx, Operand(esp, 1 * kPointerSize)); | |
4139 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | |
4140 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset)); | |
4141 | |
4142 __ CheckFastElements(edi, &double_elements); | |
4143 | |
4144 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements | |
4145 __ JumpIfSmi(eax, &smi_element); | |
4146 __ CheckFastSmiElements(edi, &fast_elements, Label::kNear); | |
4147 | |
4148 // Store into the array literal requires a elements transition. Call into | |
4149 // the runtime. | |
4150 | |
4151 __ bind(&slow_elements); | |
4152 __ pop(edi); // Pop return address and remember to put back later for tail | |
4153 // call. | |
4154 __ push(ebx); | |
4155 __ push(ecx); | |
4156 __ push(eax); | |
4157 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
4158 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | |
4159 __ push(edx); | |
4160 __ push(edi); // Return return address so that tail call returns to right | |
4161 // place. | |
4162 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | |
4163 | |
4164 __ bind(&slow_elements_from_double); | |
4165 __ pop(edx); | |
4166 __ jmp(&slow_elements); | |
4167 | |
4168 // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object. | |
4169 __ bind(&fast_elements); | |
4170 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | |
4171 __ lea(ecx, FieldOperand(ebx, ecx, times_half_pointer_size, | |
4172 FixedArrayBase::kHeaderSize)); | |
4173 __ mov(Operand(ecx, 0), eax); | |
4174 // Update the write barrier for the array store. | |
4175 __ RecordWrite(ebx, ecx, eax, | |
4176 kDontSaveFPRegs, | |
4177 EMIT_REMEMBERED_SET, | |
4178 OMIT_SMI_CHECK); | |
4179 __ ret(0); | |
4180 | |
4181 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, | |
4182 // and value is Smi. | |
4183 __ bind(&smi_element); | |
4184 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | |
4185 __ mov(FieldOperand(ebx, ecx, times_half_pointer_size, | |
4186 FixedArrayBase::kHeaderSize), eax); | |
4187 __ ret(0); | |
4188 | |
4189 // Array literal has ElementsKind of FAST_*_DOUBLE_ELEMENTS. | |
4190 __ bind(&double_elements); | |
4191 | |
4192 __ push(edx); | |
4193 __ mov(edx, FieldOperand(ebx, JSObject::kElementsOffset)); | |
4194 __ StoreNumberToDoubleElements(eax, | |
4195 edx, | |
4196 ecx, | |
4197 edi, | |
4198 xmm0, | |
4199 &slow_elements_from_double); | |
4200 __ pop(edx); | |
4201 __ ret(0); | |
4202 } | |
4203 | |
4204 | |
4205 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 4120 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
4206 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 4121 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
4207 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 4122 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); |
4208 int parameter_count_offset = | 4123 int parameter_count_offset = |
4209 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 4124 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
4210 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 4125 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
4211 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4126 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
4212 __ pop(ecx); | 4127 __ pop(ecx); |
4213 int additional_offset = | 4128 int additional_offset = |
4214 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 4129 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5752 Operand(ebp, 7 * kPointerSize), NULL); | 5667 Operand(ebp, 7 * kPointerSize), NULL); |
5753 } | 5668 } |
5754 | 5669 |
5755 | 5670 |
5756 #undef __ | 5671 #undef __ |
5757 | 5672 |
5758 } // namespace internal | 5673 } // namespace internal |
5759 } // namespace v8 | 5674 } // namespace v8 |
5760 | 5675 |
5761 #endif // V8_TARGET_ARCH_IA32 | 5676 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |