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

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

Issue 184009: First 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/objects.h » ('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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ldr(result, MemOperand(scratch1));
786 786
787 // Calculate new top and bail out if new space is exhausted. Use result 787 // Calculate new top and bail out if new space is exhausted. Use result
788 // to calculate the new top. 788 // to calculate the new top.
789 ExternalReference new_space_allocation_limit = 789 ExternalReference new_space_allocation_limit =
790 ExternalReference::new_space_allocation_limit_address(); 790 ExternalReference::new_space_allocation_limit_address();
791 mov(scratch2, Operand(new_space_allocation_limit)); 791 mov(scratch2, Operand(new_space_allocation_limit));
792 ldr(scratch2, MemOperand(scratch2)); 792 ldr(scratch2, MemOperand(scratch2));
793 add(result, result, Operand(object_size)); 793 add(result, result, Operand(object_size * kPointerSize));
794 cmp(result, Operand(scratch2)); 794 cmp(result, Operand(scratch2));
795 b(hi, gc_required); 795 b(hi, gc_required);
796 796
797 // Update allocation top. result temporarily holds the new top, 797 // Update allocation top. result temporarily holds the new top,
798 str(result, MemOperand(scratch1)); 798 str(result, MemOperand(scratch1));
799 799
800 // Tag and adjust back to start of new object. 800 // Tag and adjust back to start of new object.
801 if (tag_allocated_object) { 801 if (tag_allocated_object) {
802 sub(result, result, Operand(object_size - kHeapObjectTag)); 802 sub(result, result, Operand((object_size * kPointerSize) -
803 kHeapObjectTag));
803 } else { 804 } else {
804 sub(result, result, Operand(object_size)); 805 sub(result, result, Operand(object_size * kPointerSize));
805 } 806 }
806 } 807 }
807 808
808 809
810 void MacroAssembler::AllocateObjectInNewSpace(Register object_size,
811 Register result,
812 Register scratch1,
813 Register scratch2,
814 Label* gc_required,
815 bool tag_allocated_object) {
816 ASSERT(!result.is(scratch1));
817 ASSERT(!scratch1.is(scratch2));
818
819 // Load address of new object into result and allocation top address into
820 // scratch1.
821 ExternalReference new_space_allocation_top =
822 ExternalReference::new_space_allocation_top_address();
823 mov(scratch1, Operand(new_space_allocation_top));
824 ldr(result, MemOperand(scratch1));
825
826 // 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
828 // get the number of bytes
829 ExternalReference new_space_allocation_limit =
830 ExternalReference::new_space_allocation_limit_address();
831 mov(scratch2, Operand(new_space_allocation_limit));
832 ldr(scratch2, MemOperand(scratch2));
833 add(result, result, Operand(object_size, LSL, kPointerSizeLog2));
834
835 cmp(result, Operand(scratch2));
836 b(hi, gc_required);
837
838 // Update allocation top. result temporarily holds the new top,
839 str(result, MemOperand(scratch1));
840
841 // Tag and adjust back to start of new object.
842 if (tag_allocated_object) {
843 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2));
844 add(result, result, Operand(kHeapObjectTag));
845 } else {
846 sub(result, result, Operand(object_size, LSL, kPointerSizeLog2));
847 }
848 }
849
850
851 void MacroAssembler::UndoAllocationInNewSpace(Register object,
852 Register scratch) {
853 ExternalReference new_space_allocation_top =
854 ExternalReference::new_space_allocation_top_address();
855
856 // Make sure the object has no tag before resetting top.
857 and_(object, object, Operand(~kHeapObjectTagMask));
858 #ifdef DEBUG
859 // Check that the object un-allocated is below the current top.
860 mov(scratch, Operand(new_space_allocation_top));
861 ldr(scratch, MemOperand(scratch));
862 cmp(object, scratch);
863 Check(lt, "Undo allocation of non allocated memory");
864 #endif
865 // Write the address of the object to un-allocate as the current top.
866 mov(scratch, Operand(new_space_allocation_top));
867 str(object, MemOperand(scratch));
868 }
869
870
809 void MacroAssembler::CompareObjectType(Register function, 871 void MacroAssembler::CompareObjectType(Register function,
810 Register map, 872 Register map,
811 Register type_reg, 873 Register type_reg,
812 InstanceType type) { 874 InstanceType type) {
813 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset)); 875 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset));
876 CompareInstanceType(map, type_reg, type);
877 }
878
879
880 void MacroAssembler::CompareInstanceType(Register map,
881 Register type_reg,
882 InstanceType type) {
814 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); 883 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
815 cmp(type_reg, Operand(type)); 884 cmp(type_reg, Operand(type));
816 } 885 }
817 886
818 887
819 void MacroAssembler::TryGetFunctionPrototype(Register function, 888 void MacroAssembler::TryGetFunctionPrototype(Register function,
820 Register result, 889 Register result,
821 Register scratch, 890 Register scratch,
822 Label* miss) { 891 Label* miss) {
823 // Check that the receiver isn't a smi. 892 // Check that the receiver isn't a smi.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 mov(r0, Operand(p0)); 1124 mov(r0, Operand(p0));
1056 push(r0); 1125 push(r0);
1057 mov(r0, Operand(Smi::FromInt(p1 - p0))); 1126 mov(r0, Operand(Smi::FromInt(p1 - p0)));
1058 push(r0); 1127 push(r0);
1059 CallRuntime(Runtime::kAbort, 2); 1128 CallRuntime(Runtime::kAbort, 2);
1060 // will not return here 1129 // will not return here
1061 } 1130 }
1062 1131
1063 1132
1064 } } // namespace v8::internal 1133 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698