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

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

Issue 9630011: Reallocate if transitioning fast-smi-only to fast-double from old space on x64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 8 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 | « no previous file | no next file » | 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 void ElementsTransitionGenerator::GenerateSmiOnlyToDouble( 221 void ElementsTransitionGenerator::GenerateSmiOnlyToDouble(
222 MacroAssembler* masm, Label* fail) { 222 MacroAssembler* masm, Label* fail) {
223 // ----------- S t a t e ------------- 223 // ----------- S t a t e -------------
224 // -- rax : value 224 // -- rax : value
225 // -- rbx : target map 225 // -- rbx : target map
226 // -- rcx : key 226 // -- rcx : key
227 // -- rdx : receiver 227 // -- rdx : receiver
228 // -- rsp[0] : return address 228 // -- rsp[0] : return address
229 // ----------------------------------- 229 // -----------------------------------
230 // The fail label is not actually used since we do not allocate. 230 // The fail label is not actually used since we do not allocate.
231 Label allocated, cow_array, only_change_map, done; 231 Label allocated, allocate_new, only_change_map, done;
232 232
233 // Check for empty arrays, which only require a map transition and no changes 233 // Check for empty arrays, which only require a map transition and no changes
234 // to the backing store. 234 // to the backing store.
235 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); 235 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset));
236 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); 236 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex);
237 __ j(equal, &only_change_map); 237 __ j(equal, &only_change_map);
238 238
239 // Check backing store for COW-ness. If the negative case, we do not have to 239 // Check backing store for COW-ness. If the negative case, we do not have to
240 // allocate a new array, since FixedArray and FixedDoubleArray do not differ 240 // allocate a new array, since FixedArray and FixedDoubleArray do not differ
241 // in size. 241 // in size.
242 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); 242 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset));
243 __ CompareRoot(FieldOperand(r8, HeapObject::kMapOffset), 243 __ CompareRoot(FieldOperand(r8, HeapObject::kMapOffset),
244 Heap::kFixedCOWArrayMapRootIndex); 244 Heap::kFixedCOWArrayMapRootIndex);
245 __ j(equal, &cow_array); 245 __ j(equal, &allocate_new);
246 // If the source array is in old space, it is in pointer space, but we would
247 // expect a fast double array in data space, therefore we re-allocate.
248 __ JumpIfNotInNewSpace(r8, r14, &allocate_new);
246 __ movq(r14, r8); // Destination array equals source array. 249 __ movq(r14, r8); // Destination array equals source array.
247 250
248 __ bind(&allocated); 251 __ bind(&allocated);
249 // r8 : source FixedArray 252 // r8 : source FixedArray
250 // r9 : elements array length 253 // r9 : elements array length
251 // r14: destination FixedDoubleArray 254 // r14: destination FixedDoubleArray
252 // Set backing store's map 255 // Set backing store's map
253 __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); 256 __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex);
254 __ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi); 257 __ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi);
255 258
(...skipping 10 matching lines...) Expand all
266 // Convert smis to doubles and holes to hole NaNs. The Array's length 269 // Convert smis to doubles and holes to hole NaNs. The Array's length
267 // remains unchanged. 270 // remains unchanged.
268 STATIC_ASSERT(FixedDoubleArray::kLengthOffset == FixedArray::kLengthOffset); 271 STATIC_ASSERT(FixedDoubleArray::kLengthOffset == FixedArray::kLengthOffset);
269 STATIC_ASSERT(FixedDoubleArray::kHeaderSize == FixedArray::kHeaderSize); 272 STATIC_ASSERT(FixedDoubleArray::kHeaderSize == FixedArray::kHeaderSize);
270 273
271 Label loop, entry, convert_hole; 274 Label loop, entry, convert_hole;
272 __ movq(r15, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE); 275 __ movq(r15, BitCast<int64_t, uint64_t>(kHoleNanInt64), RelocInfo::NONE);
273 // r15: the-hole NaN 276 // r15: the-hole NaN
274 __ jmp(&entry); 277 __ jmp(&entry);
275 278
276 // Allocate new array if the source array is a COW array. 279 // Allocate new array if the source array is a COW array or in old space.
277 __ bind(&cow_array); 280 __ bind(&allocate_new);
278 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); 281 __ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize));
279 __ AllocateInNewSpace(rdi, r14, r11, r15, fail, TAG_OBJECT); 282 __ AllocateInNewSpace(rdi, r14, r11, r15, fail, TAG_OBJECT);
280 // Set receiver's backing store. 283 // Set receiver's backing store.
281 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), r14); 284 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), r14);
282 __ movq(r11, r14); 285 __ movq(r11, r14);
283 __ RecordWriteField(rdx, 286 __ RecordWriteField(rdx,
284 JSObject::kElementsOffset, 287 JSObject::kElementsOffset,
285 r11, 288 r11,
286 r15, 289 r15,
287 kDontSaveFPRegs, 290 kDontSaveFPRegs,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 times_1, 545 times_1,
543 SeqAsciiString::kHeaderSize)); 546 SeqAsciiString::kHeaderSize));
544 __ bind(&done); 547 __ bind(&done);
545 } 548 }
546 549
547 #undef __ 550 #undef __
548 551
549 } } // namespace v8::internal 552 } } // namespace v8::internal
550 553
551 #endif // V8_TARGET_ARCH_X64 554 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698