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 4893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4904 | 4904 |
4905 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4905 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4906 // ----------- S t a t e ------------- | 4906 // ----------- S t a t e ------------- |
4907 // -- x1 : function | 4907 // -- x1 : function |
4908 // -- cp : context | 4908 // -- cp : context |
4909 // -- fp : frame pointer | 4909 // -- fp : frame pointer |
4910 // -- lr : return address | 4910 // -- lr : return address |
4911 // ----------------------------------- | 4911 // ----------------------------------- |
4912 __ AssertFunction(x1); | 4912 __ AssertFunction(x1); |
4913 | 4913 |
4914 // For Ignition we need to skip all possible handler/stub frames until | 4914 // Make x2 point to the JavaScript frame. |
4915 // we reach the JavaScript frame for the function (similar to what the | 4915 __ Mov(x2, fp); |
4916 // runtime fallback implementation does). So make x2 point to that | 4916 if (skip_stub_frame()) { |
4917 // JavaScript frame. | 4917 // For Ignition we need to skip the handler/stub frame to reach the |
4918 { | 4918 // JavaScript frame for the function. |
4919 Label loop, loop_entry; | |
4920 __ Mov(x2, fp); | |
4921 __ B(&loop_entry); | |
4922 __ Bind(&loop); | |
4923 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 4919 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); |
4924 __ Bind(&loop_entry); | 4920 } |
| 4921 if (FLAG_debug_code) { |
| 4922 Label ok; |
4925 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kFunctionOffset)); | 4923 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kFunctionOffset)); |
4926 __ Cmp(x3, x1); | 4924 __ Cmp(x3, x1); |
4927 __ B(ne, &loop); | 4925 __ B(eq, &ok); |
| 4926 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4927 __ Bind(&ok); |
4928 } | 4928 } |
4929 | 4929 |
4930 // Check if we have rest parameters (only possible if we have an | 4930 // Check if we have rest parameters (only possible if we have an |
4931 // arguments adaptor frame below the function frame). | 4931 // arguments adaptor frame below the function frame). |
4932 Label no_rest_parameters; | 4932 Label no_rest_parameters; |
4933 __ Ldr(x2, MemOperand(x2, CommonFrameConstants::kCallerFPOffset)); | 4933 __ Ldr(x2, MemOperand(x2, CommonFrameConstants::kCallerFPOffset)); |
4934 __ Ldr(x3, MemOperand(x2, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4934 __ Ldr(x3, MemOperand(x2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4935 __ Cmp(x3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 4935 __ Cmp(x3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
4936 __ B(ne, &no_rest_parameters); | 4936 __ B(ne, &no_rest_parameters); |
4937 | 4937 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5051 | 5051 |
5052 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 5052 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
5053 // ----------- S t a t e ------------- | 5053 // ----------- S t a t e ------------- |
5054 // -- x1 : function | 5054 // -- x1 : function |
5055 // -- cp : context | 5055 // -- cp : context |
5056 // -- fp : frame pointer | 5056 // -- fp : frame pointer |
5057 // -- lr : return address | 5057 // -- lr : return address |
5058 // ----------------------------------- | 5058 // ----------------------------------- |
5059 __ AssertFunction(x1); | 5059 __ AssertFunction(x1); |
5060 | 5060 |
5061 // For Ignition we need to skip all possible handler/stub frames until | 5061 // Make x6 point to the JavaScript frame. |
5062 // we reach the JavaScript frame for the function (similar to what the | 5062 __ Mov(x6, fp); |
5063 // runtime fallback implementation does). So make x6 point to that | 5063 if (skip_stub_frame()) { |
5064 // JavaScript frame. | 5064 // For Ignition we need to skip the handler/stub frame to reach the |
5065 { | 5065 // JavaScript frame for the function. |
5066 Label loop, loop_entry; | |
5067 __ Mov(x6, fp); | |
5068 __ B(&loop_entry); | |
5069 __ Bind(&loop); | |
5070 __ Ldr(x6, MemOperand(x6, StandardFrameConstants::kCallerFPOffset)); | 5066 __ Ldr(x6, MemOperand(x6, StandardFrameConstants::kCallerFPOffset)); |
5071 __ Bind(&loop_entry); | 5067 } |
| 5068 if (FLAG_debug_code) { |
| 5069 Label ok; |
5072 __ Ldr(x3, MemOperand(x6, StandardFrameConstants::kFunctionOffset)); | 5070 __ Ldr(x3, MemOperand(x6, StandardFrameConstants::kFunctionOffset)); |
5073 __ Cmp(x3, x1); | 5071 __ Cmp(x3, x1); |
5074 __ B(ne, &loop); | 5072 __ B(eq, &ok); |
| 5073 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 5074 __ Bind(&ok); |
5075 } | 5075 } |
5076 | 5076 |
5077 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 5077 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
5078 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 5078 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
5079 __ Ldrsw( | 5079 __ Ldrsw( |
5080 x2, FieldMemOperand(x2, SharedFunctionInfo::kFormalParameterCountOffset)); | 5080 x2, FieldMemOperand(x2, SharedFunctionInfo::kFormalParameterCountOffset)); |
5081 __ Add(x3, x6, Operand(x2, LSL, kPointerSizeLog2)); | 5081 __ Add(x3, x6, Operand(x2, LSL, kPointerSizeLog2)); |
5082 __ Add(x3, x3, Operand(StandardFrameConstants::kCallerSPOffset)); | 5082 __ Add(x3, x3, Operand(StandardFrameConstants::kCallerSPOffset)); |
5083 __ SmiTag(x2); | 5083 __ SmiTag(x2); |
5084 | 5084 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5351 | 5351 |
5352 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { | 5352 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
5353 // ----------- S t a t e ------------- | 5353 // ----------- S t a t e ------------- |
5354 // -- x1 : function | 5354 // -- x1 : function |
5355 // -- cp : context | 5355 // -- cp : context |
5356 // -- fp : frame pointer | 5356 // -- fp : frame pointer |
5357 // -- lr : return address | 5357 // -- lr : return address |
5358 // ----------------------------------- | 5358 // ----------------------------------- |
5359 __ AssertFunction(x1); | 5359 __ AssertFunction(x1); |
5360 | 5360 |
5361 // For Ignition we need to skip all possible handler/stub frames until | 5361 // Make x2 point to the JavaScript frame. |
5362 // we reach the JavaScript frame for the function (similar to what the | 5362 __ Mov(x2, fp); |
5363 // runtime fallback implementation does). So make x2 point to that | 5363 if (skip_stub_frame()) { |
5364 // JavaScript frame. | 5364 // For Ignition we need to skip the handler/stub frame to reach the |
5365 { | 5365 // JavaScript frame for the function. |
5366 Label loop, loop_entry; | |
5367 __ Mov(x2, fp); | |
5368 __ B(&loop_entry); | |
5369 __ Bind(&loop); | |
5370 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 5366 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); |
5371 __ Bind(&loop_entry); | 5367 } |
| 5368 if (FLAG_debug_code) { |
| 5369 Label ok; |
5372 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kFunctionOffset)); | 5370 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kFunctionOffset)); |
5373 __ Cmp(x3, x1); | 5371 __ Cmp(x3, x1); |
5374 __ B(ne, &loop); | 5372 __ B(eq, &ok); |
| 5373 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 5374 __ Bind(&ok); |
5375 } | 5375 } |
5376 | 5376 |
5377 // Check if we have an arguments adaptor frame below the function frame. | 5377 // Check if we have an arguments adaptor frame below the function frame. |
5378 Label arguments_adaptor, arguments_done; | 5378 Label arguments_adaptor, arguments_done; |
5379 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 5379 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); |
5380 __ Ldr(x4, MemOperand(x3, CommonFrameConstants::kContextOrFrameTypeOffset)); | 5380 __ Ldr(x4, MemOperand(x3, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5381 __ Cmp(x4, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 5381 __ Cmp(x4, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
5382 __ B(eq, &arguments_adaptor); | 5382 __ B(eq, &arguments_adaptor); |
5383 { | 5383 { |
5384 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 5384 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5949 kStackUnwindSpace, NULL, spill_offset, | 5949 kStackUnwindSpace, NULL, spill_offset, |
5950 return_value_operand, NULL); | 5950 return_value_operand, NULL); |
5951 } | 5951 } |
5952 | 5952 |
5953 #undef __ | 5953 #undef __ |
5954 | 5954 |
5955 } // namespace internal | 5955 } // namespace internal |
5956 } // namespace v8 | 5956 } // namespace v8 |
5957 | 5957 |
5958 #endif // V8_TARGET_ARCH_ARM64 | 5958 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |