| 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 23 matching lines...) Expand all Loading... |
| 65 class JumpTarget; | 66 class JumpTarget; |
| 66 | 67 |
| 67 struct SmiIndex { | 68 struct SmiIndex { |
| 68 SmiIndex(Register index_register, ScaleFactor scale) | 69 SmiIndex(Register index_register, ScaleFactor scale) |
| 69 : reg(index_register), | 70 : reg(index_register), |
| 70 scale(scale) {} | 71 scale(scale) {} |
| 71 Register reg; | 72 Register reg; |
| 72 ScaleFactor scale; | 73 ScaleFactor scale; |
| 73 }; | 74 }; |
| 74 | 75 |
| 76 |
| 75 // MacroAssembler implements a collection of frequently used macros. | 77 // MacroAssembler implements a collection of frequently used macros. |
| 76 class MacroAssembler: public Assembler { | 78 class MacroAssembler: public Assembler { |
| 77 public: | 79 public: |
| 78 // The isolate parameter can be NULL if the macro assembler should | 80 // The isolate parameter can be NULL if the macro assembler should |
| 79 // not use isolate-dependent functionality. In this case, it's the | 81 // not use isolate-dependent functionality. In this case, it's the |
| 80 // responsibility of the caller to never invoke such function on the | 82 // responsibility of the caller to never invoke such function on the |
| 81 // macro assembler. | 83 // macro assembler. |
| 82 MacroAssembler(Isolate* isolate, void* buffer, int size); | 84 MacroAssembler(Isolate* isolate, void* buffer, int size); |
| 83 | 85 |
| 84 // Prevent the use of the RootArray during the lifetime of this | 86 // Prevent the use of the RootArray during the lifetime of this |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 Register value, | 187 Register value, |
| 186 Register scratch); | 188 Register scratch); |
| 187 | 189 |
| 188 #ifdef ENABLE_DEBUGGER_SUPPORT | 190 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 189 // --------------------------------------------------------------------------- | 191 // --------------------------------------------------------------------------- |
| 190 // Debugger Support | 192 // Debugger Support |
| 191 | 193 |
| 192 void DebugBreak(); | 194 void DebugBreak(); |
| 193 #endif | 195 #endif |
| 194 | 196 |
| 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 | 197 // Enter specific kind of exit frame; either in normal or |
| 205 // debug mode. Expects the number of arguments in register rax and | 198 // debug mode. Expects the number of arguments in register rax and |
| 206 // sets up the number of arguments in register rdi and the pointer | 199 // sets up the number of arguments in register rdi and the pointer |
| 207 // to the first argument in register rsi. | 200 // to the first argument in register rsi. |
| 208 // | 201 // |
| 209 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 202 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
| 210 // accessible via StackSpaceOperand. | 203 // accessible via StackSpaceOperand. |
| 211 void EnterExitFrame(int arg_stack_space = 0, bool save_doubles = false); | 204 void EnterExitFrame(int arg_stack_space = 0, bool save_doubles = false); |
| 212 | 205 |
| 213 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize | 206 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 void Abort(const char* msg); | 1137 void Abort(const char* msg); |
| 1145 | 1138 |
| 1146 // Check that the stack is aligned. | 1139 // Check that the stack is aligned. |
| 1147 void CheckStackAlignment(); | 1140 void CheckStackAlignment(); |
| 1148 | 1141 |
| 1149 // Verify restrictions about code generated in stubs. | 1142 // Verify restrictions about code generated in stubs. |
| 1150 void set_generating_stub(bool value) { generating_stub_ = value; } | 1143 void set_generating_stub(bool value) { generating_stub_ = value; } |
| 1151 bool generating_stub() { return generating_stub_; } | 1144 bool generating_stub() { return generating_stub_; } |
| 1152 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 1145 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
| 1153 bool allow_stub_calls() { return allow_stub_calls_; } | 1146 bool allow_stub_calls() { return allow_stub_calls_; } |
| 1147 void set_has_frame(bool value) { has_frame_ = value; } |
| 1148 bool has_frame() { return has_frame_; } |
| 1149 inline bool AllowThisStubCall(CodeStub* stub); |
| 1154 | 1150 |
| 1155 static int SafepointRegisterStackIndex(Register reg) { | 1151 static int SafepointRegisterStackIndex(Register reg) { |
| 1156 return SafepointRegisterStackIndex(reg.code()); | 1152 return SafepointRegisterStackIndex(reg.code()); |
| 1157 } | 1153 } |
| 1158 | 1154 |
| 1155 // Activation support. |
| 1156 void EnterFrame(StackFrame::Type type); |
| 1157 void LeaveFrame(StackFrame::Type type); |
| 1158 |
| 1159 private: | 1159 private: |
| 1160 // Order general registers are pushed by Pushad. | 1160 // Order general registers are pushed by Pushad. |
| 1161 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. | 1161 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. |
| 1162 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; | 1162 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; |
| 1163 static const int kNumSafepointSavedRegisters = 11; | 1163 static const int kNumSafepointSavedRegisters = 11; |
| 1164 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; | 1164 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; |
| 1165 | 1165 |
| 1166 bool generating_stub_; | 1166 bool generating_stub_; |
| 1167 bool allow_stub_calls_; | 1167 bool allow_stub_calls_; |
| 1168 bool has_frame_; |
| 1168 bool root_array_available_; | 1169 bool root_array_available_; |
| 1169 | 1170 |
| 1170 // Returns a register holding the smi value. The register MUST NOT be | 1171 // Returns a register holding the smi value. The register MUST NOT be |
| 1171 // modified. It may be the "smi 1 constant" register. | 1172 // modified. It may be the "smi 1 constant" register. |
| 1172 Register GetSmiConstant(Smi* value); | 1173 Register GetSmiConstant(Smi* value); |
| 1173 | 1174 |
| 1174 // Moves the smi value to the destination register. | 1175 // Moves the smi value to the destination register. |
| 1175 void LoadSmiConstant(Register dst, Smi* value); | 1176 void LoadSmiConstant(Register dst, Smi* value); |
| 1176 | 1177 |
| 1177 // This handle will be patched with the code object on installation. | 1178 // This handle will be patched with the code object on installation. |
| 1178 Handle<Object> code_object_; | 1179 Handle<Object> code_object_; |
| 1179 | 1180 |
| 1180 // Helper functions for generating invokes. | 1181 // Helper functions for generating invokes. |
| 1181 void InvokePrologue(const ParameterCount& expected, | 1182 void InvokePrologue(const ParameterCount& expected, |
| 1182 const ParameterCount& actual, | 1183 const ParameterCount& actual, |
| 1183 Handle<Code> code_constant, | 1184 Handle<Code> code_constant, |
| 1184 Register code_register, | 1185 Register code_register, |
| 1185 Label* done, | 1186 Label* done, |
| 1186 InvokeFlag flag, | 1187 InvokeFlag flag, |
| 1187 Label::Distance near_jump = Label::kFar, | 1188 Label::Distance near_jump = Label::kFar, |
| 1188 const CallWrapper& call_wrapper = NullCallWrapper(), | 1189 const CallWrapper& call_wrapper = NullCallWrapper(), |
| 1189 CallKind call_kind = CALL_AS_METHOD); | 1190 CallKind call_kind = CALL_AS_METHOD); |
| 1190 | 1191 |
| 1191 // Activation support. | |
| 1192 void EnterFrame(StackFrame::Type type); | |
| 1193 void LeaveFrame(StackFrame::Type type); | |
| 1194 | |
| 1195 void EnterExitFramePrologue(bool save_rax); | 1192 void EnterExitFramePrologue(bool save_rax); |
| 1196 | 1193 |
| 1197 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 1194 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
| 1198 // accessible via StackSpaceOperand. | 1195 // accessible via StackSpaceOperand. |
| 1199 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles); | 1196 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles); |
| 1200 | 1197 |
| 1201 void LeaveExitFrameEpilogue(); | 1198 void LeaveExitFrameEpilogue(); |
| 1202 | 1199 |
| 1203 // Allocation support helpers. | 1200 // Allocation support helpers. |
| 1204 // Loads the top of new-space into the result register. | 1201 // Loads the top of new-space into the result register. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 masm->popfd(); \ | 1305 masm->popfd(); \ |
| 1309 } \ | 1306 } \ |
| 1310 masm-> | 1307 masm-> |
| 1311 #else | 1308 #else |
| 1312 #define ACCESS_MASM(masm) masm-> | 1309 #define ACCESS_MASM(masm) masm-> |
| 1313 #endif | 1310 #endif |
| 1314 | 1311 |
| 1315 } } // namespace v8::internal | 1312 } } // namespace v8::internal |
| 1316 | 1313 |
| 1317 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1314 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
| OLD | NEW |