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 #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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 kDontSaveFPRegs); | 473 kDontSaveFPRegs); |
474 | 474 |
475 // Store resume mode into generator object. | 475 // Store resume mode into generator object. |
476 __ movp(FieldOperand(rbx, JSGeneratorObject::kResumeModeOffset), rdx); | 476 __ movp(FieldOperand(rbx, JSGeneratorObject::kResumeModeOffset), rdx); |
477 | 477 |
478 // Load suspended function and context. | 478 // Load suspended function and context. |
479 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); | 479 __ movp(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); |
480 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); | 480 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); |
481 | 481 |
482 // Flood function if we are stepping. | 482 // Flood function if we are stepping. |
483 Label skip_flooding; | 483 Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; |
| 484 Label stepping_prepared; |
484 ExternalReference step_in_enabled = | 485 ExternalReference step_in_enabled = |
485 ExternalReference::debug_step_in_enabled_address(masm->isolate()); | 486 ExternalReference::debug_step_in_enabled_address(masm->isolate()); |
486 Operand step_in_enabled_operand = masm->ExternalOperand(step_in_enabled); | 487 Operand step_in_enabled_operand = masm->ExternalOperand(step_in_enabled); |
487 __ cmpb(step_in_enabled_operand, Immediate(0)); | 488 __ cmpb(step_in_enabled_operand, Immediate(0)); |
488 __ j(equal, &skip_flooding); | 489 __ j(not_equal, &prepare_step_in_if_stepping); |
489 { | 490 |
490 FrameScope scope(masm, StackFrame::INTERNAL); | 491 // Flood function if we need to continue stepping in the suspended generator. |
491 __ Push(rbx); | 492 ExternalReference debug_suspended_generator = |
492 __ Push(rdx); | 493 ExternalReference::debug_suspended_generator_address(masm->isolate()); |
493 __ Push(rdi); | 494 Operand debug_suspended_generator_operand = |
494 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 495 masm->ExternalOperand(debug_suspended_generator); |
495 __ Pop(rdx); | 496 __ cmpp(rbx, debug_suspended_generator_operand); |
496 __ Pop(rbx); | 497 __ j(equal, &prepare_step_in_suspended_generator); |
497 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); | 498 __ bind(&stepping_prepared); |
498 } | |
499 __ bind(&skip_flooding); | |
500 | 499 |
501 // Pop return address. | 500 // Pop return address. |
502 __ PopReturnAddressTo(rax); | 501 __ PopReturnAddressTo(rax); |
503 | 502 |
504 // Push receiver. | 503 // Push receiver. |
505 __ Push(FieldOperand(rbx, JSGeneratorObject::kReceiverOffset)); | 504 __ Push(FieldOperand(rbx, JSGeneratorObject::kReceiverOffset)); |
506 | 505 |
507 // ----------- S t a t e ------------- | 506 // ----------- S t a t e ------------- |
508 // -- rax : return address | 507 // -- rax : return address |
509 // -- rbx : the JSGeneratorObject to resume | 508 // -- rbx : the JSGeneratorObject to resume |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 588 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
590 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); | 589 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
591 __ SmiToInteger64( | 590 __ SmiToInteger64( |
592 rcx, FieldOperand(rbx, JSGeneratorObject::kContinuationOffset)); | 591 rcx, FieldOperand(rbx, JSGeneratorObject::kContinuationOffset)); |
593 __ leap(rdx, FieldOperand(rdx, rcx, times_1, Code::kHeaderSize)); | 592 __ leap(rdx, FieldOperand(rdx, rcx, times_1, Code::kHeaderSize)); |
594 __ Move(FieldOperand(rbx, JSGeneratorObject::kContinuationOffset), | 593 __ Move(FieldOperand(rbx, JSGeneratorObject::kContinuationOffset), |
595 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | 594 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); |
596 __ movp(rax, rbx); // Continuation expects generator object in rax. | 595 __ movp(rax, rbx); // Continuation expects generator object in rax. |
597 __ jmp(rdx); | 596 __ jmp(rdx); |
598 } | 597 } |
| 598 |
| 599 __ bind(&prepare_step_in_if_stepping); |
| 600 { |
| 601 FrameScope scope(masm, StackFrame::INTERNAL); |
| 602 __ Push(rbx); |
| 603 __ Push(rdx); |
| 604 __ Push(rdi); |
| 605 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 606 __ Pop(rdx); |
| 607 __ Pop(rbx); |
| 608 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); |
| 609 } |
| 610 __ jmp(&stepping_prepared); |
| 611 |
| 612 __ bind(&prepare_step_in_suspended_generator); |
| 613 { |
| 614 FrameScope scope(masm, StackFrame::INTERNAL); |
| 615 __ Push(rbx); |
| 616 __ Push(rdx); |
| 617 __ CallRuntime(Runtime::kDebugPrepareStepInSuspendedGenerator); |
| 618 __ Pop(rdx); |
| 619 __ Pop(rbx); |
| 620 __ movp(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); |
| 621 } |
| 622 __ jmp(&stepping_prepared); |
599 } | 623 } |
600 | 624 |
601 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1, | 625 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1, |
602 Register scratch2) { | 626 Register scratch2) { |
603 Register args_count = scratch1; | 627 Register args_count = scratch1; |
604 Register return_pc = scratch2; | 628 Register return_pc = scratch2; |
605 | 629 |
606 // Get the arguments + receiver count. | 630 // Get the arguments + receiver count. |
607 __ movp(args_count, | 631 __ movp(args_count, |
608 Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp)); | 632 Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 __ ret(0); | 2944 __ ret(0); |
2921 } | 2945 } |
2922 | 2946 |
2923 | 2947 |
2924 #undef __ | 2948 #undef __ |
2925 | 2949 |
2926 } // namespace internal | 2950 } // namespace internal |
2927 } // namespace v8 | 2951 } // namespace v8 |
2928 | 2952 |
2929 #endif // V8_TARGET_ARCH_X64 | 2953 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |