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 4793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4804 __ bind(&adaptor_frame); | 4804 __ bind(&adaptor_frame); |
4805 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4805 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4806 __ str(r1, MemOperand(sp, 0)); | 4806 __ str(r1, MemOperand(sp, 0)); |
4807 __ add(r3, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); | 4807 __ add(r3, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); |
4808 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); | 4808 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
4809 __ str(r3, MemOperand(sp, 1 * kPointerSize)); | 4809 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
4810 | 4810 |
4811 // Try the new space allocation. Start out with computing the size | 4811 // Try the new space allocation. Start out with computing the size |
4812 // of the arguments object and the elements array in words. | 4812 // of the arguments object and the elements array in words. |
4813 Label add_arguments_object; | 4813 Label add_arguments_object; |
4814 __ bind(&try_allocate); | 4814 if (type_ == NEW_NON_STRICT) { |
4815 __ cmp(r1, Operand(0, RelocInfo::NONE)); | 4815 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); |
4816 __ b(eq, &add_arguments_object); | 4816 } else { |
4817 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); | 4817 __ bind(&try_allocate); |
4818 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); | 4818 __ cmp(r1, Operand(0, RelocInfo::NONE)); |
4819 __ bind(&add_arguments_object); | 4819 __ b(eq, &add_arguments_object); |
4820 __ add(r1, r1, Operand(GetArgumentsObjectSize() / kPointerSize)); | 4820 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); |
4821 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); | |
4822 __ bind(&add_arguments_object); | |
4823 __ add(r1, r1, Operand(GetArgumentsObjectSize() / kPointerSize)); | |
4821 | 4824 |
4822 // Do the allocation of both objects in one go. | 4825 // Do the allocation of both objects in one go. |
4823 __ AllocateInNewSpace( | 4826 __ AllocateInNewSpace( |
4824 r1, | 4827 r1, |
4825 r0, | 4828 r0, |
4826 r2, | 4829 r2, |
4827 r3, | 4830 r3, |
4828 &runtime, | 4831 &runtime, |
4829 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 4832 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
4830 | 4833 |
4831 // Get the arguments boilerplate from the current (global) context. | 4834 // Get the arguments boilerplate from the current (global) context. |
4832 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4835 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
4833 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); | 4836 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); |
4834 __ ldr(r4, MemOperand(r4, | 4837 __ ldr(r4, MemOperand(r4, |
4835 Context::SlotOffset(GetArgumentsBoilerplateIndex()))); | 4838 Context::SlotOffset(GetArgumentsBoilerplateIndex()))); |
4836 | 4839 |
4837 // Copy the JS object part. | 4840 // Copy the JS object part. |
4838 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); | 4841 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); |
4839 | 4842 |
4840 if (type_ == NEW_NON_STRICT) { | 4843 if (type_ == NEW_NON_STRICT) { |
Kevin Millikin (Chromium)
2011/03/23 16:07:20
This is never true, but only temporarily.
| |
4841 // Setup the callee in-object property. | 4844 // Setup the callee in-object property. |
4842 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 4845 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
4843 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 4846 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); |
4844 const int kCalleeOffset = JSObject::kHeaderSize + | 4847 const int kCalleeOffset = JSObject::kHeaderSize + |
4845 Heap::kArgumentsCalleeIndex * kPointerSize; | 4848 Heap::kArgumentsCalleeIndex * kPointerSize; |
4846 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); | 4849 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); |
4850 } | |
4851 | |
4852 // Get the length (smi tagged) and set that as an in-object property too. | |
4853 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | |
4854 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | |
4855 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | |
4856 Heap::kArgumentsLengthIndex * kPointerSize)); | |
4857 | |
4858 // If there are no actual arguments, we're done. | |
4859 Label done; | |
4860 __ cmp(r1, Operand(0, RelocInfo::NONE)); | |
4861 __ b(eq, &done); | |
4862 | |
4863 // Get the parameters pointer from the stack. | |
4864 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | |
4865 | |
4866 // Setup the elements pointer in the allocated arguments object and | |
4867 // initialize the header in the elements fixed array. | |
4868 __ add(r4, r0, Operand(GetArgumentsObjectSize())); | |
4869 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | |
4870 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | |
4871 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | |
4872 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | |
4873 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop . | |
Mads Ager (chromium)
2011/03/24 08:04:04
Long line.
| |
4874 | |
4875 // Copy the fixed array slots. | |
4876 Label loop; | |
4877 // Setup r4 to point to the first array slot. | |
4878 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
4879 __ bind(&loop); | |
4880 // Pre-decrement r2 with kPointerSize on each iteration. | |
4881 // Pre-decrement in order to skip receiver. | |
4882 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | |
4883 // Post-increment r4 with kPointerSize on each iteration. | |
4884 __ str(r3, MemOperand(r4, kPointerSize, PostIndex)); | |
4885 __ sub(r1, r1, Operand(1)); | |
4886 __ cmp(r1, Operand(0, RelocInfo::NONE)); | |
4887 __ b(ne, &loop); | |
4888 | |
4889 // Return and remove the on-stack parameters. | |
4890 __ bind(&done); | |
4891 __ add(sp, sp, Operand(3 * kPointerSize)); | |
4892 __ Ret(); | |
4893 | |
4894 // Do the runtime call to allocate the arguments object. | |
4895 __ bind(&runtime); | |
4896 __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1); | |
4847 } | 4897 } |
4848 | |
4849 // Get the length (smi tagged) and set that as an in-object property too. | |
4850 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | |
4851 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | |
4852 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | |
4853 Heap::kArgumentsLengthIndex * kPointerSize)); | |
4854 | |
4855 // If there are no actual arguments, we're done. | |
4856 Label done; | |
4857 __ cmp(r1, Operand(0, RelocInfo::NONE)); | |
4858 __ b(eq, &done); | |
4859 | |
4860 // Get the parameters pointer from the stack. | |
4861 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | |
4862 | |
4863 // Setup the elements pointer in the allocated arguments object and | |
4864 // initialize the header in the elements fixed array. | |
4865 __ add(r4, r0, Operand(GetArgumentsObjectSize())); | |
4866 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | |
4867 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | |
4868 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | |
4869 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | |
4870 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. | |
4871 | |
4872 // Copy the fixed array slots. | |
4873 Label loop; | |
4874 // Setup r4 to point to the first array slot. | |
4875 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
4876 __ bind(&loop); | |
4877 // Pre-decrement r2 with kPointerSize on each iteration. | |
4878 // Pre-decrement in order to skip receiver. | |
4879 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | |
4880 // Post-increment r4 with kPointerSize on each iteration. | |
4881 __ str(r3, MemOperand(r4, kPointerSize, PostIndex)); | |
4882 __ sub(r1, r1, Operand(1)); | |
4883 __ cmp(r1, Operand(0, RelocInfo::NONE)); | |
4884 __ b(ne, &loop); | |
4885 | |
4886 // Return and remove the on-stack parameters. | |
4887 __ bind(&done); | |
4888 __ add(sp, sp, Operand(3 * kPointerSize)); | |
4889 __ Ret(); | |
4890 | |
4891 // Do the runtime call to allocate the arguments object. | |
4892 __ bind(&runtime); | |
4893 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | |
4894 } | 4898 } |
4895 | 4899 |
4896 | 4900 |
4897 void RegExpExecStub::Generate(MacroAssembler* masm) { | 4901 void RegExpExecStub::Generate(MacroAssembler* masm) { |
4898 // Just jump directly to runtime if native RegExp is not selected at compile | 4902 // Just jump directly to runtime if native RegExp is not selected at compile |
4899 // time or if regexp entry in generated code is turned off runtime switch or | 4903 // time or if regexp entry in generated code is turned off runtime switch or |
4900 // at compilation. | 4904 // at compilation. |
4901 #ifdef V8_INTERPRETED_REGEXP | 4905 #ifdef V8_INTERPRETED_REGEXP |
4902 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 4906 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); |
4903 #else // V8_INTERPRETED_REGEXP | 4907 #else // V8_INTERPRETED_REGEXP |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6858 __ str(pc, MemOperand(sp, 0)); | 6862 __ str(pc, MemOperand(sp, 0)); |
6859 __ Jump(target); // Call the C++ function. | 6863 __ Jump(target); // Call the C++ function. |
6860 } | 6864 } |
6861 | 6865 |
6862 | 6866 |
6863 #undef __ | 6867 #undef __ |
6864 | 6868 |
6865 } } // namespace v8::internal | 6869 } } // namespace v8::internal |
6866 | 6870 |
6867 #endif // V8_TARGET_ARCH_ARM | 6871 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |