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