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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 11414155: Ensure double arrays are filled with holes when extended from variations of empty arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 years 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/elements.cc ('k') | src/parser.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 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 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); 4346 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements);
4347 __ AllocateInNewSpace(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT); 4347 __ AllocateInNewSpace(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT);
4348 4348
4349 // Restore the key, which is known to be the array length. 4349 // Restore the key, which is known to be the array length.
4350 __ mov(ecx, Immediate(0)); 4350 __ mov(ecx, Immediate(0));
4351 4351
4352 // eax: value 4352 // eax: value
4353 // ecx: key 4353 // ecx: key
4354 // edx: receiver 4354 // edx: receiver
4355 // edi: elements 4355 // edi: elements
4356 // Initialize the new FixedDoubleArray. Leave elements unitialized for 4356 // Initialize the new FixedDoubleArray.
4357 // efficiency, they are guaranteed to be initialized before use.
4358 __ mov(FieldOperand(edi, JSObject::kMapOffset), 4357 __ mov(FieldOperand(edi, JSObject::kMapOffset),
4359 Immediate(masm->isolate()->factory()->fixed_double_array_map())); 4358 Immediate(masm->isolate()->factory()->fixed_double_array_map()));
4360 __ mov(FieldOperand(edi, FixedDoubleArray::kLengthOffset), 4359 __ mov(FieldOperand(edi, FixedDoubleArray::kLengthOffset),
4361 Immediate(Smi::FromInt(JSArray::kPreallocatedArrayElements))); 4360 Immediate(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
4362 4361
4362 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) {
4363 int offset = FixedDoubleArray::OffsetOfElementAt(i);
4364 __ mov(FieldOperand(edi, offset), Immediate(kHoleNanLower32));
4365 __ mov(FieldOperand(edi, offset + kPointerSize),
4366 Immediate(kHoleNanUpper32));
4367 }
4368
4369 __ StoreNumberToDoubleElements(eax, edi, ecx, ebx, xmm0,
4370 &transition_elements_kind, true);
4371
4363 // Install the new backing store in the JSArray. 4372 // Install the new backing store in the JSArray.
4364 __ mov(FieldOperand(edx, JSObject::kElementsOffset), edi); 4373 __ mov(FieldOperand(edx, JSObject::kElementsOffset), edi);
4365 __ RecordWriteField(edx, JSObject::kElementsOffset, edi, ebx, 4374 __ RecordWriteField(edx, JSObject::kElementsOffset, edi, ebx,
4366 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 4375 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
4367 4376
4368 // Increment the length of the array. 4377 // Increment the length of the array.
4369 __ add(FieldOperand(edx, JSArray::kLengthOffset), 4378 __ add(FieldOperand(edx, JSArray::kLengthOffset),
4370 Immediate(Smi::FromInt(1))); 4379 Immediate(Smi::FromInt(1)));
4371 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); 4380 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
4372 __ jmp(&finish_store); 4381 __ ret(0);
4373 4382
4374 __ bind(&check_capacity); 4383 __ bind(&check_capacity);
4375 // eax: value 4384 // eax: value
4376 // ecx: key 4385 // ecx: key
4377 // edx: receiver 4386 // edx: receiver
4378 // edi: elements 4387 // edi: elements
4379 // Make sure that the backing store can hold additional elements. 4388 // Make sure that the backing store can hold additional elements.
4380 __ cmp(ecx, FieldOperand(edi, FixedDoubleArray::kLengthOffset)); 4389 __ cmp(ecx, FieldOperand(edi, FixedDoubleArray::kLengthOffset));
4381 __ j(above_equal, &slow); 4390 __ j(above_equal, &slow);
4382 4391
(...skipping 11 matching lines...) Expand all
4394 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4403 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4395 } 4404 }
4396 } 4405 }
4397 4406
4398 4407
4399 #undef __ 4408 #undef __
4400 4409
4401 } } // namespace v8::internal 4410 } } // namespace v8::internal
4402 4411
4403 #endif // V8_TARGET_ARCH_IA32 4412 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698