| 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); | 1580 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); |
| 1575 return kNumSafepointRegisters - reg_code - 1; | 1581 return kNumSafepointRegisters - reg_code - 1; |
| 1576 } | 1582 } |
| 1577 | 1583 |
| 1578 | 1584 |
| 1579 void MacroAssembler::Ret() { | 1585 void MacroAssembler::Ret() { |
| 1580 ret(0); | 1586 ret(0); |
| 1581 } | 1587 } |
| 1582 | 1588 |
| 1583 | 1589 |
| 1590 void MacroAssembler::Ret(int bytes_dropped, Register scratch) { |
| 1591 if (is_uint16(bytes_dropped)) { |
| 1592 ret(bytes_dropped); |
| 1593 } else { |
| 1594 pop(scratch); |
| 1595 add(Operand(esp), Immediate(bytes_dropped)); |
| 1596 push(scratch); |
| 1597 ret(0); |
| 1598 } |
| 1599 } |
| 1600 |
| 1601 |
| 1602 |
| 1603 |
| 1584 void MacroAssembler::Drop(int stack_elements) { | 1604 void MacroAssembler::Drop(int stack_elements) { |
| 1585 if (stack_elements > 0) { | 1605 if (stack_elements > 0) { |
| 1586 add(Operand(esp), Immediate(stack_elements * kPointerSize)); | 1606 add(Operand(esp), Immediate(stack_elements * kPointerSize)); |
| 1587 } | 1607 } |
| 1588 } | 1608 } |
| 1589 | 1609 |
| 1590 | 1610 |
| 1591 void MacroAssembler::Move(Register dst, Register src) { | 1611 void MacroAssembler::Move(Register dst, Register src) { |
| 1592 if (!dst.is(src)) { | 1612 if (!dst.is(src)) { |
| 1593 mov(dst, src); | 1613 mov(dst, src); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 | 1919 |
| 1900 // Check that the code was patched as expected. | 1920 // Check that the code was patched as expected. |
| 1901 ASSERT(masm_.pc_ == address_ + size_); | 1921 ASSERT(masm_.pc_ == address_ + size_); |
| 1902 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1922 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1903 } | 1923 } |
| 1904 | 1924 |
| 1905 | 1925 |
| 1906 } } // namespace v8::internal | 1926 } } // namespace v8::internal |
| 1907 | 1927 |
| 1908 #endif // V8_TARGET_ARCH_IA32 | 1928 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |