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 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 switch (expr->yield_kind()) { | 2086 switch (expr->yield_kind()) { |
2087 case Yield::kSuspend: | 2087 case Yield::kSuspend: |
2088 // Pop value from top-of-stack slot; box result into result register. | 2088 // Pop value from top-of-stack slot; box result into result register. |
2089 EmitCreateIteratorResult(false); | 2089 EmitCreateIteratorResult(false); |
2090 __ push(result_register()); | 2090 __ push(result_register()); |
2091 // Fall through. | 2091 // Fall through. |
2092 case Yield::kInitial: { | 2092 case Yield::kInitial: { |
2093 Label suspend, continuation, post_runtime, resume; | 2093 Label suspend, continuation, post_runtime, resume; |
2094 | 2094 |
2095 __ jmp(&suspend); | 2095 __ jmp(&suspend); |
2096 | |
2097 __ bind(&continuation); | 2096 __ bind(&continuation); |
| 2097 __ RecordGeneratorContinuation(); |
2098 __ jmp(&resume); | 2098 __ jmp(&resume); |
2099 | 2099 |
2100 __ bind(&suspend); | 2100 __ bind(&suspend); |
2101 VisitForAccumulatorValue(expr->generator_object()); | 2101 VisitForAccumulatorValue(expr->generator_object()); |
2102 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2102 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
2103 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2103 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
2104 Immediate(Smi::FromInt(continuation.pos()))); | 2104 Immediate(Smi::FromInt(continuation.pos()))); |
2105 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2105 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
2106 __ mov(ecx, esi); | 2106 __ mov(ecx, esi); |
2107 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, | 2107 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 | 2160 |
2161 // try { received = %yield result } | 2161 // try { received = %yield result } |
2162 // Shuffle the received result above a try handler and yield it without | 2162 // Shuffle the received result above a try handler and yield it without |
2163 // re-boxing. | 2163 // re-boxing. |
2164 __ bind(&l_try); | 2164 __ bind(&l_try); |
2165 __ pop(eax); // result | 2165 __ pop(eax); // result |
2166 int handler_index = NewHandlerTableEntry(); | 2166 int handler_index = NewHandlerTableEntry(); |
2167 EnterTryBlock(handler_index, &l_catch); | 2167 EnterTryBlock(handler_index, &l_catch); |
2168 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2168 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
2169 __ push(eax); // result | 2169 __ push(eax); // result |
| 2170 |
2170 __ jmp(&l_suspend); | 2171 __ jmp(&l_suspend); |
2171 __ bind(&l_continuation); | 2172 __ bind(&l_continuation); |
| 2173 __ RecordGeneratorContinuation(); |
2172 __ jmp(&l_resume); | 2174 __ jmp(&l_resume); |
| 2175 |
2173 __ bind(&l_suspend); | 2176 __ bind(&l_suspend); |
2174 const int generator_object_depth = kPointerSize + try_block_size; | 2177 const int generator_object_depth = kPointerSize + try_block_size; |
2175 __ mov(eax, Operand(esp, generator_object_depth)); | 2178 __ mov(eax, Operand(esp, generator_object_depth)); |
2176 __ push(eax); // g | 2179 __ push(eax); // g |
2177 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index | 2180 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index |
2178 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2181 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
2179 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2182 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
2180 Immediate(Smi::FromInt(l_continuation.pos()))); | 2183 Immediate(Smi::FromInt(l_continuation.pos()))); |
2181 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2184 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
2182 __ mov(ecx, esi); | 2185 __ mov(ecx, esi); |
(...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5491 Assembler::target_address_at(call_target_address, | 5494 Assembler::target_address_at(call_target_address, |
5492 unoptimized_code)); | 5495 unoptimized_code)); |
5493 return OSR_AFTER_STACK_CHECK; | 5496 return OSR_AFTER_STACK_CHECK; |
5494 } | 5497 } |
5495 | 5498 |
5496 | 5499 |
5497 } // namespace internal | 5500 } // namespace internal |
5498 } // namespace v8 | 5501 } // namespace v8 |
5499 | 5502 |
5500 #endif // V8_TARGET_ARCH_IA32 | 5503 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |