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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // The MANUAL indicates that the scope shouldn't actually generate code | 143 // The MANUAL indicates that the scope shouldn't actually generate code |
144 // to set up the frame because we do it manually below. | 144 // to set up the frame because we do it manually below. |
145 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 145 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
146 | 146 |
147 // This call emits the following sequence in a way that can be patched for | 147 // This call emits the following sequence in a way that can be patched for |
148 // code ageing support: | 148 // code ageing support: |
149 // Push(lr, fp, cp, x1); | 149 // Push(lr, fp, cp, x1); |
150 // Add(fp, jssp, 2 * kPointerSize); | 150 // Add(fp, jssp, 2 * kPointerSize); |
151 info->set_prologue_offset(masm_->pc_offset()); | 151 info->set_prologue_offset(masm_->pc_offset()); |
152 __ Prologue(info->IsCodePreAgingActive()); | 152 __ Prologue(info->IsCodePreAgingActive()); |
| 153 __ Push(FeedbackVector()); |
153 info->AddNoFrameRange(0, masm_->pc_offset()); | 154 info->AddNoFrameRange(0, masm_->pc_offset()); |
154 | 155 |
155 // Reserve space on the stack for locals. | 156 // Reserve space on the stack for locals. |
156 { Comment cmnt(masm_, "[ Allocate locals"); | 157 { Comment cmnt(masm_, "[ Allocate locals"); |
157 int locals_count = info->scope()->num_stack_slots(); | 158 int locals_count = info->scope()->num_stack_slots(); |
158 // Generators allocate locals, if any, in context slots. | 159 // Generators allocate locals, if any, in context slots. |
159 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); | 160 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); |
160 | 161 |
161 if (locals_count > 0) { | 162 if (locals_count > 0) { |
162 if (locals_count >= 128) { | 163 if (locals_count >= 128) { |
(...skipping 4829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4992 | 4993 |
4993 __ Bind(&suspend); | 4994 __ Bind(&suspend); |
4994 VisitForAccumulatorValue(expr->generator_object()); | 4995 VisitForAccumulatorValue(expr->generator_object()); |
4995 DCHECK((continuation.pos() > 0) && Smi::IsValid(continuation.pos())); | 4996 DCHECK((continuation.pos() > 0) && Smi::IsValid(continuation.pos())); |
4996 __ Mov(x1, Smi::FromInt(continuation.pos())); | 4997 __ Mov(x1, Smi::FromInt(continuation.pos())); |
4997 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); | 4998 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); |
4998 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); | 4999 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); |
4999 __ Mov(x1, cp); | 5000 __ Mov(x1, cp); |
5000 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, | 5001 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, |
5001 kLRHasBeenSaved, kDontSaveFPRegs); | 5002 kLRHasBeenSaved, kDontSaveFPRegs); |
5002 __ Add(x1, fp, StandardFrameConstants::kExpressionsOffset); | 5003 __ Add(x1, fp, JavaScriptFrameConstants::kLocal0Offset); |
5003 __ Cmp(__ StackPointer(), x1); | 5004 __ Cmp(__ StackPointer(), x1); |
5004 __ B(eq, &post_runtime); | 5005 __ B(eq, &post_runtime); |
5005 __ Push(x0); // generator object | 5006 __ Push(x0); // generator object |
5006 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 5007 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
5007 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5008 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5008 __ Bind(&post_runtime); | 5009 __ Bind(&post_runtime); |
5009 __ Pop(result_register()); | 5010 __ Pop(result_register()); |
5010 EmitReturnSequence(); | 5011 EmitReturnSequence(); |
5011 | 5012 |
5012 __ Bind(&resume); | 5013 __ Bind(&resume); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5184 // the generator was suspended. | 5185 // the generator was suspended. |
5185 Label resume_frame, done; | 5186 Label resume_frame, done; |
5186 __ Bl(&resume_frame); | 5187 __ Bl(&resume_frame); |
5187 __ B(&done); | 5188 __ B(&done); |
5188 | 5189 |
5189 __ Bind(&resume_frame); | 5190 __ Bind(&resume_frame); |
5190 __ Push(lr, // Return address. | 5191 __ Push(lr, // Return address. |
5191 fp, // Caller's frame pointer. | 5192 fp, // Caller's frame pointer. |
5192 cp, // Callee's context. | 5193 cp, // Callee's context. |
5193 function); // Callee's JS Function. | 5194 function); // Callee's JS Function. |
5194 __ Add(fp, __ StackPointer(), kPointerSize * 2); | 5195 |
| 5196 // Callee's type feedback vector. |
| 5197 __ Ldr(x10, FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 5198 __ Ldr(x10, FieldMemOperand(x10, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 5199 __ Push(x10); |
| 5200 |
| 5201 __ Add(fp, __ StackPointer(), |
| 5202 JavaScriptFrameConstants::kUnoptimizedFixedFrameSizeFromFp); |
5195 | 5203 |
5196 // Load and untag the operand stack size. | 5204 // Load and untag the operand stack size. |
5197 __ Ldr(x10, FieldMemOperand(generator_object, | 5205 __ Ldr(x10, FieldMemOperand(generator_object, |
5198 JSGeneratorObject::kOperandStackOffset)); | 5206 JSGeneratorObject::kOperandStackOffset)); |
5199 __ Ldr(operand_stack_size, | 5207 __ Ldr(operand_stack_size, |
5200 UntagSmiFieldMemOperand(x10, FixedArray::kLengthOffset)); | 5208 UntagSmiFieldMemOperand(x10, FixedArray::kLengthOffset)); |
5201 | 5209 |
5202 // If we are sending a value and there is no operand stack, we can jump back | 5210 // If we are sending a value and there is no operand stack, we can jump back |
5203 // in directly. | 5211 // in directly. |
5204 if (resume_mode == JSGeneratorObject::NEXT) { | 5212 if (resume_mode == JSGeneratorObject::NEXT) { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5471 } | 5479 } |
5472 } | 5480 } |
5473 | 5481 |
5474 return INTERRUPT; | 5482 return INTERRUPT; |
5475 } | 5483 } |
5476 | 5484 |
5477 | 5485 |
5478 } } // namespace v8::internal | 5486 } } // namespace v8::internal |
5479 | 5487 |
5480 #endif // V8_TARGET_ARCH_ARM64 | 5488 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |