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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 219030: Change the functions named AllocateObjectInNewSpace to AllocateInNewSpace (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/stub-cache-arm.cc ('k') | src/ia32/codegen-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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // edi: constructor 122 // edi: constructor
123 // eax: initial map 123 // eax: initial map
124 __ CmpInstanceType(eax, JS_FUNCTION_TYPE); 124 __ CmpInstanceType(eax, JS_FUNCTION_TYPE);
125 __ j(equal, &rt_call); 125 __ j(equal, &rt_call);
126 126
127 // Now allocate the JSObject on the heap. 127 // Now allocate the JSObject on the heap.
128 // edi: constructor 128 // edi: constructor
129 // eax: initial map 129 // eax: initial map
130 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset)); 130 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset));
131 __ shl(edi, kPointerSizeLog2); 131 __ shl(edi, kPointerSizeLog2);
132 __ AllocateObjectInNewSpace(edi, 132 __ AllocateInNewSpace(edi, ebx, edi, no_reg, &rt_call, NO_ALLOCATION_FLAGS);
133 ebx,
134 edi,
135 no_reg,
136 &rt_call,
137 NO_ALLOCATION_FLAGS);
138 // Allocated the JSObject, now initialize the fields. 133 // Allocated the JSObject, now initialize the fields.
139 // eax: initial map 134 // eax: initial map
140 // ebx: JSObject 135 // ebx: JSObject
141 // edi: start of next object 136 // edi: start of next object
142 __ mov(Operand(ebx, JSObject::kMapOffset), eax); 137 __ mov(Operand(ebx, JSObject::kMapOffset), eax);
143 __ mov(ecx, Factory::empty_fixed_array()); 138 __ mov(ecx, Factory::empty_fixed_array());
144 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx); 139 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx);
145 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx); 140 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx);
146 // Set extra fields in the newly allocated object. 141 // Set extra fields in the newly allocated object.
147 // eax: initial map 142 // eax: initial map
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 __ sub(edx, Operand(ecx)); 177 __ sub(edx, Operand(ecx));
183 // Done if no extra properties are to be allocated. 178 // Done if no extra properties are to be allocated.
184 __ j(zero, &allocated); 179 __ j(zero, &allocated);
185 __ Assert(positive, "Property allocation count failed."); 180 __ Assert(positive, "Property allocation count failed.");
186 181
187 // Scale the number of elements by pointer size and add the header for 182 // Scale the number of elements by pointer size and add the header for
188 // FixedArrays to the start of the next object calculation from above. 183 // FixedArrays to the start of the next object calculation from above.
189 // ebx: JSObject 184 // ebx: JSObject
190 // edi: start of next object (will be start of FixedArray) 185 // edi: start of next object (will be start of FixedArray)
191 // edx: number of elements in properties array 186 // edx: number of elements in properties array
192 __ AllocateObjectInNewSpace(FixedArray::kHeaderSize, 187 __ AllocateInNewSpace(FixedArray::kHeaderSize,
193 times_pointer_size, 188 times_pointer_size,
194 edx, 189 edx,
195 edi, 190 edi,
196 ecx, 191 ecx,
197 no_reg, 192 no_reg,
198 &undo_allocation, 193 &undo_allocation,
199 RESULT_CONTAINS_TOP); 194 RESULT_CONTAINS_TOP);
200 195
201 // Initialize the FixedArray. 196 // Initialize the FixedArray.
202 // ebx: JSObject 197 // ebx: JSObject
203 // edi: FixedArray 198 // edi: FixedArray
204 // edx: number of elements 199 // edx: number of elements
205 // ecx: start of next object 200 // ecx: start of next object
206 __ mov(eax, Factory::fixed_array_map()); 201 __ mov(eax, Factory::fixed_array_map());
207 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map 202 __ mov(Operand(edi, JSObject::kMapOffset), eax); // setup the map
208 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length 203 __ mov(Operand(edi, Array::kLengthOffset), edx); // and length
209 204
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // Load the initial map from the array function. 685 // Load the initial map from the array function.
691 __ mov(scratch1, FieldOperand(array_function, 686 __ mov(scratch1, FieldOperand(array_function,
692 JSFunction::kPrototypeOrInitialMapOffset)); 687 JSFunction::kPrototypeOrInitialMapOffset));
693 688
694 // Allocate the JSArray object together with space for a fixed array with the 689 // Allocate the JSArray object together with space for a fixed array with the
695 // requested elements. 690 // requested elements.
696 int size = JSArray::kSize; 691 int size = JSArray::kSize;
697 if (initial_capacity > 0) { 692 if (initial_capacity > 0) {
698 size += FixedArray::SizeFor(initial_capacity); 693 size += FixedArray::SizeFor(initial_capacity);
699 } 694 }
700 __ AllocateObjectInNewSpace(size, 695 __ AllocateInNewSpace(size,
701 result, 696 result,
702 scratch2, 697 scratch2,
703 scratch3, 698 scratch3,
704 gc_required, 699 gc_required,
705 TAG_OBJECT); 700 TAG_OBJECT);
706 701
707 // Allocated the JSArray. Now initialize the fields except for the elements 702 // Allocated the JSArray. Now initialize the fields except for the elements
708 // array. 703 // array.
709 // result: JSObject 704 // result: JSObject
710 // scratch1: initial map 705 // scratch1: initial map
711 // scratch2: start of next object 706 // scratch2: start of next object
712 __ mov(FieldOperand(result, JSObject::kMapOffset), scratch1); 707 __ mov(FieldOperand(result, JSObject::kMapOffset), scratch1);
713 __ mov(FieldOperand(result, JSArray::kPropertiesOffset), 708 __ mov(FieldOperand(result, JSArray::kPropertiesOffset),
714 Factory::empty_fixed_array()); 709 Factory::empty_fixed_array());
715 // Field JSArray::kElementsOffset is initialized later. 710 // Field JSArray::kElementsOffset is initialized later.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 FieldOperand(array_function, 786 FieldOperand(array_function,
792 JSFunction::kPrototypeOrInitialMapOffset)); 787 JSFunction::kPrototypeOrInitialMapOffset));
793 788
794 // Check whether an empty sized array is requested. 789 // Check whether an empty sized array is requested.
795 __ test(array_size, Operand(array_size)); 790 __ test(array_size, Operand(array_size));
796 __ j(not_zero, &not_empty); 791 __ j(not_zero, &not_empty);
797 792
798 // If an empty array is requested allocate a small elements array anyway. This 793 // If an empty array is requested allocate a small elements array anyway. This
799 // keeps the code below free of special casing for the empty array. 794 // keeps the code below free of special casing for the empty array.
800 int size = JSArray::kSize + FixedArray::SizeFor(kPreallocatedArrayElements); 795 int size = JSArray::kSize + FixedArray::SizeFor(kPreallocatedArrayElements);
801 __ AllocateObjectInNewSpace(size, 796 __ AllocateInNewSpace(size,
802 result, 797 result,
803 elements_array_end, 798 elements_array_end,
804 scratch, 799 scratch,
805 gc_required, 800 gc_required,
806 TAG_OBJECT); 801 TAG_OBJECT);
807 __ jmp(&allocated); 802 __ jmp(&allocated);
808 803
809 // Allocate the JSArray object together with space for a FixedArray with the 804 // Allocate the JSArray object together with space for a FixedArray with the
810 // requested elements. 805 // requested elements.
811 __ bind(&not_empty); 806 __ bind(&not_empty);
812 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 807 ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
813 __ AllocateObjectInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, 808 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize,
814 times_half_pointer_size, // array_size is a smi. 809 times_half_pointer_size, // array_size is a smi.
815 array_size, 810 array_size,
816 result, 811 result,
817 elements_array_end, 812 elements_array_end,
818 scratch, 813 scratch,
819 gc_required, 814 gc_required,
820 TAG_OBJECT); 815 TAG_OBJECT);
821 816
822 // Allocated the JSArray. Now initialize the fields except for the elements 817 // Allocated the JSArray. Now initialize the fields except for the elements
823 // array. 818 // array.
824 // result: JSObject 819 // result: JSObject
825 // elements_array: initial map 820 // elements_array: initial map
826 // elements_array_end: start of next object 821 // elements_array_end: start of next object
827 // array_size: size of array (smi) 822 // array_size: size of array (smi)
828 __ bind(&allocated); 823 __ bind(&allocated);
829 __ mov(FieldOperand(result, JSObject::kMapOffset), elements_array); 824 __ mov(FieldOperand(result, JSObject::kMapOffset), elements_array);
830 __ mov(elements_array, Factory::empty_fixed_array()); 825 __ mov(elements_array, Factory::empty_fixed_array());
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 // Dont adapt arguments. 1224 // Dont adapt arguments.
1230 // ------------------------------------------- 1225 // -------------------------------------------
1231 __ bind(&dont_adapt_arguments); 1226 __ bind(&dont_adapt_arguments);
1232 __ jmp(Operand(edx)); 1227 __ jmp(Operand(edx));
1233 } 1228 }
1234 1229
1235 1230
1236 #undef __ 1231 #undef __
1237 1232
1238 } } // namespace v8::internal 1233 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698