OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 613 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
614 mov(scratch, FieldOperand(scratch, token_offset)); | 614 mov(scratch, FieldOperand(scratch, token_offset)); |
615 cmp(scratch, FieldOperand(holder_reg, token_offset)); | 615 cmp(scratch, FieldOperand(holder_reg, token_offset)); |
616 pop(holder_reg); | 616 pop(holder_reg); |
617 j(not_equal, miss, not_taken); | 617 j(not_equal, miss, not_taken); |
618 | 618 |
619 bind(&same_contexts); | 619 bind(&same_contexts); |
620 } | 620 } |
621 | 621 |
622 | 622 |
623 void MacroAssembler::LoadAllocationTopHelper( | |
624 Register result, | |
625 Register result_end, | |
626 Register scratch, | |
627 bool result_contains_top_on_entry) { | |
628 ExternalReference new_space_allocation_top = | |
629 ExternalReference::new_space_allocation_top_address(); | |
630 | |
631 // Just return if allocation top is already known. | |
632 if (result_contains_top_on_entry) { | |
633 // No use of scratch if allocation top is provided. | |
634 ASSERT(scratch.is(no_reg)); | |
635 return; | |
636 } | |
637 | |
638 // Move address of new object to result. Use scratch register if available. | |
639 if (scratch.is(no_reg)) { | |
640 mov(result, Operand::StaticVariable(new_space_allocation_top)); | |
641 } else { | |
642 ASSERT(!scratch.is(result_end)); | |
643 mov(Operand(scratch), Immediate(new_space_allocation_top)); | |
644 mov(result, Operand(scratch, 0)); | |
645 } | |
646 } | |
647 | |
648 | |
649 void MacroAssembler::UpdateAllocationTopHelper(Register result_end, | |
650 Register scratch) { | |
651 ExternalReference new_space_allocation_top = | |
652 ExternalReference::new_space_allocation_top_address(); | |
653 | |
654 // Update new top. Use scratch if available. | |
655 if (scratch.is(no_reg)) { | |
656 mov(Operand::StaticVariable(new_space_allocation_top), result_end); | |
657 } else { | |
658 mov(Operand(scratch, 0), result_end); | |
659 } | |
660 } | |
661 | |
662 void MacroAssembler::AllocateObjectInNewSpace( | |
663 int object_size, | |
664 Register result, | |
665 Register result_end, | |
666 Register scratch, | |
667 Label* gc_required, | |
668 bool result_contains_top_on_entry) { | |
669 ASSERT(!result.is(result_end)); | |
670 | |
671 // Load address of new object into result. | |
672 ExternalReference new_space_allocation_limit = | |
673 ExternalReference::new_space_allocation_limit_address(); | |
674 LoadAllocationTopHelper(result, | |
675 result_end, | |
676 scratch, | |
677 result_contains_top_on_entry); | |
678 | |
679 // Calculate new top and bail out if new space is exhausted. | |
680 lea(result_end, Operand(result, object_size)); | |
681 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | |
682 j(above, gc_required, not_taken); | |
683 | |
684 // Update allocation top. | |
685 UpdateAllocationTopHelper(result_end, scratch); | |
686 } | |
687 | |
688 | |
689 void MacroAssembler::AllocateObjectInNewSpace( | |
690 int header_size, | |
691 ScaleFactor element_size, | |
692 Register element_count, | |
693 Register result, | |
694 Register result_end, | |
695 Register scratch, | |
696 Label* gc_required, | |
697 bool result_contains_top_on_entry) { | |
698 ASSERT(!result.is(result_end)); | |
699 | |
700 // Load address of new object into result. | |
701 LoadAllocationTopHelper(result, | |
702 result_end, | |
703 scratch, | |
704 result_contains_top_on_entry); | |
705 | |
706 // Calculate new top and bail out if new space is exhausted. | |
707 ExternalReference new_space_allocation_limit = | |
708 ExternalReference::new_space_allocation_limit_address(); | |
709 lea(result_end, Operand(result, element_count, element_size, header_size)); | |
710 cmp(result, Operand::StaticVariable(new_space_allocation_limit)); | |
711 j(above, gc_required); | |
712 | |
713 // Update allocation top. | |
714 UpdateAllocationTopHelper(result_end, scratch); | |
715 } | |
716 | |
717 | |
718 void MacroAssembler::AllocateObjectInNewSpace( | |
719 Register object_size, | |
720 Register result, | |
721 Register result_end, | |
722 Register scratch, | |
723 Label* gc_required, | |
724 bool result_contains_top_on_entry) { | |
725 ASSERT(!result.is(result_end)); | |
726 | |
727 // Load address of new object into result. | |
728 LoadAllocationTopHelper(result, | |
729 result_end, | |
730 scratch, | |
731 result_contains_top_on_entry); | |
732 | |
733 | |
734 // Calculate new top and bail out if new space is exhausted. | |
735 ExternalReference new_space_allocation_limit = | |
736 ExternalReference::new_space_allocation_limit_address(); | |
737 if (!object_size.is(result_end)) { | |
738 mov(result_end, object_size); | |
739 } | |
740 add(result_end, Operand(result)); | |
741 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); | |
742 j(above, gc_required, not_taken); | |
743 | |
744 // Update allocation top. | |
745 UpdateAllocationTopHelper(result_end, scratch); | |
746 } | |
747 | |
748 | |
749 void MacroAssembler::UndoAllocationInNewSpace(Register object) { | |
750 ExternalReference new_space_allocation_top = | |
751 ExternalReference::new_space_allocation_top_address(); | |
752 | |
753 // Make sure the object has no tag before resetting top. | |
754 and_(Operand(object), Immediate(~kHeapObjectTagMask)); | |
755 #ifdef DEBUG | |
756 cmp(object, Operand::StaticVariable(new_space_allocation_top)); | |
757 Check(below, "Undo allocation of non allocated memory"); | |
758 #endif | |
759 mov(Operand::StaticVariable(new_space_allocation_top), object); | |
760 } | |
761 | |
762 | |
763 void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen, | 623 void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen, |
764 Register result, | 624 Register result, |
765 Register op, | 625 Register op, |
766 JumpTarget* then_target) { | 626 JumpTarget* then_target) { |
767 JumpTarget ok; | 627 JumpTarget ok; |
768 test(result, Operand(result)); | 628 test(result, Operand(result)); |
769 ok.Branch(not_zero, taken); | 629 ok.Branch(not_zero, taken); |
770 test(op, Operand(op)); | 630 test(op, Operand(op)); |
771 then_target->Branch(sign, not_taken); | 631 then_target->Branch(sign, not_taken); |
772 ok.Bind(); | 632 ok.Bind(); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 // Indicate that code has changed. | 1035 // Indicate that code has changed. |
1176 CPU::FlushICache(address_, size_); | 1036 CPU::FlushICache(address_, size_); |
1177 | 1037 |
1178 // Check that the code was patched as expected. | 1038 // Check that the code was patched as expected. |
1179 ASSERT(masm_.pc_ == address_ + size_); | 1039 ASSERT(masm_.pc_ == address_ + size_); |
1180 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1040 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1181 } | 1041 } |
1182 | 1042 |
1183 | 1043 |
1184 } } // namespace v8::internal | 1044 } } // namespace v8::internal |
OLD | NEW |