Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 201015: Second step in allocating objects in generated code on ARM (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 766
767 bind(&same_contexts); 767 bind(&same_contexts);
768 } 768 }
769 769
770 770
771 void MacroAssembler::AllocateObjectInNewSpace(int object_size, 771 void MacroAssembler::AllocateObjectInNewSpace(int object_size,
772 Register result, 772 Register result,
773 Register scratch1, 773 Register scratch1,
774 Register scratch2, 774 Register scratch2,
775 Label* gc_required, 775 Label* gc_required,
776 bool tag_allocated_object) { 776 AllocationFlags flags) {
777 ASSERT(!result.is(scratch1)); 777 ASSERT(!result.is(scratch1));
778 ASSERT(!scratch1.is(scratch2)); 778 ASSERT(!scratch1.is(scratch2));
779 779
780 // Load address of new object into result and allocation top address into 780 // Load address of new object into result and allocation top address into
781 // scratch1. 781 // scratch1.
782 ExternalReference new_space_allocation_top = 782 ExternalReference new_space_allocation_top =
783 ExternalReference::new_space_allocation_top_address(); 783 ExternalReference::new_space_allocation_top_address();
784 mov(scratch1, Operand(new_space_allocation_top)); 784 mov(scratch1, Operand(new_space_allocation_top));
785 ldr(result, MemOperand(scratch1)); 785 if ((flags & RESULT_CONTAINS_TOP) == 0) {
786 ldr(result, MemOperand(scratch1));
787 } else {
788 #ifdef DEBUG
789 // Assert that result actually contains top on entry. scratch2 is used
790 // immediately below so this use of scratch2 does not cause difference with
791 // respect to register content between debug and release mode.
792 ldr(scratch2, MemOperand(scratch1));
793 cmp(result, scratch2);
794 Check(eq, "Unexpected allocation top");
795 #endif
796 }
786 797
787 // Calculate new top and bail out if new space is exhausted. Use result 798 // Calculate new top and bail out if new space is exhausted. Use result
788 // to calculate the new top. 799 // to calculate the new top.
789 ExternalReference new_space_allocation_limit = 800 ExternalReference new_space_allocation_limit =
790 ExternalReference::new_space_allocation_limit_address(); 801 ExternalReference::new_space_allocation_limit_address();
791 mov(scratch2, Operand(new_space_allocation_limit)); 802 mov(scratch2, Operand(new_space_allocation_limit));
792 ldr(scratch2, MemOperand(scratch2)); 803 ldr(scratch2, MemOperand(scratch2));
793 add(result, result, Operand(object_size * kPointerSize)); 804 add(result, result, Operand(object_size * kPointerSize));
794 cmp(result, Operand(scratch2)); 805 cmp(result, Operand(scratch2));
795 b(hi, gc_required); 806 b(hi, gc_required);
796 807
797 // Update allocation top. result temporarily holds the new top, 808 // Update allocation top. result temporarily holds the new top,
798 str(result, MemOperand(scratch1)); 809 str(result, MemOperand(scratch1));
799 810
800 // Tag and adjust back to start of new object. 811 // Tag and adjust back to start of new object.
801 if (tag_allocated_object) { 812 if ((flags & TAG_OBJECT) != 0) {
802 sub(result, result, Operand((object_size * kPointerSize) - 813 sub(result, result, Operand((object_size * kPointerSize) -
803 kHeapObjectTag)); 814 kHeapObjectTag));
804 } else { 815 } else {
805 sub(result, result, Operand(object_size * kPointerSize)); 816 sub(result, result, Operand(object_size * kPointerSize));
806 } 817 }
807 } 818 }
808 819
809 820
810 void MacroAssembler::AllocateObjectInNewSpace(Register object_size, 821 void MacroAssembler::AllocateObjectInNewSpace(Register object_size,
811 Register result, 822 Register result,
812 Register scratch1, 823 Register scratch1,
813 Register scratch2, 824 Register scratch2,
814 Label* gc_required, 825 Label* gc_required,
815 bool tag_allocated_object) { 826 AllocationFlags flags) {
816 ASSERT(!result.is(scratch1)); 827 ASSERT(!result.is(scratch1));
817 ASSERT(!scratch1.is(scratch2)); 828 ASSERT(!scratch1.is(scratch2));
818 829
819 // Load address of new object into result and allocation top address into 830 // Load address of new object into result and allocation top address into
820 // scratch1. 831 // scratch1.
821 ExternalReference new_space_allocation_top = 832 ExternalReference new_space_allocation_top =
822 ExternalReference::new_space_allocation_top_address(); 833 ExternalReference::new_space_allocation_top_address();
823 mov(scratch1, Operand(new_space_allocation_top)); 834 mov(scratch1, Operand(new_space_allocation_top));
824 ldr(result, MemOperand(scratch1)); 835 if ((flags & RESULT_CONTAINS_TOP) == 0) {
836 ldr(result, MemOperand(scratch1));
837 } else {
838 #ifdef DEBUG
839 // Assert that result actually contains top on entry. scratch2 is used
840 // immediately below so this use of scratch2 does not cause difference with
841 // respect to register content between debug and release mode.
842 ldr(scratch2, MemOperand(scratch1));
843 cmp(result, scratch2);
844 Check(eq, "Unexpected allocation top");
845 #endif
846 }
825 847
826 // Calculate new top and bail out if new space is exhausted. Use result 848 // Calculate new top and bail out if new space is exhausted. Use result
827 // to calculate the new top. Object size is in words so a shift is required to 849 // to calculate the new top. Object size is in words so a shift is required to
828 // get the number of bytes 850 // get the number of bytes
829 ExternalReference new_space_allocation_limit = 851 ExternalReference new_space_allocation_limit =
830 ExternalReference::new_space_allocation_limit_address(); 852 ExternalReference::new_space_allocation_limit_address();
831 mov(scratch2, Operand(new_space_allocation_limit)); 853 mov(scratch2, Operand(new_space_allocation_limit));
832 ldr(scratch2, MemOperand(scratch2)); 854 ldr(scratch2, MemOperand(scratch2));
833 add(result, result, Operand(object_size, LSL, kPointerSizeLog2)); 855 add(result, result, Operand(object_size, LSL, kPointerSizeLog2));
834
835 cmp(result, Operand(scratch2)); 856 cmp(result, Operand(scratch2));
836 b(hi, gc_required); 857 b(hi, gc_required);
837 858
838 // Update allocation top. result temporarily holds the new top, 859 // Update allocation top. result temporarily holds the new top,
839 str(result, MemOperand(scratch1)); 860 str(result, MemOperand(scratch1));
840 861
841 // Tag and adjust back to start of new object. 862 // Adjust back to start of new object.
842 if (tag_allocated_object) { 863 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2));
843 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); 864
865 // Tag object if requested.
866 if ((flags & TAG_OBJECT) != 0) {
844 add(result, result, Operand(kHeapObjectTag)); 867 add(result, result, Operand(kHeapObjectTag));
845 } else {
846 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2));
847 } 868 }
848 } 869 }
849 870
850 871
851 void MacroAssembler::UndoAllocationInNewSpace(Register object, 872 void MacroAssembler::UndoAllocationInNewSpace(Register object,
852 Register scratch) { 873 Register scratch) {
853 ExternalReference new_space_allocation_top = 874 ExternalReference new_space_allocation_top =
854 ExternalReference::new_space_allocation_top_address(); 875 ExternalReference::new_space_allocation_top_address();
855 876
856 // Make sure the object has no tag before resetting top. 877 // Make sure the object has no tag before resetting top.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 mov(r0, Operand(p0)); 1145 mov(r0, Operand(p0));
1125 push(r0); 1146 push(r0);
1126 mov(r0, Operand(Smi::FromInt(p1 - p0))); 1147 mov(r0, Operand(Smi::FromInt(p1 - p0)));
1127 push(r0); 1148 push(r0);
1128 CallRuntime(Runtime::kAbort, 2); 1149 CallRuntime(Runtime::kAbort, 2);
1129 // will not return here 1150 // will not return here
1130 } 1151 }
1131 1152
1132 1153
1133 } } // namespace v8::internal 1154 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698