| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 597 |
| 598 // Load address of new object into result. | 598 // Load address of new object into result. |
| 599 LoadAllocationTopHelper(result, scratch, flags); | 599 LoadAllocationTopHelper(result, scratch, flags); |
| 600 | 600 |
| 601 Register top_reg = result_end.is_valid() ? result_end : result; | 601 Register top_reg = result_end.is_valid() ? result_end : result; |
| 602 | 602 |
| 603 // Calculate new top and bail out if new space is exhausted. | 603 // Calculate new top and bail out if new space is exhausted. |
| 604 ExternalReference new_space_allocation_limit = | 604 ExternalReference new_space_allocation_limit = |
| 605 ExternalReference::new_space_allocation_limit_address(); | 605 ExternalReference::new_space_allocation_limit_address(); |
| 606 | 606 |
| 607 if (top_reg.is(result)) { | 607 if (!top_reg.is(result)) { |
| 608 add(Operand(top_reg), Immediate(object_size)); | 608 mov(top_reg, result); |
| 609 } else { | |
| 610 lea(top_reg, Operand(result, object_size)); | |
| 611 } | 609 } |
| 610 add(Operand(top_reg), Immediate(object_size)); |
| 611 j(carry, gc_required, not_taken); |
| 612 cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit)); | 612 cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit)); |
| 613 j(above, gc_required, not_taken); | 613 j(above, gc_required, not_taken); |
| 614 | 614 |
| 615 // Update allocation top. | 615 // Update allocation top. |
| 616 UpdateAllocationTopHelper(top_reg, scratch); | 616 UpdateAllocationTopHelper(top_reg, scratch); |
| 617 | 617 |
| 618 // Tag result if requested. | 618 // Tag result if requested. |
| 619 if (top_reg.is(result)) { | 619 if (top_reg.is(result)) { |
| 620 if ((flags & TAG_OBJECT) != 0) { | 620 if ((flags & TAG_OBJECT) != 0) { |
| 621 sub(Operand(result), Immediate(object_size - kHeapObjectTag)); | 621 sub(Operand(result), Immediate(object_size - kHeapObjectTag)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 650 return; | 650 return; |
| 651 } | 651 } |
| 652 ASSERT(!result.is(result_end)); | 652 ASSERT(!result.is(result_end)); |
| 653 | 653 |
| 654 // Load address of new object into result. | 654 // Load address of new object into result. |
| 655 LoadAllocationTopHelper(result, scratch, flags); | 655 LoadAllocationTopHelper(result, scratch, flags); |
| 656 | 656 |
| 657 // Calculate new top and bail out if new space is exhausted. | 657 // Calculate new top and bail out if new space is exhausted. |
| 658 ExternalReference new_space_allocation_limit = | 658 ExternalReference new_space_allocation_limit = |
| 659 ExternalReference::new_space_allocation_limit_address(); | 659 ExternalReference::new_space_allocation_limit_address(); |
| 660 lea(result_end, Operand(result, element_count, element_size, header_size)); | 660 |
| 661 // We assume that element_count*element_size + header_size does not |
| 662 // overflow. |
| 663 lea(result_end, Operand(element_count, element_size, header_size)); |
| 664 add(result_end, Operand(result)); |
| 665 j(carry, gc_required); |
| 661 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 666 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
| 662 j(above, gc_required); | 667 j(above, gc_required); |
| 663 | 668 |
| 664 // Tag result if requested. | 669 // Tag result if requested. |
| 665 if ((flags & TAG_OBJECT) != 0) { | 670 if ((flags & TAG_OBJECT) != 0) { |
| 666 lea(result, Operand(result, kHeapObjectTag)); | 671 lea(result, Operand(result, kHeapObjectTag)); |
| 667 } | 672 } |
| 668 | 673 |
| 669 // Update allocation top. | 674 // Update allocation top. |
| 670 UpdateAllocationTopHelper(result_end, scratch); | 675 UpdateAllocationTopHelper(result_end, scratch); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 695 // Load address of new object into result. | 700 // Load address of new object into result. |
| 696 LoadAllocationTopHelper(result, scratch, flags); | 701 LoadAllocationTopHelper(result, scratch, flags); |
| 697 | 702 |
| 698 // Calculate new top and bail out if new space is exhausted. | 703 // Calculate new top and bail out if new space is exhausted. |
| 699 ExternalReference new_space_allocation_limit = | 704 ExternalReference new_space_allocation_limit = |
| 700 ExternalReference::new_space_allocation_limit_address(); | 705 ExternalReference::new_space_allocation_limit_address(); |
| 701 if (!object_size.is(result_end)) { | 706 if (!object_size.is(result_end)) { |
| 702 mov(result_end, object_size); | 707 mov(result_end, object_size); |
| 703 } | 708 } |
| 704 add(result_end, Operand(result)); | 709 add(result_end, Operand(result)); |
| 710 j(carry, gc_required, not_taken); |
| 705 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 711 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
| 706 j(above, gc_required, not_taken); | 712 j(above, gc_required, not_taken); |
| 707 | 713 |
| 708 // Tag result if requested. | 714 // Tag result if requested. |
| 709 if ((flags & TAG_OBJECT) != 0) { | 715 if ((flags & TAG_OBJECT) != 0) { |
| 710 lea(result, Operand(result, kHeapObjectTag)); | 716 lea(result, Operand(result, kHeapObjectTag)); |
| 711 } | 717 } |
| 712 | 718 |
| 713 // Update allocation top. | 719 // Update allocation top. |
| 714 UpdateAllocationTopHelper(result_end, scratch); | 720 UpdateAllocationTopHelper(result_end, scratch); |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 | 1905 |
| 1900 // Check that the code was patched as expected. | 1906 // Check that the code was patched as expected. |
| 1901 ASSERT(masm_.pc_ == address_ + size_); | 1907 ASSERT(masm_.pc_ == address_ + size_); |
| 1902 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1908 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1903 } | 1909 } |
| 1904 | 1910 |
| 1905 | 1911 |
| 1906 } } // namespace v8::internal | 1912 } } // namespace v8::internal |
| 1907 | 1913 |
| 1908 #endif // V8_TARGET_ARCH_IA32 | 1914 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |