| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 ne, "array size is unexpectedly 0", array_size, Operand(zero_reg)); | 220 ne, "array size is unexpectedly 0", array_size, Operand(zero_reg)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Allocate the JSArray object together with space for a FixedArray with the | 223 // Allocate the JSArray object together with space for a FixedArray with the |
| 224 // requested number of elements. | 224 // requested number of elements. |
| 225 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 225 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 226 __ li(elements_array_end, | 226 __ li(elements_array_end, |
| 227 (JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize); | 227 (JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize); |
| 228 __ sra(scratch1, array_size, kSmiTagSize); | 228 __ sra(scratch1, array_size, kSmiTagSize); |
| 229 __ Addu(elements_array_end, elements_array_end, scratch1); | 229 __ Addu(elements_array_end, elements_array_end, scratch1); |
| 230 __ AllocateInNewSpace( | 230 __ Allocate(elements_array_end, |
| 231 elements_array_end, | 231 result, |
| 232 result, | 232 scratch1, |
| 233 scratch1, | 233 scratch2, |
| 234 scratch2, | 234 gc_required, |
| 235 gc_required, | 235 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
| 236 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | |
| 237 | 236 |
| 238 // Allocated the JSArray. Now initialize the fields except for the elements | 237 // Allocated the JSArray. Now initialize the fields except for the elements |
| 239 // array. | 238 // array. |
| 240 // result: JSObject | 239 // result: JSObject |
| 241 // elements_array_storage: initial map | 240 // elements_array_storage: initial map |
| 242 // array_size: size of array (smi) | 241 // array_size: size of array (smi) |
| 243 __ sw(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset)); | 242 __ sw(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset)); |
| 244 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex); | 243 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex); |
| 245 __ sw(elements_array_storage, | 244 __ sw(elements_array_storage, |
| 246 FieldMemOperand(result, JSArray::kPropertiesOffset)); | 245 FieldMemOperand(result, JSArray::kPropertiesOffset)); |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 __ pop(a2); | 887 __ pop(a2); |
| 889 __ pop(a1); | 888 __ pop(a1); |
| 890 | 889 |
| 891 __ bind(&allocate); | 890 __ bind(&allocate); |
| 892 } | 891 } |
| 893 | 892 |
| 894 // Now allocate the JSObject on the heap. | 893 // Now allocate the JSObject on the heap. |
| 895 // a1: constructor function | 894 // a1: constructor function |
| 896 // a2: initial map | 895 // a2: initial map |
| 897 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 896 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |
| 898 __ AllocateInNewSpace(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); | 897 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); |
| 899 | 898 |
| 900 // Allocated the JSObject, now initialize the fields. Map is set to | 899 // Allocated the JSObject, now initialize the fields. Map is set to |
| 901 // initial map and properties and elements are set to empty fixed array. | 900 // initial map and properties and elements are set to empty fixed array. |
| 902 // a1: constructor function | 901 // a1: constructor function |
| 903 // a2: initial map | 902 // a2: initial map |
| 904 // a3: object size | 903 // a3: object size |
| 905 // t4: JSObject (not tagged) | 904 // t4: JSObject (not tagged) |
| 906 __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex); | 905 __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex); |
| 907 __ mov(t5, t4); | 906 __ mov(t5, t4); |
| 908 __ sw(a2, MemOperand(t5, JSObject::kMapOffset)); | 907 __ sw(a2, MemOperand(t5, JSObject::kMapOffset)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 __ Assert(greater_equal, "Property allocation count failed.", | 966 __ Assert(greater_equal, "Property allocation count failed.", |
| 968 a3, Operand(zero_reg)); | 967 a3, Operand(zero_reg)); |
| 969 | 968 |
| 970 // Scale the number of elements by pointer size and add the header for | 969 // Scale the number of elements by pointer size and add the header for |
| 971 // FixedArrays to the start of the next object calculation from above. | 970 // FixedArrays to the start of the next object calculation from above. |
| 972 // a1: constructor | 971 // a1: constructor |
| 973 // a3: number of elements in properties array | 972 // a3: number of elements in properties array |
| 974 // t4: JSObject | 973 // t4: JSObject |
| 975 // t5: start of next object | 974 // t5: start of next object |
| 976 __ Addu(a0, a3, Operand(FixedArray::kHeaderSize / kPointerSize)); | 975 __ Addu(a0, a3, Operand(FixedArray::kHeaderSize / kPointerSize)); |
| 977 __ AllocateInNewSpace( | 976 __ Allocate( |
| 978 a0, | 977 a0, |
| 979 t5, | 978 t5, |
| 980 t6, | 979 t6, |
| 981 a2, | 980 a2, |
| 982 &undo_allocation, | 981 &undo_allocation, |
| 983 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); | 982 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); |
| 984 | 983 |
| 985 // Initialize the FixedArray. | 984 // Initialize the FixedArray. |
| 986 // a1: constructor | 985 // a1: constructor |
| 987 // a3: number of elements in properties array (untagged) | 986 // a3: number of elements in properties array (untagged) |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 __ bind(&dont_adapt_arguments); | 1948 __ bind(&dont_adapt_arguments); |
| 1950 __ Jump(a3); | 1949 __ Jump(a3); |
| 1951 } | 1950 } |
| 1952 | 1951 |
| 1953 | 1952 |
| 1954 #undef __ | 1953 #undef __ |
| 1955 | 1954 |
| 1956 } } // namespace v8::internal | 1955 } } // namespace v8::internal |
| 1957 | 1956 |
| 1958 #endif // V8_TARGET_ARCH_MIPS | 1957 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |