| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 __ Mov(size, Operand(mapped_params, LSL, kPointerSizeLog2)); | 2412 __ Mov(size, Operand(mapped_params, LSL, kPointerSizeLog2)); |
| 2413 __ Add(size, size, kParameterMapHeaderSize); | 2413 __ Add(size, size, kParameterMapHeaderSize); |
| 2414 | 2414 |
| 2415 // If there are no mapped parameters, set the running size total to zero. | 2415 // If there are no mapped parameters, set the running size total to zero. |
| 2416 // Otherwise, use the parameter map size calculated earlier. | 2416 // Otherwise, use the parameter map size calculated earlier. |
| 2417 __ Cmp(mapped_params, 0); | 2417 __ Cmp(mapped_params, 0); |
| 2418 __ CzeroX(size, eq); | 2418 __ CzeroX(size, eq); |
| 2419 | 2419 |
| 2420 // 2. Add the size of the backing store and arguments object. | 2420 // 2. Add the size of the backing store and arguments object. |
| 2421 __ Add(size, size, Operand(arg_count, LSL, kPointerSizeLog2)); | 2421 __ Add(size, size, Operand(arg_count, LSL, kPointerSizeLog2)); |
| 2422 __ Add(size, size, FixedArray::kHeaderSize + Heap::kArgumentsObjectSize); | 2422 __ Add(size, size, |
| 2423 FixedArray::kHeaderSize + Heap::kSloppyArgumentsObjectSize); |
| 2423 | 2424 |
| 2424 // Do the allocation of all three objects in one go. Assign this to x0, as it | 2425 // Do the allocation of all three objects in one go. Assign this to x0, as it |
| 2425 // will be returned to the caller. | 2426 // will be returned to the caller. |
| 2426 Register alloc_obj = x0; | 2427 Register alloc_obj = x0; |
| 2427 __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); | 2428 __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); |
| 2428 | 2429 |
| 2429 // Get the arguments boilerplate from the current (global) context. | 2430 // Get the arguments boilerplate from the current (global) context. |
| 2430 | 2431 |
| 2431 // x0 alloc_obj pointer to allocated objects (param map, backing | 2432 // x0 alloc_obj pointer to allocated objects (param map, backing |
| 2432 // store, arguments) | 2433 // store, arguments) |
| 2433 // x1 mapped_params number of mapped parameters, min(params, args) | 2434 // x1 mapped_params number of mapped parameters, min(params, args) |
| 2434 // x2 arg_count number of function arguments | 2435 // x2 arg_count number of function arguments |
| 2435 // x3 arg_count_smi number of function arguments (smi) | 2436 // x3 arg_count_smi number of function arguments (smi) |
| 2436 // x4 function function pointer | 2437 // x4 function function pointer |
| 2437 // x7 param_count number of function parameters | 2438 // x7 param_count number of function parameters |
| 2438 // x11 args_offset offset to args (or aliased args) boilerplate (uninit) | 2439 // x11 args_offset offset to args (or aliased args) boilerplate (uninit) |
| 2439 // x14 recv_arg pointer to receiver arguments | 2440 // x14 recv_arg pointer to receiver arguments |
| 2440 | 2441 |
| 2441 Register global_object = x10; | 2442 Register global_object = x10; |
| 2442 Register global_ctx = x10; | 2443 Register global_ctx = x10; |
| 2443 Register args_offset = x11; | 2444 Register args_offset = x11; |
| 2444 Register aliased_args_offset = x10; | 2445 Register aliased_args_offset = x10; |
| 2445 __ Ldr(global_object, GlobalObjectMemOperand()); | 2446 __ Ldr(global_object, GlobalObjectMemOperand()); |
| 2446 __ Ldr(global_ctx, FieldMemOperand(global_object, | 2447 __ Ldr(global_ctx, FieldMemOperand(global_object, |
| 2447 GlobalObject::kNativeContextOffset)); | 2448 GlobalObject::kNativeContextOffset)); |
| 2448 | 2449 |
| 2449 __ Ldr(args_offset, ContextMemOperand(global_ctx, | 2450 __ Ldr(args_offset, |
| 2450 Context::ARGUMENTS_BOILERPLATE_INDEX)); | 2451 ContextMemOperand(global_ctx, |
| 2452 Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX)); |
| 2451 __ Ldr(aliased_args_offset, | 2453 __ Ldr(aliased_args_offset, |
| 2452 ContextMemOperand(global_ctx, | 2454 ContextMemOperand(global_ctx, |
| 2453 Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX)); | 2455 Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX)); |
| 2454 __ Cmp(mapped_params, 0); | 2456 __ Cmp(mapped_params, 0); |
| 2455 __ CmovX(args_offset, aliased_args_offset, ne); | 2457 __ CmovX(args_offset, aliased_args_offset, ne); |
| 2456 | 2458 |
| 2457 // Copy the JS object part. | 2459 // Copy the JS object part. |
| 2458 __ CopyFields(alloc_obj, args_offset, CPURegList(x10, x12, x13), | 2460 __ CopyFields(alloc_obj, args_offset, CPURegList(x10, x12, x13), |
| 2459 JSObject::kHeaderSize / kPointerSize); | 2461 JSObject::kHeaderSize / kPointerSize); |
| 2460 | 2462 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2479 // x1 mapped_params number of mapped parameters, min(params, args) | 2481 // x1 mapped_params number of mapped parameters, min(params, args) |
| 2480 // x2 arg_count number of function arguments | 2482 // x2 arg_count number of function arguments |
| 2481 // x3 arg_count_smi number of function arguments (smi) | 2483 // x3 arg_count_smi number of function arguments (smi) |
| 2482 // x4 function function pointer | 2484 // x4 function function pointer |
| 2483 // x5 elements pointer to parameter map or backing store (uninit) | 2485 // x5 elements pointer to parameter map or backing store (uninit) |
| 2484 // x6 backing_store pointer to backing store (uninit) | 2486 // x6 backing_store pointer to backing store (uninit) |
| 2485 // x7 param_count number of function parameters | 2487 // x7 param_count number of function parameters |
| 2486 // x14 recv_arg pointer to receiver arguments | 2488 // x14 recv_arg pointer to receiver arguments |
| 2487 | 2489 |
| 2488 Register elements = x5; | 2490 Register elements = x5; |
| 2489 __ Add(elements, alloc_obj, Heap::kArgumentsObjectSize); | 2491 __ Add(elements, alloc_obj, Heap::kSloppyArgumentsObjectSize); |
| 2490 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); | 2492 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
| 2491 | 2493 |
| 2492 // Initialize parameter map. If there are no mapped arguments, we're done. | 2494 // Initialize parameter map. If there are no mapped arguments, we're done. |
| 2493 Label skip_parameter_map; | 2495 Label skip_parameter_map; |
| 2494 __ Cmp(mapped_params, 0); | 2496 __ Cmp(mapped_params, 0); |
| 2495 // Set up backing store address, because it is needed later for filling in | 2497 // Set up backing store address, because it is needed later for filling in |
| 2496 // the unmapped arguments. | 2498 // the unmapped arguments. |
| 2497 Register backing_store = x6; | 2499 Register backing_store = x6; |
| 2498 __ CmovX(backing_store, elements, eq); | 2500 __ CmovX(backing_store, elements, eq); |
| 2499 __ B(eq, &skip_parameter_map); | 2501 __ B(eq, &skip_parameter_map); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); | 2646 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); |
| 2645 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); | 2647 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); |
| 2646 | 2648 |
| 2647 // Try the new space allocation. Start out with computing the size of the | 2649 // Try the new space allocation. Start out with computing the size of the |
| 2648 // arguments object and the elements array in words. | 2650 // arguments object and the elements array in words. |
| 2649 Register size = x10; | 2651 Register size = x10; |
| 2650 __ Bind(&try_allocate); | 2652 __ Bind(&try_allocate); |
| 2651 __ Add(size, param_count, FixedArray::kHeaderSize / kPointerSize); | 2653 __ Add(size, param_count, FixedArray::kHeaderSize / kPointerSize); |
| 2652 __ Cmp(param_count, 0); | 2654 __ Cmp(param_count, 0); |
| 2653 __ CzeroX(size, eq); | 2655 __ CzeroX(size, eq); |
| 2654 __ Add(size, size, Heap::kArgumentsObjectSizeStrict / kPointerSize); | 2656 __ Add(size, size, Heap::kStrictArgumentsObjectSize / kPointerSize); |
| 2655 | 2657 |
| 2656 // Do the allocation of both objects in one go. Assign this to x0, as it will | 2658 // Do the allocation of both objects in one go. Assign this to x0, as it will |
| 2657 // be returned to the caller. | 2659 // be returned to the caller. |
| 2658 Register alloc_obj = x0; | 2660 Register alloc_obj = x0; |
| 2659 __ Allocate(size, alloc_obj, x11, x12, &runtime, | 2661 __ Allocate(size, alloc_obj, x11, x12, &runtime, |
| 2660 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2662 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
| 2661 | 2663 |
| 2662 // Get the arguments boilerplate from the current (native) context. | 2664 // Get the arguments boilerplate from the current (native) context. |
| 2663 Register global_object = x10; | 2665 Register global_object = x10; |
| 2664 Register global_ctx = x10; | 2666 Register global_ctx = x10; |
| 2665 Register args_offset = x4; | 2667 Register args_offset = x4; |
| 2666 __ Ldr(global_object, GlobalObjectMemOperand()); | 2668 __ Ldr(global_object, GlobalObjectMemOperand()); |
| 2667 __ Ldr(global_ctx, FieldMemOperand(global_object, | 2669 __ Ldr(global_ctx, FieldMemOperand(global_object, |
| 2668 GlobalObject::kNativeContextOffset)); | 2670 GlobalObject::kNativeContextOffset)); |
| 2669 __ Ldr(args_offset, | 2671 __ Ldr(args_offset, |
| 2670 ContextMemOperand(global_ctx, | 2672 ContextMemOperand(global_ctx, |
| 2671 Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX)); | 2673 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX)); |
| 2672 | 2674 |
| 2673 // x0 alloc_obj pointer to allocated objects: parameter array and | 2675 // x0 alloc_obj pointer to allocated objects: parameter array and |
| 2674 // arguments object | 2676 // arguments object |
| 2675 // x1 param_count_smi number of parameters passed to function (smi) | 2677 // x1 param_count_smi number of parameters passed to function (smi) |
| 2676 // x2 params pointer to parameters | 2678 // x2 params pointer to parameters |
| 2677 // x3 function function pointer | 2679 // x3 function function pointer |
| 2678 // x4 args_offset offset to arguments boilerplate | 2680 // x4 args_offset offset to arguments boilerplate |
| 2679 // x13 param_count number of parameters passed to function | 2681 // x13 param_count number of parameters passed to function |
| 2680 | 2682 |
| 2681 // Copy the JS object part. | 2683 // Copy the JS object part. |
| 2682 __ CopyFields(alloc_obj, args_offset, CPURegList(x5, x6, x7), | 2684 __ CopyFields(alloc_obj, args_offset, CPURegList(x5, x6, x7), |
| 2683 JSObject::kHeaderSize / kPointerSize); | 2685 JSObject::kHeaderSize / kPointerSize); |
| 2684 | 2686 |
| 2685 // Set the smi-tagged length as an in-object property. | 2687 // Set the smi-tagged length as an in-object property. |
| 2686 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2688 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 2687 const int kLengthOffset = JSObject::kHeaderSize + | 2689 const int kLengthOffset = JSObject::kHeaderSize + |
| 2688 Heap::kArgumentsLengthIndex * kPointerSize; | 2690 Heap::kArgumentsLengthIndex * kPointerSize; |
| 2689 __ Str(param_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); | 2691 __ Str(param_count_smi, FieldMemOperand(alloc_obj, kLengthOffset)); |
| 2690 | 2692 |
| 2691 // If there are no actual arguments, we're done. | 2693 // If there are no actual arguments, we're done. |
| 2692 Label done; | 2694 Label done; |
| 2693 __ Cbz(param_count, &done); | 2695 __ Cbz(param_count, &done); |
| 2694 | 2696 |
| 2695 // Set up the elements pointer in the allocated arguments object and | 2697 // Set up the elements pointer in the allocated arguments object and |
| 2696 // initialize the header in the elements fixed array. | 2698 // initialize the header in the elements fixed array. |
| 2697 Register elements = x5; | 2699 Register elements = x5; |
| 2698 __ Add(elements, alloc_obj, Heap::kArgumentsObjectSizeStrict); | 2700 __ Add(elements, alloc_obj, Heap::kStrictArgumentsObjectSize); |
| 2699 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); | 2701 __ Str(elements, FieldMemOperand(alloc_obj, JSObject::kElementsOffset)); |
| 2700 __ LoadRoot(x10, Heap::kFixedArrayMapRootIndex); | 2702 __ LoadRoot(x10, Heap::kFixedArrayMapRootIndex); |
| 2701 __ Str(x10, FieldMemOperand(elements, FixedArray::kMapOffset)); | 2703 __ Str(x10, FieldMemOperand(elements, FixedArray::kMapOffset)); |
| 2702 __ Str(param_count_smi, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 2704 __ Str(param_count_smi, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 2703 | 2705 |
| 2704 // x0 alloc_obj pointer to allocated objects: parameter array and | 2706 // x0 alloc_obj pointer to allocated objects: parameter array and |
| 2705 // arguments object | 2707 // arguments object |
| 2706 // x1 param_count_smi number of parameters passed to function (smi) | 2708 // x1 param_count_smi number of parameters passed to function (smi) |
| 2707 // x2 params pointer to parameters | 2709 // x2 params pointer to parameters |
| 2708 // x3 function function pointer | 2710 // x3 function function pointer |
| (...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5799 MemOperand(fp, 6 * kPointerSize), | 5801 MemOperand(fp, 6 * kPointerSize), |
| 5800 NULL); | 5802 NULL); |
| 5801 } | 5803 } |
| 5802 | 5804 |
| 5803 | 5805 |
| 5804 #undef __ | 5806 #undef __ |
| 5805 | 5807 |
| 5806 } } // namespace v8::internal | 5808 } } // namespace v8::internal |
| 5807 | 5809 |
| 5808 #endif // V8_TARGET_ARCH_A64 | 5810 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |