| 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 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 switch (expr->yield_kind()) { | 2073 switch (expr->yield_kind()) { |
| 2074 case Yield::kSuspend: | 2074 case Yield::kSuspend: |
| 2075 // Pop value from top-of-stack slot; box result into result register. | 2075 // Pop value from top-of-stack slot; box result into result register. |
| 2076 EmitCreateIteratorResult(false); | 2076 EmitCreateIteratorResult(false); |
| 2077 __ push(result_register()); | 2077 __ push(result_register()); |
| 2078 // Fall through. | 2078 // Fall through. |
| 2079 case Yield::kInitial: { | 2079 case Yield::kInitial: { |
| 2080 Label suspend, continuation, post_runtime, resume; | 2080 Label suspend, continuation, post_runtime, resume; |
| 2081 | 2081 |
| 2082 __ jmp(&suspend); | 2082 __ jmp(&suspend); |
| 2083 | |
| 2084 __ bind(&continuation); | 2083 __ bind(&continuation); |
| 2084 __ RecordGeneratorContinuation(); |
| 2085 __ jmp(&resume); | 2085 __ jmp(&resume); |
| 2086 | 2086 |
| 2087 __ bind(&suspend); | 2087 __ bind(&suspend); |
| 2088 VisitForAccumulatorValue(expr->generator_object()); | 2088 VisitForAccumulatorValue(expr->generator_object()); |
| 2089 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2089 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 2090 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2090 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
| 2091 Immediate(Smi::FromInt(continuation.pos()))); | 2091 Immediate(Smi::FromInt(continuation.pos()))); |
| 2092 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2092 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
| 2093 __ mov(ecx, esi); | 2093 __ mov(ecx, esi); |
| 2094 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, | 2094 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 | 2147 |
| 2148 // try { received = %yield result } | 2148 // try { received = %yield result } |
| 2149 // Shuffle the received result above a try handler and yield it without | 2149 // Shuffle the received result above a try handler and yield it without |
| 2150 // re-boxing. | 2150 // re-boxing. |
| 2151 __ bind(&l_try); | 2151 __ bind(&l_try); |
| 2152 __ pop(eax); // result | 2152 __ pop(eax); // result |
| 2153 int handler_index = NewHandlerTableEntry(); | 2153 int handler_index = NewHandlerTableEntry(); |
| 2154 EnterTryBlock(handler_index, &l_catch); | 2154 EnterTryBlock(handler_index, &l_catch); |
| 2155 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2155 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
| 2156 __ push(eax); // result | 2156 __ push(eax); // result |
| 2157 |
| 2157 __ jmp(&l_suspend); | 2158 __ jmp(&l_suspend); |
| 2158 __ bind(&l_continuation); | 2159 __ bind(&l_continuation); |
| 2160 __ RecordGeneratorContinuation(); |
| 2159 __ jmp(&l_resume); | 2161 __ jmp(&l_resume); |
| 2162 |
| 2160 __ bind(&l_suspend); | 2163 __ bind(&l_suspend); |
| 2161 const int generator_object_depth = kPointerSize + try_block_size; | 2164 const int generator_object_depth = kPointerSize + try_block_size; |
| 2162 __ mov(eax, Operand(esp, generator_object_depth)); | 2165 __ mov(eax, Operand(esp, generator_object_depth)); |
| 2163 __ push(eax); // g | 2166 __ push(eax); // g |
| 2164 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index | 2167 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index |
| 2165 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2168 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2166 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2169 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
| 2167 Immediate(Smi::FromInt(l_continuation.pos()))); | 2170 Immediate(Smi::FromInt(l_continuation.pos()))); |
| 2168 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2171 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
| 2169 __ mov(ecx, esi); | 2172 __ mov(ecx, esi); |
| (...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5462 Assembler::target_address_at(call_target_address, | 5465 Assembler::target_address_at(call_target_address, |
| 5463 unoptimized_code)); | 5466 unoptimized_code)); |
| 5464 return OSR_AFTER_STACK_CHECK; | 5467 return OSR_AFTER_STACK_CHECK; |
| 5465 } | 5468 } |
| 5466 | 5469 |
| 5467 | 5470 |
| 5468 } // namespace internal | 5471 } // namespace internal |
| 5469 } // namespace v8 | 5472 } // namespace v8 |
| 5470 | 5473 |
| 5471 #endif // V8_TARGET_ARCH_IA32 | 5474 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |