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

Side by Side Diff: src/arm/builtins-arm.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, 2 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 | « no previous file | src/arm/codegen-arm.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 int initial_capacity, 83 int initial_capacity,
84 Label* gc_required) { 84 Label* gc_required) {
85 ASSERT(initial_capacity > 0); 85 ASSERT(initial_capacity > 0);
86 // Load the initial map from the array function. 86 // Load the initial map from the array function.
87 __ ldr(scratch1, FieldMemOperand(array_function, 87 __ ldr(scratch1, FieldMemOperand(array_function,
88 JSFunction::kPrototypeOrInitialMapOffset)); 88 JSFunction::kPrototypeOrInitialMapOffset));
89 89
90 // Allocate the JSArray object together with space for a fixed array with the 90 // Allocate the JSArray object together with space for a fixed array with the
91 // requested elements. 91 // requested elements.
92 int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity); 92 int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity);
93 __ AllocateObjectInNewSpace(size / kPointerSize, 93 __ AllocateInNewSpace(size / kPointerSize,
94 result, 94 result,
95 scratch2, 95 scratch2,
96 scratch3, 96 scratch3,
97 gc_required, 97 gc_required,
98 TAG_OBJECT); 98 TAG_OBJECT);
99 99
100 // Allocated the JSArray. Now initialize the fields except for the elements 100 // Allocated the JSArray. Now initialize the fields except for the elements
101 // array. 101 // array.
102 // result: JSObject 102 // result: JSObject
103 // scratch1: initial map 103 // scratch1: initial map
104 // scratch2: start of next object 104 // scratch2: start of next object
105 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); 105 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset));
106 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); 106 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex);
107 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); 107 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset));
108 // Field JSArray::kElementsOffset is initialized later. 108 // Field JSArray::kElementsOffset is initialized later.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 JSFunction::kPrototypeOrInitialMapOffset)); 167 JSFunction::kPrototypeOrInitialMapOffset));
168 168
169 // Check whether an empty sized array is requested. 169 // Check whether an empty sized array is requested.
170 __ tst(array_size, array_size); 170 __ tst(array_size, array_size);
171 __ b(nz, &not_empty); 171 __ b(nz, &not_empty);
172 172
173 // If an empty array is requested allocate a small elements array anyway. This 173 // If an empty array is requested allocate a small elements array anyway. This
174 // keeps the code below free of special casing for the empty array. 174 // keeps the code below free of special casing for the empty array.
175 int size = JSArray::kSize + 175 int size = JSArray::kSize +
176 FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); 176 FixedArray::SizeFor(JSArray::kPreallocatedArrayElements);
177 __ AllocateObjectInNewSpace(size / kPointerSize, 177 __ AllocateInNewSpace(size / kPointerSize,
178 result, 178 result,
179 elements_array_end, 179 elements_array_end,
180 scratch1, 180 scratch1,
181 gc_required, 181 gc_required,
182 TAG_OBJECT); 182 TAG_OBJECT);
183 __ jmp(&allocated); 183 __ jmp(&allocated);
184 184
185 // Allocate the JSArray object together with space for a FixedArray with the 185 // Allocate the JSArray object together with space for a FixedArray with the
186 // requested number of elements. 186 // requested number of elements.
187 __ bind(&not_empty); 187 __ bind(&not_empty);
188 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 188 ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
189 __ mov(elements_array_end, 189 __ mov(elements_array_end,
190 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize)); 190 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize));
191 __ add(elements_array_end, 191 __ add(elements_array_end,
192 elements_array_end, 192 elements_array_end,
193 Operand(array_size, ASR, kSmiTagSize)); 193 Operand(array_size, ASR, kSmiTagSize));
194 __ AllocateObjectInNewSpace(elements_array_end, 194 __ AllocateInNewSpace(elements_array_end,
195 result, 195 result,
196 scratch1, 196 scratch1,
197 scratch2, 197 scratch2,
198 gc_required, 198 gc_required,
199 TAG_OBJECT); 199 TAG_OBJECT);
200 200
201 // Allocated the JSArray. Now initialize the fields except for the elements 201 // Allocated the JSArray. Now initialize the fields except for the elements
202 // array. 202 // array.
203 // result: JSObject 203 // result: JSObject
204 // elements_array_storage: initial map 204 // elements_array_storage: initial map
205 // array_size: size of array (smi) 205 // array_size: size of array (smi)
206 __ bind(&allocated); 206 __ bind(&allocated);
207 __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset)); 207 __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset));
208 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex); 208 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex);
209 __ str(elements_array_storage, 209 __ str(elements_array_storage,
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // r2: initial map 533 // r2: initial map
534 // r7: undefined 534 // r7: undefined
535 __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE); 535 __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE);
536 __ b(eq, &rt_call); 536 __ b(eq, &rt_call);
537 537
538 // Now allocate the JSObject on the heap. 538 // Now allocate the JSObject on the heap.
539 // r1: constructor function 539 // r1: constructor function
540 // r2: initial map 540 // r2: initial map
541 // r7: undefined 541 // r7: undefined
542 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset)); 542 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset));
543 __ AllocateObjectInNewSpace(r3, r4, r5, r6, &rt_call, NO_ALLOCATION_FLAGS); 543 __ AllocateInNewSpace(r3, r4, r5, r6, &rt_call, NO_ALLOCATION_FLAGS);
544 544
545 // Allocated the JSObject, now initialize the fields. Map is set to initial 545 // Allocated the JSObject, now initialize the fields. Map is set to initial
546 // map and properties and elements are set to empty fixed array. 546 // map and properties and elements are set to empty fixed array.
547 // r1: constructor function 547 // r1: constructor function
548 // r2: initial map 548 // r2: initial map
549 // r3: object size 549 // r3: object size
550 // r4: JSObject (not tagged) 550 // r4: JSObject (not tagged)
551 // r7: undefined 551 // r7: undefined
552 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); 552 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
553 __ mov(r5, r4); 553 __ mov(r5, r4);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 __ Assert(pl, "Property allocation count failed."); 604 __ Assert(pl, "Property allocation count failed.");
605 605
606 // Scale the number of elements by pointer size and add the header for 606 // Scale the number of elements by pointer size and add the header for
607 // FixedArrays to the start of the next object calculation from above. 607 // FixedArrays to the start of the next object calculation from above.
608 // r1: constructor 608 // r1: constructor
609 // r3: number of elements in properties array 609 // r3: number of elements in properties array
610 // r4: JSObject 610 // r4: JSObject
611 // r5: start of next object 611 // r5: start of next object
612 // r7: undefined 612 // r7: undefined
613 __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize)); 613 __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize));
614 __ AllocateObjectInNewSpace(r0, 614 __ AllocateInNewSpace(r0,
615 r5, 615 r5,
616 r6, 616 r6,
617 r2, 617 r2,
618 &undo_allocation, 618 &undo_allocation,
619 RESULT_CONTAINS_TOP); 619 RESULT_CONTAINS_TOP);
620 620
621 // Initialize the FixedArray. 621 // Initialize the FixedArray.
622 // r1: constructor 622 // r1: constructor
623 // r3: number of elements in properties array 623 // r3: number of elements in properties array
624 // r4: JSObject 624 // r4: JSObject
625 // r5: FixedArray (not tagged) 625 // r5: FixedArray (not tagged)
626 // r7: undefined 626 // r7: undefined
627 __ LoadRoot(r6, Heap::kFixedArrayMapRootIndex); 627 __ LoadRoot(r6, Heap::kFixedArrayMapRootIndex);
628 __ mov(r2, r5); 628 __ mov(r2, r5);
629 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); 629 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset);
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 // Dont adapt arguments. 1278 // Dont adapt arguments.
1279 // ------------------------------------------- 1279 // -------------------------------------------
1280 __ bind(&dont_adapt_arguments); 1280 __ bind(&dont_adapt_arguments);
1281 __ Jump(r3); 1281 __ Jump(r3);
1282 } 1282 }
1283 1283
1284 1284
1285 #undef __ 1285 #undef __
1286 1286
1287 } } // namespace v8::internal 1287 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698