| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 | 257 |
| 258 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { | 258 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
| 259 // Stack layout on entry: | 259 // Stack layout on entry: |
| 260 // | 260 // |
| 261 // [sp]: constant elements. | 261 // [sp]: constant elements. |
| 262 // [sp + kPointerSize]: literal index. | 262 // [sp + kPointerSize]: literal index. |
| 263 // [sp + (2 * kPointerSize)]: literals array. | 263 // [sp + (2 * kPointerSize)]: literals array. |
| 264 | 264 |
| 265 // All sizes here are multiples of kPointerSize. | 265 // All sizes here are multiples of kPointerSize. |
| 266 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; | 266 int elements_size = 0; |
| 267 if (length_ > 0) { |
| 268 elements_size = mode_ == CLONE_DOUBLE_ELEMENTS |
| 269 ? FixedDoubleArray::SizeFor(length_) |
| 270 : FixedArray::SizeFor(length_); |
| 271 } |
| 267 int size = JSArray::kSize + elements_size; | 272 int size = JSArray::kSize + elements_size; |
| 268 | 273 |
| 269 // Load boilerplate object into r3 and check if we need to create a | 274 // Load boilerplate object into r3 and check if we need to create a |
| 270 // boilerplate. | 275 // boilerplate. |
| 271 Label slow_case; | 276 Label slow_case; |
| 272 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 277 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); |
| 273 __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); | 278 __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); |
| 274 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 279 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 275 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 280 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 276 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 281 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 277 __ cmp(r3, ip); | 282 __ cmp(r3, ip); |
| 278 __ b(eq, &slow_case); | 283 __ b(eq, &slow_case); |
| 279 | 284 |
| 280 if (FLAG_debug_code) { | 285 if (FLAG_debug_code) { |
| 281 const char* message; | 286 const char* message; |
| 282 Heap::RootListIndex expected_map_index; | 287 Heap::RootListIndex expected_map_index; |
| 283 if (mode_ == CLONE_ELEMENTS) { | 288 if (mode_ == CLONE_ELEMENTS) { |
| 284 message = "Expected (writable) fixed array"; | 289 message = "Expected (writable) fixed array"; |
| 285 expected_map_index = Heap::kFixedArrayMapRootIndex; | 290 expected_map_index = Heap::kFixedArrayMapRootIndex; |
| 291 } else if (mode_ == CLONE_DOUBLE_ELEMENTS) { |
| 292 message = "Expected (writable) fixed double array"; |
| 293 expected_map_index = Heap::kFixedDoubleArrayMapRootIndex; |
| 286 } else { | 294 } else { |
| 287 ASSERT(mode_ == COPY_ON_WRITE_ELEMENTS); | 295 ASSERT(mode_ == COPY_ON_WRITE_ELEMENTS); |
| 288 message = "Expected copy-on-write fixed array"; | 296 message = "Expected copy-on-write fixed array"; |
| 289 expected_map_index = Heap::kFixedCOWArrayMapRootIndex; | 297 expected_map_index = Heap::kFixedCOWArrayMapRootIndex; |
| 290 } | 298 } |
| 291 __ push(r3); | 299 __ push(r3); |
| 292 __ ldr(r3, FieldMemOperand(r3, JSArray::kElementsOffset)); | 300 __ ldr(r3, FieldMemOperand(r3, JSArray::kElementsOffset)); |
| 293 __ ldr(r3, FieldMemOperand(r3, HeapObject::kMapOffset)); | 301 __ ldr(r3, FieldMemOperand(r3, HeapObject::kMapOffset)); |
| 294 __ LoadRoot(ip, expected_map_index); | 302 __ LoadRoot(ip, expected_map_index); |
| 295 __ cmp(r3, ip); | 303 __ cmp(r3, ip); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 315 } | 323 } |
| 316 | 324 |
| 317 if (length_ > 0) { | 325 if (length_ > 0) { |
| 318 // Get hold of the elements array of the boilerplate and setup the | 326 // Get hold of the elements array of the boilerplate and setup the |
| 319 // elements pointer in the resulting object. | 327 // elements pointer in the resulting object. |
| 320 __ ldr(r3, FieldMemOperand(r3, JSArray::kElementsOffset)); | 328 __ ldr(r3, FieldMemOperand(r3, JSArray::kElementsOffset)); |
| 321 __ add(r2, r0, Operand(JSArray::kSize)); | 329 __ add(r2, r0, Operand(JSArray::kSize)); |
| 322 __ str(r2, FieldMemOperand(r0, JSArray::kElementsOffset)); | 330 __ str(r2, FieldMemOperand(r0, JSArray::kElementsOffset)); |
| 323 | 331 |
| 324 // Copy the elements array. | 332 // Copy the elements array. |
| 333 ASSERT((elements_size % kPointerSize) == 0); |
| 325 __ CopyFields(r2, r3, r1.bit(), elements_size / kPointerSize); | 334 __ CopyFields(r2, r3, r1.bit(), elements_size / kPointerSize); |
| 326 } | 335 } |
| 327 | 336 |
| 328 // Return and remove the on-stack parameters. | 337 // Return and remove the on-stack parameters. |
| 329 __ add(sp, sp, Operand(3 * kPointerSize)); | 338 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 330 __ Ret(); | 339 __ Ret(); |
| 331 | 340 |
| 332 __ bind(&slow_case); | 341 __ bind(&slow_case); |
| 333 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); | 342 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); |
| 334 } | 343 } |
| (...skipping 6827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7162 | 7171 |
| 7163 // Fall through when we need to inform the incremental marker. | 7172 // Fall through when we need to inform the incremental marker. |
| 7164 } | 7173 } |
| 7165 | 7174 |
| 7166 | 7175 |
| 7167 #undef __ | 7176 #undef __ |
| 7168 | 7177 |
| 7169 } } // namespace v8::internal | 7178 } } // namespace v8::internal |
| 7170 | 7179 |
| 7171 #endif // V8_TARGET_ARCH_ARM | 7180 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |