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

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

Issue 1867263002: [generators] Store the resume mode in the generator object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/objects-inl.h ('k') | no next file » | 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // -- rdx : the resume mode (tagged) 472 // -- rdx : the resume mode (tagged)
473 // -- rsp[0] : return address 473 // -- rsp[0] : return address
474 // ----------------------------------- 474 // -----------------------------------
475 __ AssertGeneratorObject(rbx); 475 __ AssertGeneratorObject(rbx);
476 476
477 // Store input value into generator object. 477 // Store input value into generator object.
478 __ movp(FieldOperand(rbx, JSGeneratorObject::kInputOffset), rax); 478 __ movp(FieldOperand(rbx, JSGeneratorObject::kInputOffset), rax);
479 __ RecordWriteField(rbx, JSGeneratorObject::kInputOffset, rax, rcx, 479 __ RecordWriteField(rbx, JSGeneratorObject::kInputOffset, rax, rcx,
480 kDontSaveFPRegs); 480 kDontSaveFPRegs);
481 481
482 // Store resume mode into generator object.
483 __ movp(FieldOperand(rbx, JSGeneratorObject::kResumeModeOffset), rdx);
484 __ RecordWriteField(rbx, JSGeneratorObject::kResumeModeOffset, rdx, rcx,
Benedikt Meurer 2016/04/08 10:20:14 You don't need a write barrier, the resume mode is
485 kDontSaveFPRegs);
486
482 // Load suspended function and context. 487 // Load suspended function and context.
483 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); 488 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset));
484 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); 489 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset));
485 490
486 // Flood function if we are stepping. 491 // Flood function if we are stepping.
487 Label skip_flooding; 492 Label skip_flooding;
488 ExternalReference step_in_enabled = 493 ExternalReference step_in_enabled =
489 ExternalReference::debug_step_in_enabled_address(masm->isolate()); 494 ExternalReference::debug_step_in_enabled_address(masm->isolate());
490 Operand step_in_enabled_operand = masm->ExternalOperand(step_in_enabled); 495 Operand step_in_enabled_operand = masm->ExternalOperand(step_in_enabled);
491 __ cmpb(step_in_enabled_operand, Immediate(0)); 496 __ cmpb(step_in_enabled_operand, Immediate(0));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 __ bind(&loop); 557 __ bind(&loop);
553 __ cmpl(rcx, rax); 558 __ cmpl(rcx, rax);
554 __ j(equal, &done_loop, Label::kNear); 559 __ j(equal, &done_loop, Label::kNear);
555 __ Push( 560 __ Push(
556 FieldOperand(rsi, rcx, times_pointer_size, FixedArray::kHeaderSize)); 561 FieldOperand(rsi, rcx, times_pointer_size, FixedArray::kHeaderSize));
557 __ addl(rcx, Immediate(1)); 562 __ addl(rcx, Immediate(1));
558 __ jmp(&loop); 563 __ jmp(&loop);
559 __ bind(&done_loop); 564 __ bind(&done_loop);
560 } 565 }
561 566
562 // Push resume mode (consumed in continuation).
563 __ Push(rdx);
564
565 // Reset operand stack so we don't leak. 567 // Reset operand stack so we don't leak.
566 __ LoadRoot(FieldOperand(rbx, JSGeneratorObject::kOperandStackOffset), 568 __ LoadRoot(FieldOperand(rbx, JSGeneratorObject::kOperandStackOffset),
567 Heap::kEmptyFixedArrayRootIndex); 569 Heap::kEmptyFixedArrayRootIndex);
568 570
569 // Restore context and value. 571 // Restore context.
570 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); 572 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset));
571 __ movp(rax, FieldOperand(rbx, JSGeneratorObject::kInputOffset));
572 573
573 // Resume the generator function at the continuation. 574 // Resume the generator function at the continuation.
574 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 575 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
575 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); 576 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset));
576 __ SmiToInteger64(rcx, 577 __ SmiToInteger64(rcx,
577 FieldOperand(rbx, JSGeneratorObject::kContinuationOffset)); 578 FieldOperand(rbx, JSGeneratorObject::kContinuationOffset));
578 __ leap(rdx, FieldOperand(rdx, rcx, times_1, Code::kHeaderSize)); 579 __ leap(rdx, FieldOperand(rdx, rcx, times_1, Code::kHeaderSize));
579 __ Move(FieldOperand(rbx, JSGeneratorObject::kContinuationOffset), 580 __ Move(FieldOperand(rbx, JSGeneratorObject::kContinuationOffset),
580 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); 581 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
582 __ movp(rax, rbx); // Continuation expects generator object in rax.
581 __ jmp(rdx); 583 __ jmp(rdx);
582 } 584 }
583 585
584 // Generate code for entering a JS function with the interpreter. 586 // Generate code for entering a JS function with the interpreter.
585 // On entry to the function the receiver and arguments have been pushed on the 587 // On entry to the function the receiver and arguments have been pushed on the
586 // stack left to right. The actual argument count matches the formal parameter 588 // stack left to right. The actual argument count matches the formal parameter
587 // count expected by the function. 589 // count expected by the function.
588 // 590 //
589 // The live registers are: 591 // The live registers are:
590 // o rdi: the JS function object being called 592 // o rdi: the JS function object being called
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2791 __ ret(0); 2793 __ ret(0);
2792 } 2794 }
2793 2795
2794 2796
2795 #undef __ 2797 #undef __
2796 2798
2797 } // namespace internal 2799 } // namespace internal
2798 } // namespace v8 2800 } // namespace v8
2799 2801
2800 #endif // V8_TARGET_ARCH_X64 2802 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698