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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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(Immediate(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 __ push(Immediate(isolate()->factory()->undefined_value())); | 150 __ push(Immediate(isolate()->factory()->undefined_value())); |
150 } else if (locals_count > 1) { | 151 } else if (locals_count > 1) { |
151 if (locals_count >= 128) { | 152 if (locals_count >= 128) { |
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 | 2070 |
2070 __ bind(&suspend); | 2071 __ bind(&suspend); |
2071 VisitForAccumulatorValue(expr->generator_object()); | 2072 VisitForAccumulatorValue(expr->generator_object()); |
2072 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2073 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
2073 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2074 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
2074 Immediate(Smi::FromInt(continuation.pos()))); | 2075 Immediate(Smi::FromInt(continuation.pos()))); |
2075 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2076 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
2076 __ mov(ecx, esi); | 2077 __ mov(ecx, esi); |
2077 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, | 2078 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
2078 kDontSaveFPRegs); | 2079 kDontSaveFPRegs); |
2079 __ lea(ebx, Operand(ebp, StandardFrameConstants::kExpressionsOffset)); | 2080 __ lea(ebx, Operand(ebp, JavaScriptFrameConstants::kLocal0Offset)); |
2080 __ cmp(esp, ebx); | 2081 __ cmp(esp, ebx); |
2081 __ j(equal, &post_runtime); | 2082 __ j(equal, &post_runtime); |
2082 __ push(eax); // generator object | 2083 __ push(eax); // generator object |
2083 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2084 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
2084 __ mov(context_register(), | 2085 __ mov(context_register(), |
2085 Operand(ebp, StandardFrameConstants::kContextOffset)); | 2086 Operand(ebp, StandardFrameConstants::kContextOffset)); |
2086 __ bind(&post_runtime); | 2087 __ bind(&post_runtime); |
2087 __ pop(result_register()); | 2088 __ pop(result_register()); |
2088 EmitReturnSequence(); | 2089 EmitReturnSequence(); |
2089 | 2090 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 Label resume_frame, done; | 2252 Label resume_frame, done; |
2252 __ bind(&push_frame); | 2253 __ bind(&push_frame); |
2253 __ call(&resume_frame); | 2254 __ call(&resume_frame); |
2254 __ jmp(&done); | 2255 __ jmp(&done); |
2255 __ bind(&resume_frame); | 2256 __ bind(&resume_frame); |
2256 __ push(ebp); // Caller's frame pointer. | 2257 __ push(ebp); // Caller's frame pointer. |
2257 __ mov(ebp, esp); | 2258 __ mov(ebp, esp); |
2258 __ push(esi); // Callee's context. | 2259 __ push(esi); // Callee's context. |
2259 __ push(edi); // Callee's JS Function. | 2260 __ push(edi); // Callee's JS Function. |
2260 | 2261 |
| 2262 // Callee's type feedback vector. |
| 2263 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 2264 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 2265 __ push(edx); |
| 2266 |
2261 // Load the operand stack size. | 2267 // Load the operand stack size. |
2262 __ mov(edx, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); | 2268 __ mov(edx, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); |
2263 __ mov(edx, FieldOperand(edx, FixedArray::kLengthOffset)); | 2269 __ mov(edx, FieldOperand(edx, FixedArray::kLengthOffset)); |
2264 __ SmiUntag(edx); | 2270 __ SmiUntag(edx); |
2265 | 2271 |
2266 // If we are sending a value and there is no operand stack, we can jump back | 2272 // If we are sending a value and there is no operand stack, we can jump back |
2267 // in directly. | 2273 // in directly. |
2268 if (resume_mode == JSGeneratorObject::NEXT) { | 2274 if (resume_mode == JSGeneratorObject::NEXT) { |
2269 Label slow_resume; | 2275 Label slow_resume; |
2270 __ cmp(edx, Immediate(0)); | 2276 __ cmp(edx, Immediate(0)); |
(...skipping 3087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5358 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5364 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5359 Assembler::target_address_at(call_target_address, | 5365 Assembler::target_address_at(call_target_address, |
5360 unoptimized_code)); | 5366 unoptimized_code)); |
5361 return OSR_AFTER_STACK_CHECK; | 5367 return OSR_AFTER_STACK_CHECK; |
5362 } | 5368 } |
5363 | 5369 |
5364 | 5370 |
5365 } } // namespace v8::internal | 5371 } } // namespace v8::internal |
5366 | 5372 |
5367 #endif // V8_TARGET_ARCH_IA32 | 5373 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |