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

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
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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 ASSERT(scratch.is(edi)); // rep stos destination 1121 ASSERT(scratch.is(edi)); // rep stos destination
1123 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count 1122 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count
1124 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax 1123 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax
1125 1124
1126 __ LoadInitialArrayMap(array_function, scratch, 1125 __ LoadInitialArrayMap(array_function, scratch,
1127 elements_array, fill_with_hole); 1126 elements_array, fill_with_hole);
1128 1127
1129 // Allocate the JSArray object together with space for a FixedArray with the 1128 // Allocate the JSArray object together with space for a FixedArray with the
1130 // requested elements. 1129 // requested elements.
1131 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 1130 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
1132 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, 1131 __ Allocate(JSArray::kSize + FixedArray::kHeaderSize,
1133 times_pointer_size, 1132 times_pointer_size,
1134 array_size, 1133 array_size,
1135 REGISTER_VALUE_IS_SMI, 1134 REGISTER_VALUE_IS_SMI,
1136 result, 1135 result,
1137 elements_array_end, 1136 elements_array_end,
1138 scratch, 1137 scratch,
1139 gc_required, 1138 gc_required,
1140 TAG_OBJECT); 1139 TAG_OBJECT);
1141 1140
1142 // Allocated the JSArray. Now initialize the fields except for the elements 1141 // Allocated the JSArray. Now initialize the fields except for the elements
1143 // array. 1142 // array.
1144 // result: JSObject 1143 // result: JSObject
1145 // elements_array: initial map 1144 // elements_array: initial map
1146 // elements_array_end: start of next object 1145 // elements_array_end: start of next object
1147 // array_size: size of array (smi) 1146 // array_size: size of array (smi)
1148 __ mov(FieldOperand(result, JSObject::kMapOffset), elements_array); 1147 __ mov(FieldOperand(result, JSObject::kMapOffset), elements_array);
1149 Factory* factory = masm->isolate()->factory(); 1148 Factory* factory = masm->isolate()->factory();
1150 __ mov(elements_array, factory->empty_fixed_array()); 1149 __ mov(elements_array, factory->empty_fixed_array());
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1876 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1878 generator.Generate(); 1877 generator.Generate();
1879 } 1878 }
1880 1879
1881 1880
1882 #undef __ 1881 #undef __
1883 } 1882 }
1884 } // namespace v8::internal 1883 } // namespace v8::internal
1885 1884
1886 #endif // V8_TARGET_ARCH_IA32 1885 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698