| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 switch (expr->yield_kind()) { | 2119 switch (expr->yield_kind()) { |
| 2120 case Yield::kSuspend: | 2120 case Yield::kSuspend: |
| 2121 // Pop value from top-of-stack slot; box result into result register. | 2121 // Pop value from top-of-stack slot; box result into result register. |
| 2122 EmitCreateIteratorResult(false); | 2122 EmitCreateIteratorResult(false); |
| 2123 __ Push(result_register()); | 2123 __ Push(result_register()); |
| 2124 // Fall through. | 2124 // Fall through. |
| 2125 case Yield::kInitial: { | 2125 case Yield::kInitial: { |
| 2126 Label suspend, continuation, post_runtime, resume; | 2126 Label suspend, continuation, post_runtime, resume; |
| 2127 | 2127 |
| 2128 __ jmp(&suspend); | 2128 __ jmp(&suspend); |
| 2129 | |
| 2130 __ bind(&continuation); | 2129 __ bind(&continuation); |
| 2130 __ RecordGeneratorContinuation(); |
| 2131 __ jmp(&resume); | 2131 __ jmp(&resume); |
| 2132 | 2132 |
| 2133 __ bind(&suspend); | 2133 __ bind(&suspend); |
| 2134 VisitForAccumulatorValue(expr->generator_object()); | 2134 VisitForAccumulatorValue(expr->generator_object()); |
| 2135 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2135 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 2136 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), | 2136 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), |
| 2137 Smi::FromInt(continuation.pos())); | 2137 Smi::FromInt(continuation.pos())); |
| 2138 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); | 2138 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); |
| 2139 __ movp(rcx, rsi); | 2139 __ movp(rcx, rsi); |
| 2140 __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx, | 2140 __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2194 | 2194 |
| 2195 // try { received = %yield result } | 2195 // try { received = %yield result } |
| 2196 // Shuffle the received result above a try handler and yield it without | 2196 // Shuffle the received result above a try handler and yield it without |
| 2197 // re-boxing. | 2197 // re-boxing. |
| 2198 __ bind(&l_try); | 2198 __ bind(&l_try); |
| 2199 __ Pop(rax); // result | 2199 __ Pop(rax); // result |
| 2200 int handler_index = NewHandlerTableEntry(); | 2200 int handler_index = NewHandlerTableEntry(); |
| 2201 EnterTryBlock(handler_index, &l_catch); | 2201 EnterTryBlock(handler_index, &l_catch); |
| 2202 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2202 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
| 2203 __ Push(rax); // result | 2203 __ Push(rax); // result |
| 2204 |
| 2204 __ jmp(&l_suspend); | 2205 __ jmp(&l_suspend); |
| 2205 __ bind(&l_continuation); | 2206 __ bind(&l_continuation); |
| 2207 __ RecordGeneratorContinuation(); |
| 2206 __ jmp(&l_resume); | 2208 __ jmp(&l_resume); |
| 2209 |
| 2207 __ bind(&l_suspend); | 2210 __ bind(&l_suspend); |
| 2208 const int generator_object_depth = kPointerSize + try_block_size; | 2211 const int generator_object_depth = kPointerSize + try_block_size; |
| 2209 __ movp(rax, Operand(rsp, generator_object_depth)); | 2212 __ movp(rax, Operand(rsp, generator_object_depth)); |
| 2210 __ Push(rax); // g | 2213 __ Push(rax); // g |
| 2211 __ Push(Smi::FromInt(handler_index)); // handler-index | 2214 __ Push(Smi::FromInt(handler_index)); // handler-index |
| 2212 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2215 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2213 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), | 2216 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), |
| 2214 Smi::FromInt(l_continuation.pos())); | 2217 Smi::FromInt(l_continuation.pos())); |
| 2215 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); | 2218 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); |
| 2216 __ movp(rcx, rsi); | 2219 __ movp(rcx, rsi); |
| (...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5516 Assembler::target_address_at(call_target_address, | 5519 Assembler::target_address_at(call_target_address, |
| 5517 unoptimized_code)); | 5520 unoptimized_code)); |
| 5518 return OSR_AFTER_STACK_CHECK; | 5521 return OSR_AFTER_STACK_CHECK; |
| 5519 } | 5522 } |
| 5520 | 5523 |
| 5521 | 5524 |
| 5522 } // namespace internal | 5525 } // namespace internal |
| 5523 } // namespace v8 | 5526 } // namespace v8 |
| 5524 | 5527 |
| 5525 #endif // V8_TARGET_ARCH_X64 | 5528 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |