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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 5058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5069 | 5069 |
5070 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 5070 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
5071 // ----------- S t a t e ------------- | 5071 // ----------- S t a t e ------------- |
5072 // -- x1 : function | 5072 // -- x1 : function |
5073 // -- cp : context | 5073 // -- cp : context |
5074 // -- fp : frame pointer | 5074 // -- fp : frame pointer |
5075 // -- lr : return address | 5075 // -- lr : return address |
5076 // ----------------------------------- | 5076 // ----------------------------------- |
5077 __ AssertFunction(x1); | 5077 __ AssertFunction(x1); |
5078 | 5078 |
| 5079 // For Ignition we need to skip all possible handler/stub frames until |
| 5080 // we reach the JavaScript frame for the function (similar to what the |
| 5081 // runtime fallback implementation does). So make x6 point to that |
| 5082 // JavaScript frame. |
| 5083 { |
| 5084 Label loop, loop_entry; |
| 5085 __ Mov(x6, fp); |
| 5086 __ B(&loop_entry); |
| 5087 __ Bind(&loop); |
| 5088 __ Ldr(x6, MemOperand(x6, StandardFrameConstants::kCallerFPOffset)); |
| 5089 __ Bind(&loop_entry); |
| 5090 __ Ldr(x3, MemOperand(x6, StandardFrameConstants::kFunctionOffset)); |
| 5091 __ Cmp(x3, x1); |
| 5092 __ B(ne, &loop); |
| 5093 } |
| 5094 |
5079 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 5095 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
5080 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 5096 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
5081 __ Ldrsw( | 5097 __ Ldrsw( |
5082 x2, FieldMemOperand(x2, SharedFunctionInfo::kFormalParameterCountOffset)); | 5098 x2, FieldMemOperand(x2, SharedFunctionInfo::kFormalParameterCountOffset)); |
5083 __ Add(x3, fp, Operand(x2, LSL, kPointerSizeLog2)); | 5099 __ Add(x3, x6, Operand(x2, LSL, kPointerSizeLog2)); |
5084 __ Add(x3, x3, Operand(StandardFrameConstants::kCallerSPOffset)); | 5100 __ Add(x3, x3, Operand(StandardFrameConstants::kCallerSPOffset)); |
5085 __ SmiTag(x2); | 5101 __ SmiTag(x2); |
5086 | 5102 |
5087 // x1 : function | 5103 // x1 : function |
5088 // x2 : number of parameters (tagged) | 5104 // x2 : number of parameters (tagged) |
5089 // x3 : parameters pointer | 5105 // x3 : parameters pointer |
| 5106 // x6 : JavaScript frame pointer |
5090 // | 5107 // |
5091 // Returns pointer to result object in x0. | 5108 // Returns pointer to result object in x0. |
5092 | 5109 |
5093 // Make an untagged copy of the parameter count. | 5110 // Make an untagged copy of the parameter count. |
5094 // Note: arg_count_smi is an alias of param_count_smi. | 5111 // Note: arg_count_smi is an alias of param_count_smi. |
5095 Register function = x1; | 5112 Register function = x1; |
5096 Register arg_count_smi = x2; | 5113 Register arg_count_smi = x2; |
5097 Register param_count_smi = x2; | 5114 Register param_count_smi = x2; |
5098 Register recv_arg = x3; | 5115 Register recv_arg = x3; |
5099 Register param_count = x7; | 5116 Register param_count = x7; |
5100 __ SmiUntag(param_count, param_count_smi); | 5117 __ SmiUntag(param_count, param_count_smi); |
5101 | 5118 |
5102 // Check if the calling frame is an arguments adaptor frame. | 5119 // Check if the calling frame is an arguments adaptor frame. |
5103 Register caller_fp = x11; | 5120 Register caller_fp = x11; |
5104 Register caller_ctx = x12; | 5121 Register caller_ctx = x12; |
5105 Label runtime; | 5122 Label runtime; |
5106 Label adaptor_frame, try_allocate; | 5123 Label adaptor_frame, try_allocate; |
5107 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 5124 __ Ldr(caller_fp, MemOperand(x6, StandardFrameConstants::kCallerFPOffset)); |
5108 __ Ldr( | 5125 __ Ldr( |
5109 caller_ctx, | 5126 caller_ctx, |
5110 MemOperand(caller_fp, CommonFrameConstants::kContextOrFrameTypeOffset)); | 5127 MemOperand(caller_fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5111 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 5128 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
5112 __ B(eq, &adaptor_frame); | 5129 __ B(eq, &adaptor_frame); |
5113 | 5130 |
5114 // No adaptor, parameter count = argument count. | 5131 // No adaptor, parameter count = argument count. |
5115 | 5132 |
5116 // x1 function function pointer | 5133 // x1 function function pointer |
5117 // x2 arg_count_smi number of function arguments (smi) | 5134 // x2 arg_count_smi number of function arguments (smi) |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5945 kStackUnwindSpace, NULL, spill_offset, | 5962 kStackUnwindSpace, NULL, spill_offset, |
5946 return_value_operand, NULL); | 5963 return_value_operand, NULL); |
5947 } | 5964 } |
5948 | 5965 |
5949 #undef __ | 5966 #undef __ |
5950 | 5967 |
5951 } // namespace internal | 5968 } // namespace internal |
5952 } // namespace v8 | 5969 } // namespace v8 |
5953 | 5970 |
5954 #endif // V8_TARGET_ARCH_ARM64 | 5971 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |