OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "assembler.h" | 31 #include "assembler.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 // Default scratch register used by MacroAssembler (and other code that needs | 36 // Default scratch register used by MacroAssembler (and other code that needs |
37 // a spare register). The register isn't callee save, and not used by the | 37 // a spare register). The register isn't callee save, and not used by the |
38 // function calling convention. | 38 // function calling convention. |
39 static const Register kScratchRegister = r10; | 39 static const Register kScratchRegister = r10; |
40 | 40 |
| 41 // Registers for passing arguments into a C function. |
| 42 #ifdef _WIN64 |
| 43 static const int kCArgRegsCount = 4; |
| 44 static const RegList kCCallerSaved = |
| 45 rax.bit() | rcx.bit() | rdx.bit() | r8.bit() | |
| 46 r9.bit() | r10.bit() | r11.bit(); |
| 47 #else |
| 48 static const int kCArgRegsCount = 6; |
| 49 static const RegList kCCallerSaved = |
| 50 rax.bit() | rcx.bit() | rdx.bit() | rsi.bit() | rdi.bit() | r8.bit() | |
| 51 r9.bit() | r10.bit() | r11.bit(); |
| 52 #endif |
| 53 extern const Register kCArgRegs[kCArgRegsCount]; |
| 54 |
| 55 |
41 // Convenience for platform-independent signatures. | 56 // Convenience for platform-independent signatures. |
42 typedef Operand MemOperand; | 57 typedef Operand MemOperand; |
43 | 58 |
44 // Forward declaration. | 59 // Forward declaration. |
45 class JumpTarget; | 60 class JumpTarget; |
46 | 61 |
47 struct SmiIndex { | 62 struct SmiIndex { |
48 SmiIndex(Register index_register, ScaleFactor scale) | 63 SmiIndex(Register index_register, ScaleFactor scale) |
49 : reg(index_register), | 64 : reg(index_register), |
50 scale(scale) {} | 65 scale(scale) {} |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // Eventually this should be used for all C calls. | 663 // Eventually this should be used for all C calls. |
649 void CallRuntime(Runtime::Function* f, int num_arguments); | 664 void CallRuntime(Runtime::Function* f, int num_arguments); |
650 | 665 |
651 // Convenience function: Same as above, but takes the fid instead. | 666 // Convenience function: Same as above, but takes the fid instead. |
652 void CallRuntime(Runtime::FunctionId id, int num_arguments); | 667 void CallRuntime(Runtime::FunctionId id, int num_arguments); |
653 | 668 |
654 // Convenience function: call an external reference. | 669 // Convenience function: call an external reference. |
655 void CallExternalReference(const ExternalReference& ext, | 670 void CallExternalReference(const ExternalReference& ext, |
656 int num_arguments); | 671 int num_arguments); |
657 | 672 |
658 // Tail call of a runtime routine (jump). | 673 // Tail call of a runtime routine (jump or equivalent if jump is not |
659 // Like JumpToRuntime, but also takes care of passing the number | 674 // possible). Like JumpToRuntime, but also takes care of passing the number |
660 // of arguments. | 675 // of arguments. |
661 void TailCallRuntime(const ExternalReference& ext, | 676 void TailCallRuntime(Runtime::FunctionId id, |
662 int num_arguments, | 677 int num_arguments, |
663 int result_size); | 678 int result_size); |
664 | 679 |
| 680 void TailCallExternalReference(const ExternalReference& ext, |
| 681 int num_arguments, |
| 682 int result_size); |
| 683 |
| 684 |
665 // Jump to a runtime routine. | 685 // Jump to a runtime routine. |
666 void JumpToRuntime(const ExternalReference& ext, int result_size); | 686 void JumpToRuntime(const ExternalReference& ext, int result_size); |
667 | 687 |
668 // Before calling a C-function from generated code, align arguments on stack. | 688 // Before calling a C-function from generated code, align arguments on stack. |
669 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 689 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
670 // etc., not pushed. The argument count assumes all arguments are word sized. | 690 // etc., not pushed. The argument count assumes all arguments are word sized. |
671 // The number of slots reserved for arguments depends on platform. On Windows | 691 // The number of slots reserved for arguments depends on platform. On Windows |
672 // stack slots are reserved for the arguments passed in registers. On other | 692 // stack slots are reserved for the arguments passed in registers. On other |
673 // platforms stack slots are only reserved for the arguments actually passed | 693 // platforms stack slots are only reserved for the arguments actually passed |
674 // on the stack. | 694 // on the stack. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } \ | 824 } \ |
805 masm-> | 825 masm-> |
806 #else | 826 #else |
807 #define ACCESS_MASM(masm) masm-> | 827 #define ACCESS_MASM(masm) masm-> |
808 #endif | 828 #endif |
809 | 829 |
810 | 830 |
811 } } // namespace v8::internal | 831 } } // namespace v8::internal |
812 | 832 |
813 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 833 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |