OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 __ bind(&ok); | 131 __ bind(&ok); |
132 } | 132 } |
133 | 133 |
134 // Open a frame scope to indicate that there is a frame on the stack. The | 134 // Open a frame scope to indicate that there is a frame on the stack. The |
135 // MANUAL indicates that the scope shouldn't actually generate code to set up | 135 // MANUAL indicates that the scope shouldn't actually generate code to set up |
136 // the frame (that is done below). | 136 // the frame (that is done below). |
137 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 137 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
138 | 138 |
139 info->set_prologue_offset(masm_->pc_offset()); | 139 info->set_prologue_offset(masm_->pc_offset()); |
140 __ Prologue(info->IsCodePreAgingActive()); | 140 __ Prologue(info->IsCodePreAgingActive()); |
| 141 __ Push(FeedbackVector()); |
141 info->AddNoFrameRange(0, masm_->pc_offset()); | 142 info->AddNoFrameRange(0, masm_->pc_offset()); |
142 | 143 |
143 { Comment cmnt(masm_, "[ Allocate locals"); | 144 { Comment cmnt(masm_, "[ Allocate locals"); |
144 int locals_count = info->scope()->num_stack_slots(); | 145 int locals_count = info->scope()->num_stack_slots(); |
145 // Generators allocate locals, if any, in context slots. | 146 // Generators allocate locals, if any, in context slots. |
146 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); | 147 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); |
147 if (locals_count == 1) { | 148 if (locals_count == 1) { |
148 __ PushRoot(Heap::kUndefinedValueRootIndex); | 149 __ PushRoot(Heap::kUndefinedValueRootIndex); |
149 } else if (locals_count > 1) { | 150 } else if (locals_count > 1) { |
150 if (locals_count >= 128) { | 151 if (locals_count >= 128) { |
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 | 2096 |
2096 __ bind(&suspend); | 2097 __ bind(&suspend); |
2097 VisitForAccumulatorValue(expr->generator_object()); | 2098 VisitForAccumulatorValue(expr->generator_object()); |
2098 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2099 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
2099 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), | 2100 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), |
2100 Smi::FromInt(continuation.pos())); | 2101 Smi::FromInt(continuation.pos())); |
2101 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); | 2102 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); |
2102 __ movp(rcx, rsi); | 2103 __ movp(rcx, rsi); |
2103 __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx, | 2104 __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx, |
2104 kDontSaveFPRegs); | 2105 kDontSaveFPRegs); |
2105 __ leap(rbx, Operand(rbp, StandardFrameConstants::kExpressionsOffset)); | 2106 __ leap(rbx, Operand(rbp, JavaScriptFrameConstants::kLocal0Offset)); |
2106 __ cmpp(rsp, rbx); | 2107 __ cmpp(rsp, rbx); |
2107 __ j(equal, &post_runtime); | 2108 __ j(equal, &post_runtime); |
2108 __ Push(rax); // generator object | 2109 __ Push(rax); // generator object |
2109 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2110 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
2110 __ movp(context_register(), | 2111 __ movp(context_register(), |
2111 Operand(rbp, StandardFrameConstants::kContextOffset)); | 2112 Operand(rbp, StandardFrameConstants::kContextOffset)); |
2112 __ bind(&post_runtime); | 2113 __ bind(&post_runtime); |
2113 | 2114 |
2114 __ Pop(result_register()); | 2115 __ Pop(result_register()); |
2115 EmitReturnSequence(); | 2116 EmitReturnSequence(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 Label resume_frame, done; | 2277 Label resume_frame, done; |
2277 __ bind(&push_frame); | 2278 __ bind(&push_frame); |
2278 __ call(&resume_frame); | 2279 __ call(&resume_frame); |
2279 __ jmp(&done); | 2280 __ jmp(&done); |
2280 __ bind(&resume_frame); | 2281 __ bind(&resume_frame); |
2281 __ pushq(rbp); // Caller's frame pointer. | 2282 __ pushq(rbp); // Caller's frame pointer. |
2282 __ movp(rbp, rsp); | 2283 __ movp(rbp, rsp); |
2283 __ Push(rsi); // Callee's context. | 2284 __ Push(rsi); // Callee's context. |
2284 __ Push(rdi); // Callee's JS Function. | 2285 __ Push(rdi); // Callee's JS Function. |
2285 | 2286 |
| 2287 // Callee's type feedback vector. |
| 2288 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 2289 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 2290 __ Push(rdx); |
| 2291 |
2286 // Load the operand stack size. | 2292 // Load the operand stack size. |
2287 __ movp(rdx, FieldOperand(rbx, JSGeneratorObject::kOperandStackOffset)); | 2293 __ movp(rdx, FieldOperand(rbx, JSGeneratorObject::kOperandStackOffset)); |
2288 __ movp(rdx, FieldOperand(rdx, FixedArray::kLengthOffset)); | 2294 __ movp(rdx, FieldOperand(rdx, FixedArray::kLengthOffset)); |
2289 __ SmiToInteger32(rdx, rdx); | 2295 __ SmiToInteger32(rdx, rdx); |
2290 | 2296 |
2291 // If we are sending a value and there is no operand stack, we can jump back | 2297 // If we are sending a value and there is no operand stack, we can jump back |
2292 // in directly. | 2298 // in directly. |
2293 if (resume_mode == JSGeneratorObject::NEXT) { | 2299 if (resume_mode == JSGeneratorObject::NEXT) { |
2294 Label slow_resume; | 2300 Label slow_resume; |
2295 __ cmpp(rdx, Immediate(0)); | 2301 __ cmpp(rdx, Immediate(0)); |
(...skipping 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5387 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5393 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5388 Assembler::target_address_at(call_target_address, | 5394 Assembler::target_address_at(call_target_address, |
5389 unoptimized_code)); | 5395 unoptimized_code)); |
5390 return OSR_AFTER_STACK_CHECK; | 5396 return OSR_AFTER_STACK_CHECK; |
5391 } | 5397 } |
5392 | 5398 |
5393 | 5399 |
5394 } } // namespace v8::internal | 5400 } } // namespace v8::internal |
5395 | 5401 |
5396 #endif // V8_TARGET_ARCH_X64 | 5402 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |