| 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 (tagged) | 2022 // r2 = argument count (smi-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_BOILERPLATE_INDEX); | 2025 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
| 2026 const int kAliasedOffset = | 2026 const int kAliasedOffset = |
| 2027 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); | 2027 Context::SlotOffset(Context::ALIASED_ARGUMENTS_MAP_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 (tagged) | 2037 // r2 = argument count (smi-tagged) |
| 2038 // r4 = address of boilerplate object (tagged) | 2038 // r4 = address of arguments map (tagged) |
| 2039 // Copy the JS object part. | 2039 __ str(r4, FieldMemOperand(r0, JSObject::kMapOffset)); |
| 2040 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { | 2040 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
| 2041 __ ldr(r3, FieldMemOperand(r4, i)); | 2041 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
| 2042 __ str(r3, FieldMemOperand(r0, i)); | 2042 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 2043 } | |
| 2044 | 2043 |
| 2045 // Set up the callee in-object property. | 2044 // Set up the callee in-object property. |
| 2046 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 2045 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
| 2047 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 2046 __ 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); |
| 2053 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2054 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 2054 const int kLengthOffset = JSObject::kHeaderSize + | 2055 const int kLengthOffset = JSObject::kHeaderSize + |
| 2055 Heap::kArgumentsLengthIndex * kPointerSize; | 2056 Heap::kArgumentsLengthIndex * kPointerSize; |
| 2056 __ str(r2, FieldMemOperand(r0, kLengthOffset)); | 2057 __ str(r2, FieldMemOperand(r0, kLengthOffset)); |
| 2057 | 2058 |
| 2058 // Set up the elements pointer in the allocated arguments object. | 2059 // Set up the elements pointer in the allocated arguments object. |
| 2059 // If we allocated a parameter map, r4 will point there, otherwise | 2060 // If we allocated a parameter map, r4 will point there, otherwise |
| 2060 // it will point to the backing store. | 2061 // it will point to the backing store. |
| 2061 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); | 2062 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); |
| 2062 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2063 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 __ bind(&add_arguments_object); | 2197 __ bind(&add_arguments_object); |
| 2197 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); | 2198 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
| 2198 | 2199 |
| 2199 // Do the allocation of both objects in one go. | 2200 // Do the allocation of both objects in one go. |
| 2200 __ Allocate(r1, r0, r2, r3, &runtime, | 2201 __ Allocate(r1, r0, r2, r3, &runtime, |
| 2201 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2202 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
| 2202 | 2203 |
| 2203 // Get the arguments boilerplate from the current native context. | 2204 // Get the arguments boilerplate from the current native context. |
| 2204 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2205 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2205 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2206 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
| 2206 __ ldr(r4, MemOperand(r4, Context::SlotOffset( | 2207 __ ldr(r4, MemOperand( |
| 2207 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX))); | 2208 r4, Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX))); |
| 2208 | 2209 |
| 2209 // Copy the JS object part. | 2210 __ str(r4, FieldMemOperand(r0, JSObject::kMapOffset)); |
| 2210 __ CopyFields(r0, r4, d0, JSObject::kHeaderSize / kPointerSize); | 2211 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
| 2212 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
| 2213 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 2211 | 2214 |
| 2212 // Get the length (smi tagged) and set that as an in-object property too. | 2215 // Get the length (smi tagged) and set that as an in-object property too. |
| 2213 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2216 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 2214 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 2217 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
| 2218 __ AssertSmi(r1); |
| 2215 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | 2219 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + |
| 2216 Heap::kArgumentsLengthIndex * kPointerSize)); | 2220 Heap::kArgumentsLengthIndex * kPointerSize)); |
| 2217 | 2221 |
| 2218 // If there are no actual arguments, we're done. | 2222 // If there are no actual arguments, we're done. |
| 2219 Label done; | 2223 Label done; |
| 2220 __ cmp(r1, Operand::Zero()); | 2224 __ cmp(r1, Operand::Zero()); |
| 2221 __ b(eq, &done); | 2225 __ b(eq, &done); |
| 2222 | 2226 |
| 2223 // Get the parameters pointer from the stack. | 2227 // Get the parameters pointer from the stack. |
| 2224 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 2228 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
| (...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5076 MemOperand(fp, 6 * kPointerSize), | 5080 MemOperand(fp, 6 * kPointerSize), |
| 5077 NULL); | 5081 NULL); |
| 5078 } | 5082 } |
| 5079 | 5083 |
| 5080 | 5084 |
| 5081 #undef __ | 5085 #undef __ |
| 5082 | 5086 |
| 5083 } } // namespace v8::internal | 5087 } } // namespace v8::internal |
| 5084 | 5088 |
| 5085 #endif // V8_TARGET_ARCH_ARM | 5089 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |