OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 __ Add(size, size, | 2096 __ Add(size, size, |
2097 FixedArray::kHeaderSize + Heap::kSloppyArgumentsObjectSize); | 2097 FixedArray::kHeaderSize + Heap::kSloppyArgumentsObjectSize); |
2098 | 2098 |
2099 // Do the allocation of all three objects in one go. Assign this to x0, as it | 2099 // Do the allocation of all three objects in one go. Assign this to x0, as it |
2100 // will be returned to the caller. | 2100 // will be returned to the caller. |
2101 Register alloc_obj = x0; | 2101 Register alloc_obj = x0; |
2102 __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); | 2102 __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); |
2103 | 2103 |
2104 // Get the arguments boilerplate from the current (global) context. | 2104 // Get the arguments boilerplate from the current (global) context. |
2105 | 2105 |
2106 // x0 alloc_obj pointer to allocated objects (param map, backing | 2106 // x0 alloc_obj pointer to allocated objects (param map, backing |
2107 // store, arguments) | 2107 // store, arguments) |
2108 // x1 mapped_params number of mapped parameters, min(params, args) | 2108 // x1 mapped_params number of mapped parameters, min(params, args) |
2109 // x2 arg_count number of function arguments | 2109 // x2 arg_count number of function arguments |
2110 // x3 arg_count_smi number of function arguments (smi) | 2110 // x3 arg_count_smi number of function arguments (smi) |
2111 // x4 function function pointer | 2111 // x4 function function pointer |
2112 // x7 param_count number of function parameters | 2112 // x7 param_count number of function parameters |
2113 // x11 args_offset offset to args (or aliased args) boilerplate (uninit) | 2113 // x11 sloppy_args_map offset to args (or aliased args) map (uninit) |
2114 // x14 recv_arg pointer to receiver arguments | 2114 // x14 recv_arg pointer to receiver arguments |
2115 | 2115 |
2116 Register global_object = x10; | 2116 Register global_object = x10; |
2117 Register global_ctx = x10; | 2117 Register global_ctx = x10; |
2118 Register args_offset = x11; | 2118 Register sloppy_args_map = x11; |
2119 Register aliased_args_offset = x10; | 2119 Register aliased_args_map = x10; |
2120 __ Ldr(global_object, GlobalObjectMemOperand()); | 2120 __ Ldr(global_object, GlobalObjectMemOperand()); |
2121 __ Ldr(global_ctx, FieldMemOperand(global_object, | 2121 __ Ldr(global_ctx, FieldMemOperand(global_object, |
2122 GlobalObject::kNativeContextOffset)); | 2122 GlobalObject::kNativeContextOffset)); |
2123 | 2123 |
2124 __ Ldr(args_offset, | 2124 __ Ldr(sloppy_args_map, |
2125 ContextMemOperand(global_ctx, | 2125 ContextMemOperand(global_ctx, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); |
2126 Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX)); | 2126 __ Ldr(aliased_args_map, |
2127 __ Ldr(aliased_args_offset, | 2127 ContextMemOperand(global_ctx, Context::ALIASED_ARGUMENTS_MAP_INDEX)); |
2128 ContextMemOperand(global_ctx, | |
2129 Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX)); | |
2130 __ Cmp(mapped_params, 0); | 2128 __ Cmp(mapped_params, 0); |
2131 __ CmovX(args_offset, aliased_args_offset, ne); | 2129 __ CmovX(sloppy_args_map, aliased_args_map, ne); |
2132 | 2130 |
2133 // Copy the JS object part. | 2131 // Copy the JS object part. |
2134 __ CopyFields(alloc_obj, args_offset, CPURegList(x10, x12, x13), | 2132 __ Str(sloppy_args_map, FieldMemOperand(alloc_obj, JSObject::kMapOffset)); |
2135 JSObject::kHeaderSize / kPointerSize); | 2133 __ LoadRoot(x10, Heap::kEmptyFixedArrayRootIndex); |
| 2134 __ Str(x10, FieldMemOperand(alloc_obj, JSObject::kPropertiesOffset)); |
| 2135 __ Str(x10, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
2136 | 2136 |
2137 // Set up the callee in-object property. | 2137 // Set up the callee in-object property. |
2138 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 2138 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
2139 const int kCalleeOffset = JSObject::kHeaderSize + | 2139 const int kCalleeOffset = JSObject::kHeaderSize + |
2140 Heap::kArgumentsCalleeIndex * kPointerSize; | 2140 Heap::kArgumentsCalleeIndex * kPointerSize; |
| 2141 __ AssertNotSmi(function); |
2141 __ Str(function, FieldMemOperand(alloc_obj, kCalleeOffset)); | 2142 __ Str(function, FieldMemOperand(alloc_obj, kCalleeOffset)); |
2142 | 2143 |
2143 // Use the length and set that as an in-object property. | 2144 // Use the length and set that as an in-object property. |
2144 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2145 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2145 const int kLengthOffset = JSObject::kHeaderSize + | 2146 const int kLengthOffset = JSObject::kHeaderSize + |
2146 Heap::kArgumentsLengthIndex * kPointerSize; | 2147 Heap::kArgumentsLengthIndex * kPointerSize; |
2147 __ Str(arg_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); | 2148 __ Str(arg_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); |
2148 | 2149 |
2149 // Set up the elements pointer in the allocated arguments object. | 2150 // Set up the elements pointer in the allocated arguments object. |
2150 // If we allocated a parameter map, "elements" will point there, otherwise | 2151 // If we allocated a parameter map, "elements" will point there, otherwise |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 | 2332 |
2332 // Do the allocation of both objects in one go. Assign this to x0, as it will | 2333 // Do the allocation of both objects in one go. Assign this to x0, as it will |
2333 // be returned to the caller. | 2334 // be returned to the caller. |
2334 Register alloc_obj = x0; | 2335 Register alloc_obj = x0; |
2335 __ Allocate(size, alloc_obj, x11, x12, &runtime, | 2336 __ Allocate(size, alloc_obj, x11, x12, &runtime, |
2336 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2337 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
2337 | 2338 |
2338 // Get the arguments boilerplate from the current (native) context. | 2339 // Get the arguments boilerplate from the current (native) context. |
2339 Register global_object = x10; | 2340 Register global_object = x10; |
2340 Register global_ctx = x10; | 2341 Register global_ctx = x10; |
2341 Register args_offset = x4; | 2342 Register strict_args_map = x4; |
2342 __ Ldr(global_object, GlobalObjectMemOperand()); | 2343 __ Ldr(global_object, GlobalObjectMemOperand()); |
2343 __ Ldr(global_ctx, FieldMemOperand(global_object, | 2344 __ Ldr(global_ctx, FieldMemOperand(global_object, |
2344 GlobalObject::kNativeContextOffset)); | 2345 GlobalObject::kNativeContextOffset)); |
2345 __ Ldr(args_offset, | 2346 __ Ldr(strict_args_map, |
2346 ContextMemOperand(global_ctx, | 2347 ContextMemOperand(global_ctx, Context::STRICT_ARGUMENTS_MAP_INDEX)); |
2347 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX)); | |
2348 | 2348 |
2349 // x0 alloc_obj pointer to allocated objects: parameter array and | 2349 // x0 alloc_obj pointer to allocated objects: parameter array and |
2350 // arguments object | 2350 // arguments object |
2351 // x1 param_count_smi number of parameters passed to function (smi) | 2351 // x1 param_count_smi number of parameters passed to function (smi) |
2352 // x2 params pointer to parameters | 2352 // x2 params pointer to parameters |
2353 // x3 function function pointer | 2353 // x3 function function pointer |
2354 // x4 args_offset offset to arguments boilerplate | 2354 // x4 strict_args_map offset to arguments map |
2355 // x13 param_count number of parameters passed to function | 2355 // x13 param_count number of parameters passed to function |
2356 | 2356 __ Str(strict_args_map, FieldMemOperand(alloc_obj, JSObject::kMapOffset)); |
2357 // Copy the JS object part. | 2357 __ LoadRoot(x5, Heap::kEmptyFixedArrayRootIndex); |
2358 __ CopyFields(alloc_obj, args_offset, CPURegList(x5, x6, x7), | 2358 __ Str(x5, FieldMemOperand(alloc_obj, JSObject::kPropertiesOffset)); |
2359 JSObject::kHeaderSize / kPointerSize); | 2359 __ Str(x5, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
2360 | 2360 |
2361 // Set the smi-tagged length as an in-object property. | 2361 // Set the smi-tagged length as an in-object property. |
2362 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2362 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2363 const int kLengthOffset = JSObject::kHeaderSize + | 2363 const int kLengthOffset = JSObject::kHeaderSize + |
2364 Heap::kArgumentsLengthIndex * kPointerSize; | 2364 Heap::kArgumentsLengthIndex * kPointerSize; |
2365 __ Str(param_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); | 2365 __ Str(param_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); |
2366 | 2366 |
2367 // If there are no actual arguments, we're done. | 2367 // If there are no actual arguments, we're done. |
2368 Label done; | 2368 Label done; |
2369 __ Cbz(param_count, &done); | 2369 __ Cbz(param_count, &done); |
(...skipping 3058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5428 MemOperand(fp, 6 * kPointerSize), | 5428 MemOperand(fp, 6 * kPointerSize), |
5429 NULL); | 5429 NULL); |
5430 } | 5430 } |
5431 | 5431 |
5432 | 5432 |
5433 #undef __ | 5433 #undef __ |
5434 | 5434 |
5435 } } // namespace v8::internal | 5435 } } // namespace v8::internal |
5436 | 5436 |
5437 #endif // V8_TARGET_ARCH_ARM64 | 5437 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |