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

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

Issue 12440041: Generalizing remaining Allocate functions in the macro assemblers used in pretenuring. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/code-stubs-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 __ pop(eax); 209 __ pop(eax);
210 210
211 __ bind(&allocate); 211 __ bind(&allocate);
212 } 212 }
213 213
214 // Now allocate the JSObject on the heap. 214 // Now allocate the JSObject on the heap.
215 // edi: constructor 215 // edi: constructor
216 // eax: initial map 216 // eax: initial map
217 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset)); 217 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset));
218 __ shl(edi, kPointerSizeLog2); 218 __ shl(edi, kPointerSizeLog2);
219 __ AllocateInNewSpace( 219 __ Allocate(edi, ebx, edi, no_reg, &rt_call, NO_ALLOCATION_FLAGS);
220 edi, ebx, edi, no_reg, &rt_call, NO_ALLOCATION_FLAGS);
221 // Allocated the JSObject, now initialize the fields. 220 // Allocated the JSObject, now initialize the fields.
222 // eax: initial map 221 // eax: initial map
223 // ebx: JSObject 222 // ebx: JSObject
224 // edi: start of next object 223 // edi: start of next object
225 __ mov(Operand(ebx, JSObject::kMapOffset), eax); 224 __ mov(Operand(ebx, JSObject::kMapOffset), eax);
226 Factory* factory = masm->isolate()->factory(); 225 Factory* factory = masm->isolate()->factory();
227 __ mov(ecx, factory->empty_fixed_array()); 226 __ mov(ecx, factory->empty_fixed_array());
228 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx); 227 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx);
229 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx); 228 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx);
230 // Set extra fields in the newly allocated object. 229 // Set extra fields in the newly allocated object.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 __ sub(edx, ecx); 272 __ sub(edx, ecx);
274 // Done if no extra properties are to be allocated. 273 // Done if no extra properties are to be allocated.
275 __ j(zero, &allocated); 274 __ j(zero, &allocated);
276 __ Assert(positive, "Property allocation count failed."); 275 __ Assert(positive, "Property allocation count failed.");
277 276
278 // Scale the number of elements by pointer size and add the header for 277 // Scale the number of elements by pointer size and add the header for
279 // FixedArrays to the start of the next object calculation from above. 278 // FixedArrays to the start of the next object calculation from above.
280 // ebx: JSObject 279 // ebx: JSObject
281 // edi: start of next object (will be start of FixedArray) 280 // edi: start of next object (will be start of FixedArray)
282 // edx: number of elements in properties array 281 // edx: number of elements in properties array
283 __ AllocateInNewSpace(FixedArray::kHeaderSize, 282 __ Allocate(FixedArray::kHeaderSize,
284 times_pointer_size, 283 times_pointer_size,
285 edx, 284 edx,
286 REGISTER_VALUE_IS_INT32, 285 REGISTER_VALUE_IS_INT32,
287 edi, 286 edi,
288 ecx, 287 ecx,
289 no_reg, 288 no_reg,
290 &undo_allocation, 289 &undo_allocation,
291 RESULT_CONTAINS_TOP); 290 RESULT_CONTAINS_TOP);
292 291
293 // Initialize the FixedArray. 292 // Initialize the FixedArray.
294 // ebx: JSObject 293 // ebx: JSObject
295 // edi: FixedArray 294 // edi: FixedArray
296 // edx: number of elements 295 // edx: number of elements
297 // ecx: start of next object 296 // ecx: start of next object
298 __ mov(eax, factory->fixed_array_map()); 297 __ mov(eax, factory->fixed_array_map());
299 __ mov(Operand(edi, FixedArray::kMapOffset), eax); // setup the map 298 __ mov(Operand(edi, FixedArray::kMapOffset), eax); // setup the map
300 __ SmiTag(edx); 299 __ SmiTag(edx);
301 __ mov(Operand(edi, FixedArray::kLengthOffset), edx); // and length 300 __ mov(Operand(edi, FixedArray::kLengthOffset), edx); // and length
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 ASSERT(scratch.is(edi)); // rep stos destination 1117 ASSERT(scratch.is(edi)); // rep stos destination
1119 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count 1118 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count
1120 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax 1119 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax
1121 1120
1122 __ LoadInitialArrayMap(array_function, scratch, 1121 __ LoadInitialArrayMap(array_function, scratch,
1123 elements_array, fill_with_hole); 1122 elements_array, fill_with_hole);
1124 1123
1125 // Allocate the JSArray object together with space for a FixedArray with the 1124 // Allocate the JSArray object together with space for a FixedArray with the
1126 // requested elements. 1125 // requested elements.
1127 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 1126 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
1128 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, 1127 __ Allocate(JSArray::kSize + FixedArray::kHeaderSize,
1129 times_pointer_size, 1128 times_pointer_size,
1130 array_size, 1129 array_size,
1131 REGISTER_VALUE_IS_SMI, 1130 REGISTER_VALUE_IS_SMI,
1132 result, 1131 result,
1133 elements_array_end, 1132 elements_array_end,
1134 scratch, 1133 scratch,
1135 gc_required, 1134 gc_required,
1136 TAG_OBJECT); 1135 TAG_OBJECT);
1137 1136
1138 // Allocated the JSArray. Now initialize the fields except for the elements 1137 // Allocated the JSArray. Now initialize the fields except for the elements
1139 // array. 1138 // array.
1140 // result: JSObject 1139 // result: JSObject
1141 // elements_array: initial map 1140 // elements_array: initial map
1142 // elements_array_end: start of next object 1141 // elements_array_end: start of next object
1143 // array_size: size of array (smi) 1142 // array_size: size of array (smi)
1144 __ mov(FieldOperand(result, JSObject::kMapOffset), elements_array); 1143 __ mov(FieldOperand(result, JSObject::kMapOffset), elements_array);
1145 Factory* factory = masm->isolate()->factory(); 1144 Factory* factory = masm->isolate()->factory();
1146 __ mov(elements_array, factory->empty_fixed_array()); 1145 __ mov(elements_array, factory->empty_fixed_array());
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1872 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1874 generator.Generate(); 1873 generator.Generate();
1875 } 1874 }
1876 1875
1877 1876
1878 #undef __ 1877 #undef __
1879 } 1878 }
1880 } // namespace v8::internal 1879 } // namespace v8::internal
1881 1880
1882 #endif // V8_TARGET_ARCH_IA32 1881 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698