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

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

Issue 6711027: [Isolates] Merge 7201:7258 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 __ pop(r3); 84 __ pop(r3);
85 85
86 // Attempt to allocate new JSFunction in new space. 86 // Attempt to allocate new JSFunction in new space.
87 __ AllocateInNewSpace(JSFunction::kSize, 87 __ AllocateInNewSpace(JSFunction::kSize,
88 r0, 88 r0,
89 r1, 89 r1,
90 r2, 90 r2,
91 &gc, 91 &gc,
92 TAG_OBJECT); 92 TAG_OBJECT);
93 93
94 int map_index = strict_mode_ == kStrictMode
95 ? Context::STRICT_MODE_FUNCTION_MAP_INDEX
96 : Context::FUNCTION_MAP_INDEX;
97
94 // Compute the function map in the current global context and set that 98 // Compute the function map in the current global context and set that
95 // as the map of the allocated object. 99 // as the map of the allocated object.
96 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 100 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
97 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); 101 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
98 __ ldr(r2, MemOperand(r2, Context::SlotOffset(Context::FUNCTION_MAP_INDEX))); 102 __ ldr(r2, MemOperand(r2, Context::SlotOffset(map_index)));
99 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); 103 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
100 104
101 // Initialize the rest of the function. We don't have to update the 105 // Initialize the rest of the function. We don't have to update the
102 // write barrier because the allocated object is in new space. 106 // write barrier because the allocated object is in new space.
103 __ LoadRoot(r1, Heap::kEmptyFixedArrayRootIndex); 107 __ LoadRoot(r1, Heap::kEmptyFixedArrayRootIndex);
104 __ LoadRoot(r2, Heap::kTheHoleValueRootIndex); 108 __ LoadRoot(r2, Heap::kTheHoleValueRootIndex);
105 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); 109 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
106 __ str(r1, FieldMemOperand(r0, JSObject::kPropertiesOffset)); 110 __ str(r1, FieldMemOperand(r0, JSObject::kPropertiesOffset));
107 __ str(r1, FieldMemOperand(r0, JSObject::kElementsOffset)); 111 __ str(r1, FieldMemOperand(r0, JSObject::kElementsOffset));
108 __ str(r2, FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); 112 __ str(r2, FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset));
(...skipping 4677 matching lines...) Expand 10 before | Expand all | Expand 10 after
4786 4790
4787 // Try the new space allocation. Start out with computing the size 4791 // Try the new space allocation. Start out with computing the size
4788 // of the arguments object and the elements array in words. 4792 // of the arguments object and the elements array in words.
4789 Label add_arguments_object; 4793 Label add_arguments_object;
4790 __ bind(&try_allocate); 4794 __ bind(&try_allocate);
4791 __ cmp(r1, Operand(0, RelocInfo::NONE)); 4795 __ cmp(r1, Operand(0, RelocInfo::NONE));
4792 __ b(eq, &add_arguments_object); 4796 __ b(eq, &add_arguments_object);
4793 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); 4797 __ mov(r1, Operand(r1, LSR, kSmiTagSize));
4794 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); 4798 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize));
4795 __ bind(&add_arguments_object); 4799 __ bind(&add_arguments_object);
4796 __ add(r1, r1, Operand(Heap::kArgumentsObjectSize / kPointerSize)); 4800 __ add(r1, r1, Operand(GetArgumentsObjectSize() / kPointerSize));
4797 4801
4798 // Do the allocation of both objects in one go. 4802 // Do the allocation of both objects in one go.
4799 __ AllocateInNewSpace( 4803 __ AllocateInNewSpace(
4800 r1, 4804 r1,
4801 r0, 4805 r0,
4802 r2, 4806 r2,
4803 r3, 4807 r3,
4804 &runtime, 4808 &runtime,
4805 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); 4809 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
4806 4810
4807 // Get the arguments boilerplate from the current (global) context. 4811 // Get the arguments boilerplate from the current (global) context.
4808 int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX);
4809 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 4812 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
4810 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); 4813 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset));
4811 __ ldr(r4, MemOperand(r4, offset)); 4814 __ ldr(r4, MemOperand(r4,
4815 Context::SlotOffset(GetArgumentsBoilerplateIndex())));
4812 4816
4813 // Copy the JS object part. 4817 // Copy the JS object part.
4814 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); 4818 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize);
4815 4819
4816 // Setup the callee in-object property. 4820 if (type_ == NEW_NON_STRICT) {
4817 STATIC_ASSERT(Heap::arguments_callee_index == 0); 4821 // Setup the callee in-object property.
4818 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); 4822 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1);
4819 __ str(r3, FieldMemOperand(r0, JSObject::kHeaderSize)); 4823 __ ldr(r3, MemOperand(sp, 2 * kPointerSize));
4824 const int kCalleeOffset = JSObject::kHeaderSize +
4825 Heap::kArgumentsCalleeIndex * kPointerSize;
4826 __ str(r3, FieldMemOperand(r0, kCalleeOffset));
4827 }
4820 4828
4821 // Get the length (smi tagged) and set that as an in-object property too. 4829 // Get the length (smi tagged) and set that as an in-object property too.
4822 STATIC_ASSERT(Heap::arguments_length_index == 1); 4830 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
4823 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); 4831 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
4824 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); 4832 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize +
4833 Heap::kArgumentsLengthIndex * kPointerSize));
4825 4834
4826 // If there are no actual arguments, we're done. 4835 // If there are no actual arguments, we're done.
4827 Label done; 4836 Label done;
4828 __ cmp(r1, Operand(0, RelocInfo::NONE)); 4837 __ cmp(r1, Operand(0, RelocInfo::NONE));
4829 __ b(eq, &done); 4838 __ b(eq, &done);
4830 4839
4831 // Get the parameters pointer from the stack. 4840 // Get the parameters pointer from the stack.
4832 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); 4841 __ ldr(r2, MemOperand(sp, 1 * kPointerSize));
4833 4842
4834 // Setup the elements pointer in the allocated arguments object and 4843 // Setup the elements pointer in the allocated arguments object and
4835 // initialize the header in the elements fixed array. 4844 // initialize the header in the elements fixed array.
4836 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); 4845 __ add(r4, r0, Operand(GetArgumentsObjectSize()));
4837 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); 4846 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset));
4838 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); 4847 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex);
4839 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); 4848 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset));
4840 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); 4849 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset));
4841 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. 4850 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop.
4842 4851
4843 // Copy the fixed array slots. 4852 // Copy the fixed array slots.
4844 Label loop; 4853 Label loop;
4845 // Setup r4 to point to the first array slot. 4854 // Setup r4 to point to the first array slot.
4846 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4855 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
6825 __ str(pc, MemOperand(sp, 0)); 6834 __ str(pc, MemOperand(sp, 0));
6826 __ Jump(target); // Call the C++ function. 6835 __ Jump(target); // Call the C++ function.
6827 } 6836 }
6828 6837
6829 6838
6830 #undef __ 6839 #undef __
6831 6840
6832 } } // namespace v8::internal 6841 } } // namespace v8::internal
6833 6842
6834 #endif // V8_TARGET_ARCH_ARM 6843 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/codegen-arm.h » ('j') | src/global-handles.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698