Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: src/x64/macro-assembler-x64.h

Issue 7084032: Add asserts and state tracking to ensure that we do not call (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 void Abort(const char* msg); 1111 void Abort(const char* msg);
1119 1112
1120 // Check that the stack is aligned. 1113 // Check that the stack is aligned.
1121 void CheckStackAlignment(); 1114 void CheckStackAlignment();
1122 1115
1123 // Verify restrictions about code generated in stubs. 1116 // Verify restrictions about code generated in stubs.
1124 void set_generating_stub(bool value) { generating_stub_ = value; } 1117 void set_generating_stub(bool value) { generating_stub_ = value; }
1125 bool generating_stub() { return generating_stub_; } 1118 bool generating_stub() { return generating_stub_; }
1126 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } 1119 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
1127 bool allow_stub_calls() { return allow_stub_calls_; } 1120 bool allow_stub_calls() { return allow_stub_calls_; }
1121 void set_has_frame(bool value) { has_frame_ = value; }
1122 bool has_frame() { return has_frame_; }
1123 inline bool AllowThisStubCall(CodeStub* stub);
1128 1124
1129 static int SafepointRegisterStackIndex(Register reg) { 1125 static int SafepointRegisterStackIndex(Register reg) {
1130 return SafepointRegisterStackIndex(reg.code()); 1126 return SafepointRegisterStackIndex(reg.code());
1131 } 1127 }
1132 1128
1129 // Activation support.
1130 void EnterFrame(StackFrame::Type type);
1131 void LeaveFrame(StackFrame::Type type);
1132
1133 private: 1133 private:
1134 // Order general registers are pushed by Pushad. 1134 // Order general registers are pushed by Pushad.
1135 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. 1135 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15.
1136 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; 1136 static int kSafepointPushRegisterIndices[Register::kNumRegisters];
1137 static const int kNumSafepointSavedRegisters = 11; 1137 static const int kNumSafepointSavedRegisters = 11;
1138 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; 1138 static const int kSmiShift = kSmiTagSize + kSmiShiftSize;
1139 1139
1140 bool generating_stub_; 1140 bool generating_stub_;
1141 bool allow_stub_calls_; 1141 bool allow_stub_calls_;
1142 bool has_frame_;
1142 bool root_array_available_; 1143 bool root_array_available_;
1143 1144
1144 // Returns a register holding the smi value. The register MUST NOT be 1145 // Returns a register holding the smi value. The register MUST NOT be
1145 // modified. It may be the "smi 1 constant" register. 1146 // modified. It may be the "smi 1 constant" register.
1146 Register GetSmiConstant(Smi* value); 1147 Register GetSmiConstant(Smi* value);
1147 1148
1148 // Moves the smi value to the destination register. 1149 // Moves the smi value to the destination register.
1149 void LoadSmiConstant(Register dst, Smi* value); 1150 void LoadSmiConstant(Register dst, Smi* value);
1150 1151
1151 // This handle will be patched with the code object on installation. 1152 // This handle will be patched with the code object on installation.
1152 Handle<Object> code_object_; 1153 Handle<Object> code_object_;
1153 1154
1154 // Helper functions for generating invokes. 1155 // Helper functions for generating invokes.
1155 void InvokePrologue(const ParameterCount& expected, 1156 void InvokePrologue(const ParameterCount& expected,
1156 const ParameterCount& actual, 1157 const ParameterCount& actual,
1157 Handle<Code> code_constant, 1158 Handle<Code> code_constant,
1158 Register code_register, 1159 Register code_register,
1159 Label* done, 1160 Label* done,
1160 InvokeFlag flag, 1161 InvokeFlag flag,
1161 Label::Distance near_jump = Label::kFar, 1162 Label::Distance near_jump = Label::kFar,
1162 const CallWrapper& call_wrapper = NullCallWrapper(), 1163 const CallWrapper& call_wrapper = NullCallWrapper(),
1163 CallKind call_kind = CALL_AS_METHOD); 1164 CallKind call_kind = CALL_AS_METHOD);
1164 1165
1165 // Activation support.
1166 void EnterFrame(StackFrame::Type type);
1167 void LeaveFrame(StackFrame::Type type);
1168
1169 void EnterExitFramePrologue(bool save_rax); 1166 void EnterExitFramePrologue(bool save_rax);
1170 1167
1171 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack 1168 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
1172 // accessible via StackSpaceOperand. 1169 // accessible via StackSpaceOperand.
1173 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles); 1170 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles);
1174 1171
1175 void LeaveExitFrameEpilogue(); 1172 void LeaveExitFrameEpilogue();
1176 1173
1177 // Allocation support helpers. 1174 // Allocation support helpers.
1178 // Loads the top of new-space into the result register. 1175 // Loads the top of new-space into the result register.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 masm->popfd(); \ 1279 masm->popfd(); \
1283 } \ 1280 } \
1284 masm-> 1281 masm->
1285 #else 1282 #else
1286 #define ACCESS_MASM(masm) masm-> 1283 #define ACCESS_MASM(masm) masm->
1287 #endif 1284 #endif
1288 1285
1289 } } // namespace v8::internal 1286 } } // namespace v8::internal
1290 1287
1291 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 1288 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698