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

Side by Side Diff: src/builtins/x64/builtins-x64.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 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/builtins/builtins-promise.cc ('k') | src/code-factory.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 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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 434 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
435 Generate_JSEntryTrampolineHelper(masm, false); 435 Generate_JSEntryTrampolineHelper(masm, false);
436 } 436 }
437 437
438 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 438 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
439 Generate_JSEntryTrampolineHelper(masm, true); 439 Generate_JSEntryTrampolineHelper(masm, true);
440 } 440 }
441 441
442 // static 442 // static
443 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { 443 void Builtins::Generate_ResumeGenerator(MacroAssembler* masm,
444 ResumeGeneratorType type) {
444 // ----------- S t a t e ------------- 445 // ----------- S t a t e -------------
445 // -- rax : the value to pass to the generator 446 // -- rax : the value to pass to the generator
446 // -- rbx : the JSGeneratorObject to resume 447 // -- rbx : the JSGeneratorObject to resume
447 // -- rdx : the resume mode (tagged) 448 // -- rdx : the resume mode (tagged)
448 // -- rsp[0] : return address 449 // -- rsp[0] : return address
449 // ----------------------------------- 450 // -----------------------------------
450 __ AssertGeneratorObject(rbx);
451 451
452 // Store input value into generator object. 452 // Store input value into generator object.
453 __ movp(FieldOperand(rbx, JSGeneratorObject::kInputOrDebugPosOffset), rax); 453 int offset = type == ResumeGeneratorType::kYield
454 __ RecordWriteField(rbx, JSGeneratorObject::kInputOrDebugPosOffset, rax, rcx, 454 ? JSGeneratorObject::kInputOrDebugPosOffset
455 kDontSaveFPRegs); 455 : JSAsyncGeneratorObject::kAwaitInputOffset;
456 __ movp(FieldOperand(rbx, offset), rax);
457 __ RecordWriteField(rbx, offset, rax, rcx, kDontSaveFPRegs);
456 458
457 // Store resume mode into generator object. 459 // Store resume mode into generator object.
458 __ movp(FieldOperand(rbx, JSGeneratorObject::kResumeModeOffset), rdx); 460 __ movp(FieldOperand(rbx, JSGeneratorObject::kResumeModeOffset), rdx);
459 461
460 // Load suspended function and context. 462 // Load suspended function and context.
461 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); 463 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset));
462 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); 464 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset));
463 465
464 // Flood function if we are stepping. 466 // Flood function if we are stepping.
465 Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; 467 Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 __ Push(rbx); 554 __ Push(rbx);
553 __ Push(rdx); 555 __ Push(rdx);
554 __ CallRuntime(Runtime::kDebugPrepareStepInSuspendedGenerator); 556 __ CallRuntime(Runtime::kDebugPrepareStepInSuspendedGenerator);
555 __ Pop(rdx); 557 __ Pop(rdx);
556 __ Pop(rbx); 558 __ Pop(rbx);
557 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); 559 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset));
558 } 560 }
559 __ jmp(&stepping_prepared); 561 __ jmp(&stepping_prepared);
560 } 562 }
561 563
564 // static
565 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
566 // ----------- S t a t e -------------
567 // -- rax : the value to pass to the generator
568 // -- rbx : the JSGeneratorObject to resume
569 // -- rdx : the resume mode (tagged)
570 // -- rsp[0] : return address
571 // -----------------------------------
572 __ AssertGeneratorObject(rbx);
573 Generate_ResumeGenerator(masm, ResumeGeneratorType::kYield);
574 }
575
576 // static
577 void Builtins::Generate_ResumeAwaitedGeneratorTrampoline(MacroAssembler* masm) {
578 // ----------- S t a t e -------------
579 // -- rax : the value to pass to the generator
580 // -- rbx : the JSGeneratorObject to resume
581 // -- rdx : the resume mode (tagged)
582 // -- rsp[0] : return address
583 // -----------------------------------
584 __ AssertAsyncGeneratorObject(rbx);
585 Generate_ResumeGenerator(masm, ResumeGeneratorType::kAwait);
586 }
587
562 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1, 588 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1,
563 Register scratch2) { 589 Register scratch2) {
564 Register args_count = scratch1; 590 Register args_count = scratch1;
565 Register return_pc = scratch2; 591 Register return_pc = scratch2;
566 592
567 // Get the arguments + receiver count. 593 // Get the arguments + receiver count.
568 __ movp(args_count, 594 __ movp(args_count,
569 Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp)); 595 Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp));
570 __ movl(args_count, 596 __ movl(args_count,
571 FieldOperand(args_count, BytecodeArray::kParameterSizeOffset)); 597 FieldOperand(args_count, BytecodeArray::kParameterSizeOffset));
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3072 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3047 Generate_OnStackReplacementHelper(masm, true); 3073 Generate_OnStackReplacementHelper(masm, true);
3048 } 3074 }
3049 3075
3050 #undef __ 3076 #undef __
3051 3077
3052 } // namespace internal 3078 } // namespace internal
3053 } // namespace v8 3079 } // namespace v8
3054 3080
3055 #endif // V8_TARGET_ARCH_X64 3081 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/builtins/builtins-promise.cc ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698