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

Side by Side Diff: src/x64/cfg-x64.cc

Issue 165127: Factor out some platform-independent code into the shared cfg.cc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 StackCheckStub stub; 96 StackCheckStub stub;
97 __ CallStub(&stub); 97 __ CallStub(&stub);
98 __ jmp(&deferred_exit); 98 __ jmp(&deferred_exit);
99 } 99 }
100 } 100 }
101 101
102 102
103 void ExitNode::Compile(MacroAssembler* masm) { 103 void ExitNode::Compile(MacroAssembler* masm) {
104 ASSERT(!is_marked()); 104 ASSERT(!is_marked());
105 is_marked_ = true; 105 is_marked_ = true;
106
107 Comment cmnt(masm, "[ ExitNode"); 106 Comment cmnt(masm, "[ ExitNode");
108 if (FLAG_trace) { 107 if (FLAG_trace) {
109 __ push(rax); 108 __ push(rax);
110 __ CallRuntime(Runtime::kTraceExit, 1); 109 __ CallRuntime(Runtime::kTraceExit, 1);
111 } 110 }
112 __ RecordJSReturn(); 111 __ RecordJSReturn();
113 __ movq(rsp, rbp); 112 __ movq(rsp, rbp);
114 __ pop(rbp); 113 __ pop(rbp);
115 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); 114 int count = CfgGlobals::current()->fun()->scope()->num_parameters();
116 __ ret((count + 1) * kPointerSize); 115 __ ret((count + 1) * kPointerSize);
117 // Add padding that will be overwritten by a debugger breakpoint. 116 // Add padding that will be overwritten by a debugger breakpoint.
118 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2. 117 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2.
119 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2; 118 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2;
120 for (int i = 0; i < kPadding; ++i) { 119 for (int i = 0; i < kPadding; ++i) {
121 __ int3(); 120 __ int3();
122 } 121 }
123 } 122 }
124 123
125 124
126 void PositionInstr::Compile(MacroAssembler* masm) {
127 if (FLAG_debug_info && pos_ != RelocInfo::kNoPosition) {
128 __ RecordStatementPosition(pos_);
129 __ RecordPosition(pos_);
130 }
131 }
132
133
134 void MoveInstr::Compile(MacroAssembler* masm) {
135 location()->Move(masm, value());
136 }
137
138
139 void BinaryOpInstr::Compile(MacroAssembler* masm) { 125 void BinaryOpInstr::Compile(MacroAssembler* masm) {
140 // The right-hand value should not be on the stack---if it is a 126 // The right-hand value should not be on the stack---if it is a
141 // compiler-generated temporary it is in the accumulator. 127 // compiler-generated temporary it is in the accumulator.
142 ASSERT(!value1()->is_on_stack()); 128 ASSERT(!value1()->is_on_stack());
143 129
144 Comment cmnt(masm, "[ BinaryOpInstr"); 130 Comment cmnt(masm, "[ BinaryOpInstr");
145 // We can overwrite one of the operands if it is a temporary. 131 // We can overwrite one of the operands if it is a temporary.
146 OverwriteMode mode = NO_OVERWRITE; 132 OverwriteMode mode = NO_OVERWRITE;
147 if (value0()->is_temporary()) { 133 if (value0()->is_temporary()) {
148 mode = OVERWRITE_LEFT; 134 mode = OVERWRITE_LEFT;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void SlotLocation::Get(MacroAssembler* masm, Register reg) { 190 void SlotLocation::Get(MacroAssembler* masm, Register reg) {
205 __ movq(reg, ToOperand(this)); 191 __ movq(reg, ToOperand(this));
206 } 192 }
207 193
208 194
209 void SlotLocation::Set(MacroAssembler* masm, Register reg) { 195 void SlotLocation::Set(MacroAssembler* masm, Register reg) {
210 __ movq(ToOperand(this), reg); 196 __ movq(ToOperand(this), reg);
211 } 197 }
212 198
213 199
200 void SlotLocation::Push(MacroAssembler* masm) {
201 __ push(ToOperand(this));
202 }
203
204
214 void SlotLocation::Move(MacroAssembler* masm, Value* value) { 205 void SlotLocation::Move(MacroAssembler* masm, Value* value) {
215 // We dispatch to the value because in some cases (temp or constant) we 206 // We dispatch to the value because in some cases (temp or constant) we
216 // can use special instruction sequences. 207 // can use special instruction sequences.
217 value->MoveToSlot(masm, this); 208 value->MoveToSlot(masm, this);
218 } 209 }
219 210
220 211
221 void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) { 212 void SlotLocation::MoveToSlot(MacroAssembler* masm, SlotLocation* loc) {
222 __ movq(kScratchRegister, ToOperand(this)); 213 __ movq(kScratchRegister, ToOperand(this));
223 __ movq(ToOperand(loc), kScratchRegister); 214 __ movq(ToOperand(loc), kScratchRegister);
224 } 215 }
225 216
226 217
227 void SlotLocation::Push(MacroAssembler* masm) {
228 __ push(ToOperand(this));
229 }
230
231
232 void TempLocation::Get(MacroAssembler* masm, Register reg) { 218 void TempLocation::Get(MacroAssembler* masm, Register reg) {
233 switch (where_) { 219 switch (where_) {
234 case ACCUMULATOR: 220 case ACCUMULATOR:
235 if (!reg.is(rax)) __ movq(reg, rax); 221 if (!reg.is(rax)) __ movq(reg, rax);
236 break; 222 break;
237 case STACK: 223 case STACK:
238 __ pop(reg); 224 __ pop(reg);
239 break; 225 break;
240 case NOT_ALLOCATED: 226 case NOT_ALLOCATED:
241 UNREACHABLE(); 227 UNREACHABLE();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 break; 279 break;
294 case NOT_ALLOCATED: 280 case NOT_ALLOCATED:
295 UNREACHABLE(); 281 UNREACHABLE();
296 } 282 }
297 } 283 }
298 284
299 285
300 #undef __ 286 #undef __
301 287
302 } } // namespace v8::internal 288 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698