| 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 4817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4828 | 4828 |
| 4829 // Try the new space allocation. Start out with computing the size | 4829 // Try the new space allocation. Start out with computing the size |
| 4830 // of the arguments object and the elements array in words. | 4830 // of the arguments object and the elements array in words. |
| 4831 Label add_arguments_object; | 4831 Label add_arguments_object; |
| 4832 __ bind(&try_allocate); | 4832 __ bind(&try_allocate); |
| 4833 __ cmp(r1, Operand(0, RelocInfo::NONE)); | 4833 __ cmp(r1, Operand(0, RelocInfo::NONE)); |
| 4834 __ b(eq, &add_arguments_object); | 4834 __ b(eq, &add_arguments_object); |
| 4835 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); | 4835 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); |
| 4836 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); | 4836 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); |
| 4837 __ bind(&add_arguments_object); | 4837 __ bind(&add_arguments_object); |
| 4838 __ add(r1, r1, Operand(Heap::kArgumentsObjectSize / kPointerSize)); | 4838 __ add(r1, r1, Operand(GetArgumentsObjectSize() / kPointerSize)); |
| 4839 | 4839 |
| 4840 // Do the allocation of both objects in one go. | 4840 // Do the allocation of both objects in one go. |
| 4841 __ AllocateInNewSpace( | 4841 __ AllocateInNewSpace( |
| 4842 r1, | 4842 r1, |
| 4843 r0, | 4843 r0, |
| 4844 r2, | 4844 r2, |
| 4845 r3, | 4845 r3, |
| 4846 &runtime, | 4846 &runtime, |
| 4847 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 4847 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
| 4848 | 4848 |
| 4849 // Get the arguments boilerplate from the current (global) context. | 4849 // Get the arguments boilerplate from the current (global) context. |
| 4850 int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX); | |
| 4851 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4850 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4852 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); | 4851 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); |
| 4853 __ ldr(r4, MemOperand(r4, offset)); | 4852 __ ldr(r4, MemOperand(r4, |
| 4853 Context::SlotOffset(GetArgumentsBoilerplateIndex()))); |
| 4854 | 4854 |
| 4855 // Copy the JS object part. | 4855 // Copy the JS object part. |
| 4856 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); | 4856 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); |
| 4857 | 4857 |
| 4858 // Setup the callee in-object property. | 4858 if (type_ == NEW_NON_STRICT) { |
| 4859 STATIC_ASSERT(Heap::arguments_callee_index == 0); | 4859 // Setup the callee in-object property. |
| 4860 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 4860 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
| 4861 __ str(r3, FieldMemOperand(r0, JSObject::kHeaderSize)); | 4861 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); |
| 4862 const int kCalleeOffset = JSObject::kHeaderSize + |
| 4863 Heap::kArgumentsCalleeIndex * kPointerSize; |
| 4864 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); |
| 4865 } |
| 4862 | 4866 |
| 4863 // Get the length (smi tagged) and set that as an in-object property too. | 4867 // Get the length (smi tagged) and set that as an in-object property too. |
| 4864 STATIC_ASSERT(Heap::arguments_length_index == 1); | 4868 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 4865 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 4869 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
| 4866 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); | 4870 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + |
| 4871 Heap::kArgumentsLengthIndex * kPointerSize)); |
| 4867 | 4872 |
| 4868 // If there are no actual arguments, we're done. | 4873 // If there are no actual arguments, we're done. |
| 4869 Label done; | 4874 Label done; |
| 4870 __ cmp(r1, Operand(0, RelocInfo::NONE)); | 4875 __ cmp(r1, Operand(0, RelocInfo::NONE)); |
| 4871 __ b(eq, &done); | 4876 __ b(eq, &done); |
| 4872 | 4877 |
| 4873 // Get the parameters pointer from the stack. | 4878 // Get the parameters pointer from the stack. |
| 4874 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 4879 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
| 4875 | 4880 |
| 4876 // Setup the elements pointer in the allocated arguments object and | 4881 // Setup the elements pointer in the allocated arguments object and |
| 4877 // initialize the header in the elements fixed array. | 4882 // initialize the header in the elements fixed array. |
| 4878 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); | 4883 __ add(r4, r0, Operand(GetArgumentsObjectSize())); |
| 4879 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 4884 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 4880 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 4885 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
| 4881 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | 4886 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); |
| 4882 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 4887 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 4883 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. | 4888 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. |
| 4884 | 4889 |
| 4885 // Copy the fixed array slots. | 4890 // Copy the fixed array slots. |
| 4886 Label loop; | 4891 Label loop; |
| 4887 // Setup r4 to point to the first array slot. | 4892 // Setup r4 to point to the first array slot. |
| 4888 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4893 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| (...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6848 __ str(pc, MemOperand(sp, 0)); | 6853 __ str(pc, MemOperand(sp, 0)); |
| 6849 __ Jump(target); // Call the C++ function. | 6854 __ Jump(target); // Call the C++ function. |
| 6850 } | 6855 } |
| 6851 | 6856 |
| 6852 | 6857 |
| 6853 #undef __ | 6858 #undef __ |
| 6854 | 6859 |
| 6855 } } // namespace v8::internal | 6860 } } // namespace v8::internal |
| 6856 | 6861 |
| 6857 #endif // V8_TARGET_ARCH_ARM | 6862 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |