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

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

Issue 11411253: MIPS: 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: 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 | « 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 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4836 FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4837 __ lw(elements_reg, 4837 __ lw(elements_reg,
4838 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4838 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4839 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); 4839 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
4840 __ Branch(&check_capacity, ne, elements_reg, Operand(at)); 4840 __ Branch(&check_capacity, ne, elements_reg, Operand(at));
4841 4841
4842 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); 4842 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements);
4843 __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow, 4843 __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow,
4844 TAG_OBJECT); 4844 TAG_OBJECT);
4845 4845
4846 // Initialize the new FixedDoubleArray. Leave elements unitialized for 4846 // Initialize the new FixedDoubleArray.
4847 // efficiency, they are guaranteed to be initialized before use.
4848 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); 4847 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex);
4849 __ sw(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); 4848 __ sw(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset));
4850 __ li(scratch1, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); 4849 __ li(scratch1, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
4851 __ sw(scratch1, 4850 __ sw(scratch1,
4852 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); 4851 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset));
4853 4852
4853 __ li(scratch1, Operand(kHoleNanLower32));
4854 __ li(scratch2, Operand(kHoleNanUpper32));
4855 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) {
4856 int offset = FixedDoubleArray::OffsetOfElementAt(i);
4857 __ sw(scratch1, FieldMemOperand(elements_reg, offset));
4858 __ sw(scratch2, FieldMemOperand(elements_reg, offset + kPointerSize));
4859 }
4860
4861 __ StoreNumberToDoubleElements(value_reg,
4862 key_reg,
4863 // All registers after this are overwritten.
4864 elements_reg,
4865 scratch1,
4866 scratch2,
4867 scratch3,
4868 scratch4,
4869 &transition_elements_kind);
4870
4854 // Install the new backing store in the JSArray. 4871 // Install the new backing store in the JSArray.
4855 __ sw(elements_reg, 4872 __ sw(elements_reg,
4856 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4873 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4857 __ RecordWriteField(receiver_reg, JSObject::kElementsOffset, elements_reg, 4874 __ RecordWriteField(receiver_reg, JSObject::kElementsOffset, elements_reg,
4858 scratch1, kRAHasNotBeenSaved, kDontSaveFPRegs, 4875 scratch1, kRAHasNotBeenSaved, kDontSaveFPRegs,
4859 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 4876 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
4860 4877
4861 // Increment the length of the array. 4878 // Increment the length of the array.
4862 __ li(length_reg, Operand(Smi::FromInt(1))); 4879 __ li(length_reg, Operand(Smi::FromInt(1)));
4863 __ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4880 __ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4864 __ lw(elements_reg, 4881 __ lw(elements_reg,
4865 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4882 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4866 __ jmp(&finish_store); 4883 __ Ret();
4867 4884
4868 __ bind(&check_capacity); 4885 __ bind(&check_capacity);
4869 // Make sure that the backing store can hold additional elements. 4886 // Make sure that the backing store can hold additional elements.
4870 __ lw(scratch1, 4887 __ lw(scratch1,
4871 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); 4888 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset));
4872 __ Branch(&slow, hs, length_reg, Operand(scratch1)); 4889 __ Branch(&slow, hs, length_reg, Operand(scratch1));
4873 4890
4874 // Grow the array and finish the store. 4891 // Grow the array and finish the store.
4875 __ Addu(length_reg, length_reg, Operand(Smi::FromInt(1))); 4892 __ Addu(length_reg, length_reg, Operand(Smi::FromInt(1)));
4876 __ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4893 __ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4877 __ jmp(&finish_store); 4894 __ jmp(&finish_store);
4878 4895
4879 __ bind(&slow); 4896 __ bind(&slow);
4880 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow(); 4897 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow();
4881 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4898 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4882 } 4899 }
4883 } 4900 }
4884 4901
4885 4902
4886 #undef __ 4903 #undef __
4887 4904
4888 } } // namespace v8::internal 4905 } } // namespace v8::internal
4889 4906
4890 #endif // V8_TARGET_ARCH_MIPS 4907 #endif // V8_TARGET_ARCH_MIPS
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