| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 switch (expr->yield_kind()) { | 2064 switch (expr->yield_kind()) { |
| 2065 case Yield::kSuspend: | 2065 case Yield::kSuspend: |
| 2066 // Pop value from top-of-stack slot; box result into result register. | 2066 // Pop value from top-of-stack slot; box result into result register. |
| 2067 EmitCreateIteratorResult(false); | 2067 EmitCreateIteratorResult(false); |
| 2068 __ push(result_register()); | 2068 __ push(result_register()); |
| 2069 // Fall through. | 2069 // Fall through. |
| 2070 case Yield::kInitial: { | 2070 case Yield::kInitial: { |
| 2071 Label suspend, continuation, post_runtime, resume; | 2071 Label suspend, continuation, post_runtime, resume; |
| 2072 | 2072 |
| 2073 __ jmp(&suspend); | 2073 __ jmp(&suspend); |
| 2074 | |
| 2075 __ bind(&continuation); | 2074 __ bind(&continuation); |
| 2075 __ RecordGeneratorContinuation(); |
| 2076 __ jmp(&resume); | 2076 __ jmp(&resume); |
| 2077 | 2077 |
| 2078 __ bind(&suspend); | 2078 __ bind(&suspend); |
| 2079 VisitForAccumulatorValue(expr->generator_object()); | 2079 VisitForAccumulatorValue(expr->generator_object()); |
| 2080 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2080 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 2081 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2081 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
| 2082 Immediate(Smi::FromInt(continuation.pos()))); | 2082 Immediate(Smi::FromInt(continuation.pos()))); |
| 2083 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2083 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
| 2084 __ mov(ecx, esi); | 2084 __ mov(ecx, esi); |
| 2085 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, | 2085 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 | 2138 |
| 2139 // try { received = %yield result } | 2139 // try { received = %yield result } |
| 2140 // Shuffle the received result above a try handler and yield it without | 2140 // Shuffle the received result above a try handler and yield it without |
| 2141 // re-boxing. | 2141 // re-boxing. |
| 2142 __ bind(&l_try); | 2142 __ bind(&l_try); |
| 2143 __ pop(eax); // result | 2143 __ pop(eax); // result |
| 2144 int handler_index = NewHandlerTableEntry(); | 2144 int handler_index = NewHandlerTableEntry(); |
| 2145 EnterTryBlock(handler_index, &l_catch); | 2145 EnterTryBlock(handler_index, &l_catch); |
| 2146 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2146 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
| 2147 __ push(eax); // result | 2147 __ push(eax); // result |
| 2148 |
| 2148 __ jmp(&l_suspend); | 2149 __ jmp(&l_suspend); |
| 2149 __ bind(&l_continuation); | 2150 __ bind(&l_continuation); |
| 2151 __ RecordGeneratorContinuation(); |
| 2150 __ jmp(&l_resume); | 2152 __ jmp(&l_resume); |
| 2153 |
| 2151 __ bind(&l_suspend); | 2154 __ bind(&l_suspend); |
| 2152 const int generator_object_depth = kPointerSize + try_block_size; | 2155 const int generator_object_depth = kPointerSize + try_block_size; |
| 2153 __ mov(eax, Operand(esp, generator_object_depth)); | 2156 __ mov(eax, Operand(esp, generator_object_depth)); |
| 2154 __ push(eax); // g | 2157 __ push(eax); // g |
| 2155 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index | 2158 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index |
| 2156 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2159 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2157 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2160 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
| 2158 Immediate(Smi::FromInt(l_continuation.pos()))); | 2161 Immediate(Smi::FromInt(l_continuation.pos()))); |
| 2159 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2162 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
| 2160 __ mov(ecx, esi); | 2163 __ mov(ecx, esi); |
| (...skipping 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5451 Assembler::target_address_at(call_target_address, | 5454 Assembler::target_address_at(call_target_address, |
| 5452 unoptimized_code)); | 5455 unoptimized_code)); |
| 5453 return OSR_AFTER_STACK_CHECK; | 5456 return OSR_AFTER_STACK_CHECK; |
| 5454 } | 5457 } |
| 5455 | 5458 |
| 5456 | 5459 |
| 5457 } // namespace internal | 5460 } // namespace internal |
| 5458 } // namespace v8 | 5461 } // namespace v8 |
| 5459 | 5462 |
| 5460 #endif // V8_TARGET_ARCH_X87 | 5463 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |