Chromium Code Reviews| 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 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2008 __ add(r9, r9, Operand(r2, LSL, 1)); | 2008 __ add(r9, r9, Operand(r2, LSL, 1)); |
| 2009 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); | 2009 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); |
| 2010 | 2010 |
| 2011 // 3. Arguments object. | 2011 // 3. Arguments object. |
| 2012 __ add(r9, r9, Operand(Heap::kSloppyArgumentsObjectSize)); | 2012 __ add(r9, r9, Operand(Heap::kSloppyArgumentsObjectSize)); |
| 2013 | 2013 |
| 2014 // Do the allocation of all three objects in one go. | 2014 // Do the allocation of all three objects in one go. |
| 2015 __ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT); | 2015 __ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT); |
| 2016 | 2016 |
| 2017 // r0 = address of new object(s) (tagged) | 2017 // r0 = address of new object(s) (tagged) |
| 2018 // r2 = argument count (tagged) | 2018 // r2 = argument count (smi-tagged) |
| 2019 // Get the arguments boilerplate from the current native context into r4. | 2019 // Get the arguments boilerplate from the current native context into r4. |
| 2020 const int kNormalOffset = | 2020 const int kNormalOffset = |
| 2021 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX); | 2021 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
| 2022 const int kAliasedOffset = | 2022 const int kAliasedOffset = |
| 2023 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); | 2023 Context::SlotOffset(Context::ALIASED_ARGUMENTS_MAP_INDEX); |
| 2024 | 2024 |
| 2025 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2025 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2026 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2026 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
| 2027 __ cmp(r1, Operand::Zero()); | 2027 __ cmp(r1, Operand::Zero()); |
| 2028 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); | 2028 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); |
| 2029 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); | 2029 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); |
| 2030 | 2030 |
| 2031 // r0 = address of new object (tagged) | 2031 // r0 = address of new object (tagged) |
| 2032 // r1 = mapped parameter count (tagged) | 2032 // r1 = mapped parameter count (tagged) |
| 2033 // r2 = argument count (tagged) | 2033 // r2 = argument count (smi-tagged) |
| 2034 // r4 = address of boilerplate object (tagged) | 2034 // r4 = address of boilerplate object (tagged) |
|
Igor Sheludko
2014/07/02 14:17:14
Outdated comment about r4.
| |
| 2035 // Copy the JS object part. | 2035 __ str(r4, FieldMemOperand(r0, JSObject::kMapOffset)); |
| 2036 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { | 2036 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
| 2037 __ ldr(r3, FieldMemOperand(r4, i)); | 2037 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
| 2038 __ str(r3, FieldMemOperand(r0, i)); | 2038 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 2039 } | |
| 2040 | 2039 |
| 2041 // Set up the callee in-object property. | 2040 // Set up the callee in-object property. |
| 2042 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 2041 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
| 2043 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 2042 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); |
| 2043 __ AssertNotSmi(r3); | |
| 2044 const int kCalleeOffset = JSObject::kHeaderSize + | 2044 const int kCalleeOffset = JSObject::kHeaderSize + |
| 2045 Heap::kArgumentsCalleeIndex * kPointerSize; | 2045 Heap::kArgumentsCalleeIndex * kPointerSize; |
| 2046 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); | 2046 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); |
| 2047 | 2047 |
| 2048 // Use the length (smi tagged) and set that as an in-object property too. | 2048 // Use the length (smi tagged) and set that as an in-object property too. |
| 2049 __ AssertSmi(r2); | |
| 2049 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2050 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 2050 const int kLengthOffset = JSObject::kHeaderSize + | 2051 const int kLengthOffset = JSObject::kHeaderSize + |
| 2051 Heap::kArgumentsLengthIndex * kPointerSize; | 2052 Heap::kArgumentsLengthIndex * kPointerSize; |
| 2052 __ str(r2, FieldMemOperand(r0, kLengthOffset)); | 2053 __ str(r2, FieldMemOperand(r0, kLengthOffset)); |
| 2053 | 2054 |
| 2054 // Set up the elements pointer in the allocated arguments object. | 2055 // Set up the elements pointer in the allocated arguments object. |
| 2055 // If we allocated a parameter map, r4 will point there, otherwise | 2056 // If we allocated a parameter map, r4 will point there, otherwise |
| 2056 // it will point to the backing store. | 2057 // it will point to the backing store. |
| 2057 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); | 2058 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); |
| 2058 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2059 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2193 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); | 2194 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
| 2194 | 2195 |
| 2195 // Do the allocation of both objects in one go. | 2196 // Do the allocation of both objects in one go. |
| 2196 __ Allocate(r1, r0, r2, r3, &runtime, | 2197 __ Allocate(r1, r0, r2, r3, &runtime, |
| 2197 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2198 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
| 2198 | 2199 |
| 2199 // Get the arguments boilerplate from the current native context. | 2200 // Get the arguments boilerplate from the current native context. |
| 2200 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2201 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 2201 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2202 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
| 2202 __ ldr(r4, MemOperand(r4, Context::SlotOffset( | 2203 __ ldr(r4, MemOperand(r4, Context::SlotOffset( |
| 2203 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX))); | 2204 Context::STRICT_ARGUMENTS_MAP_INDEX))); |
| 2204 | 2205 |
| 2205 // Copy the JS object part. | 2206 __ str(r4, FieldMemOperand(r0, JSObject::kMapOffset)); |
| 2206 __ CopyFields(r0, r4, d0, JSObject::kHeaderSize / kPointerSize); | 2207 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
| 2208 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | |
| 2209 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | |
| 2207 | 2210 |
| 2208 // Get the length (smi tagged) and set that as an in-object property too. | 2211 // Get the length (smi tagged) and set that as an in-object property too. |
| 2209 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2212 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 2210 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 2213 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
| 2214 __ AssertSmi(r1); | |
| 2211 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | 2215 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + |
| 2212 Heap::kArgumentsLengthIndex * kPointerSize)); | 2216 Heap::kArgumentsLengthIndex * kPointerSize)); |
| 2213 | 2217 |
| 2214 // If there are no actual arguments, we're done. | 2218 // If there are no actual arguments, we're done. |
| 2215 Label done; | 2219 Label done; |
| 2216 __ cmp(r1, Operand::Zero()); | 2220 __ cmp(r1, Operand::Zero()); |
| 2217 __ b(eq, &done); | 2221 __ b(eq, &done); |
| 2218 | 2222 |
| 2219 // Get the parameters pointer from the stack. | 2223 // Get the parameters pointer from the stack. |
| 2220 __ 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... | |
| 5072 MemOperand(fp, 6 * kPointerSize), | 5076 MemOperand(fp, 6 * kPointerSize), |
| 5073 NULL); | 5077 NULL); |
| 5074 } | 5078 } |
| 5075 | 5079 |
| 5076 | 5080 |
| 5077 #undef __ | 5081 #undef __ |
| 5078 | 5082 |
| 5079 } } // namespace v8::internal | 5083 } } // namespace v8::internal |
| 5080 | 5084 |
| 5081 #endif // V8_TARGET_ARCH_ARM | 5085 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |