| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 | 579 |
| 580 | 580 |
| 581 void MacroAssembler::AllocateInNewSpace(int object_size, | 581 void MacroAssembler::AllocateInNewSpace(int object_size, |
| 582 Register result, | 582 Register result, |
| 583 Register result_end, | 583 Register result_end, |
| 584 Register scratch, | 584 Register scratch, |
| 585 Label* gc_required, | 585 Label* gc_required, |
| 586 AllocationFlags flags) { | 586 AllocationFlags flags) { |
| 587 if (!FLAG_inline_new) { |
| 588 if (FLAG_debug_code) { |
| 589 // Trash the registers to simulate an allocation failure. |
| 590 mov(result, Immediate(0x7091)); |
| 591 if (result_end.is_valid()) { |
| 592 mov(result_end, Immediate(0x7191)); |
| 593 } |
| 594 if (scratch.is_valid()) { |
| 595 mov(scratch, Immediate(0x7291)); |
| 596 } |
| 597 } |
| 598 jmp(gc_required); |
| 599 return; |
| 600 } |
| 587 ASSERT(!result.is(result_end)); | 601 ASSERT(!result.is(result_end)); |
| 588 | 602 |
| 589 // Load address of new object into result. | 603 // Load address of new object into result. |
| 590 LoadAllocationTopHelper(result, result_end, scratch, flags); | 604 LoadAllocationTopHelper(result, result_end, scratch, flags); |
| 591 | 605 |
| 592 Register top_reg = result_end.is_valid() ? result_end : result; | 606 Register top_reg = result_end.is_valid() ? result_end : result; |
| 593 | 607 |
| 594 // Calculate new top and bail out if new space is exhausted. | 608 // Calculate new top and bail out if new space is exhausted. |
| 595 ExternalReference new_space_allocation_limit = | 609 ExternalReference new_space_allocation_limit = |
| 596 ExternalReference::new_space_allocation_limit_address(); | 610 ExternalReference::new_space_allocation_limit_address(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 620 | 634 |
| 621 | 635 |
| 622 void MacroAssembler::AllocateInNewSpace(int header_size, | 636 void MacroAssembler::AllocateInNewSpace(int header_size, |
| 623 ScaleFactor element_size, | 637 ScaleFactor element_size, |
| 624 Register element_count, | 638 Register element_count, |
| 625 Register result, | 639 Register result, |
| 626 Register result_end, | 640 Register result_end, |
| 627 Register scratch, | 641 Register scratch, |
| 628 Label* gc_required, | 642 Label* gc_required, |
| 629 AllocationFlags flags) { | 643 AllocationFlags flags) { |
| 644 if (!FLAG_inline_new) { |
| 645 if (FLAG_debug_code) { |
| 646 // Trash the registers to simulate an allocation failure. |
| 647 mov(result, Immediate(0x7091)); |
| 648 mov(result_end, Immediate(0x7191)); |
| 649 if (scratch.is_valid()) { |
| 650 mov(scratch, Immediate(0x7291)); |
| 651 } |
| 652 // Register element_count is not modified by the function. |
| 653 } |
| 654 jmp(gc_required); |
| 655 return; |
| 656 } |
| 630 ASSERT(!result.is(result_end)); | 657 ASSERT(!result.is(result_end)); |
| 631 | 658 |
| 632 // Load address of new object into result. | 659 // Load address of new object into result. |
| 633 LoadAllocationTopHelper(result, result_end, scratch, flags); | 660 LoadAllocationTopHelper(result, result_end, scratch, flags); |
| 634 | 661 |
| 635 // Calculate new top and bail out if new space is exhausted. | 662 // Calculate new top and bail out if new space is exhausted. |
| 636 ExternalReference new_space_allocation_limit = | 663 ExternalReference new_space_allocation_limit = |
| 637 ExternalReference::new_space_allocation_limit_address(); | 664 ExternalReference::new_space_allocation_limit_address(); |
| 638 lea(result_end, Operand(result, element_count, element_size, header_size)); | 665 lea(result_end, Operand(result, element_count, element_size, header_size)); |
| 639 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 666 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
| 640 j(above, gc_required); | 667 j(above, gc_required); |
| 641 | 668 |
| 642 // Tag result if requested. | 669 // Tag result if requested. |
| 643 if ((flags & TAG_OBJECT) != 0) { | 670 if ((flags & TAG_OBJECT) != 0) { |
| 644 lea(result, Operand(result, kHeapObjectTag)); | 671 lea(result, Operand(result, kHeapObjectTag)); |
| 645 } | 672 } |
| 646 | 673 |
| 647 // Update allocation top. | 674 // Update allocation top. |
| 648 UpdateAllocationTopHelper(result_end, scratch); | 675 UpdateAllocationTopHelper(result_end, scratch); |
| 649 } | 676 } |
| 650 | 677 |
| 651 | 678 |
| 652 void MacroAssembler::AllocateInNewSpace(Register object_size, | 679 void MacroAssembler::AllocateInNewSpace(Register object_size, |
| 653 Register result, | 680 Register result, |
| 654 Register result_end, | 681 Register result_end, |
| 655 Register scratch, | 682 Register scratch, |
| 656 Label* gc_required, | 683 Label* gc_required, |
| 657 AllocationFlags flags) { | 684 AllocationFlags flags) { |
| 685 if (!FLAG_inline_new) { |
| 686 if (FLAG_debug_code) { |
| 687 // Trash the registers to simulate an allocation failure. |
| 688 mov(result, Immediate(0x7091)); |
| 689 mov(result_end, Immediate(0x7191)); |
| 690 if (scratch.is_valid()) { |
| 691 mov(scratch, Immediate(0x7291)); |
| 692 } |
| 693 // object_size is left unchanged by this function. |
| 694 } |
| 695 jmp(gc_required); |
| 696 return; |
| 697 } |
| 658 ASSERT(!result.is(result_end)); | 698 ASSERT(!result.is(result_end)); |
| 659 | 699 |
| 660 // Load address of new object into result. | 700 // Load address of new object into result. |
| 661 LoadAllocationTopHelper(result, result_end, scratch, flags); | 701 LoadAllocationTopHelper(result, result_end, scratch, flags); |
| 662 | 702 |
| 663 // Calculate new top and bail out if new space is exhausted. | 703 // Calculate new top and bail out if new space is exhausted. |
| 664 ExternalReference new_space_allocation_limit = | 704 ExternalReference new_space_allocation_limit = |
| 665 ExternalReference::new_space_allocation_limit_address(); | 705 ExternalReference::new_space_allocation_limit_address(); |
| 666 if (!object_size.is(result_end)) { | 706 if (!object_size.is(result_end)) { |
| 667 mov(result_end, object_size); | 707 mov(result_end, object_size); |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 | 1712 |
| 1673 // Check that the code was patched as expected. | 1713 // Check that the code was patched as expected. |
| 1674 ASSERT(masm_.pc_ == address_ + size_); | 1714 ASSERT(masm_.pc_ == address_ + size_); |
| 1675 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1715 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1676 } | 1716 } |
| 1677 | 1717 |
| 1678 | 1718 |
| 1679 } } // namespace v8::internal | 1719 } } // namespace v8::internal |
| 1680 | 1720 |
| 1681 #endif // V8_TARGET_ARCH_IA32 | 1721 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |