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

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

Issue 11684005: Refactor and improve inlined double-aligned allocations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 11 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/code-stubs-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 __ b(eq, &only_change_map); 186 __ b(eq, &only_change_map);
187 187
188 __ push(lr); 188 __ push(lr);
189 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); 189 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset));
190 // r4: source FixedArray 190 // r4: source FixedArray
191 // r5: number of elements (smi-tagged) 191 // r5: number of elements (smi-tagged)
192 192
193 // Allocate new FixedDoubleArray. 193 // Allocate new FixedDoubleArray.
194 // Use lr as a temporary register. 194 // Use lr as a temporary register.
195 __ mov(lr, Operand(r5, LSL, 2)); 195 __ mov(lr, Operand(r5, LSL, 2));
196 __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize + kPointerSize)); 196 __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize));
197 __ AllocateInNewSpace(lr, r6, r7, r9, &gc_required, NO_ALLOCATION_FLAGS); 197 __ AllocateInNewSpace(lr, r6, r7, r9, &gc_required, DOUBLE_ALIGNMENT);
198 // r6: destination FixedDoubleArray, not tagged as heap object. 198 // r6: destination FixedDoubleArray, not tagged as heap object.
199 199
200 // Align the array conveniently for doubles.
201 // Store a filler value in the unused memory.
202 Label aligned, aligned_done;
203 __ tst(r6, Operand(kDoubleAlignmentMask));
204 __ mov(ip, Operand(masm->isolate()->factory()->one_pointer_filler_map()));
205 __ b(eq, &aligned);
206 // Store at the beginning of the allocated memory and update the base pointer.
207 __ str(ip, MemOperand(r6, kPointerSize, PostIndex));
208 __ b(&aligned_done);
209
210 __ bind(&aligned);
211 // Store the filler at the end of the allocated memory.
212 __ sub(lr, lr, Operand(kPointerSize));
213 __ str(ip, MemOperand(r6, lr));
214
215 __ bind(&aligned_done);
216
217 // Set destination FixedDoubleArray's length and map. 200 // Set destination FixedDoubleArray's length and map.
218 __ LoadRoot(r9, Heap::kFixedDoubleArrayMapRootIndex); 201 __ LoadRoot(r9, Heap::kFixedDoubleArrayMapRootIndex);
219 __ str(r5, MemOperand(r6, FixedDoubleArray::kLengthOffset)); 202 __ str(r5, MemOperand(r6, FixedDoubleArray::kLengthOffset));
220 // Update receiver's map. 203 // Update receiver's map.
221 __ str(r9, MemOperand(r6, HeapObject::kMapOffset)); 204 __ str(r9, MemOperand(r6, HeapObject::kMapOffset));
222 205
223 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); 206 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset));
224 __ RecordWriteField(r2, 207 __ RecordWriteField(r2,
225 HeapObject::kMapOffset, 208 HeapObject::kMapOffset,
226 r3, 209 r3,
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 patcher.masm()->add(r0, pc, Operand(-8)); 681 patcher.masm()->add(r0, pc, Operand(-8));
699 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 682 patcher.masm()->ldr(pc, MemOperand(pc, -4));
700 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); 683 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
701 } 684 }
702 } 685 }
703 686
704 687
705 } } // namespace v8::internal 688 } } // namespace v8::internal
706 689
707 #endif // V8_TARGET_ARCH_ARM 690 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698