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/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 __ Fmov(fp_zero, 0.0); | 1317 __ Fmov(fp_zero, 0.0); |
1318 | 1318 |
1319 // Build an entry frame (see layout below). | 1319 // Build an entry frame (see layout below). |
1320 int marker = type(); | 1320 int marker = type(); |
1321 int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used. | 1321 int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used. |
1322 __ Mov(x13, bad_frame_pointer); | 1322 __ Mov(x13, bad_frame_pointer); |
1323 __ Mov(x12, Smi::FromInt(marker)); | 1323 __ Mov(x12, Smi::FromInt(marker)); |
1324 __ Mov(x11, ExternalReference(Isolate::kCEntryFPAddress, isolate())); | 1324 __ Mov(x11, ExternalReference(Isolate::kCEntryFPAddress, isolate())); |
1325 __ Ldr(x10, MemOperand(x11)); | 1325 __ Ldr(x10, MemOperand(x11)); |
1326 | 1326 |
1327 __ Push(x13, xzr, x12, x10); | 1327 __ Push(x13, x12, xzr, x10); |
1328 // Set up fp. | 1328 // Set up fp. |
1329 __ Sub(fp, jssp, EntryFrameConstants::kCallerFPOffset); | 1329 __ Sub(fp, jssp, EntryFrameConstants::kCallerFPOffset); |
1330 | 1330 |
1331 // Push the JS entry frame marker. Also set js_entry_sp if this is the | 1331 // Push the JS entry frame marker. Also set js_entry_sp if this is the |
1332 // outermost JS call. | 1332 // outermost JS call. |
1333 Label non_outermost_js, done; | 1333 Label non_outermost_js, done; |
1334 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, isolate()); | 1334 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, isolate()); |
1335 __ Mov(x10, ExternalReference(js_entry_sp)); | 1335 __ Mov(x10, ExternalReference(js_entry_sp)); |
1336 __ Ldr(x11, MemOperand(x10)); | 1336 __ Ldr(x11, MemOperand(x10)); |
1337 __ Cbnz(x11, &non_outermost_js); | 1337 __ Cbnz(x11, &non_outermost_js); |
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 | 3657 |
3658 __ Bind(&skip_to_incremental_compacting); | 3658 __ Bind(&skip_to_incremental_compacting); |
3659 GenerateIncremental(masm, INCREMENTAL_COMPACTION); | 3659 GenerateIncremental(masm, INCREMENTAL_COMPACTION); |
3660 } | 3660 } |
3661 | 3661 |
3662 | 3662 |
3663 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3663 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
3664 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3664 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
3665 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3665 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
3666 int parameter_count_offset = | 3666 int parameter_count_offset = |
3667 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3667 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
3668 __ Ldr(x1, MemOperand(fp, parameter_count_offset)); | 3668 __ Ldr(x1, MemOperand(fp, parameter_count_offset)); |
3669 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 3669 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
3670 __ Add(x1, x1, 1); | 3670 __ Add(x1, x1, 1); |
3671 } | 3671 } |
3672 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3672 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
3673 __ Drop(x1); | 3673 __ Drop(x1); |
3674 // Return to IC Miss stub, continuation still on stack. | 3674 // Return to IC Miss stub, continuation still on stack. |
3675 __ Ret(); | 3675 __ Ret(); |
3676 } | 3676 } |
3677 | 3677 |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4947 // we reach the JavaScript frame for the function (similar to what the | 4947 // we reach the JavaScript frame for the function (similar to what the |
4948 // runtime fallback implementation does). So make x2 point to that | 4948 // runtime fallback implementation does). So make x2 point to that |
4949 // JavaScript frame. | 4949 // JavaScript frame. |
4950 { | 4950 { |
4951 Label loop, loop_entry; | 4951 Label loop, loop_entry; |
4952 __ Mov(x2, fp); | 4952 __ Mov(x2, fp); |
4953 __ B(&loop_entry); | 4953 __ B(&loop_entry); |
4954 __ Bind(&loop); | 4954 __ Bind(&loop); |
4955 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 4955 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); |
4956 __ Bind(&loop_entry); | 4956 __ Bind(&loop_entry); |
4957 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kMarkerOffset)); | 4957 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kFunctionOffset)); |
4958 __ Cmp(x3, x1); | 4958 __ Cmp(x3, x1); |
4959 __ B(ne, &loop); | 4959 __ B(ne, &loop); |
4960 } | 4960 } |
4961 | 4961 |
4962 // Check if we have rest parameters (only possible if we have an | 4962 // Check if we have rest parameters (only possible if we have an |
4963 // arguments adaptor frame below the function frame). | 4963 // arguments adaptor frame below the function frame). |
4964 Label no_rest_parameters; | 4964 Label no_rest_parameters; |
4965 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 4965 __ Ldr(x2, MemOperand(x2, CommonFrameConstants::kCallerFPOffset)); |
4966 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kContextOffset)); | 4966 __ Ldr(x3, MemOperand(x2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4967 __ Cmp(x3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 4967 __ Cmp(x3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
4968 __ B(ne, &no_rest_parameters); | 4968 __ B(ne, &no_rest_parameters); |
4969 | 4969 |
4970 // Check if the arguments adaptor frame contains more arguments than | 4970 // Check if the arguments adaptor frame contains more arguments than |
4971 // specified by the function's internal formal parameter count. | 4971 // specified by the function's internal formal parameter count. |
4972 Label rest_parameters; | 4972 Label rest_parameters; |
4973 __ Ldrsw(x0, UntagSmiMemOperand( | 4973 __ Ldrsw(x0, UntagSmiMemOperand( |
4974 x2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4974 x2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4975 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 4975 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
4976 __ Ldrsw( | 4976 __ Ldrsw( |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5112 Register recv_arg = x3; | 5112 Register recv_arg = x3; |
5113 Register param_count = x7; | 5113 Register param_count = x7; |
5114 __ SmiUntag(param_count, param_count_smi); | 5114 __ SmiUntag(param_count, param_count_smi); |
5115 | 5115 |
5116 // Check if the calling frame is an arguments adaptor frame. | 5116 // Check if the calling frame is an arguments adaptor frame. |
5117 Register caller_fp = x11; | 5117 Register caller_fp = x11; |
5118 Register caller_ctx = x12; | 5118 Register caller_ctx = x12; |
5119 Label runtime; | 5119 Label runtime; |
5120 Label adaptor_frame, try_allocate; | 5120 Label adaptor_frame, try_allocate; |
5121 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 5121 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
5122 __ Ldr(caller_ctx, MemOperand(caller_fp, | 5122 __ Ldr( |
5123 StandardFrameConstants::kContextOffset)); | 5123 caller_ctx, |
| 5124 MemOperand(caller_fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5124 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 5125 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
5125 __ B(eq, &adaptor_frame); | 5126 __ B(eq, &adaptor_frame); |
5126 | 5127 |
5127 // No adaptor, parameter count = argument count. | 5128 // No adaptor, parameter count = argument count. |
5128 | 5129 |
5129 // x1 function function pointer | 5130 // x1 function function pointer |
5130 // x2 arg_count_smi number of function arguments (smi) | 5131 // x2 arg_count_smi number of function arguments (smi) |
5131 // x3 recv_arg pointer to receiver arguments | 5132 // x3 recv_arg pointer to receiver arguments |
5132 // x4 mapped_params number of mapped params, min(params, args) (uninit) | 5133 // x4 mapped_params number of mapped params, min(params, args) (uninit) |
5133 // x7 param_count number of function parameters | 5134 // x7 param_count number of function parameters |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5376 // we reach the JavaScript frame for the function (similar to what the | 5377 // we reach the JavaScript frame for the function (similar to what the |
5377 // runtime fallback implementation does). So make x2 point to that | 5378 // runtime fallback implementation does). So make x2 point to that |
5378 // JavaScript frame. | 5379 // JavaScript frame. |
5379 { | 5380 { |
5380 Label loop, loop_entry; | 5381 Label loop, loop_entry; |
5381 __ Mov(x2, fp); | 5382 __ Mov(x2, fp); |
5382 __ B(&loop_entry); | 5383 __ B(&loop_entry); |
5383 __ Bind(&loop); | 5384 __ Bind(&loop); |
5384 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 5385 __ Ldr(x2, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); |
5385 __ Bind(&loop_entry); | 5386 __ Bind(&loop_entry); |
5386 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kMarkerOffset)); | 5387 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kFunctionOffset)); |
5387 __ Cmp(x3, x1); | 5388 __ Cmp(x3, x1); |
5388 __ B(ne, &loop); | 5389 __ B(ne, &loop); |
5389 } | 5390 } |
5390 | 5391 |
5391 // Check if we have an arguments adaptor frame below the function frame. | 5392 // Check if we have an arguments adaptor frame below the function frame. |
5392 Label arguments_adaptor, arguments_done; | 5393 Label arguments_adaptor, arguments_done; |
5393 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); | 5394 __ Ldr(x3, MemOperand(x2, StandardFrameConstants::kCallerFPOffset)); |
5394 __ Ldr(x4, MemOperand(x3, StandardFrameConstants::kContextOffset)); | 5395 __ Ldr(x4, MemOperand(x3, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5395 __ Cmp(x4, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 5396 __ Cmp(x4, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
5396 __ B(eq, &arguments_adaptor); | 5397 __ B(eq, &arguments_adaptor); |
5397 { | 5398 { |
5398 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 5399 __ Ldr(x1, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
5399 __ Ldrsw(x0, FieldMemOperand( | 5400 __ Ldrsw(x0, FieldMemOperand( |
5400 x1, SharedFunctionInfo::kFormalParameterCountOffset)); | 5401 x1, SharedFunctionInfo::kFormalParameterCountOffset)); |
5401 __ Add(x2, x2, Operand(x0, LSL, kPointerSizeLog2)); | 5402 __ Add(x2, x2, Operand(x0, LSL, kPointerSizeLog2)); |
5402 __ Add(x2, x2, StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize); | 5403 __ Add(x2, x2, StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize); |
5403 } | 5404 } |
5404 __ B(&arguments_done); | 5405 __ B(&arguments_done); |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5973 return_value_operand, NULL); | 5974 return_value_operand, NULL); |
5974 } | 5975 } |
5975 | 5976 |
5976 | 5977 |
5977 #undef __ | 5978 #undef __ |
5978 | 5979 |
5979 } // namespace internal | 5980 } // namespace internal |
5980 } // namespace v8 | 5981 } // namespace v8 |
5981 | 5982 |
5982 #endif // V8_TARGET_ARCH_ARM64 | 5983 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |