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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 static void AllocateEmptyJSArray(MacroAssembler* masm, | 970 static void AllocateEmptyJSArray(MacroAssembler* masm, |
971 Register array_function, | 971 Register array_function, |
972 Register result, | 972 Register result, |
973 Register scratch1, | 973 Register scratch1, |
974 Register scratch2, | 974 Register scratch2, |
975 Register scratch3, | 975 Register scratch3, |
976 Label* gc_required) { | 976 Label* gc_required) { |
977 const int initial_capacity = JSArray::kPreallocatedArrayElements; | 977 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
978 STATIC_ASSERT(initial_capacity >= 0); | 978 STATIC_ASSERT(initial_capacity >= 0); |
979 | 979 |
980 __ LoadInitialArrayMap(array_function, scratch2, scratch1); | 980 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
981 | 981 |
982 // Allocate the JSArray object together with space for a fixed array with the | 982 // Allocate the JSArray object together with space for a fixed array with the |
983 // requested elements. | 983 // requested elements. |
984 int size = JSArray::kSize; | 984 int size = JSArray::kSize; |
985 if (initial_capacity > 0) { | 985 if (initial_capacity > 0) { |
986 size += FixedArray::SizeFor(initial_capacity); | 986 size += FixedArray::SizeFor(initial_capacity); |
987 } | 987 } |
988 __ AllocateInNewSpace(size, | 988 __ AllocateInNewSpace(size, |
989 result, | 989 result, |
990 scratch2, | 990 scratch2, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 // register elements_array is scratched. | 1069 // register elements_array is scratched. |
1070 static void AllocateJSArray(MacroAssembler* masm, | 1070 static void AllocateJSArray(MacroAssembler* masm, |
1071 Register array_function, // Array function. | 1071 Register array_function, // Array function. |
1072 Register array_size, // As a smi, cannot be 0. | 1072 Register array_size, // As a smi, cannot be 0. |
1073 Register result, | 1073 Register result, |
1074 Register elements_array, | 1074 Register elements_array, |
1075 Register elements_array_end, | 1075 Register elements_array_end, |
1076 Register scratch, | 1076 Register scratch, |
1077 bool fill_with_hole, | 1077 bool fill_with_hole, |
1078 Label* gc_required) { | 1078 Label* gc_required) { |
1079 __ LoadInitialArrayMap(array_function, scratch, elements_array); | 1079 __ LoadInitialArrayMap(array_function, scratch, |
| 1080 elements_array, fill_with_hole); |
1080 | 1081 |
1081 if (FLAG_debug_code) { // Assert that array size is not zero. | 1082 if (FLAG_debug_code) { // Assert that array size is not zero. |
1082 __ testq(array_size, array_size); | 1083 __ testq(array_size, array_size); |
1083 __ Assert(not_zero, "array size is unexpectedly 0"); | 1084 __ Assert(not_zero, "array size is unexpectedly 0"); |
1084 } | 1085 } |
1085 | 1086 |
1086 // Allocate the JSArray object together with space for a FixedArray with the | 1087 // Allocate the JSArray object together with space for a FixedArray with the |
1087 // requested elements. | 1088 // requested elements. |
1088 SmiIndex index = | 1089 SmiIndex index = |
1089 masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); | 1090 masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 // Double values are handled by the runtime. | 1297 // Double values are handled by the runtime. |
1297 __ CheckMap(r8, | 1298 __ CheckMap(r8, |
1298 masm->isolate()->factory()->heap_number_map(), | 1299 masm->isolate()->factory()->heap_number_map(), |
1299 ¬_double, | 1300 ¬_double, |
1300 DONT_DO_SMI_CHECK); | 1301 DONT_DO_SMI_CHECK); |
1301 __ bind(&cant_transition_map); | 1302 __ bind(&cant_transition_map); |
1302 __ UndoAllocationInNewSpace(rbx); | 1303 __ UndoAllocationInNewSpace(rbx); |
1303 __ jmp(call_generic_code); | 1304 __ jmp(call_generic_code); |
1304 | 1305 |
1305 __ bind(¬_double); | 1306 __ bind(¬_double); |
1306 // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS. | 1307 // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS. |
1307 // rbx: JSArray | 1308 // rbx: JSArray |
1308 __ movq(r11, FieldOperand(rbx, HeapObject::kMapOffset)); | 1309 __ movq(r11, FieldOperand(rbx, HeapObject::kMapOffset)); |
1309 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, | 1310 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
1310 FAST_ELEMENTS, | 1311 FAST_ELEMENTS, |
1311 r11, | 1312 r11, |
1312 kScratchRegister, | 1313 kScratchRegister, |
1313 &cant_transition_map); | 1314 &cant_transition_map); |
1314 | 1315 |
1315 __ movq(FieldOperand(rbx, HeapObject::kMapOffset), r11); | 1316 __ movq(FieldOperand(rbx, HeapObject::kMapOffset), r11); |
1316 __ RecordWriteField(rbx, HeapObject::kMapOffset, r11, r8, | 1317 __ RecordWriteField(rbx, HeapObject::kMapOffset, r11, r8, |
1317 kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 1318 kDontSaveFPRegs, OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
1318 | 1319 |
1319 // Finish the array initialization loop. | 1320 // Finish the array initialization loop. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1737 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1737 generator.Generate(); | 1738 generator.Generate(); |
1738 } | 1739 } |
1739 | 1740 |
1740 | 1741 |
1741 #undef __ | 1742 #undef __ |
1742 | 1743 |
1743 } } // namespace v8::internal | 1744 } } // namespace v8::internal |
1744 | 1745 |
1745 #endif // V8_TARGET_ARCH_X64 | 1746 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |