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 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 switch (expr->yield_kind()) { | 2077 switch (expr->yield_kind()) { |
2078 case Yield::kSuspend: | 2078 case Yield::kSuspend: |
2079 // Pop value from top-of-stack slot; box result into result register. | 2079 // Pop value from top-of-stack slot; box result into result register. |
2080 EmitCreateIteratorResult(false); | 2080 EmitCreateIteratorResult(false); |
2081 __ push(result_register()); | 2081 __ push(result_register()); |
2082 // Fall through. | 2082 // Fall through. |
2083 case Yield::kInitial: { | 2083 case Yield::kInitial: { |
2084 Label suspend, continuation, post_runtime, resume; | 2084 Label suspend, continuation, post_runtime, resume; |
2085 | 2085 |
2086 __ jmp(&suspend); | 2086 __ jmp(&suspend); |
2087 | |
2088 __ bind(&continuation); | 2087 __ bind(&continuation); |
| 2088 __ RecordGeneratorContinuation(); |
2089 __ jmp(&resume); | 2089 __ jmp(&resume); |
2090 | 2090 |
2091 __ bind(&suspend); | 2091 __ bind(&suspend); |
2092 VisitForAccumulatorValue(expr->generator_object()); | 2092 VisitForAccumulatorValue(expr->generator_object()); |
2093 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2093 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
2094 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2094 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
2095 Immediate(Smi::FromInt(continuation.pos()))); | 2095 Immediate(Smi::FromInt(continuation.pos()))); |
2096 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2096 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
2097 __ mov(ecx, esi); | 2097 __ mov(ecx, esi); |
2098 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, | 2098 __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 | 2151 |
2152 // try { received = %yield result } | 2152 // try { received = %yield result } |
2153 // Shuffle the received result above a try handler and yield it without | 2153 // Shuffle the received result above a try handler and yield it without |
2154 // re-boxing. | 2154 // re-boxing. |
2155 __ bind(&l_try); | 2155 __ bind(&l_try); |
2156 __ pop(eax); // result | 2156 __ pop(eax); // result |
2157 int handler_index = NewHandlerTableEntry(); | 2157 int handler_index = NewHandlerTableEntry(); |
2158 EnterTryBlock(handler_index, &l_catch); | 2158 EnterTryBlock(handler_index, &l_catch); |
2159 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2159 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
2160 __ push(eax); // result | 2160 __ push(eax); // result |
| 2161 |
2161 __ jmp(&l_suspend); | 2162 __ jmp(&l_suspend); |
2162 __ bind(&l_continuation); | 2163 __ bind(&l_continuation); |
| 2164 __ RecordGeneratorContinuation(); |
2163 __ jmp(&l_resume); | 2165 __ jmp(&l_resume); |
| 2166 |
2164 __ bind(&l_suspend); | 2167 __ bind(&l_suspend); |
2165 const int generator_object_depth = kPointerSize + try_block_size; | 2168 const int generator_object_depth = kPointerSize + try_block_size; |
2166 __ mov(eax, Operand(esp, generator_object_depth)); | 2169 __ mov(eax, Operand(esp, generator_object_depth)); |
2167 __ push(eax); // g | 2170 __ push(eax); // g |
2168 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index | 2171 __ push(Immediate(Smi::FromInt(handler_index))); // handler-index |
2169 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2172 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
2170 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), | 2173 __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
2171 Immediate(Smi::FromInt(l_continuation.pos()))); | 2174 Immediate(Smi::FromInt(l_continuation.pos()))); |
2172 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); | 2175 __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
2173 __ mov(ecx, esi); | 2176 __ mov(ecx, esi); |
(...skipping 3307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 Assembler::target_address_at(call_target_address, | 5484 Assembler::target_address_at(call_target_address, |
5482 unoptimized_code)); | 5485 unoptimized_code)); |
5483 return OSR_AFTER_STACK_CHECK; | 5486 return OSR_AFTER_STACK_CHECK; |
5484 } | 5487 } |
5485 | 5488 |
5486 | 5489 |
5487 } // namespace internal | 5490 } // namespace internal |
5488 } // namespace v8 | 5491 } // namespace v8 |
5489 | 5492 |
5490 #endif // V8_TARGET_ARCH_X87 | 5493 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |