Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 6698015: Implement strict mode arguments caller/callee. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR Feedback. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/codegen-arm.h » ('j') | src/arm/codegen-arm.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_OBJECT) {
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::arguments_callee_index == 1);
Kevin Millikin (Chromium) 2011/03/16 09:48:41 That name is old school. You might as well change
Martin Maly 2011/03/16 22:22:25 Done.
4861 __ str(r3, FieldMemOperand(r0, JSObject::kHeaderSize)); 4861 __ ldr(r3, MemOperand(sp, 2 * kPointerSize));
4862 MemOperand callee_operand = FieldMemOperand(
Kevin Millikin (Chromium) 2011/03/16 09:48:41 You're right, this is ugly. I would write instead
Martin Maly 2011/03/16 22:22:25 Done. Good suggestion!
4863 r0,
4864 JSObject::kHeaderSize + Heap::arguments_callee_index * kPointerSize);
4865 __ str(r3, callee_operand);
4866 }
4862 4867
4863 // Get the length (smi tagged) and set that as an in-object property too. 4868 // Get the length (smi tagged) and set that as an in-object property too.
4864 STATIC_ASSERT(Heap::arguments_length_index == 1); 4869 STATIC_ASSERT(Heap::arguments_length_index == 0);
4865 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); 4870 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
4866 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); 4871 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize +
4872 Heap::arguments_length_index * kPointerSize));
4867 4873
4868 // If there are no actual arguments, we're done. 4874 // If there are no actual arguments, we're done.
4869 Label done; 4875 Label done;
4870 __ cmp(r1, Operand(0, RelocInfo::NONE)); 4876 __ cmp(r1, Operand(0, RelocInfo::NONE));
4871 __ b(eq, &done); 4877 __ b(eq, &done);
4872 4878
4873 // Get the parameters pointer from the stack. 4879 // Get the parameters pointer from the stack.
4874 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); 4880 __ ldr(r2, MemOperand(sp, 1 * kPointerSize));
4875 4881
4876 // Setup the elements pointer in the allocated arguments object and 4882 // Setup the elements pointer in the allocated arguments object and
4877 // initialize the header in the elements fixed array. 4883 // initialize the header in the elements fixed array.
4878 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); 4884 __ add(r4, r0, Operand(GetArgumentsObjectSize()));
4879 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); 4885 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset));
4880 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); 4886 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex);
4881 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); 4887 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset));
4882 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); 4888 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset));
4883 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. 4889 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop.
4884 4890
4885 // Copy the fixed array slots. 4891 // Copy the fixed array slots.
4886 Label loop; 4892 Label loop;
4887 // Setup r4 to point to the first array slot. 4893 // Setup r4 to point to the first array slot.
4888 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4894 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after
6848 __ str(pc, MemOperand(sp, 0)); 6854 __ str(pc, MemOperand(sp, 0));
6849 __ Jump(target); // Call the C++ function. 6855 __ Jump(target); // Call the C++ function.
6850 } 6856 }
6851 6857
6852 6858
6853 #undef __ 6859 #undef __
6854 6860
6855 } } // namespace v8::internal 6861 } } // namespace v8::internal
6856 6862
6857 #endif // V8_TARGET_ARCH_ARM 6863 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/codegen-arm.h » ('j') | src/arm/codegen-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698