| 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 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(Immediate(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 __ push(Immediate(isolate()->factory()->undefined_value())); | 149 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 149 } else if (locals_count > 1) { | 150 } else if (locals_count > 1) { |
| 150 if (locals_count >= 128) { | 151 if (locals_count >= 128) { |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 | 2062 |
| 2062 __ bind(&suspend); | 2063 __ bind(&suspend); |
| 2063 VisitForAccumulatorValue(expr->generator_object()); | 2064 VisitForAccumulatorValue(expr->generator_object()); |
| 2064 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2065 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 2065 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2066 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
| 2066 Immediate(Smi::FromInt(continuation.pos()))); | 2067 Immediate(Smi::FromInt(continuation.pos()))); |
| 2067 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2068 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
| 2068 __ mov(ecx, esi); | 2069 __ mov(ecx, esi); |
| 2069 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, | 2070 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
| 2070 kDontSaveFPRegs); | 2071 kDontSaveFPRegs); |
| 2071 __ lea(ebx, Operand(ebp, StandardFrameConstants::kExpressionsOffset)); | 2072 __ lea(ebx, Operand(ebp, JavaScriptFrameConstants::kLocal0Offset)); |
| 2072 __ cmp(esp, ebx); | 2073 __ cmp(esp, ebx); |
| 2073 __ j(equal, &post_runtime); | 2074 __ j(equal, &post_runtime); |
| 2074 __ push(eax); // generator object | 2075 __ push(eax); // generator object |
| 2075 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2076 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 2076 __ mov(context_register(), | 2077 __ mov(context_register(), |
| 2077 Operand(ebp, StandardFrameConstants::kContextOffset)); | 2078 Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2078 __ bind(&post_runtime); | 2079 __ bind(&post_runtime); |
| 2079 __ pop(result_register()); | 2080 __ pop(result_register()); |
| 2080 EmitReturnSequence(); | 2081 EmitReturnSequence(); |
| 2081 | 2082 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 Label resume_frame, done; | 2244 Label resume_frame, done; |
| 2244 __ bind(&push_frame); | 2245 __ bind(&push_frame); |
| 2245 __ call(&resume_frame); | 2246 __ call(&resume_frame); |
| 2246 __ jmp(&done); | 2247 __ jmp(&done); |
| 2247 __ bind(&resume_frame); | 2248 __ bind(&resume_frame); |
| 2248 __ push(ebp); // Caller's frame pointer. | 2249 __ push(ebp); // Caller's frame pointer. |
| 2249 __ mov(ebp, esp); | 2250 __ mov(ebp, esp); |
| 2250 __ push(esi); // Callee's context. | 2251 __ push(esi); // Callee's context. |
| 2251 __ push(edi); // Callee's JS Function. | 2252 __ push(edi); // Callee's JS Function. |
| 2252 | 2253 |
| 2254 // Callee's type feedback vector. |
| 2255 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 2256 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 2257 __ push(edx); |
| 2258 |
| 2253 // Load the operand stack size. | 2259 // Load the operand stack size. |
| 2254 __ mov(edx, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); | 2260 __ mov(edx, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); |
| 2255 __ mov(edx, FieldOperand(edx, FixedArray::kLengthOffset)); | 2261 __ mov(edx, FieldOperand(edx, FixedArray::kLengthOffset)); |
| 2256 __ SmiUntag(edx); | 2262 __ SmiUntag(edx); |
| 2257 | 2263 |
| 2258 // If we are sending a value and there is no operand stack, we can jump back | 2264 // If we are sending a value and there is no operand stack, we can jump back |
| 2259 // in directly. | 2265 // in directly. |
| 2260 if (resume_mode == JSGeneratorObject::NEXT) { | 2266 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2261 Label slow_resume; | 2267 Label slow_resume; |
| 2262 __ cmp(edx, Immediate(0)); | 2268 __ cmp(edx, Immediate(0)); |
| (...skipping 3103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5366 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5372 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5367 Assembler::target_address_at(call_target_address, | 5373 Assembler::target_address_at(call_target_address, |
| 5368 unoptimized_code)); | 5374 unoptimized_code)); |
| 5369 return OSR_AFTER_STACK_CHECK; | 5375 return OSR_AFTER_STACK_CHECK; |
| 5370 } | 5376 } |
| 5371 | 5377 |
| 5372 | 5378 |
| 5373 } } // namespace v8::internal | 5379 } } // namespace v8::internal |
| 5374 | 5380 |
| 5375 #endif // V8_TARGET_ARCH_IA32 | 5381 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |