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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = { 15 }; // r15 (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 |
| 56 // to take advantage of negitive 8-bit displacement values. |
| 57 static const int kRootRegisterBias = 128; |
55 | 58 |
56 // Convenience for platform-independent signatures. | 59 // Convenience for platform-independent signatures. |
57 typedef Operand MemOperand; | 60 typedef Operand MemOperand; |
58 | 61 |
59 // Forward declaration. | 62 // Forward declaration. |
60 class JumpTarget; | 63 class JumpTarget; |
61 class PostCallGenerator; | 64 class PostCallGenerator; |
62 | 65 |
63 struct SmiIndex { | 66 struct SmiIndex { |
64 SmiIndex(Register index_register, ScaleFactor scale) | 67 SmiIndex(Register index_register, ScaleFactor scale) |
65 : reg(index_register), | 68 : reg(index_register), |
66 scale(scale) {} | 69 scale(scale) {} |
67 Register reg; | 70 Register reg; |
68 ScaleFactor scale; | 71 ScaleFactor scale; |
69 }; | 72 }; |
70 | 73 |
71 // MacroAssembler implements a collection of frequently used macros. | 74 // MacroAssembler implements a collection of frequently used macros. |
72 class MacroAssembler: public Assembler { | 75 class MacroAssembler: public Assembler { |
73 public: | 76 public: |
74 MacroAssembler(void* buffer, int size); | 77 MacroAssembler(void* buffer, int size); |
75 | 78 |
76 void LoadRoot(Register destination, Heap::RootListIndex index); | 79 void LoadRoot(Register destination, Heap::RootListIndex index); |
| 80 // Load a root value where the index (or part of it) is variable. |
| 81 // The variable_offset register is added to the fixed_offset value |
| 82 // to get the index into the root-array. |
| 83 void LoadRootIndexed(Register destination, |
| 84 Register variable_offset, |
| 85 int fixed_offset); |
77 void CompareRoot(Register with, Heap::RootListIndex index); | 86 void CompareRoot(Register with, Heap::RootListIndex index); |
78 void CompareRoot(const Operand& with, Heap::RootListIndex index); | 87 void CompareRoot(const Operand& with, Heap::RootListIndex index); |
79 void PushRoot(Heap::RootListIndex index); | 88 void PushRoot(Heap::RootListIndex index); |
80 void StoreRoot(Register source, Heap::RootListIndex index); | 89 void StoreRoot(Register source, Heap::RootListIndex index); |
81 | 90 |
82 // --------------------------------------------------------------------------- | 91 // --------------------------------------------------------------------------- |
83 // GC Support | 92 // GC Support |
84 | 93 |
85 // For page containing |object| mark region covering |addr| dirty. | 94 // For page containing |object| mark region covering |addr| dirty. |
86 // RecordWriteHelper only works if the object is not in new | 95 // RecordWriteHelper only works if the object is not in new |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void LeaveApiExitFrame(); | 178 void LeaveApiExitFrame(); |
170 | 179 |
171 // Push and pop the registers that can hold pointers. | 180 // Push and pop the registers that can hold pointers. |
172 void PushSafepointRegisters() { Pushad(); } | 181 void PushSafepointRegisters() { Pushad(); } |
173 void PopSafepointRegisters() { Popad(); } | 182 void PopSafepointRegisters() { Popad(); } |
174 // Store the value in register src in the safepoint register stack | 183 // Store the value in register src in the safepoint register stack |
175 // slot for register dst. | 184 // slot for register dst. |
176 void StoreToSafepointRegisterSlot(Register dst, Register src); | 185 void StoreToSafepointRegisterSlot(Register dst, Register src); |
177 void LoadFromSafepointRegisterSlot(Register dst, Register src); | 186 void LoadFromSafepointRegisterSlot(Register dst, Register src); |
178 | 187 |
| 188 void InitializeRootRegister() { |
| 189 ExternalReference roots_address = ExternalReference::roots_address(); |
| 190 movq(kRootRegister, roots_address); |
| 191 addq(kRootRegister, Immediate(kRootRegisterBias)); |
| 192 } |
| 193 |
179 // --------------------------------------------------------------------------- | 194 // --------------------------------------------------------------------------- |
180 // JavaScript invokes | 195 // JavaScript invokes |
181 | 196 |
182 // Invoke the JavaScript function code by either calling or jumping. | 197 // Invoke the JavaScript function code by either calling or jumping. |
183 void InvokeCode(Register code, | 198 void InvokeCode(Register code, |
184 const ParameterCount& expected, | 199 const ParameterCount& expected, |
185 const ParameterCount& actual, | 200 const ParameterCount& actual, |
186 InvokeFlag flag, | 201 InvokeFlag flag, |
187 PostCallGenerator* post_call_generator = NULL); | 202 PostCallGenerator* post_call_generator = NULL); |
188 | 203 |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 Jump(adaptor, RelocInfo::CODE_TARGET); | 1858 Jump(adaptor, RelocInfo::CODE_TARGET); |
1844 } | 1859 } |
1845 bind(&invoke); | 1860 bind(&invoke); |
1846 } | 1861 } |
1847 } | 1862 } |
1848 | 1863 |
1849 | 1864 |
1850 } } // namespace v8::internal | 1865 } } // namespace v8::internal |
1851 | 1866 |
1852 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1867 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |