Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Check for empty arrays, which only require a map transition and no changes | 439 // Check for empty arrays, which only require a map transition and no changes |
| 440 // to the backing store. | 440 // to the backing store. |
| 441 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | 441 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); |
| 442 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 442 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
| 443 __ b(eq, &only_change_map); | 443 __ b(eq, &only_change_map); |
| 444 | 444 |
| 445 __ push(lr); | 445 __ push(lr); |
| 446 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 446 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 447 // r4: source FixedArray | |
| 448 // r5: number of elements (smi-tagged) | 447 // r5: number of elements (smi-tagged) |
| 449 | 448 |
| 450 // Allocate new FixedDoubleArray. | 449 // Allocate new FixedDoubleArray. |
| 451 // Use lr as a temporary register. | 450 // Use lr as a temporary register. |
| 452 __ mov(lr, Operand(r5, LSL, 2)); | 451 __ mov(lr, Operand(r5, LSL, 2)); |
| 453 __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); | 452 __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); |
| 454 __ Allocate(lr, r6, r7, r9, &gc_required, DOUBLE_ALIGNMENT); | 453 __ Allocate(lr, r6, r4, r9, &gc_required, DOUBLE_ALIGNMENT); |
| 455 // r6: destination FixedDoubleArray, not tagged as heap object. | 454 // r6: destination FixedDoubleArray, not tagged as heap object. |
| 456 | 455 |
| 457 // Set destination FixedDoubleArray's length and map. | 456 // Set destination FixedDoubleArray's length and map. |
| 458 __ LoadRoot(r9, Heap::kFixedDoubleArrayMapRootIndex); | 457 __ LoadRoot(r9, Heap::kFixedDoubleArrayMapRootIndex); |
| 459 __ str(r5, MemOperand(r6, FixedDoubleArray::kLengthOffset)); | 458 __ str(r5, MemOperand(r6, FixedDoubleArray::kLengthOffset)); |
| 460 // Update receiver's map. | 459 // Update receiver's map. |
| 461 __ str(r9, MemOperand(r6, HeapObject::kMapOffset)); | 460 __ str(r9, MemOperand(r6, HeapObject::kMapOffset)); |
| 462 | 461 |
| 463 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 462 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 464 __ RecordWriteField(r2, | 463 __ RecordWriteField(r2, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 475 __ RecordWriteField(r2, | 474 __ RecordWriteField(r2, |
| 476 JSObject::kElementsOffset, | 475 JSObject::kElementsOffset, |
| 477 r3, | 476 r3, |
| 478 r9, | 477 r9, |
| 479 kLRHasBeenSaved, | 478 kLRHasBeenSaved, |
| 480 kDontSaveFPRegs, | 479 kDontSaveFPRegs, |
| 481 EMIT_REMEMBERED_SET, | 480 EMIT_REMEMBERED_SET, |
| 482 OMIT_SMI_CHECK); | 481 OMIT_SMI_CHECK); |
| 483 | 482 |
| 484 // Prepare for conversion loop. | 483 // Prepare for conversion loop. |
| 484 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | |
|
ulan
2013/09/13 14:20:48
Moving this up to line 454 seems to have fixed the
rmcilroy_google
2013/09/13 14:52:58
Done.
| |
| 485 __ add(r3, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 485 __ add(r3, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 486 __ add(r7, r6, Operand(FixedDoubleArray::kHeaderSize)); | 486 __ add(r9, r6, Operand(FixedDoubleArray::kHeaderSize)); |
| 487 __ add(r6, r7, Operand(r5, LSL, 2)); | 487 __ add(r6, r9, Operand(r5, LSL, 2)); |
| 488 __ mov(r4, Operand(kHoleNanLower32)); | 488 __ mov(r4, Operand(kHoleNanLower32)); |
| 489 __ mov(r5, Operand(kHoleNanUpper32)); | 489 __ mov(r5, Operand(kHoleNanUpper32)); |
| 490 // r3: begin of source FixedArray element fields, not tagged | 490 // r3: begin of source FixedArray element fields, not tagged |
| 491 // r4: kHoleNanLower32 | 491 // r4: kHoleNanLower32 |
| 492 // r5: kHoleNanUpper32 | 492 // r5: kHoleNanUpper32 |
| 493 // r6: end of destination FixedDoubleArray, not tagged | 493 // r6: end of destination FixedDoubleArray, not tagged |
| 494 // r7: begin of FixedDoubleArray element fields, not tagged | 494 // r9: begin of FixedDoubleArray element fields, not tagged |
| 495 | 495 |
| 496 __ b(&entry); | 496 __ b(&entry); |
| 497 | 497 |
| 498 __ bind(&only_change_map); | 498 __ bind(&only_change_map); |
| 499 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 499 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 500 __ RecordWriteField(r2, | 500 __ RecordWriteField(r2, |
| 501 HeapObject::kMapOffset, | 501 HeapObject::kMapOffset, |
| 502 r3, | 502 r3, |
| 503 r9, | 503 r9, |
| 504 kLRHasNotBeenSaved, | 504 kLRHasNotBeenSaved, |
| 505 kDontSaveFPRegs, | 505 kDontSaveFPRegs, |
| 506 OMIT_REMEMBERED_SET, | 506 OMIT_REMEMBERED_SET, |
| 507 OMIT_SMI_CHECK); | 507 OMIT_SMI_CHECK); |
| 508 __ b(&done); | 508 __ b(&done); |
| 509 | 509 |
| 510 // Call into runtime if GC is required. | 510 // Call into runtime if GC is required. |
| 511 __ bind(&gc_required); | 511 __ bind(&gc_required); |
| 512 __ pop(lr); | 512 __ pop(lr); |
| 513 __ b(fail); | 513 __ b(fail); |
| 514 | 514 |
| 515 // Convert and copy elements. | 515 // Convert and copy elements. |
| 516 __ bind(&loop); | 516 __ bind(&loop); |
| 517 __ ldr(r9, MemOperand(r3, 4, PostIndex)); | 517 __ ldr(lr, MemOperand(r3, 4, PostIndex)); |
| 518 // r9: current element | 518 // lr: current element |
| 519 __ UntagAndJumpIfNotSmi(r9, r9, &convert_hole); | 519 __ UntagAndJumpIfNotSmi(lr, lr, &convert_hole); |
| 520 | 520 |
| 521 // Normal smi, convert to double and store. | 521 // Normal smi, convert to double and store. |
| 522 __ vmov(s0, r9); | 522 __ vmov(s0, lr); |
| 523 __ vcvt_f64_s32(d0, s0); | 523 __ vcvt_f64_s32(d0, s0); |
| 524 __ vstr(d0, r7, 0); | 524 __ vstr(d0, r9, 0); |
| 525 __ add(r7, r7, Operand(8)); | 525 __ add(r9, r9, Operand(8)); |
| 526 __ b(&entry); | 526 __ b(&entry); |
| 527 | 527 |
| 528 // Hole found, store the-hole NaN. | 528 // Hole found, store the-hole NaN. |
| 529 __ bind(&convert_hole); | 529 __ bind(&convert_hole); |
| 530 if (FLAG_debug_code) { | 530 if (FLAG_debug_code) { |
| 531 // Restore a "smi-untagged" heap object. | 531 // Restore a "smi-untagged" heap object. |
| 532 __ SmiTag(r9); | 532 __ SmiTag(lr); |
| 533 __ orr(r9, r9, Operand(1)); | 533 __ orr(lr, lr, Operand(1)); |
| 534 __ CompareRoot(r9, Heap::kTheHoleValueRootIndex); | 534 __ CompareRoot(lr, Heap::kTheHoleValueRootIndex); |
| 535 __ Assert(eq, kObjectFoundInSmiOnlyArray); | 535 __ Assert(eq, kObjectFoundInSmiOnlyArray); |
| 536 } | 536 } |
| 537 __ Strd(r4, r5, MemOperand(r7, 8, PostIndex)); | 537 __ Strd(r4, r5, MemOperand(r9, 8, PostIndex)); |
| 538 | 538 |
| 539 __ bind(&entry); | 539 __ bind(&entry); |
| 540 __ cmp(r7, r6); | 540 __ cmp(r9, r6); |
| 541 __ b(lt, &loop); | 541 __ b(lt, &loop); |
| 542 | 542 |
| 543 __ pop(lr); | 543 __ pop(lr); |
| 544 __ bind(&done); | 544 __ bind(&done); |
| 545 } | 545 } |
| 546 | 546 |
| 547 | 547 |
| 548 void ElementsTransitionGenerator::GenerateDoubleToObject( | 548 void ElementsTransitionGenerator::GenerateDoubleToObject( |
| 549 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 549 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
| 550 // ----------- S t a t e ------------- | 550 // ----------- S t a t e ------------- |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 570 | 570 |
| 571 __ push(lr); | 571 __ push(lr); |
| 572 __ Push(r3, r2, r1, r0); | 572 __ Push(r3, r2, r1, r0); |
| 573 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 573 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 574 // r4: source FixedDoubleArray | 574 // r4: source FixedDoubleArray |
| 575 // r5: number of elements (smi-tagged) | 575 // r5: number of elements (smi-tagged) |
| 576 | 576 |
| 577 // Allocate new FixedArray. | 577 // Allocate new FixedArray. |
| 578 __ mov(r0, Operand(FixedDoubleArray::kHeaderSize)); | 578 __ mov(r0, Operand(FixedDoubleArray::kHeaderSize)); |
| 579 __ add(r0, r0, Operand(r5, LSL, 1)); | 579 __ add(r0, r0, Operand(r5, LSL, 1)); |
| 580 __ Allocate(r0, r6, r7, r9, &gc_required, NO_ALLOCATION_FLAGS); | 580 __ Allocate(r0, r6, r3, r9, &gc_required, NO_ALLOCATION_FLAGS); |
| 581 // r6: destination FixedArray, not tagged as heap object | 581 // r6: destination FixedArray, not tagged as heap object |
| 582 // Set destination FixedDoubleArray's length and map. | 582 // Set destination FixedDoubleArray's length and map. |
| 583 __ LoadRoot(r9, Heap::kFixedArrayMapRootIndex); | 583 __ LoadRoot(r9, Heap::kFixedArrayMapRootIndex); |
| 584 __ str(r5, MemOperand(r6, FixedDoubleArray::kLengthOffset)); | 584 __ str(r5, MemOperand(r6, FixedDoubleArray::kLengthOffset)); |
| 585 __ str(r9, MemOperand(r6, HeapObject::kMapOffset)); | 585 __ str(r9, MemOperand(r6, HeapObject::kMapOffset)); |
| 586 | 586 |
| 587 // Prepare for conversion loop. | 587 // Prepare for conversion loop. |
| 588 __ add(r4, r4, Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag + 4)); | 588 __ add(r4, r4, Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag + 4)); |
| 589 __ add(r3, r6, Operand(FixedArray::kHeaderSize)); | 589 __ add(r3, r6, Operand(FixedArray::kHeaderSize)); |
| 590 __ add(r6, r6, Operand(kHeapObjectTag)); | 590 __ add(r6, r6, Operand(kHeapObjectTag)); |
| 591 __ add(r5, r3, Operand(r5, LSL, 1)); | 591 __ add(r5, r3, Operand(r5, LSL, 1)); |
| 592 __ LoadRoot(r7, Heap::kTheHoleValueRootIndex); | |
| 593 __ LoadRoot(r9, Heap::kHeapNumberMapRootIndex); | 592 __ LoadRoot(r9, Heap::kHeapNumberMapRootIndex); |
| 594 // Using offsetted addresses in r4 to fully take advantage of post-indexing. | 593 // Using offsetted addresses in r4 to fully take advantage of post-indexing. |
| 595 // r3: begin of destination FixedArray element fields, not tagged | 594 // r3: begin of destination FixedArray element fields, not tagged |
| 596 // r4: begin of source FixedDoubleArray element fields, not tagged, +4 | 595 // r4: begin of source FixedDoubleArray element fields, not tagged, +4 |
| 597 // r5: end of destination FixedArray, not tagged | 596 // r5: end of destination FixedArray, not tagged |
| 598 // r6: destination FixedArray | 597 // r6: destination FixedArray |
| 599 // r7: the-hole pointer | |
| 600 // r9: heap number map | 598 // r9: heap number map |
| 601 __ b(&entry); | 599 __ b(&entry); |
| 602 | 600 |
| 603 // Call into runtime if GC is required. | 601 // Call into runtime if GC is required. |
| 604 __ bind(&gc_required); | 602 __ bind(&gc_required); |
| 605 __ Pop(r3, r2, r1, r0); | 603 __ Pop(r3, r2, r1, r0); |
| 606 __ pop(lr); | 604 __ pop(lr); |
| 607 __ b(fail); | 605 __ b(fail); |
| 608 | 606 |
| 609 __ bind(&loop); | 607 __ bind(&loop); |
| 610 __ ldr(r1, MemOperand(r4, 8, PostIndex)); | 608 __ ldr(r1, MemOperand(r4, 8, PostIndex)); |
| 611 // lr: current element's upper 32 bit | 609 // r1: current element's upper 32 bit |
| 612 // r4: address of next element's upper 32 bit | 610 // r4: address of next element's upper 32 bit |
| 613 __ cmp(r1, Operand(kHoleNanUpper32)); | 611 __ cmp(r1, Operand(kHoleNanUpper32)); |
| 614 __ b(eq, &convert_hole); | 612 __ b(eq, &convert_hole); |
| 615 | 613 |
| 616 // Non-hole double, copy value into a heap number. | 614 // Non-hole double, copy value into a heap number. |
| 617 __ AllocateHeapNumber(r2, r0, lr, r9, &gc_required); | 615 __ AllocateHeapNumber(r2, r0, lr, r9, &gc_required); |
| 618 // r2: new heap number | 616 // r2: new heap number |
| 619 __ ldr(r0, MemOperand(r4, 12, NegOffset)); | 617 __ ldr(r0, MemOperand(r4, 12, NegOffset)); |
| 620 __ Strd(r0, r1, FieldMemOperand(r2, HeapNumber::kValueOffset)); | 618 __ Strd(r0, r1, FieldMemOperand(r2, HeapNumber::kValueOffset)); |
| 621 __ mov(r0, r3); | 619 __ mov(r0, r3); |
| 622 __ str(r2, MemOperand(r3, 4, PostIndex)); | 620 __ str(r2, MemOperand(r3, 4, PostIndex)); |
| 623 __ RecordWrite(r6, | 621 __ RecordWrite(r6, |
| 624 r0, | 622 r0, |
| 625 r2, | 623 r2, |
| 626 kLRHasBeenSaved, | 624 kLRHasBeenSaved, |
| 627 kDontSaveFPRegs, | 625 kDontSaveFPRegs, |
| 628 EMIT_REMEMBERED_SET, | 626 EMIT_REMEMBERED_SET, |
| 629 OMIT_SMI_CHECK); | 627 OMIT_SMI_CHECK); |
| 630 __ b(&entry); | 628 __ b(&entry); |
| 631 | 629 |
| 632 // Replace the-hole NaN with the-hole pointer. | 630 // Replace the-hole NaN with the-hole pointer. |
| 633 __ bind(&convert_hole); | 631 __ bind(&convert_hole); |
| 634 __ str(r7, MemOperand(r3, 4, PostIndex)); | 632 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); |
| 633 __ str(r0, MemOperand(r3, 4, PostIndex)); | |
| 635 | 634 |
| 636 __ bind(&entry); | 635 __ bind(&entry); |
| 637 __ cmp(r3, r5); | 636 __ cmp(r3, r5); |
| 638 __ b(lt, &loop); | 637 __ b(lt, &loop); |
| 639 | 638 |
| 640 __ Pop(r3, r2, r1, r0); | 639 __ Pop(r3, r2, r1, r0); |
| 641 // Replace receiver's backing store with newly created and filled FixedArray. | 640 // Replace receiver's backing store with newly created and filled FixedArray. |
| 642 __ str(r6, FieldMemOperand(r2, JSObject::kElementsOffset)); | 641 __ str(r6, FieldMemOperand(r2, JSObject::kElementsOffset)); |
| 643 __ RecordWriteField(r2, | 642 __ RecordWriteField(r2, |
| 644 JSObject::kElementsOffset, | 643 JSObject::kElementsOffset, |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 patcher.masm()->add(r0, pc, Operand(-8)); | 883 patcher.masm()->add(r0, pc, Operand(-8)); |
| 885 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 884 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 886 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 885 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 887 } | 886 } |
| 888 } | 887 } |
| 889 | 888 |
| 890 | 889 |
| 891 } } // namespace v8::internal | 890 } } // namespace v8::internal |
| 892 | 891 |
| 893 #endif // V8_TARGET_ARCH_ARM | 892 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |