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-factory.h" | 7 #include "src/code-factory.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/compiler.h" | |
11 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
12 #include "src/full-codegen/full-codegen.h" | 11 #include "src/full-codegen/full-codegen.h" |
13 #include "src/ic/ic.h" | 12 #include "src/ic/ic.h" |
14 #include "src/parser.h" | 13 #include "src/parser.h" |
15 #include "src/scopes.h" | 14 #include "src/scopes.h" |
16 | 15 |
17 #include "src/arm64/code-stubs-arm64.h" | 16 #include "src/arm64/code-stubs-arm64.h" |
18 #include "src/arm64/frames-arm64.h" | 17 #include "src/arm64/frames-arm64.h" |
19 #include "src/arm64/macro-assembler-arm64.h" | 18 #include "src/arm64/macro-assembler-arm64.h" |
20 | 19 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // The MANUAL indicates that the scope shouldn't actually generate code | 136 // The MANUAL indicates that the scope shouldn't actually generate code |
138 // to set up the frame because we do it manually below. | 137 // to set up the frame because we do it manually below. |
139 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 138 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
140 | 139 |
141 // This call emits the following sequence in a way that can be patched for | 140 // This call emits the following sequence in a way that can be patched for |
142 // code ageing support: | 141 // code ageing support: |
143 // Push(lr, fp, cp, x1); | 142 // Push(lr, fp, cp, x1); |
144 // Add(fp, jssp, 2 * kPointerSize); | 143 // Add(fp, jssp, 2 * kPointerSize); |
145 info->set_prologue_offset(masm_->pc_offset()); | 144 info->set_prologue_offset(masm_->pc_offset()); |
146 __ Prologue(info->IsCodePreAgingActive()); | 145 __ Prologue(info->IsCodePreAgingActive()); |
147 info->AddNoFrameRange(0, masm_->pc_offset()); | |
148 | 146 |
149 // Reserve space on the stack for locals. | 147 // Reserve space on the stack for locals. |
150 { Comment cmnt(masm_, "[ Allocate locals"); | 148 { Comment cmnt(masm_, "[ Allocate locals"); |
151 int locals_count = info->scope()->num_stack_slots(); | 149 int locals_count = info->scope()->num_stack_slots(); |
152 // Generators allocate locals, if any, in context slots. | 150 // Generators allocate locals, if any, in context slots. |
153 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); | 151 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); |
154 | 152 |
155 if (locals_count > 0) { | 153 if (locals_count > 0) { |
156 if (locals_count >= 128) { | 154 if (locals_count >= 128) { |
157 Label ok; | 155 Label ok; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 RelocInfo::CODE_TARGET); | 460 RelocInfo::CODE_TARGET); |
463 __ Pop(x0); | 461 __ Pop(x0); |
464 EmitProfilingCounterReset(); | 462 EmitProfilingCounterReset(); |
465 __ Bind(&ok); | 463 __ Bind(&ok); |
466 | 464 |
467 SetReturnPosition(literal()); | 465 SetReturnPosition(literal()); |
468 const Register& current_sp = __ StackPointer(); | 466 const Register& current_sp = __ StackPointer(); |
469 // Nothing ensures 16 bytes alignment here. | 467 // Nothing ensures 16 bytes alignment here. |
470 DCHECK(!current_sp.Is(csp)); | 468 DCHECK(!current_sp.Is(csp)); |
471 __ Mov(current_sp, fp); | 469 __ Mov(current_sp, fp); |
472 int no_frame_start = masm_->pc_offset(); | |
473 __ Ldp(fp, lr, MemOperand(current_sp, 2 * kXRegSize, PostIndex)); | 470 __ Ldp(fp, lr, MemOperand(current_sp, 2 * kXRegSize, PostIndex)); |
474 // Drop the arguments and receiver and return. | 471 // Drop the arguments and receiver and return. |
475 // TODO(all): This implementation is overkill as it supports 2**31+1 | 472 // TODO(all): This implementation is overkill as it supports 2**31+1 |
476 // arguments, consider how to improve it without creating a security | 473 // arguments, consider how to improve it without creating a security |
477 // hole. | 474 // hole. |
478 __ ldr_pcrel(ip0, (3 * kInstructionSize) >> kLoadLiteralScaleLog2); | 475 __ ldr_pcrel(ip0, (3 * kInstructionSize) >> kLoadLiteralScaleLog2); |
479 __ Add(current_sp, current_sp, ip0); | 476 __ Add(current_sp, current_sp, ip0); |
480 __ Ret(); | 477 __ Ret(); |
481 int32_t arg_count = info_->scope()->num_parameters() + 1; | 478 int32_t arg_count = info_->scope()->num_parameters() + 1; |
482 __ dc64(kXRegSize * arg_count); | 479 __ dc64(kXRegSize * arg_count); |
483 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | |
484 } | 480 } |
485 } | 481 } |
486 | 482 |
487 | 483 |
488 void FullCodeGenerator::StackValueContext::Plug(Variable* var) const { | 484 void FullCodeGenerator::StackValueContext::Plug(Variable* var) const { |
489 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 485 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
490 codegen()->GetVar(result_register(), var); | 486 codegen()->GetVar(result_register(), var); |
491 __ Push(result_register()); | 487 __ Push(result_register()); |
492 } | 488 } |
493 | 489 |
(...skipping 4763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 } | 5253 } |
5258 | 5254 |
5259 return INTERRUPT; | 5255 return INTERRUPT; |
5260 } | 5256 } |
5261 | 5257 |
5262 | 5258 |
5263 } // namespace internal | 5259 } // namespace internal |
5264 } // namespace v8 | 5260 } // namespace v8 |
5265 | 5261 |
5266 #endif // V8_TARGET_ARCH_ARM64 | 5262 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |