OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4324 Comment cmnt(masm_, "[ Yield"); | 4324 Comment cmnt(masm_, "[ Yield"); |
4325 // Evaluate yielded value first; the initial iterator definition depends on | 4325 // Evaluate yielded value first; the initial iterator definition depends on |
4326 // this. It stays on the stack while we update the iterator. | 4326 // this. It stays on the stack while we update the iterator. |
4327 VisitForStackValue(expr->expression()); | 4327 VisitForStackValue(expr->expression()); |
4328 | 4328 |
4329 // TODO(jbramley): Tidy this up once the merge is done, using named registers | 4329 // TODO(jbramley): Tidy this up once the merge is done, using named registers |
4330 // and suchlike. The implementation changes a little by bleeding_edge so I | 4330 // and suchlike. The implementation changes a little by bleeding_edge so I |
4331 // don't want to spend too much time on it now. | 4331 // don't want to spend too much time on it now. |
4332 | 4332 |
4333 switch (expr->yield_kind()) { | 4333 switch (expr->yield_kind()) { |
4334 case Yield::SUSPEND: | 4334 case Yield::kSuspend: |
4335 // Pop value from top-of-stack slot; box result into result register. | 4335 // Pop value from top-of-stack slot; box result into result register. |
4336 EmitCreateIteratorResult(false); | 4336 EmitCreateIteratorResult(false); |
4337 __ Push(result_register()); | 4337 __ Push(result_register()); |
4338 // Fall through. | 4338 // Fall through. |
4339 case Yield::INITIAL: { | 4339 case Yield::kInitial: { |
4340 Label suspend, continuation, post_runtime, resume; | 4340 Label suspend, continuation, post_runtime, resume; |
4341 | 4341 |
4342 __ B(&suspend); | 4342 __ B(&suspend); |
4343 | 4343 |
4344 // TODO(jbramley): This label is bound here because the following code | 4344 // TODO(jbramley): This label is bound here because the following code |
4345 // looks at its pos(). Is it possible to do something more efficient here, | 4345 // looks at its pos(). Is it possible to do something more efficient here, |
4346 // perhaps using Adr? | 4346 // perhaps using Adr? |
4347 __ Bind(&continuation); | 4347 __ Bind(&continuation); |
4348 __ B(&resume); | 4348 __ B(&resume); |
4349 | 4349 |
(...skipping 14 matching lines...) Expand all Loading... |
4364 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4364 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4365 __ Bind(&post_runtime); | 4365 __ Bind(&post_runtime); |
4366 __ Pop(result_register()); | 4366 __ Pop(result_register()); |
4367 EmitReturnSequence(); | 4367 EmitReturnSequence(); |
4368 | 4368 |
4369 __ Bind(&resume); | 4369 __ Bind(&resume); |
4370 context()->Plug(result_register()); | 4370 context()->Plug(result_register()); |
4371 break; | 4371 break; |
4372 } | 4372 } |
4373 | 4373 |
4374 case Yield::FINAL: { | 4374 case Yield::kFinal: { |
4375 VisitForAccumulatorValue(expr->generator_object()); | 4375 VisitForAccumulatorValue(expr->generator_object()); |
4376 __ Mov(x1, Smi::FromInt(JSGeneratorObject::kGeneratorClosed)); | 4376 __ Mov(x1, Smi::FromInt(JSGeneratorObject::kGeneratorClosed)); |
4377 __ Str(x1, FieldMemOperand(result_register(), | 4377 __ Str(x1, FieldMemOperand(result_register(), |
4378 JSGeneratorObject::kContinuationOffset)); | 4378 JSGeneratorObject::kContinuationOffset)); |
4379 // Pop value from top-of-stack slot, box result into result register. | 4379 // Pop value from top-of-stack slot, box result into result register. |
4380 EmitCreateIteratorResult(true); | 4380 EmitCreateIteratorResult(true); |
4381 EmitUnwindBeforeReturn(); | 4381 EmitUnwindBeforeReturn(); |
4382 EmitReturnSequence(); | 4382 EmitReturnSequence(); |
4383 break; | 4383 break; |
4384 } | 4384 } |
4385 | 4385 |
4386 case Yield::DELEGATING: { | 4386 case Yield::kDelegating: { |
4387 VisitForStackValue(expr->generator_object()); | 4387 VisitForStackValue(expr->generator_object()); |
4388 | 4388 |
4389 // Initial stack layout is as follows: | 4389 // Initial stack layout is as follows: |
4390 // [sp + 1 * kPointerSize] iter | 4390 // [sp + 1 * kPointerSize] iter |
4391 // [sp + 0 * kPointerSize] g | 4391 // [sp + 0 * kPointerSize] g |
4392 | 4392 |
4393 Label l_catch, l_try, l_suspend, l_continuation, l_resume; | 4393 Label l_catch, l_try, l_suspend, l_continuation, l_resume; |
4394 Label l_next, l_call, l_loop; | 4394 Label l_next, l_call, l_loop; |
4395 Register load_receiver = LoadConvention::ReceiverRegister(); | 4395 Register load_receiver = LoadConvention::ReceiverRegister(); |
4396 Register load_name = LoadConvention::NameRegister(); | 4396 Register load_name = LoadConvention::NameRegister(); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4911 return previous_; | 4911 return previous_; |
4912 } | 4912 } |
4913 | 4913 |
4914 | 4914 |
4915 #undef __ | 4915 #undef __ |
4916 | 4916 |
4917 | 4917 |
4918 } } // namespace v8::internal | 4918 } } // namespace v8::internal |
4919 | 4919 |
4920 #endif // V8_TARGET_ARCH_ARM64 | 4920 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |