OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 30 matching lines...) Expand all Loading... |
41 TAG_OBJECT = 1 << 0, | 41 TAG_OBJECT = 1 << 0, |
42 // The content of the result register already contains the allocation top in | 42 // The content of the result register already contains the allocation top in |
43 // new space. | 43 // new space. |
44 RESULT_CONTAINS_TOP = 1 << 1 | 44 RESULT_CONTAINS_TOP = 1 << 1 |
45 }; | 45 }; |
46 | 46 |
47 // Default scratch register used by MacroAssembler (and other code that needs | 47 // Default scratch register used by MacroAssembler (and other code that needs |
48 // a spare register). The register isn't callee save, and not used by the | 48 // a spare register). The register isn't callee save, and not used by the |
49 // function calling convention. | 49 // function calling convention. |
50 static const Register kScratchRegister = { 10 }; // r10. | 50 static const Register kScratchRegister = { 10 }; // r10. |
51 static const Register kSmiConstantRegister = { 15 }; // r15 (callee save). | 51 static const Register kSmiConstantRegister = { 12 }; // r12 (callee save). |
52 static const Register kRootRegister = { 13 }; // r13 (callee save). | 52 static const Register kRootRegister = { 13 }; // r13 (callee save). |
53 // Value of smi in kSmiConstantRegister. | 53 // Value of smi in kSmiConstantRegister. |
54 static const int kSmiConstantRegisterValue = 1; | 54 static const int kSmiConstantRegisterValue = 1; |
55 // Actual value of root register is offset from the root array's start | 55 // Actual value of root register is offset from the root array's start |
56 // to take advantage of negitive 8-bit displacement values. | 56 // to take advantage of negitive 8-bit displacement values. |
57 static const int kRootRegisterBias = 128; | 57 static const int kRootRegisterBias = 128; |
58 | 58 |
59 // Convenience for platform-independent signatures. | 59 // Convenience for platform-independent signatures. |
60 typedef Operand MemOperand; | 60 typedef Operand MemOperand; |
61 | 61 |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 934 |
935 // Prepares stack to put arguments (aligns and so on). | 935 // Prepares stack to put arguments (aligns and so on). |
936 // WIN64 calling convention requires to put the pointer to the return value | 936 // WIN64 calling convention requires to put the pointer to the return value |
937 // slot into rcx (rcx must be preserverd until TryCallApiFunctionAndReturn). | 937 // slot into rcx (rcx must be preserverd until TryCallApiFunctionAndReturn). |
938 // Saves context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize | 938 // Saves context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize |
939 // inside the exit frame (not GCed) accessible via StackSpaceOperand. | 939 // inside the exit frame (not GCed) accessible via StackSpaceOperand. |
940 void PrepareCallApiFunction(int arg_stack_space); | 940 void PrepareCallApiFunction(int arg_stack_space); |
941 | 941 |
942 // Calls an API function. Allocates HandleScope, extracts | 942 // Calls an API function. Allocates HandleScope, extracts |
943 // returned value from handle and propagates exceptions. | 943 // returned value from handle and propagates exceptions. |
944 // Clobbers r12, r14, rbx and caller-save registers. Restores context. | 944 // Clobbers r14, r15, rbx and caller-save registers. Restores context. |
945 // On return removes stack_space * kPointerSize (GCed). | 945 // On return removes stack_space * kPointerSize (GCed). |
946 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( | 946 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( |
947 ApiFunction* function, int stack_space); | 947 ApiFunction* function, int stack_space); |
948 | 948 |
949 // Before calling a C-function from generated code, align arguments on stack. | 949 // Before calling a C-function from generated code, align arguments on stack. |
950 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 950 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
951 // etc., not pushed. The argument count assumes all arguments are word sized. | 951 // etc., not pushed. The argument count assumes all arguments are word sized. |
952 // The number of slots reserved for arguments depends on platform. On Windows | 952 // The number of slots reserved for arguments depends on platform. On Windows |
953 // stack slots are reserved for the arguments passed in registers. On other | 953 // stack slots are reserved for the arguments passed in registers. On other |
954 // platforms stack slots are only reserved for the arguments actually passed | 954 // platforms stack slots are only reserved for the arguments actually passed |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 void CheckStackAlignment(); | 1006 void CheckStackAlignment(); |
1007 | 1007 |
1008 // Verify restrictions about code generated in stubs. | 1008 // Verify restrictions about code generated in stubs. |
1009 void set_generating_stub(bool value) { generating_stub_ = value; } | 1009 void set_generating_stub(bool value) { generating_stub_ = value; } |
1010 bool generating_stub() { return generating_stub_; } | 1010 bool generating_stub() { return generating_stub_; } |
1011 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 1011 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
1012 bool allow_stub_calls() { return allow_stub_calls_; } | 1012 bool allow_stub_calls() { return allow_stub_calls_; } |
1013 | 1013 |
1014 private: | 1014 private: |
1015 // Order general registers are pushed by Pushad. | 1015 // Order general registers are pushed by Pushad. |
1016 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14. | 1016 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. |
1017 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; | 1017 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; |
1018 static const int kNumSafepointSavedRegisters = 11; | 1018 static const int kNumSafepointSavedRegisters = 11; |
1019 | 1019 |
1020 bool generating_stub_; | 1020 bool generating_stub_; |
1021 bool allow_stub_calls_; | 1021 bool allow_stub_calls_; |
1022 | 1022 |
1023 // Returns a register holding the smi value. The register MUST NOT be | 1023 // Returns a register holding the smi value. The register MUST NOT be |
1024 // modified. It may be the "smi 1 constant" register. | 1024 // modified. It may be the "smi 1 constant" register. |
1025 Register GetSmiConstant(Smi* value); | 1025 Register GetSmiConstant(Smi* value); |
1026 | 1026 |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 Jump(adaptor, RelocInfo::CODE_TARGET); | 1883 Jump(adaptor, RelocInfo::CODE_TARGET); |
1884 } | 1884 } |
1885 bind(&invoke); | 1885 bind(&invoke); |
1886 } | 1886 } |
1887 } | 1887 } |
1888 | 1888 |
1889 | 1889 |
1890 } } // namespace v8::internal | 1890 } } // namespace v8::internal |
1891 | 1891 |
1892 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1892 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |