OLD | NEW |
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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 static void AllocateEmptyJSArray(MacroAssembler* masm, | 893 static void AllocateEmptyJSArray(MacroAssembler* masm, |
894 Register array_function, | 894 Register array_function, |
895 Register result, | 895 Register result, |
896 Register scratch1, | 896 Register scratch1, |
897 Register scratch2, | 897 Register scratch2, |
898 Register scratch3, | 898 Register scratch3, |
899 Label* gc_required) { | 899 Label* gc_required) { |
900 const int initial_capacity = JSArray::kPreallocatedArrayElements; | 900 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
901 STATIC_ASSERT(initial_capacity >= 0); | 901 STATIC_ASSERT(initial_capacity >= 0); |
902 | 902 |
903 __ LoadInitialArrayMap(array_function, scratch2, scratch1); | 903 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
904 | 904 |
905 // Allocate the JSArray object together with space for a fixed array with the | 905 // Allocate the JSArray object together with space for a fixed array with the |
906 // requested elements. | 906 // requested elements. |
907 int size = JSArray::kSize; | 907 int size = JSArray::kSize; |
908 if (initial_capacity > 0) { | 908 if (initial_capacity > 0) { |
909 size += FixedArray::SizeFor(initial_capacity); | 909 size += FixedArray::SizeFor(initial_capacity); |
910 } | 910 } |
911 __ AllocateInNewSpace(size, | 911 __ AllocateInNewSpace(size, |
912 result, | 912 result, |
913 scratch2, | 913 scratch2, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 Register result, | 996 Register result, |
997 Register elements_array, | 997 Register elements_array, |
998 Register elements_array_end, | 998 Register elements_array_end, |
999 Register scratch, | 999 Register scratch, |
1000 bool fill_with_hole, | 1000 bool fill_with_hole, |
1001 Label* gc_required) { | 1001 Label* gc_required) { |
1002 ASSERT(scratch.is(edi)); // rep stos destination | 1002 ASSERT(scratch.is(edi)); // rep stos destination |
1003 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count | 1003 ASSERT(!fill_with_hole || array_size.is(ecx)); // rep stos count |
1004 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax | 1004 ASSERT(!fill_with_hole || !result.is(eax)); // result is never eax |
1005 | 1005 |
1006 __ LoadInitialArrayMap(array_function, scratch, elements_array); | 1006 __ LoadInitialArrayMap(array_function, scratch, |
| 1007 elements_array, fill_with_hole); |
1007 | 1008 |
1008 // Allocate the JSArray object together with space for a FixedArray with the | 1009 // Allocate the JSArray object together with space for a FixedArray with the |
1009 // requested elements. | 1010 // requested elements. |
1010 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 1011 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
1011 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, | 1012 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, |
1012 times_half_pointer_size, // array_size is a smi. | 1013 times_half_pointer_size, // array_size is a smi. |
1013 array_size, | 1014 array_size, |
1014 result, | 1015 result, |
1015 elements_array_end, | 1016 elements_array_end, |
1016 scratch, | 1017 scratch, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 masm->isolate()->factory()->heap_number_map(), | 1268 masm->isolate()->factory()->heap_number_map(), |
1268 ¬_double, | 1269 ¬_double, |
1269 DONT_DO_SMI_CHECK); | 1270 DONT_DO_SMI_CHECK); |
1270 __ bind(&cant_transition_map); | 1271 __ bind(&cant_transition_map); |
1271 // Throw away the array that's only been partially constructed. | 1272 // Throw away the array that's only been partially constructed. |
1272 __ pop(eax); | 1273 __ pop(eax); |
1273 __ UndoAllocationInNewSpace(eax); | 1274 __ UndoAllocationInNewSpace(eax); |
1274 __ jmp(&prepare_generic_code_call); | 1275 __ jmp(&prepare_generic_code_call); |
1275 | 1276 |
1276 __ bind(¬_double); | 1277 __ bind(¬_double); |
1277 // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS. | 1278 // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS. |
1278 __ mov(ebx, Operand(esp, 0)); | 1279 __ mov(ebx, Operand(esp, 0)); |
1279 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); | 1280 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); |
1280 __ LoadTransitionedArrayMapConditional( | 1281 __ LoadTransitionedArrayMapConditional( |
1281 FAST_SMI_ONLY_ELEMENTS, | 1282 FAST_SMI_ELEMENTS, |
1282 FAST_ELEMENTS, | 1283 FAST_ELEMENTS, |
1283 edi, | 1284 edi, |
1284 eax, | 1285 eax, |
1285 &cant_transition_map); | 1286 &cant_transition_map); |
1286 __ mov(FieldOperand(ebx, HeapObject::kMapOffset), edi); | 1287 __ mov(FieldOperand(ebx, HeapObject::kMapOffset), edi); |
1287 __ RecordWriteField(ebx, HeapObject::kMapOffset, edi, eax, | 1288 __ RecordWriteField(ebx, HeapObject::kMapOffset, edi, eax, |
1288 kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 1289 kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
1289 | 1290 |
1290 // Prepare to re-enter the loop | 1291 // Prepare to re-enter the loop |
1291 __ lea(edi, Operand(esp, last_arg_offset)); | 1292 __ lea(edi, Operand(esp, last_arg_offset)); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1730 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1730 generator.Generate(); | 1731 generator.Generate(); |
1731 } | 1732 } |
1732 | 1733 |
1733 | 1734 |
1734 #undef __ | 1735 #undef __ |
1735 } | 1736 } |
1736 } // namespace v8::internal | 1737 } // namespace v8::internal |
1737 | 1738 |
1738 #endif // V8_TARGET_ARCH_IA32 | 1739 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |