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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // The MANUAL indicates that the scope shouldn't actually generate code | 142 // The MANUAL indicates that the scope shouldn't actually generate code |
143 // to set up the frame because we do it manually below. | 143 // to set up the frame because we do it manually below. |
144 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 144 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
145 | 145 |
146 // This call emits the following sequence in a way that can be patched for | 146 // This call emits the following sequence in a way that can be patched for |
147 // code ageing support: | 147 // code ageing support: |
148 // Push(lr, fp, cp, x1); | 148 // Push(lr, fp, cp, x1); |
149 // Add(fp, jssp, 2 * kPointerSize); | 149 // Add(fp, jssp, 2 * kPointerSize); |
150 info->set_prologue_offset(masm_->pc_offset()); | 150 info->set_prologue_offset(masm_->pc_offset()); |
151 __ Prologue(info->IsCodePreAgingActive()); | 151 __ Prologue(info->IsCodePreAgingActive()); |
| 152 __ Push(FeedbackVector()); |
152 info->AddNoFrameRange(0, masm_->pc_offset()); | 153 info->AddNoFrameRange(0, masm_->pc_offset()); |
153 | 154 |
154 // Reserve space on the stack for locals. | 155 // Reserve space on the stack for locals. |
155 { Comment cmnt(masm_, "[ Allocate locals"); | 156 { Comment cmnt(masm_, "[ Allocate locals"); |
156 int locals_count = info->scope()->num_stack_slots(); | 157 int locals_count = info->scope()->num_stack_slots(); |
157 // Generators allocate locals, if any, in context slots. | 158 // Generators allocate locals, if any, in context slots. |
158 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); | 159 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); |
159 | 160 |
160 if (locals_count > 0) { | 161 if (locals_count > 0) { |
161 if (locals_count >= 128) { | 162 if (locals_count >= 128) { |
(...skipping 4782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4944 | 4945 |
4945 __ Bind(&suspend); | 4946 __ Bind(&suspend); |
4946 VisitForAccumulatorValue(expr->generator_object()); | 4947 VisitForAccumulatorValue(expr->generator_object()); |
4947 DCHECK((continuation.pos() > 0) && Smi::IsValid(continuation.pos())); | 4948 DCHECK((continuation.pos() > 0) && Smi::IsValid(continuation.pos())); |
4948 __ Mov(x1, Smi::FromInt(continuation.pos())); | 4949 __ Mov(x1, Smi::FromInt(continuation.pos())); |
4949 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); | 4950 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); |
4950 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); | 4951 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); |
4951 __ Mov(x1, cp); | 4952 __ Mov(x1, cp); |
4952 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, | 4953 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, |
4953 kLRHasBeenSaved, kDontSaveFPRegs); | 4954 kLRHasBeenSaved, kDontSaveFPRegs); |
4954 __ Add(x1, fp, StandardFrameConstants::kExpressionsOffset); | 4955 __ Add(x1, fp, JavaScriptFrameConstants::kLocal0Offset); |
4955 __ Cmp(__ StackPointer(), x1); | 4956 __ Cmp(__ StackPointer(), x1); |
4956 __ B(eq, &post_runtime); | 4957 __ B(eq, &post_runtime); |
4957 __ Push(x0); // generator object | 4958 __ Push(x0); // generator object |
4958 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 4959 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
4959 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4960 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4960 __ Bind(&post_runtime); | 4961 __ Bind(&post_runtime); |
4961 __ Pop(result_register()); | 4962 __ Pop(result_register()); |
4962 EmitReturnSequence(); | 4963 EmitReturnSequence(); |
4963 | 4964 |
4964 __ Bind(&resume); | 4965 __ Bind(&resume); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5136 // the generator was suspended. | 5137 // the generator was suspended. |
5137 Label resume_frame, done; | 5138 Label resume_frame, done; |
5138 __ Bl(&resume_frame); | 5139 __ Bl(&resume_frame); |
5139 __ B(&done); | 5140 __ B(&done); |
5140 | 5141 |
5141 __ Bind(&resume_frame); | 5142 __ Bind(&resume_frame); |
5142 __ Push(lr, // Return address. | 5143 __ Push(lr, // Return address. |
5143 fp, // Caller's frame pointer. | 5144 fp, // Caller's frame pointer. |
5144 cp, // Callee's context. | 5145 cp, // Callee's context. |
5145 function); // Callee's JS Function. | 5146 function); // Callee's JS Function. |
5146 __ Add(fp, __ StackPointer(), kPointerSize * 2); | 5147 |
| 5148 // Callee's type feedback vector. |
| 5149 __ Ldr(x10, FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 5150 __ Ldr(x10, FieldMemOperand(x10, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 5151 __ Push(x10); |
| 5152 |
| 5153 __ Add(fp, __ StackPointer(), |
| 5154 JavaScriptFrameConstants::kUnoptimizedFixedFrameSizeFromFp); |
5147 | 5155 |
5148 // Load and untag the operand stack size. | 5156 // Load and untag the operand stack size. |
5149 __ Ldr(x10, FieldMemOperand(generator_object, | 5157 __ Ldr(x10, FieldMemOperand(generator_object, |
5150 JSGeneratorObject::kOperandStackOffset)); | 5158 JSGeneratorObject::kOperandStackOffset)); |
5151 __ Ldr(operand_stack_size, | 5159 __ Ldr(operand_stack_size, |
5152 UntagSmiFieldMemOperand(x10, FixedArray::kLengthOffset)); | 5160 UntagSmiFieldMemOperand(x10, FixedArray::kLengthOffset)); |
5153 | 5161 |
5154 // If we are sending a value and there is no operand stack, we can jump back | 5162 // If we are sending a value and there is no operand stack, we can jump back |
5155 // in directly. | 5163 // in directly. |
5156 if (resume_mode == JSGeneratorObject::NEXT) { | 5164 if (resume_mode == JSGeneratorObject::NEXT) { |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5480 return previous_; | 5488 return previous_; |
5481 } | 5489 } |
5482 | 5490 |
5483 | 5491 |
5484 #undef __ | 5492 #undef __ |
5485 | 5493 |
5486 | 5494 |
5487 } } // namespace v8::internal | 5495 } } // namespace v8::internal |
5488 | 5496 |
5489 #endif // V8_TARGET_ARCH_ARM64 | 5497 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |