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

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

Issue 2047002: Add a flag to the ARM version of new space allocation in generated code... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 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') | src/arm/codegen-arm.cc » ('J')
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 int initial_capacity, 100 int initial_capacity,
101 Label* gc_required) { 101 Label* gc_required) {
102 ASSERT(initial_capacity > 0); 102 ASSERT(initial_capacity > 0);
103 // Load the initial map from the array function. 103 // Load the initial map from the array function.
104 __ ldr(scratch1, FieldMemOperand(array_function, 104 __ ldr(scratch1, FieldMemOperand(array_function,
105 JSFunction::kPrototypeOrInitialMapOffset)); 105 JSFunction::kPrototypeOrInitialMapOffset));
106 106
107 // Allocate the JSArray object together with space for a fixed array with the 107 // Allocate the JSArray object together with space for a fixed array with the
108 // requested elements. 108 // requested elements.
109 int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity); 109 int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity);
110 __ AllocateInNewSpace(size / kPointerSize, 110 __ AllocateInNewSpace(size,
111 result, 111 result,
112 scratch2, 112 scratch2,
113 scratch3, 113 scratch3,
114 gc_required, 114 gc_required,
115 TAG_OBJECT); 115 TAG_OBJECT);
116 116
117 // Allocated the JSArray. Now initialize the fields except for the elements 117 // Allocated the JSArray. Now initialize the fields except for the elements
118 // array. 118 // array.
119 // result: JSObject 119 // result: JSObject
120 // scratch1: initial map 120 // scratch1: initial map
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 JSFunction::kPrototypeOrInitialMapOffset)); 184 JSFunction::kPrototypeOrInitialMapOffset));
185 185
186 // Check whether an empty sized array is requested. 186 // Check whether an empty sized array is requested.
187 __ tst(array_size, array_size); 187 __ tst(array_size, array_size);
188 __ b(nz, &not_empty); 188 __ b(nz, &not_empty);
189 189
190 // If an empty array is requested allocate a small elements array anyway. This 190 // If an empty array is requested allocate a small elements array anyway. This
191 // keeps the code below free of special casing for the empty array. 191 // keeps the code below free of special casing for the empty array.
192 int size = JSArray::kSize + 192 int size = JSArray::kSize +
193 FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); 193 FixedArray::SizeFor(JSArray::kPreallocatedArrayElements);
194 __ AllocateInNewSpace(size / kPointerSize, 194 __ AllocateInNewSpace(size,
195 result, 195 result,
196 elements_array_end, 196 elements_array_end,
197 scratch1, 197 scratch1,
198 gc_required, 198 gc_required,
199 TAG_OBJECT); 199 TAG_OBJECT);
200 __ jmp(&allocated); 200 __ jmp(&allocated);
201 201
202 // Allocate the JSArray object together with space for a FixedArray with the 202 // Allocate the JSArray object together with space for a FixedArray with the
203 // requested number of elements. 203 // requested number of elements.
204 __ bind(&not_empty); 204 __ bind(&not_empty);
205 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 205 ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
206 __ mov(elements_array_end, 206 __ mov(elements_array_end,
207 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize)); 207 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize));
208 __ add(elements_array_end, 208 __ add(elements_array_end,
209 elements_array_end, 209 elements_array_end,
210 Operand(array_size, ASR, kSmiTagSize)); 210 Operand(array_size, ASR, kSmiTagSize));
211 __ AllocateInNewSpace(elements_array_end, 211 __ AllocateInNewSpace(
212 result, 212 elements_array_end,
213 scratch1, 213 result,
214 scratch2, 214 scratch1,
215 gc_required, 215 scratch2,
216 TAG_OBJECT); 216 gc_required,
217 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
217 218
218 // Allocated the JSArray. Now initialize the fields except for the elements 219 // Allocated the JSArray. Now initialize the fields except for the elements
219 // array. 220 // array.
220 // result: JSObject 221 // result: JSObject
221 // elements_array_storage: initial map 222 // elements_array_storage: initial map
222 // array_size: size of array (smi) 223 // array_size: size of array (smi)
223 __ bind(&allocated); 224 __ bind(&allocated);
224 __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset)); 225 __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset));
225 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex); 226 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex);
226 __ str(elements_array_storage, 227 __ str(elements_array_storage,
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // r2: initial map 555 // r2: initial map
555 // r7: undefined 556 // r7: undefined
556 __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE); 557 __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE);
557 __ b(eq, &rt_call); 558 __ b(eq, &rt_call);
558 559
559 // Now allocate the JSObject on the heap. 560 // Now allocate the JSObject on the heap.
560 // r1: constructor function 561 // r1: constructor function
561 // r2: initial map 562 // r2: initial map
562 // r7: undefined 563 // r7: undefined
563 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset)); 564 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset));
564 __ AllocateInNewSpace(r3, r4, r5, r6, &rt_call, NO_ALLOCATION_FLAGS); 565 __ AllocateInNewSpace(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS);
565 566
566 // Allocated the JSObject, now initialize the fields. Map is set to initial 567 // Allocated the JSObject, now initialize the fields. Map is set to initial
567 // map and properties and elements are set to empty fixed array. 568 // map and properties and elements are set to empty fixed array.
568 // r1: constructor function 569 // r1: constructor function
569 // r2: initial map 570 // r2: initial map
570 // r3: object size 571 // r3: object size
571 // r4: JSObject (not tagged) 572 // r4: JSObject (not tagged)
572 // r7: undefined 573 // r7: undefined
573 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); 574 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
574 __ mov(r5, r4); 575 __ mov(r5, r4);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 __ Assert(pl, "Property allocation count failed."); 626 __ Assert(pl, "Property allocation count failed.");
626 627
627 // Scale the number of elements by pointer size and add the header for 628 // Scale the number of elements by pointer size and add the header for
628 // FixedArrays to the start of the next object calculation from above. 629 // FixedArrays to the start of the next object calculation from above.
629 // r1: constructor 630 // r1: constructor
630 // r3: number of elements in properties array 631 // r3: number of elements in properties array
631 // r4: JSObject 632 // r4: JSObject
632 // r5: start of next object 633 // r5: start of next object
633 // r7: undefined 634 // r7: undefined
634 __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize)); 635 __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize));
635 __ AllocateInNewSpace(r0, 636 __ AllocateInNewSpace(
636 r5, 637 r0,
637 r6, 638 r5,
638 r2, 639 r6,
639 &undo_allocation, 640 r2,
640 RESULT_CONTAINS_TOP); 641 &undo_allocation,
642 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS));
641 643
642 // Initialize the FixedArray. 644 // Initialize the FixedArray.
643 // r1: constructor 645 // r1: constructor
644 // r3: number of elements in properties array 646 // r3: number of elements in properties array
645 // r4: JSObject 647 // r4: JSObject
646 // r5: FixedArray (not tagged) 648 // r5: FixedArray (not tagged)
647 // r7: undefined 649 // r7: undefined
648 __ LoadRoot(r6, Heap::kFixedArrayMapRootIndex); 650 __ LoadRoot(r6, Heap::kFixedArrayMapRootIndex);
649 __ mov(r2, r5); 651 __ mov(r2, r5);
650 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); 652 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset);
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 // Dont adapt arguments. 1304 // Dont adapt arguments.
1303 // ------------------------------------------- 1305 // -------------------------------------------
1304 __ bind(&dont_adapt_arguments); 1306 __ bind(&dont_adapt_arguments);
1305 __ Jump(r3); 1307 __ Jump(r3);
1306 } 1308 }
1307 1309
1308 1310
1309 #undef __ 1311 #undef __
1310 1312
1311 } } // namespace v8::internal 1313 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/codegen-arm.cc » ('j') | src/arm/codegen-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698