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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 void ElementsTransitionGenerator::GenerateDoubleToObject( | 555 void ElementsTransitionGenerator::GenerateDoubleToObject( |
556 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 556 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
557 // ----------- S t a t e ------------- | 557 // ----------- S t a t e ------------- |
558 // -- r0 : value | 558 // -- r0 : value |
559 // -- r1 : key | 559 // -- r1 : key |
560 // -- r2 : receiver | 560 // -- r2 : receiver |
561 // -- lr : return address | 561 // -- lr : return address |
562 // -- r3 : target map, scratch for subsequent call | 562 // -- r3 : target map, scratch for subsequent call |
563 // -- r4 : scratch (elements) | 563 // -- r4 : scratch (elements) |
564 // ----------------------------------- | 564 // ----------------------------------- |
565 Label entry, loop, convert_hole, gc_required, only_change_map; | 565 Label entry, loop, convert_hole, gc_required, gc_cleanup, only_change_map; |
566 | 566 |
567 if (mode == TRACK_ALLOCATION_SITE) { | 567 if (mode == TRACK_ALLOCATION_SITE) { |
568 __ JumpIfJSArrayHasAllocationMemento(r2, r4, fail); | 568 __ JumpIfJSArrayHasAllocationMemento(r2, r4, fail); |
569 } | 569 } |
570 | 570 |
571 // Check for empty arrays, which only require a map transition and no changes | 571 // Check for empty arrays, which only require a map transition and no changes |
572 // to the backing store. | 572 // to the backing store. |
573 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | 573 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); |
574 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 574 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
575 __ b(eq, &only_change_map); | 575 __ b(eq, &only_change_map); |
(...skipping 21 matching lines...) Expand all Loading... |
597 __ add(r5, r3, Operand(r5, LSL, 1)); | 597 __ add(r5, r3, Operand(r5, LSL, 1)); |
598 __ LoadRoot(r9, Heap::kHeapNumberMapRootIndex); | 598 __ LoadRoot(r9, Heap::kHeapNumberMapRootIndex); |
599 // Using offsetted addresses in r4 to fully take advantage of post-indexing. | 599 // Using offsetted addresses in r4 to fully take advantage of post-indexing. |
600 // r3: begin of destination FixedArray element fields, not tagged | 600 // r3: begin of destination FixedArray element fields, not tagged |
601 // r4: begin of source FixedDoubleArray element fields, not tagged, +4 | 601 // r4: begin of source FixedDoubleArray element fields, not tagged, +4 |
602 // r5: end of destination FixedArray, not tagged | 602 // r5: end of destination FixedArray, not tagged |
603 // r6: destination FixedArray | 603 // r6: destination FixedArray |
604 // r9: heap number map | 604 // r9: heap number map |
605 __ b(&entry); | 605 __ b(&entry); |
606 | 606 |
| 607 __ bind(&gc_cleanup); |
| 608 #ifdef VERIFY_HEAP |
| 609 // Make sure new space is iterable if we are verifying the heap. |
| 610 __ mov(r0, Operand(masm->isolate()->factory()->one_pointer_filler_map())); |
| 611 __ str(r0, MemOperand(r3, 4, PostIndex)); |
| 612 __ cmp(r3, r5); |
| 613 __ b(lt, &gc_cleanup); |
| 614 #endif |
| 615 |
607 // Call into runtime if GC is required. | 616 // Call into runtime if GC is required. |
608 __ bind(&gc_required); | 617 __ bind(&gc_required); |
609 __ Pop(r3, r2, r1, r0); | 618 __ Pop(r3, r2, r1, r0); |
610 __ pop(lr); | 619 __ pop(lr); |
611 __ b(fail); | 620 __ b(fail); |
612 | 621 |
613 __ bind(&loop); | 622 __ bind(&loop); |
614 __ ldr(r1, MemOperand(r4, 8, PostIndex)); | 623 __ ldr(r1, MemOperand(r4, 8, PostIndex)); |
615 // r1: current element's upper 32 bit | 624 // r1: current element's upper 32 bit |
616 // r4: address of next element's upper 32 bit | 625 // r4: address of next element's upper 32 bit |
617 __ cmp(r1, Operand(kHoleNanUpper32)); | 626 __ cmp(r1, Operand(kHoleNanUpper32)); |
618 __ b(eq, &convert_hole); | 627 __ b(eq, &convert_hole); |
619 | 628 |
620 // Non-hole double, copy value into a heap number. | 629 // Non-hole double, copy value into a heap number. |
621 __ AllocateHeapNumber(r2, r0, lr, r9, &gc_required); | 630 __ AllocateHeapNumber(r2, r0, lr, r9, &gc_cleanup); |
622 // r2: new heap number | 631 // r2: new heap number |
623 __ ldr(r0, MemOperand(r4, 12, NegOffset)); | 632 __ ldr(r0, MemOperand(r4, 12, NegOffset)); |
624 __ Strd(r0, r1, FieldMemOperand(r2, HeapNumber::kValueOffset)); | 633 __ Strd(r0, r1, FieldMemOperand(r2, HeapNumber::kValueOffset)); |
625 __ mov(r0, r3); | 634 __ mov(r0, r3); |
626 __ str(r2, MemOperand(r3, 4, PostIndex)); | 635 __ str(r2, MemOperand(r3, 4, PostIndex)); |
627 __ RecordWrite(r6, | 636 __ RecordWrite(r6, |
628 r0, | 637 r0, |
629 r2, | 638 r2, |
630 kLRHasBeenSaved, | 639 kLRHasBeenSaved, |
631 kDontSaveFPRegs, | 640 kDontSaveFPRegs, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 patcher.masm()->add(r0, pc, Operand(-8)); | 920 patcher.masm()->add(r0, pc, Operand(-8)); |
912 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 921 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
913 patcher.masm()->emit_code_stub_address(stub); | 922 patcher.masm()->emit_code_stub_address(stub); |
914 } | 923 } |
915 } | 924 } |
916 | 925 |
917 | 926 |
918 } } // namespace v8::internal | 927 } } // namespace v8::internal |
919 | 928 |
920 #endif // V8_TARGET_ARCH_ARM | 929 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |