OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // Call into runtime if GC is required. | 348 // Call into runtime if GC is required. |
349 __ bind(&gc_required); | 349 __ bind(&gc_required); |
350 // Restore registers before jumping into runtime. | 350 // Restore registers before jumping into runtime. |
351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
352 __ pop(ebx); | 352 __ pop(ebx); |
353 __ pop(eax); | 353 __ pop(eax); |
354 __ jmp(fail); | 354 __ jmp(fail); |
355 | 355 |
356 // Convert and copy elements | 356 // Convert and copy elements |
357 // esi: source FixedArray | 357 // esi: source FixedArray |
358 // edi: number of elements to convert/copy | |
359 __ bind(&loop); | 358 __ bind(&loop); |
360 __ sub(edi, Immediate(Smi::FromInt(1))); | |
361 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); | 359 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); |
362 // ebx: current element from source | 360 // ebx: current element from source |
363 // edi: index of current element | 361 // edi: index of current element |
364 __ JumpIfNotSmi(ebx, &convert_hole); | 362 __ JumpIfNotSmi(ebx, &convert_hole); |
365 | 363 |
366 // Normal smi, convert it to double and store. | 364 // Normal smi, convert it to double and store. |
367 __ SmiUntag(ebx); | 365 __ SmiUntag(ebx); |
368 if (CpuFeatures::IsSupported(SSE2)) { | 366 if (CpuFeatures::IsSupported(SSE2)) { |
369 CpuFeatures::Scope fscope(SSE2); | 367 CpuFeatures::Scope fscope(SSE2); |
370 __ cvtsi2sd(xmm0, ebx); | 368 __ cvtsi2sd(xmm0, ebx); |
(...skipping 12 matching lines...) Expand all Loading... |
383 if (CpuFeatures::IsSupported(SSE2)) { | 381 if (CpuFeatures::IsSupported(SSE2)) { |
384 CpuFeatures::Scope use_sse2(SSE2); | 382 CpuFeatures::Scope use_sse2(SSE2); |
385 __ movdbl(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize), | 383 __ movdbl(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize), |
386 the_hole_nan); | 384 the_hole_nan); |
387 } else { | 385 } else { |
388 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); | 386 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); |
389 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); | 387 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); |
390 } | 388 } |
391 | 389 |
392 __ bind(&entry); | 390 __ bind(&entry); |
393 __ test(edi, edi); | 391 __ sub(edi, Immediate(Smi::FromInt(1))); |
394 __ j(not_zero, &loop); | 392 __ j(not_sign, &loop); |
395 | 393 |
396 __ pop(ebx); | 394 __ pop(ebx); |
397 __ pop(eax); | 395 __ pop(eax); |
398 // eax: value | 396 // eax: value |
399 // ebx: target map | 397 // ebx: target map |
400 // Set transitioned map. | 398 // Set transitioned map. |
401 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 399 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
402 __ RecordWriteField(edx, | 400 __ RecordWriteField(edx, |
403 HeapObject::kMapOffset, | 401 HeapObject::kMapOffset, |
404 ebx, | 402 ebx, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 445 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
448 __ pop(ebx); | 446 __ pop(ebx); |
449 __ pop(edx); | 447 __ pop(edx); |
450 __ pop(eax); | 448 __ pop(eax); |
451 __ jmp(fail); | 449 __ jmp(fail); |
452 | 450 |
453 // Box doubles into heap numbers. | 451 // Box doubles into heap numbers. |
454 // edi: source FixedDoubleArray | 452 // edi: source FixedDoubleArray |
455 // eax: destination FixedArray | 453 // eax: destination FixedArray |
456 __ bind(&loop); | 454 __ bind(&loop); |
457 __ sub(ebx, Immediate(Smi::FromInt(1))); | |
458 // ebx: index of current element (smi-tagged) | 455 // ebx: index of current element (smi-tagged) |
459 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | 456 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
460 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); | 457 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); |
461 __ j(equal, &convert_hole); | 458 __ j(equal, &convert_hole); |
462 | 459 |
463 // Non-hole double, copy value into a heap number. | 460 // Non-hole double, copy value into a heap number. |
464 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); | 461 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); |
465 // edx: new heap number | 462 // edx: new heap number |
466 if (CpuFeatures::IsSupported(SSE2)) { | 463 if (CpuFeatures::IsSupported(SSE2)) { |
467 CpuFeatures::Scope fscope(SSE2); | 464 CpuFeatures::Scope fscope(SSE2); |
(...skipping 15 matching lines...) Expand all Loading... |
483 EMIT_REMEMBERED_SET, | 480 EMIT_REMEMBERED_SET, |
484 OMIT_SMI_CHECK); | 481 OMIT_SMI_CHECK); |
485 __ jmp(&entry, Label::kNear); | 482 __ jmp(&entry, Label::kNear); |
486 | 483 |
487 // Replace the-hole NaN with the-hole pointer. | 484 // Replace the-hole NaN with the-hole pointer. |
488 __ bind(&convert_hole); | 485 __ bind(&convert_hole); |
489 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), | 486 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), |
490 masm->isolate()->factory()->the_hole_value()); | 487 masm->isolate()->factory()->the_hole_value()); |
491 | 488 |
492 __ bind(&entry); | 489 __ bind(&entry); |
493 __ test(ebx, ebx); | 490 __ sub(ebx, Immediate(Smi::FromInt(1))); |
494 __ j(not_zero, &loop); | 491 __ j(not_sign, &loop); |
495 | 492 |
496 __ pop(ebx); | 493 __ pop(ebx); |
497 __ pop(edx); | 494 __ pop(edx); |
498 // ebx: target map | 495 // ebx: target map |
499 // edx: receiver | 496 // edx: receiver |
500 // Set transitioned map. | 497 // Set transitioned map. |
501 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 498 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
502 __ RecordWriteField(edx, | 499 __ RecordWriteField(edx, |
503 HeapObject::kMapOffset, | 500 HeapObject::kMapOffset, |
504 ebx, | 501 ebx, |
(...skipping 14 matching lines...) Expand all Loading... |
519 // Restore registers. | 516 // Restore registers. |
520 __ pop(eax); | 517 __ pop(eax); |
521 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 518 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
522 } | 519 } |
523 | 520 |
524 #undef __ | 521 #undef __ |
525 | 522 |
526 } } // namespace v8::internal | 523 } } // namespace v8::internal |
527 | 524 |
528 #endif // V8_TARGET_ARCH_IA32 | 525 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |