| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 Register result, | 665 Register result, |
| 666 Register result_end, | 666 Register result_end, |
| 667 Register scratch, | 667 Register scratch, |
| 668 Label* gc_required, | 668 Label* gc_required, |
| 669 AllocationFlags flags) { | 669 AllocationFlags flags) { |
| 670 ASSERT(!result.is(result_end)); | 670 ASSERT(!result.is(result_end)); |
| 671 | 671 |
| 672 // Load address of new object into result. | 672 // Load address of new object into result. |
| 673 LoadAllocationTopHelper(result, result_end, scratch, flags); | 673 LoadAllocationTopHelper(result, result_end, scratch, flags); |
| 674 | 674 |
| 675 Register top_reg = result_end.is_valid() ? result_end : result; |
| 676 |
| 675 // Calculate new top and bail out if new space is exhausted. | 677 // Calculate new top and bail out if new space is exhausted. |
| 676 ExternalReference new_space_allocation_limit = | 678 ExternalReference new_space_allocation_limit = |
| 677 ExternalReference::new_space_allocation_limit_address(); | 679 ExternalReference::new_space_allocation_limit_address(); |
| 678 lea(result_end, Operand(result, object_size)); | 680 |
| 679 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | 681 if (top_reg.is(result)) { |
| 682 add(Operand(top_reg), Immediate(object_size)); |
| 683 } else { |
| 684 lea(top_reg, Operand(result, object_size)); |
| 685 } |
| 686 cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit)); |
| 680 j(above, gc_required, not_taken); | 687 j(above, gc_required, not_taken); |
| 681 | 688 |
| 689 // Update allocation top. |
| 690 UpdateAllocationTopHelper(top_reg, scratch); |
| 691 |
| 682 // Tag result if requested. | 692 // Tag result if requested. |
| 683 if ((flags & TAG_OBJECT) != 0) { | 693 if (top_reg.is(result)) { |
| 684 lea(result, Operand(result, kHeapObjectTag)); | 694 if ((flags & TAG_OBJECT) != 0) { |
| 695 sub(Operand(result), Immediate(object_size - kHeapObjectTag)); |
| 696 } else { |
| 697 sub(Operand(result), Immediate(object_size)); |
| 698 } |
| 699 } else if ((flags & TAG_OBJECT) != 0) { |
| 700 add(Operand(result), Immediate(kHeapObjectTag)); |
| 685 } | 701 } |
| 686 | |
| 687 // Update allocation top. | |
| 688 UpdateAllocationTopHelper(result_end, scratch); | |
| 689 } | 702 } |
| 690 | 703 |
| 691 | 704 |
| 692 void MacroAssembler::AllocateInNewSpace(int header_size, | 705 void MacroAssembler::AllocateInNewSpace(int header_size, |
| 693 ScaleFactor element_size, | 706 ScaleFactor element_size, |
| 694 Register element_count, | 707 Register element_count, |
| 695 Register result, | 708 Register result, |
| 696 Register result_end, | 709 Register result_end, |
| 697 Register scratch, | 710 Register scratch, |
| 698 Label* gc_required, | 711 Label* gc_required, |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 | 1611 |
| 1599 // Check that the code was patched as expected. | 1612 // Check that the code was patched as expected. |
| 1600 ASSERT(masm_.pc_ == address_ + size_); | 1613 ASSERT(masm_.pc_ == address_ + size_); |
| 1601 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1614 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1602 } | 1615 } |
| 1603 | 1616 |
| 1604 | 1617 |
| 1605 } } // namespace v8::internal | 1618 } } // namespace v8::internal |
| 1606 | 1619 |
| 1607 #endif // V8_TARGET_ARCH_IA32 | 1620 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |