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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 int num_arguments) { | 656 int num_arguments) { |
657 Set(rax, num_arguments); | 657 Set(rax, num_arguments); |
658 LoadAddress(rbx, ext); | 658 LoadAddress(rbx, ext); |
659 | 659 |
660 CEntryStub stub(isolate(), 1); | 660 CEntryStub stub(isolate(), 1); |
661 CallStub(&stub); | 661 CallStub(&stub); |
662 } | 662 } |
663 | 663 |
664 | 664 |
665 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, | 665 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, |
666 int num_arguments, | 666 int num_arguments) { |
667 int result_size) { | |
668 // ----------- S t a t e ------------- | 667 // ----------- S t a t e ------------- |
669 // -- rsp[0] : return address | 668 // -- rsp[0] : return address |
670 // -- rsp[8] : argument num_arguments - 1 | 669 // -- rsp[8] : argument num_arguments - 1 |
671 // ... | 670 // ... |
672 // -- rsp[8 * num_arguments] : argument 0 (receiver) | 671 // -- rsp[8 * num_arguments] : argument 0 (receiver) |
673 // ----------------------------------- | 672 // ----------------------------------- |
674 | 673 |
675 // TODO(1236192): Most runtime routines don't need the number of | 674 // TODO(1236192): Most runtime routines don't need the number of |
676 // arguments passed in because it is constant. At some point we | 675 // arguments passed in because it is constant. At some point we |
677 // should remove this need and make the runtime routine entry code | 676 // should remove this need and make the runtime routine entry code |
678 // smarter. | 677 // smarter. |
679 Set(rax, num_arguments); | 678 Set(rax, num_arguments); |
680 JumpToExternalReference(ext, result_size); | 679 JumpToExternalReference(ext); |
681 } | 680 } |
682 | 681 |
683 | 682 |
684 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, | 683 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, |
685 int num_arguments, | 684 int num_arguments) { |
686 int result_size) { | 685 TailCallExternalReference(ExternalReference(fid, isolate()), num_arguments); |
687 TailCallExternalReference(ExternalReference(fid, isolate()), | |
688 num_arguments, | |
689 result_size); | |
690 } | 686 } |
691 | 687 |
692 | 688 |
693 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext, | 689 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { |
694 int result_size) { | |
695 // Set the entry point and jump to the C entry runtime stub. | 690 // Set the entry point and jump to the C entry runtime stub. |
696 LoadAddress(rbx, ext); | 691 LoadAddress(rbx, ext); |
697 CEntryStub ces(isolate(), result_size); | 692 CEntryStub ces(isolate(), 1); |
698 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); | 693 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); |
699 } | 694 } |
700 | 695 |
701 | 696 |
702 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, | 697 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
703 const CallWrapper& call_wrapper) { | 698 const CallWrapper& call_wrapper) { |
704 // You can't call a builtin without a valid frame. | 699 // You can't call a builtin without a valid frame. |
705 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 700 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
706 | 701 |
707 // Fake a parameter count to avoid emitting code to do the check. | 702 // Fake a parameter count to avoid emitting code to do the check. |
(...skipping 4761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5469 movl(rax, dividend); | 5464 movl(rax, dividend); |
5470 shrl(rax, Immediate(31)); | 5465 shrl(rax, Immediate(31)); |
5471 addl(rdx, rax); | 5466 addl(rdx, rax); |
5472 } | 5467 } |
5473 | 5468 |
5474 | 5469 |
5475 } // namespace internal | 5470 } // namespace internal |
5476 } // namespace v8 | 5471 } // namespace v8 |
5477 | 5472 |
5478 #endif // V8_TARGET_ARCH_X64 | 5473 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |