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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ | 28 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ |
29 #define V8_X64_MACRO_ASSEMBLER_X64_H_ | 29 #define V8_X64_MACRO_ASSEMBLER_X64_H_ |
30 | 30 |
31 #include "assembler.h" | 31 #include "assembler.h" |
| 32 #include "frames.h" |
32 #include "v8globals.h" | 33 #include "v8globals.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 // Flags used for the AllocateInNewSpace functions. | 38 // Flags used for the AllocateInNewSpace functions. |
38 enum AllocationFlags { | 39 enum AllocationFlags { |
39 // No special flags. | 40 // No special flags. |
40 NO_ALLOCATION_FLAGS = 0, | 41 NO_ALLOCATION_FLAGS = 0, |
41 // Return the pointer to the allocated already tagged as a heap object. | 42 // Return the pointer to the allocated already tagged as a heap object. |
(...skipping 12 matching lines...) Expand all Loading... |
54 static const Register kRootRegister = { 13 }; // r13 (callee save). | 55 static const Register kRootRegister = { 13 }; // r13 (callee save). |
55 // Value of smi in kSmiConstantRegister. | 56 // Value of smi in kSmiConstantRegister. |
56 static const int kSmiConstantRegisterValue = 1; | 57 static const int kSmiConstantRegisterValue = 1; |
57 // Actual value of root register is offset from the root array's start | 58 // Actual value of root register is offset from the root array's start |
58 // to take advantage of negitive 8-bit displacement values. | 59 // to take advantage of negitive 8-bit displacement values. |
59 static const int kRootRegisterBias = 128; | 60 static const int kRootRegisterBias = 128; |
60 | 61 |
61 // Convenience for platform-independent signatures. | 62 // Convenience for platform-independent signatures. |
62 typedef Operand MemOperand; | 63 typedef Operand MemOperand; |
63 | 64 |
| 65 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; |
| 66 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; |
| 67 |
| 68 bool AreAliased(Register r1, Register r2, Register r3, Register r4); |
| 69 |
64 // Forward declaration. | 70 // Forward declaration. |
65 class JumpTarget; | 71 class JumpTarget; |
66 | 72 |
67 struct SmiIndex { | 73 struct SmiIndex { |
68 SmiIndex(Register index_register, ScaleFactor scale) | 74 SmiIndex(Register index_register, ScaleFactor scale) |
69 : reg(index_register), | 75 : reg(index_register), |
70 scale(scale) {} | 76 scale(scale) {} |
71 Register reg; | 77 Register reg; |
72 ScaleFactor scale; | 78 ScaleFactor scale; |
73 }; | 79 }; |
74 | 80 |
| 81 |
75 // MacroAssembler implements a collection of frequently used macros. | 82 // MacroAssembler implements a collection of frequently used macros. |
76 class MacroAssembler: public Assembler { | 83 class MacroAssembler: public Assembler { |
77 public: | 84 public: |
78 // The isolate parameter can be NULL if the macro assembler should | 85 // The isolate parameter can be NULL if the macro assembler should |
79 // not use isolate-dependent functionality. In this case, it's the | 86 // not use isolate-dependent functionality. In this case, it's the |
80 // responsibility of the caller to never invoke such function on the | 87 // responsibility of the caller to never invoke such function on the |
81 // macro assembler. | 88 // macro assembler. |
82 MacroAssembler(Isolate* isolate, void* buffer, int size); | 89 MacroAssembler(Isolate* isolate, void* buffer, int size); |
83 | 90 |
84 // Prevent the use of the RootArray during the lifetime of this | 91 // Prevent the use of the RootArray during the lifetime of this |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Load a root value where the index (or part of it) is variable. | 134 // Load a root value where the index (or part of it) is variable. |
128 // The variable_offset register is added to the fixed_offset value | 135 // The variable_offset register is added to the fixed_offset value |
129 // to get the index into the root-array. | 136 // to get the index into the root-array. |
130 void LoadRootIndexed(Register destination, | 137 void LoadRootIndexed(Register destination, |
131 Register variable_offset, | 138 Register variable_offset, |
132 int fixed_offset); | 139 int fixed_offset); |
133 void CompareRoot(Register with, Heap::RootListIndex index); | 140 void CompareRoot(Register with, Heap::RootListIndex index); |
134 void CompareRoot(const Operand& with, Heap::RootListIndex index); | 141 void CompareRoot(const Operand& with, Heap::RootListIndex index); |
135 void PushRoot(Heap::RootListIndex index); | 142 void PushRoot(Heap::RootListIndex index); |
136 | 143 |
137 // --------------------------------------------------------------------------- | 144 // These functions do not arrange the registers in any particular order so |
138 // GC Support | 145 // they are not useful for calls that can cause a GC. The caller can |
| 146 // exclude up to 3 registers that do not need to be saved and restored. |
| 147 void PushCallerSaved(SaveFPRegsMode fp_mode, |
| 148 Register exclusion1 = no_reg, |
| 149 Register exclusion2 = no_reg, |
| 150 Register exclusion3 = no_reg); |
| 151 void PopCallerSaved(SaveFPRegsMode fp_mode, |
| 152 Register exclusion1 = no_reg, |
| 153 Register exclusion2 = no_reg, |
| 154 Register exclusion3 = no_reg); |
139 | 155 |
140 // For page containing |object| mark region covering |addr| dirty. | 156 // --------------------------------------------------------------------------- |
141 // RecordWriteHelper only works if the object is not in new | 157 // GC Support |
142 // space. | |
143 void RecordWriteHelper(Register object, | |
144 Register addr, | |
145 Register scratch); | |
146 | 158 |
147 // Check if object is in new space. The condition cc can be equal or | |
148 // not_equal. If it is equal a jump will be done if the object is on new | |
149 // space. The register scratch can be object itself, but it will be clobbered. | |
150 void InNewSpace(Register object, | |
151 Register scratch, | |
152 Condition cc, | |
153 Label* branch, | |
154 Label::Distance near_jump = Label::kFar); | |
155 | 159 |
156 // For page containing |object| mark region covering [object+offset] | 160 enum RememberedSetFinalAction { |
| 161 kReturnAtEnd, |
| 162 kFallThroughAtEnd |
| 163 }; |
| 164 |
| 165 // Record in the remembered set the fact that we have a pointer to new space |
| 166 // at the address pointed to by the addr register. Only works if addr is not |
| 167 // in new space. |
| 168 void RememberedSetHelper(Register object, // Used for debug code. |
| 169 Register addr, |
| 170 Register scratch, |
| 171 SaveFPRegsMode save_fp, |
| 172 RememberedSetFinalAction and_then); |
| 173 |
| 174 void CheckPageFlag(Register object, |
| 175 Register scratch, |
| 176 int mask, |
| 177 Condition cc, |
| 178 Label* condition_met, |
| 179 Label::Distance condition_met_distance = Label::kFar); |
| 180 |
| 181 // Check if object is in new space. Jumps if the object is not in new space. |
| 182 // The register scratch can be object itself, but scratch will be clobbered. |
| 183 void JumpIfNotInNewSpace(Register object, |
| 184 Register scratch, |
| 185 Label* branch, |
| 186 Label::Distance distance = Label::kFar) { |
| 187 InNewSpace(object, scratch, not_equal, branch, distance); |
| 188 } |
| 189 |
| 190 // Check if object is in new space. Jumps if the object is in new space. |
| 191 // The register scratch can be object itself, but it will be clobbered. |
| 192 void JumpIfInNewSpace(Register object, |
| 193 Register scratch, |
| 194 Label* branch, |
| 195 Label::Distance distance = Label::kFar) { |
| 196 InNewSpace(object, scratch, equal, branch, distance); |
| 197 } |
| 198 |
| 199 // Check if an object has the black incremental marking color. Also uses rcx! |
| 200 void JumpIfBlack(Register object, |
| 201 Register scratch0, |
| 202 Register scratch1, |
| 203 Label* on_black, |
| 204 Label::Distance on_black_distance = Label::kFar); |
| 205 |
| 206 // Detects conservatively whether an object is data-only, ie it does need to |
| 207 // be scanned by the garbage collector. |
| 208 void JumpIfDataObject(Register value, |
| 209 Register scratch, |
| 210 Label* not_data_object, |
| 211 Label::Distance not_data_object_distance); |
| 212 |
| 213 // Checks the color of an object. If the object is already grey or black |
| 214 // then we just fall through, since it is already live. If it is white and |
| 215 // we can determine that it doesn't need to be scanned, then we just mark it |
| 216 // black and fall through. For the rest we jump to the label so the |
| 217 // incremental marker can fix its assumptions. |
| 218 void EnsureNotWhite(Register object, |
| 219 Register scratch1, |
| 220 Register scratch2, |
| 221 Label* object_is_white_and_not_data, |
| 222 Label::Distance distance); |
| 223 |
| 224 // Notify the garbage collector that we wrote a pointer into an object. |
| 225 // |object| is the object being stored into, |value| is the object being |
| 226 // stored. value and scratch registers are clobbered by the operation. |
| 227 // The offset is the offset from the start of the object, not the offset from |
| 228 // the tagged HeapObject pointer. For use with FieldOperand(reg, off). |
| 229 void RecordWriteField( |
| 230 Register object, |
| 231 int offset, |
| 232 Register value, |
| 233 Register scratch, |
| 234 SaveFPRegsMode save_fp, |
| 235 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, |
| 236 SmiCheck smi_check = INLINE_SMI_CHECK); |
| 237 |
| 238 // As above, but the offset has the tag presubtracted. For use with |
| 239 // Operand(reg, off). |
| 240 void RecordWriteContextSlot( |
| 241 Register context, |
| 242 int offset, |
| 243 Register value, |
| 244 Register scratch, |
| 245 SaveFPRegsMode save_fp, |
| 246 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, |
| 247 SmiCheck smi_check = INLINE_SMI_CHECK) { |
| 248 RecordWriteField(context, |
| 249 offset + kHeapObjectTag, |
| 250 value, |
| 251 scratch, |
| 252 save_fp, |
| 253 remembered_set_action, |
| 254 smi_check); |
| 255 } |
| 256 |
| 257 // Notify the garbage collector that we wrote a pointer into a fixed array. |
| 258 // |array| is the array being stored into, |value| is the |
| 259 // object being stored. |index| is the array index represented as a |
| 260 // Smi. All registers are clobbered by the operation RecordWriteArray |
| 261 // filters out smis so it does not update the write barrier if the |
| 262 // value is a smi. |
| 263 void RecordWriteArray( |
| 264 Register array, |
| 265 Register value, |
| 266 Register index, |
| 267 SaveFPRegsMode save_fp, |
| 268 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, |
| 269 SmiCheck smi_check = INLINE_SMI_CHECK); |
| 270 |
| 271 // For page containing |object| mark region covering |address| |
157 // dirty. |object| is the object being stored into, |value| is the | 272 // dirty. |object| is the object being stored into, |value| is the |
158 // object being stored. If |offset| is zero, then the |scratch| | 273 // object being stored. The address and value registers are clobbered by the |
159 // register contains the array index into the elements array | |
160 // represented as an untagged 32-bit integer. All registers are | |
161 // clobbered by the operation. RecordWrite filters out smis so it | |
162 // does not update the write barrier if the value is a smi. | |
163 void RecordWrite(Register object, | |
164 int offset, | |
165 Register value, | |
166 Register scratch); | |
167 | |
168 // For page containing |object| mark region covering [address] | |
169 // dirty. |object| is the object being stored into, |value| is the | |
170 // object being stored. All registers are clobbered by the | |
171 // operation. RecordWrite filters out smis so it does not update | 274 // operation. RecordWrite filters out smis so it does not update |
172 // the write barrier if the value is a smi. | 275 // the write barrier if the value is a smi. |
173 void RecordWrite(Register object, | 276 void RecordWrite( |
174 Register address, | 277 Register object, |
175 Register value); | 278 Register address, |
176 | 279 Register value, |
177 // For page containing |object| mark region covering [object+offset] dirty. | 280 SaveFPRegsMode save_fp, |
178 // The value is known to not be a smi. | 281 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, |
179 // object is the object being stored into, value is the object being stored. | 282 SmiCheck smi_check = INLINE_SMI_CHECK); |
180 // If offset is zero, then the scratch register contains the array index into | |
181 // the elements array represented as an untagged 32-bit integer. | |
182 // All registers are clobbered by the operation. | |
183 void RecordWriteNonSmi(Register object, | |
184 int offset, | |
185 Register value, | |
186 Register scratch); | |
187 | 283 |
188 #ifdef ENABLE_DEBUGGER_SUPPORT | 284 #ifdef ENABLE_DEBUGGER_SUPPORT |
189 // --------------------------------------------------------------------------- | 285 // --------------------------------------------------------------------------- |
190 // Debugger Support | 286 // Debugger Support |
191 | 287 |
192 void DebugBreak(); | 288 void DebugBreak(); |
193 #endif | 289 #endif |
194 | 290 |
195 // --------------------------------------------------------------------------- | |
196 // Activation frames | |
197 | |
198 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } | |
199 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } | |
200 | |
201 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } | |
202 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } | |
203 | |
204 // Enter specific kind of exit frame; either in normal or | 291 // Enter specific kind of exit frame; either in normal or |
205 // debug mode. Expects the number of arguments in register rax and | 292 // debug mode. Expects the number of arguments in register rax and |
206 // sets up the number of arguments in register rdi and the pointer | 293 // sets up the number of arguments in register rdi and the pointer |
207 // to the first argument in register rsi. | 294 // to the first argument in register rsi. |
208 // | 295 // |
209 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 296 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
210 // accessible via StackSpaceOperand. | 297 // accessible via StackSpaceOperand. |
211 void EnterExitFrame(int arg_stack_space = 0, bool save_doubles = false); | 298 void EnterExitFrame(int arg_stack_space = 0, bool save_doubles = false); |
212 | 299 |
213 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize | 300 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 // Compare instance type for map. | 840 // Compare instance type for map. |
754 // Always use unsigned comparisons: above and below, not less and greater. | 841 // Always use unsigned comparisons: above and below, not less and greater. |
755 void CmpInstanceType(Register map, InstanceType type); | 842 void CmpInstanceType(Register map, InstanceType type); |
756 | 843 |
757 // Check if a map for a JSObject indicates that the object has fast elements. | 844 // Check if a map for a JSObject indicates that the object has fast elements. |
758 // Jump to the specified label if it does not. | 845 // Jump to the specified label if it does not. |
759 void CheckFastElements(Register map, | 846 void CheckFastElements(Register map, |
760 Label* fail, | 847 Label* fail, |
761 Label::Distance distance = Label::kFar); | 848 Label::Distance distance = Label::kFar); |
762 | 849 |
| 850 // Check if a map for a JSObject indicates that the object can have both smi |
| 851 // and HeapObject elements. Jump to the specified label if it does not. |
| 852 void CheckFastObjectElements(Register map, |
| 853 Label* fail, |
| 854 Label::Distance distance = Label::kFar); |
| 855 |
| 856 // Check if a map for a JSObject indicates that the object has fast smi only |
| 857 // elements. Jump to the specified label if it does not. |
| 858 void CheckFastSmiOnlyElements(Register map, |
| 859 Label* fail, |
| 860 Label::Distance distance = Label::kFar); |
| 861 |
| 862 // Check to see if maybe_number can be stored as a double in |
| 863 // FastDoubleElements. If it can, store it at the index specified by key in |
| 864 // the FastDoubleElements array elements, otherwise jump to fail. |
| 865 // Note that key must not be smi-tagged. |
| 866 void StoreNumberToDoubleElements(Register maybe_number, |
| 867 Register elements, |
| 868 Register key, |
| 869 XMMRegister xmm_scratch, |
| 870 Label* fail); |
| 871 |
763 // Check if the map of an object is equal to a specified map and | 872 // Check if the map of an object is equal to a specified map and |
764 // branch to label if not. Skip the smi check if not required | 873 // branch to label if not. Skip the smi check if not required |
765 // (object is known to be a heap object) | 874 // (object is known to be a heap object) |
766 void CheckMap(Register obj, | 875 void CheckMap(Register obj, |
767 Handle<Map> map, | 876 Handle<Map> map, |
768 Label* fail, | 877 Label* fail, |
769 SmiCheckType smi_check_type); | 878 SmiCheckType smi_check_type); |
770 | 879 |
771 // Check if the map of an object is equal to a specified map and branch to a | 880 // Check if the map of an object is equal to a specified map and branch to a |
772 // specified target if equal. Skip the smi check if not required (object is | 881 // specified target if equal. Skip the smi check if not required (object is |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // free, do use it, otherwise kScratchRegister will be used). | 1221 // free, do use it, otherwise kScratchRegister will be used). |
1113 // The min_length is a minimum limit on the value that length will have. | 1222 // The min_length is a minimum limit on the value that length will have. |
1114 // The algorithm has some special cases that might be omitted if the string | 1223 // The algorithm has some special cases that might be omitted if the string |
1115 // is known to always be long. | 1224 // is known to always be long. |
1116 void CopyBytes(Register destination, | 1225 void CopyBytes(Register destination, |
1117 Register source, | 1226 Register source, |
1118 Register length, | 1227 Register length, |
1119 int min_length = 0, | 1228 int min_length = 0, |
1120 Register scratch = kScratchRegister); | 1229 Register scratch = kScratchRegister); |
1121 | 1230 |
| 1231 // Initialize fields with filler values. Fields starting at |start_offset| |
| 1232 // not including end_offset are overwritten with the value in |filler|. At |
| 1233 // the end the loop, |start_offset| takes the value of |end_offset|. |
| 1234 void InitializeFieldsWithFiller(Register start_offset, |
| 1235 Register end_offset, |
| 1236 Register filler); |
| 1237 |
1122 | 1238 |
1123 // --------------------------------------------------------------------------- | 1239 // --------------------------------------------------------------------------- |
1124 // StatsCounter support | 1240 // StatsCounter support |
1125 | 1241 |
1126 void SetCounter(StatsCounter* counter, int value); | 1242 void SetCounter(StatsCounter* counter, int value); |
1127 void IncrementCounter(StatsCounter* counter, int value); | 1243 void IncrementCounter(StatsCounter* counter, int value); |
1128 void DecrementCounter(StatsCounter* counter, int value); | 1244 void DecrementCounter(StatsCounter* counter, int value); |
1129 | 1245 |
1130 | 1246 |
1131 // --------------------------------------------------------------------------- | 1247 // --------------------------------------------------------------------------- |
(...skipping 12 matching lines...) Expand all Loading... |
1144 void Abort(const char* msg); | 1260 void Abort(const char* msg); |
1145 | 1261 |
1146 // Check that the stack is aligned. | 1262 // Check that the stack is aligned. |
1147 void CheckStackAlignment(); | 1263 void CheckStackAlignment(); |
1148 | 1264 |
1149 // Verify restrictions about code generated in stubs. | 1265 // Verify restrictions about code generated in stubs. |
1150 void set_generating_stub(bool value) { generating_stub_ = value; } | 1266 void set_generating_stub(bool value) { generating_stub_ = value; } |
1151 bool generating_stub() { return generating_stub_; } | 1267 bool generating_stub() { return generating_stub_; } |
1152 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 1268 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
1153 bool allow_stub_calls() { return allow_stub_calls_; } | 1269 bool allow_stub_calls() { return allow_stub_calls_; } |
| 1270 void set_has_frame(bool value) { has_frame_ = value; } |
| 1271 bool has_frame() { return has_frame_; } |
| 1272 inline bool AllowThisStubCall(CodeStub* stub); |
1154 | 1273 |
1155 static int SafepointRegisterStackIndex(Register reg) { | 1274 static int SafepointRegisterStackIndex(Register reg) { |
1156 return SafepointRegisterStackIndex(reg.code()); | 1275 return SafepointRegisterStackIndex(reg.code()); |
1157 } | 1276 } |
1158 | 1277 |
| 1278 // Activation support. |
| 1279 void EnterFrame(StackFrame::Type type); |
| 1280 void LeaveFrame(StackFrame::Type type); |
| 1281 |
1159 private: | 1282 private: |
1160 // Order general registers are pushed by Pushad. | 1283 // Order general registers are pushed by Pushad. |
1161 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. | 1284 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. |
1162 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; | 1285 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; |
1163 static const int kNumSafepointSavedRegisters = 11; | 1286 static const int kNumSafepointSavedRegisters = 11; |
1164 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; | 1287 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; |
1165 | 1288 |
1166 bool generating_stub_; | 1289 bool generating_stub_; |
1167 bool allow_stub_calls_; | 1290 bool allow_stub_calls_; |
| 1291 bool has_frame_; |
1168 bool root_array_available_; | 1292 bool root_array_available_; |
1169 | 1293 |
1170 // Returns a register holding the smi value. The register MUST NOT be | 1294 // Returns a register holding the smi value. The register MUST NOT be |
1171 // modified. It may be the "smi 1 constant" register. | 1295 // modified. It may be the "smi 1 constant" register. |
1172 Register GetSmiConstant(Smi* value); | 1296 Register GetSmiConstant(Smi* value); |
1173 | 1297 |
1174 // Moves the smi value to the destination register. | 1298 // Moves the smi value to the destination register. |
1175 void LoadSmiConstant(Register dst, Smi* value); | 1299 void LoadSmiConstant(Register dst, Smi* value); |
1176 | 1300 |
1177 // This handle will be patched with the code object on installation. | 1301 // This handle will be patched with the code object on installation. |
1178 Handle<Object> code_object_; | 1302 Handle<Object> code_object_; |
1179 | 1303 |
1180 // Helper functions for generating invokes. | 1304 // Helper functions for generating invokes. |
1181 void InvokePrologue(const ParameterCount& expected, | 1305 void InvokePrologue(const ParameterCount& expected, |
1182 const ParameterCount& actual, | 1306 const ParameterCount& actual, |
1183 Handle<Code> code_constant, | 1307 Handle<Code> code_constant, |
1184 Register code_register, | 1308 Register code_register, |
1185 Label* done, | 1309 Label* done, |
1186 InvokeFlag flag, | 1310 InvokeFlag flag, |
1187 Label::Distance near_jump = Label::kFar, | 1311 Label::Distance near_jump = Label::kFar, |
1188 const CallWrapper& call_wrapper = NullCallWrapper(), | 1312 const CallWrapper& call_wrapper = NullCallWrapper(), |
1189 CallKind call_kind = CALL_AS_METHOD); | 1313 CallKind call_kind = CALL_AS_METHOD); |
1190 | 1314 |
1191 // Activation support. | |
1192 void EnterFrame(StackFrame::Type type); | |
1193 void LeaveFrame(StackFrame::Type type); | |
1194 | |
1195 void EnterExitFramePrologue(bool save_rax); | 1315 void EnterExitFramePrologue(bool save_rax); |
1196 | 1316 |
1197 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 1317 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
1198 // accessible via StackSpaceOperand. | 1318 // accessible via StackSpaceOperand. |
1199 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles); | 1319 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles); |
1200 | 1320 |
1201 void LeaveExitFrameEpilogue(); | 1321 void LeaveExitFrameEpilogue(); |
1202 | 1322 |
1203 // Allocation support helpers. | 1323 // Allocation support helpers. |
1204 // Loads the top of new-space into the result register. | 1324 // Loads the top of new-space into the result register. |
1205 // Otherwise the address of the new-space top is loaded into scratch (if | 1325 // Otherwise the address of the new-space top is loaded into scratch (if |
1206 // scratch is valid), and the new-space top is loaded into result. | 1326 // scratch is valid), and the new-space top is loaded into result. |
1207 void LoadAllocationTopHelper(Register result, | 1327 void LoadAllocationTopHelper(Register result, |
1208 Register scratch, | 1328 Register scratch, |
1209 AllocationFlags flags); | 1329 AllocationFlags flags); |
1210 // Update allocation top with value in result_end register. | 1330 // Update allocation top with value in result_end register. |
1211 // If scratch is valid, it contains the address of the allocation top. | 1331 // If scratch is valid, it contains the address of the allocation top. |
1212 void UpdateAllocationTopHelper(Register result_end, Register scratch); | 1332 void UpdateAllocationTopHelper(Register result_end, Register scratch); |
1213 | 1333 |
1214 // Helper for PopHandleScope. Allowed to perform a GC and returns | 1334 // Helper for PopHandleScope. Allowed to perform a GC and returns |
1215 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and | 1335 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and |
1216 // possibly returns a failure object indicating an allocation failure. | 1336 // possibly returns a failure object indicating an allocation failure. |
1217 Object* PopHandleScopeHelper(Register saved, | 1337 Object* PopHandleScopeHelper(Register saved, |
1218 Register scratch, | 1338 Register scratch, |
1219 bool gc_allowed); | 1339 bool gc_allowed); |
1220 | 1340 |
| 1341 // Helper for implementing JumpIfNotInNewSpace and JumpIfInNewSpace. |
| 1342 void InNewSpace(Register object, |
| 1343 Register scratch, |
| 1344 Condition cc, |
| 1345 Label* branch, |
| 1346 Label::Distance distance = Label::kFar); |
| 1347 |
| 1348 // Helper for finding the mark bits for an address. Afterwards, the |
| 1349 // bitmap register points at the word with the mark bits and the mask |
| 1350 // the position of the first bit. Uses rcx as scratch and leaves addr_reg |
| 1351 // unchanged. |
| 1352 inline void GetMarkBits(Register addr_reg, |
| 1353 Register bitmap_reg, |
| 1354 Register mask_reg); |
1221 | 1355 |
1222 // Compute memory operands for safepoint stack slots. | 1356 // Compute memory operands for safepoint stack slots. |
1223 Operand SafepointRegisterSlot(Register reg); | 1357 Operand SafepointRegisterSlot(Register reg); |
1224 static int SafepointRegisterStackIndex(int reg_code) { | 1358 static int SafepointRegisterStackIndex(int reg_code) { |
1225 return kNumSafepointRegisters - kSafepointPushRegisterIndices[reg_code] - 1; | 1359 return kNumSafepointRegisters - kSafepointPushRegisterIndices[reg_code] - 1; |
1226 } | 1360 } |
1227 | 1361 |
1228 // Needs access to SafepointRegisterStackIndex for optimized frame | 1362 // Needs access to SafepointRegisterStackIndex for optimized frame |
1229 // traversal. | 1363 // traversal. |
1230 friend class OptimizedFrame; | 1364 friend class OptimizedFrame; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 masm->popfd(); \ | 1442 masm->popfd(); \ |
1309 } \ | 1443 } \ |
1310 masm-> | 1444 masm-> |
1311 #else | 1445 #else |
1312 #define ACCESS_MASM(masm) masm-> | 1446 #define ACCESS_MASM(masm) masm-> |
1313 #endif | 1447 #endif |
1314 | 1448 |
1315 } } // namespace v8::internal | 1449 } } // namespace v8::internal |
1316 | 1450 |
1317 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1451 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |