| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // and filled with the hole values. | 109 // and filled with the hole values. |
| 110 static void AllocateEmptyJSArray(MacroAssembler* masm, | 110 static void AllocateEmptyJSArray(MacroAssembler* masm, |
| 111 Register array_function, | 111 Register array_function, |
| 112 Register result, | 112 Register result, |
| 113 Register scratch1, | 113 Register scratch1, |
| 114 Register scratch2, | 114 Register scratch2, |
| 115 Register scratch3, | 115 Register scratch3, |
| 116 Label* gc_required) { | 116 Label* gc_required) { |
| 117 const int initial_capacity = JSArray::kPreallocatedArrayElements; | 117 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
| 118 STATIC_ASSERT(initial_capacity >= 0); | 118 STATIC_ASSERT(initial_capacity >= 0); |
| 119 // Load the initial map from the array function. | 119 __ LoadGlobalInitialConstructedArrayMap(array_function, scratch2, scratch1); |
| 120 __ lw(scratch1, FieldMemOperand(array_function, | |
| 121 JSFunction::kPrototypeOrInitialMapOffset)); | |
| 122 | 120 |
| 123 // Allocate the JSArray object together with space for a fixed array with the | 121 // Allocate the JSArray object together with space for a fixed array with the |
| 124 // requested elements. | 122 // requested elements. |
| 125 int size = JSArray::kSize; | 123 int size = JSArray::kSize; |
| 126 if (initial_capacity > 0) { | 124 if (initial_capacity > 0) { |
| 127 size += FixedArray::SizeFor(initial_capacity); | 125 size += FixedArray::SizeFor(initial_capacity); |
| 128 } | 126 } |
| 129 __ AllocateInNewSpace(size, | 127 __ AllocateInNewSpace(size, |
| 130 result, | 128 result, |
| 131 scratch2, | 129 scratch2, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 Register array_function, // Array function. | 205 Register array_function, // Array function. |
| 208 Register array_size, // As a smi, cannot be 0. | 206 Register array_size, // As a smi, cannot be 0. |
| 209 Register result, | 207 Register result, |
| 210 Register elements_array_storage, | 208 Register elements_array_storage, |
| 211 Register elements_array_end, | 209 Register elements_array_end, |
| 212 Register scratch1, | 210 Register scratch1, |
| 213 Register scratch2, | 211 Register scratch2, |
| 214 bool fill_with_hole, | 212 bool fill_with_hole, |
| 215 Label* gc_required) { | 213 Label* gc_required) { |
| 216 // Load the initial map from the array function. | 214 // Load the initial map from the array function. |
| 217 __ lw(elements_array_storage, | 215 __ LoadGlobalInitialConstructedArrayMap(array_function, scratch2, |
| 218 FieldMemOperand(array_function, | 216 elements_array_storage); |
| 219 JSFunction::kPrototypeOrInitialMapOffset)); | |
| 220 | 217 |
| 221 if (FLAG_debug_code) { // Assert that array size is not zero. | 218 if (FLAG_debug_code) { // Assert that array size is not zero. |
| 222 __ Assert( | 219 __ Assert( |
| 223 ne, "array size is unexpectedly 0", array_size, Operand(zero_reg)); | 220 ne, "array size is unexpectedly 0", array_size, Operand(zero_reg)); |
| 224 } | 221 } |
| 225 | 222 |
| 226 // 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 |
| 227 // requested number of elements. | 224 // requested number of elements. |
| 228 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 225 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 229 __ li(elements_array_end, | 226 __ li(elements_array_end, |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 __ bind(&dont_adapt_arguments); | 1809 __ bind(&dont_adapt_arguments); |
| 1813 __ Jump(a3); | 1810 __ Jump(a3); |
| 1814 } | 1811 } |
| 1815 | 1812 |
| 1816 | 1813 |
| 1817 #undef __ | 1814 #undef __ |
| 1818 | 1815 |
| 1819 } } // namespace v8::internal | 1816 } } // namespace v8::internal |
| 1820 | 1817 |
| 1821 #endif // V8_TARGET_ARCH_MIPS | 1818 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |