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 #include "src/x87/codegen-x87.h" | 5 #include "src/x87/codegen-x87.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 | 263 |
264 // Check for empty arrays, which only require a map transition and no changes | 264 // Check for empty arrays, which only require a map transition and no changes |
265 // to the backing store. | 265 // to the backing store. |
266 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 266 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
267 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 267 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
268 __ j(equal, &only_change_map); | 268 __ j(equal, &only_change_map); |
269 | 269 |
270 __ push(eax); | 270 __ push(eax); |
271 __ push(ebx); | 271 __ push(ebx); |
| 272 __ push(esi); |
272 | 273 |
273 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); | 274 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); |
274 | 275 |
275 // Allocate new FixedDoubleArray. | 276 // Allocate new FixedDoubleArray. |
276 // edx: receiver | 277 // edx: receiver |
277 // edi: length of source FixedArray (smi-tagged) | 278 // edi: length of source FixedArray (smi-tagged) |
278 AllocationFlags flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT); | 279 AllocationFlags flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT); |
279 __ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, | 280 __ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, |
280 REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, flags); | 281 REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, flags); |
281 | 282 |
(...skipping 12 matching lines...) Expand all Loading... |
294 | 295 |
295 __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); | 296 __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); |
296 | 297 |
297 // Prepare for conversion loop. | 298 // Prepare for conversion loop. |
298 ExternalReference canonical_the_hole_nan_reference = | 299 ExternalReference canonical_the_hole_nan_reference = |
299 ExternalReference::address_of_the_hole_nan(); | 300 ExternalReference::address_of_the_hole_nan(); |
300 __ jmp(&entry); | 301 __ jmp(&entry); |
301 | 302 |
302 // Call into runtime if GC is required. | 303 // Call into runtime if GC is required. |
303 __ bind(&gc_required); | 304 __ bind(&gc_required); |
| 305 |
304 // Restore registers before jumping into runtime. | 306 // Restore registers before jumping into runtime. |
305 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 307 __ pop(esi); |
306 __ pop(ebx); | 308 __ pop(ebx); |
307 __ pop(eax); | 309 __ pop(eax); |
308 __ jmp(fail); | 310 __ jmp(fail); |
309 | 311 |
310 // Convert and copy elements | 312 // Convert and copy elements |
311 // esi: source FixedArray | 313 // esi: source FixedArray |
312 __ bind(&loop); | 314 __ bind(&loop); |
313 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); | 315 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); |
314 // ebx: current element from source | 316 // ebx: current element from source |
315 // edi: index of current element | 317 // edi: index of current element |
(...skipping 15 matching lines...) Expand all Loading... |
331 __ Assert(equal, kObjectFoundInSmiOnlyArray); | 333 __ Assert(equal, kObjectFoundInSmiOnlyArray); |
332 } | 334 } |
333 | 335 |
334 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); | 336 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); |
335 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); | 337 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); |
336 | 338 |
337 __ bind(&entry); | 339 __ bind(&entry); |
338 __ sub(edi, Immediate(Smi::FromInt(1))); | 340 __ sub(edi, Immediate(Smi::FromInt(1))); |
339 __ j(not_sign, &loop); | 341 __ j(not_sign, &loop); |
340 | 342 |
| 343 // Restore registers. |
| 344 __ pop(esi); |
341 __ pop(ebx); | 345 __ pop(ebx); |
342 __ pop(eax); | 346 __ pop(eax); |
343 | 347 |
344 // Restore esi. | |
345 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
346 | |
347 __ bind(&only_change_map); | 348 __ bind(&only_change_map); |
348 // eax: value | 349 // eax: value |
349 // ebx: target map | 350 // ebx: target map |
350 // Set transitioned map. | 351 // Set transitioned map. |
351 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 352 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
352 __ RecordWriteField(edx, HeapObject::kMapOffset, ebx, edi, kDontSaveFPRegs, | 353 __ RecordWriteField(edx, HeapObject::kMapOffset, ebx, edi, kDontSaveFPRegs, |
353 OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 354 OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
354 } | 355 } |
355 | 356 |
356 | 357 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 CodePatcher patcher(isolate, sequence, young_length); | 645 CodePatcher patcher(isolate, sequence, young_length); |
645 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 646 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
646 } | 647 } |
647 } | 648 } |
648 | 649 |
649 | 650 |
650 } // namespace internal | 651 } // namespace internal |
651 } // namespace v8 | 652 } // namespace v8 |
652 | 653 |
653 #endif // V8_TARGET_ARCH_X87 | 654 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |