Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: src/full-codegen/arm64/full-codegen-arm64.cc

Issue 1639343005: [generators] Implement Generator.prototype.return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@yield-star
Patch Set: Another rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 4325 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 __ Push(result_register()); 4336 __ Push(result_register());
4337 // Fall through. 4337 // Fall through.
4338 case Yield::kInitial: { 4338 case Yield::kInitial: {
4339 Label suspend, continuation, post_runtime, resume; 4339 Label suspend, continuation, post_runtime, resume;
4340 4340
4341 __ B(&suspend); 4341 __ B(&suspend);
4342 // TODO(jbramley): This label is bound here because the following code 4342 // TODO(jbramley): This label is bound here because the following code
4343 // looks at its pos(). Is it possible to do something more efficient here, 4343 // looks at its pos(). Is it possible to do something more efficient here,
4344 // perhaps using Adr? 4344 // perhaps using Adr?
4345 __ Bind(&continuation); 4345 __ Bind(&continuation);
4346 // When we arrive here, the stack top is the resume mode and
4347 // result_register() holds the input value (the argument given to the
4348 // respective resume operation).
4346 __ RecordGeneratorContinuation(); 4349 __ RecordGeneratorContinuation();
4347 __ B(&resume); 4350 __ Pop(x1);
4351 __ Cmp(x1, Smi::FromInt(JSGeneratorObject::RETURN));
4352 __ B(ne, &resume);
4353 __ Push(result_register());
4354 EmitCreateIteratorResult(true);
4355 EmitUnwindBeforeReturn();
4356 EmitReturnSequence();
4348 4357
4349 __ Bind(&suspend); 4358 __ Bind(&suspend);
4350 VisitForAccumulatorValue(expr->generator_object()); 4359 VisitForAccumulatorValue(expr->generator_object());
4351 DCHECK((continuation.pos() > 0) && Smi::IsValid(continuation.pos())); 4360 DCHECK((continuation.pos() > 0) && Smi::IsValid(continuation.pos()));
4352 __ Mov(x1, Smi::FromInt(continuation.pos())); 4361 __ Mov(x1, Smi::FromInt(continuation.pos()));
4353 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset)); 4362 __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset));
4354 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset)); 4363 __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset));
4355 __ Mov(x1, cp); 4364 __ Mov(x1, cp);
4356 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2, 4365 __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2,
4357 kLRHasBeenSaved, kDontSaveFPRegs); 4366 kLRHasBeenSaved, kDontSaveFPRegs);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 Label slow_resume; 4573 Label slow_resume;
4565 __ Cbnz(operand_stack_size, &slow_resume); 4574 __ Cbnz(operand_stack_size, &slow_resume);
4566 __ Ldr(x10, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); 4575 __ Ldr(x10, FieldMemOperand(function, JSFunction::kCodeEntryOffset));
4567 __ Ldrsw(x11, 4576 __ Ldrsw(x11,
4568 UntagSmiFieldMemOperand(generator_object, 4577 UntagSmiFieldMemOperand(generator_object,
4569 JSGeneratorObject::kContinuationOffset)); 4578 JSGeneratorObject::kContinuationOffset));
4570 __ Add(x10, x10, x11); 4579 __ Add(x10, x10, x11);
4571 __ Mov(x12, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); 4580 __ Mov(x12, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
4572 __ Str(x12, FieldMemOperand(generator_object, 4581 __ Str(x12, FieldMemOperand(generator_object,
4573 JSGeneratorObject::kContinuationOffset)); 4582 JSGeneratorObject::kContinuationOffset));
4583 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
4574 __ Br(x10); 4584 __ Br(x10);
4575 4585
4576 __ Bind(&slow_resume); 4586 __ Bind(&slow_resume);
4577 } 4587 }
4578 4588
4579 // Otherwise, we push holes for the operand stack and call the runtime to fix 4589 // Otherwise, we push holes for the operand stack and call the runtime to fix
4580 // up the stack and the handlers. 4590 // up the stack and the handlers.
4581 __ PushMultipleTimes(the_hole, operand_stack_size); 4591 __ PushMultipleTimes(the_hole, operand_stack_size);
4582 4592
4583 __ Mov(x10, Smi::FromInt(resume_mode)); 4593 __ Mov(x10, Smi::FromInt(resume_mode));
4594 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
4584 __ Push(generator_object, result_register(), x10); 4595 __ Push(generator_object, result_register(), x10);
4585 __ CallRuntime(Runtime::kResumeJSGeneratorObject); 4596 __ CallRuntime(Runtime::kResumeJSGeneratorObject);
4586 // Not reached: the runtime call returns elsewhere. 4597 // Not reached: the runtime call returns elsewhere.
4587 __ Unreachable(); 4598 __ Unreachable();
4588 4599
4589 __ Bind(&done); 4600 __ Bind(&done);
4590 context()->Plug(result_register()); 4601 context()->Plug(result_register());
4591 } 4602 }
4592 4603
4593 4604
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
4826 } 4837 }
4827 4838
4828 return INTERRUPT; 4839 return INTERRUPT;
4829 } 4840 }
4830 4841
4831 4842
4832 } // namespace internal 4843 } // namespace internal
4833 } // namespace v8 4844 } // namespace v8
4834 4845
4835 #endif // V8_TARGET_ARCH_ARM64 4846 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698