| 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 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 switch (expr->yield_kind()) { | 2106 switch (expr->yield_kind()) { |
| 2107 case Yield::kSuspend: | 2107 case Yield::kSuspend: |
| 2108 // Pop value from top-of-stack slot; box result into result register. | 2108 // Pop value from top-of-stack slot; box result into result register. |
| 2109 EmitCreateIteratorResult(false); | 2109 EmitCreateIteratorResult(false); |
| 2110 __ Push(result_register()); | 2110 __ Push(result_register()); |
| 2111 // Fall through. | 2111 // Fall through. |
| 2112 case Yield::kInitial: { | 2112 case Yield::kInitial: { |
| 2113 Label suspend, continuation, post_runtime, resume; | 2113 Label suspend, continuation, post_runtime, resume; |
| 2114 | 2114 |
| 2115 __ jmp(&suspend); | 2115 __ jmp(&suspend); |
| 2116 | |
| 2117 __ bind(&continuation); | 2116 __ bind(&continuation); |
| 2117 __ RecordGeneratorContinuation(); |
| 2118 __ jmp(&resume); | 2118 __ jmp(&resume); |
| 2119 | 2119 |
| 2120 __ bind(&suspend); | 2120 __ bind(&suspend); |
| 2121 VisitForAccumulatorValue(expr->generator_object()); | 2121 VisitForAccumulatorValue(expr->generator_object()); |
| 2122 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2122 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 2123 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), | 2123 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), |
| 2124 Smi::FromInt(continuation.pos())); | 2124 Smi::FromInt(continuation.pos())); |
| 2125 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); | 2125 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); |
| 2126 __ movp(rcx, rsi); | 2126 __ movp(rcx, rsi); |
| 2127 __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx, | 2127 __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 | 2181 |
| 2182 // try { received = %yield result } | 2182 // try { received = %yield result } |
| 2183 // Shuffle the received result above a try handler and yield it without | 2183 // Shuffle the received result above a try handler and yield it without |
| 2184 // re-boxing. | 2184 // re-boxing. |
| 2185 __ bind(&l_try); | 2185 __ bind(&l_try); |
| 2186 __ Pop(rax); // result | 2186 __ Pop(rax); // result |
| 2187 int handler_index = NewHandlerTableEntry(); | 2187 int handler_index = NewHandlerTableEntry(); |
| 2188 EnterTryBlock(handler_index, &l_catch); | 2188 EnterTryBlock(handler_index, &l_catch); |
| 2189 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2189 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
| 2190 __ Push(rax); // result | 2190 __ Push(rax); // result |
| 2191 |
| 2191 __ jmp(&l_suspend); | 2192 __ jmp(&l_suspend); |
| 2192 __ bind(&l_continuation); | 2193 __ bind(&l_continuation); |
| 2194 __ RecordGeneratorContinuation(); |
| 2193 __ jmp(&l_resume); | 2195 __ jmp(&l_resume); |
| 2196 |
| 2194 __ bind(&l_suspend); | 2197 __ bind(&l_suspend); |
| 2195 const int generator_object_depth = kPointerSize + try_block_size; | 2198 const int generator_object_depth = kPointerSize + try_block_size; |
| 2196 __ movp(rax, Operand(rsp, generator_object_depth)); | 2199 __ movp(rax, Operand(rsp, generator_object_depth)); |
| 2197 __ Push(rax); // g | 2200 __ Push(rax); // g |
| 2198 __ Push(Smi::FromInt(handler_index)); // handler-index | 2201 __ Push(Smi::FromInt(handler_index)); // handler-index |
| 2199 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2202 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2200 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), | 2203 __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset), |
| 2201 Smi::FromInt(l_continuation.pos())); | 2204 Smi::FromInt(l_continuation.pos())); |
| 2202 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); | 2205 __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi); |
| 2203 __ movp(rcx, rsi); | 2206 __ movp(rcx, rsi); |
| (...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5487 Assembler::target_address_at(call_target_address, | 5490 Assembler::target_address_at(call_target_address, |
| 5488 unoptimized_code)); | 5491 unoptimized_code)); |
| 5489 return OSR_AFTER_STACK_CHECK; | 5492 return OSR_AFTER_STACK_CHECK; |
| 5490 } | 5493 } |
| 5491 | 5494 |
| 5492 | 5495 |
| 5493 } // namespace internal | 5496 } // namespace internal |
| 5494 } // namespace v8 | 5497 } // namespace v8 |
| 5495 | 5498 |
| 5496 #endif // V8_TARGET_ARCH_X64 | 5499 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |