OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2012 __ add(r9, r9, Operand(r2, LSL, 1)); | 2012 __ add(r9, r9, Operand(r2, LSL, 1)); |
2013 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); | 2013 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); |
2014 | 2014 |
2015 // 3. Arguments object. | 2015 // 3. Arguments object. |
2016 __ add(r9, r9, Operand(Heap::kSloppyArgumentsObjectSize)); | 2016 __ add(r9, r9, Operand(Heap::kSloppyArgumentsObjectSize)); |
2017 | 2017 |
2018 // Do the allocation of all three objects in one go. | 2018 // Do the allocation of all three objects in one go. |
2019 __ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT); | 2019 __ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT); |
2020 | 2020 |
2021 // r0 = address of new object(s) (tagged) | 2021 // r0 = address of new object(s) (tagged) |
2022 // r2 = argument count (smi-tagged) | 2022 // r2 = argument count (tagged) |
2023 // Get the arguments boilerplate from the current native context into r4. | 2023 // Get the arguments boilerplate from the current native context into r4. |
2024 const int kNormalOffset = | 2024 const int kNormalOffset = |
2025 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); | 2025 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX); |
2026 const int kAliasedOffset = | 2026 const int kAliasedOffset = |
2027 Context::SlotOffset(Context::ALIASED_ARGUMENTS_MAP_INDEX); | 2027 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); |
2028 | 2028 |
2029 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2029 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2030 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2030 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
2031 __ cmp(r1, Operand::Zero()); | 2031 __ cmp(r1, Operand::Zero()); |
2032 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); | 2032 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); |
2033 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); | 2033 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); |
2034 | 2034 |
2035 // r0 = address of new object (tagged) | 2035 // r0 = address of new object (tagged) |
2036 // r1 = mapped parameter count (tagged) | 2036 // r1 = mapped parameter count (tagged) |
2037 // r2 = argument count (smi-tagged) | 2037 // r2 = argument count (tagged) |
2038 // r4 = address of arguments map (tagged) | 2038 // r4 = address of boilerplate object (tagged) |
2039 __ str(r4, FieldMemOperand(r0, JSObject::kMapOffset)); | 2039 // Copy the JS object part. |
2040 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 2040 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { |
2041 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | 2041 __ ldr(r3, FieldMemOperand(r4, i)); |
2042 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2042 __ str(r3, FieldMemOperand(r0, i)); |
| 2043 } |
2043 | 2044 |
2044 // Set up the callee in-object property. | 2045 // Set up the callee in-object property. |
2045 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 2046 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
2046 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 2047 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); |
2047 __ AssertNotSmi(r3); | |
2048 const int kCalleeOffset = JSObject::kHeaderSize + | 2048 const int kCalleeOffset = JSObject::kHeaderSize + |
2049 Heap::kArgumentsCalleeIndex * kPointerSize; | 2049 Heap::kArgumentsCalleeIndex * kPointerSize; |
2050 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); | 2050 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); |
2051 | 2051 |
2052 // Use the length (smi tagged) and set that as an in-object property too. | 2052 // Use the length (smi tagged) and set that as an in-object property too. |
2053 __ AssertSmi(r2); | |
2054 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2053 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2055 const int kLengthOffset = JSObject::kHeaderSize + | 2054 const int kLengthOffset = JSObject::kHeaderSize + |
2056 Heap::kArgumentsLengthIndex * kPointerSize; | 2055 Heap::kArgumentsLengthIndex * kPointerSize; |
2057 __ str(r2, FieldMemOperand(r0, kLengthOffset)); | 2056 __ str(r2, FieldMemOperand(r0, kLengthOffset)); |
2058 | 2057 |
2059 // Set up the elements pointer in the allocated arguments object. | 2058 // Set up the elements pointer in the allocated arguments object. |
2060 // If we allocated a parameter map, r4 will point there, otherwise | 2059 // If we allocated a parameter map, r4 will point there, otherwise |
2061 // it will point to the backing store. | 2060 // it will point to the backing store. |
2062 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); | 2061 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); |
2063 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2062 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 __ bind(&add_arguments_object); | 2196 __ bind(&add_arguments_object); |
2198 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); | 2197 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
2199 | 2198 |
2200 // Do the allocation of both objects in one go. | 2199 // Do the allocation of both objects in one go. |
2201 __ Allocate(r1, r0, r2, r3, &runtime, | 2200 __ Allocate(r1, r0, r2, r3, &runtime, |
2202 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2201 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
2203 | 2202 |
2204 // Get the arguments boilerplate from the current native context. | 2203 // Get the arguments boilerplate from the current native context. |
2205 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2204 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2206 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2205 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
2207 __ ldr(r4, MemOperand( | 2206 __ ldr(r4, MemOperand(r4, Context::SlotOffset( |
2208 r4, Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX))); | 2207 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX))); |
2209 | 2208 |
2210 __ str(r4, FieldMemOperand(r0, JSObject::kMapOffset)); | 2209 // Copy the JS object part. |
2211 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 2210 __ CopyFields(r0, r4, d0, JSObject::kHeaderSize / kPointerSize); |
2212 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | |
2213 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | |
2214 | 2211 |
2215 // Get the length (smi tagged) and set that as an in-object property too. | 2212 // Get the length (smi tagged) and set that as an in-object property too. |
2216 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2213 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2217 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 2214 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
2218 __ AssertSmi(r1); | |
2219 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | 2215 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + |
2220 Heap::kArgumentsLengthIndex * kPointerSize)); | 2216 Heap::kArgumentsLengthIndex * kPointerSize)); |
2221 | 2217 |
2222 // If there are no actual arguments, we're done. | 2218 // If there are no actual arguments, we're done. |
2223 Label done; | 2219 Label done; |
2224 __ cmp(r1, Operand::Zero()); | 2220 __ cmp(r1, Operand::Zero()); |
2225 __ b(eq, &done); | 2221 __ b(eq, &done); |
2226 | 2222 |
2227 // Get the parameters pointer from the stack. | 2223 // Get the parameters pointer from the stack. |
2228 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 2224 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
(...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5080 MemOperand(fp, 6 * kPointerSize), | 5076 MemOperand(fp, 6 * kPointerSize), |
5081 NULL); | 5077 NULL); |
5082 } | 5078 } |
5083 | 5079 |
5084 | 5080 |
5085 #undef __ | 5081 #undef __ |
5086 | 5082 |
5087 } } // namespace v8::internal | 5083 } } // namespace v8::internal |
5088 | 5084 |
5089 #endif // V8_TARGET_ARCH_ARM | 5085 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |