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

Side by Side Diff: src/ppc/lithium-gap-resolver-ppc.cc

Issue 714093002: PowerPC specific sub-directories. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/ppc/lithium-gap-resolver-ppc.h ('k') | src/ppc/lithium-ppc.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/mips/lithium-codegen-mips.h" 7 #include "src/ppc/lithium-codegen-ppc.h"
8 #include "src/mips/lithium-gap-resolver-mips.h" 8 #include "src/ppc/lithium-gap-resolver-ppc.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 static const Register kSavedValueRegister = {11};
14
13 LGapResolver::LGapResolver(LCodeGen* owner) 15 LGapResolver::LGapResolver(LCodeGen* owner)
14 : cgen_(owner), 16 : cgen_(owner),
15 moves_(32, owner->zone()), 17 moves_(32, owner->zone()),
16 root_index_(0), 18 root_index_(0),
17 in_cycle_(false), 19 in_cycle_(false),
18 saved_destination_(NULL) {} 20 saved_destination_(NULL) {}
19 21
20 22
21 void LGapResolver::Resolve(LParallelMove* parallel_move) { 23 void LGapResolver::Resolve(LParallelMove* parallel_move) {
22 DCHECK(moves_.is_empty()); 24 DCHECK(moves_.is_empty());
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void LGapResolver::BreakCycle(int index) { 140 void LGapResolver::BreakCycle(int index) {
139 // We save in a register the value that should end up in the source of 141 // We save in a register the value that should end up in the source of
140 // moves_[root_index]. After performing all moves in the tree rooted 142 // moves_[root_index]. After performing all moves in the tree rooted
141 // in that move, we save the value to that source. 143 // in that move, we save the value to that source.
142 DCHECK(moves_[index].destination()->Equals(moves_[root_index_].source())); 144 DCHECK(moves_[index].destination()->Equals(moves_[root_index_].source()));
143 DCHECK(!in_cycle_); 145 DCHECK(!in_cycle_);
144 in_cycle_ = true; 146 in_cycle_ = true;
145 LOperand* source = moves_[index].source(); 147 LOperand* source = moves_[index].source();
146 saved_destination_ = moves_[index].destination(); 148 saved_destination_ = moves_[index].destination();
147 if (source->IsRegister()) { 149 if (source->IsRegister()) {
148 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); 150 __ mr(kSavedValueRegister, cgen_->ToRegister(source));
149 } else if (source->IsStackSlot()) { 151 } else if (source->IsStackSlot()) {
150 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); 152 __ LoadP(kSavedValueRegister, cgen_->ToMemOperand(source));
151 } else if (source->IsDoubleRegister()) { 153 } else if (source->IsDoubleRegister()) {
152 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); 154 __ fmr(kScratchDoubleReg, cgen_->ToDoubleRegister(source));
153 } else if (source->IsDoubleStackSlot()) { 155 } else if (source->IsDoubleStackSlot()) {
154 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); 156 __ lfd(kScratchDoubleReg, cgen_->ToMemOperand(source));
155 } else { 157 } else {
156 UNREACHABLE(); 158 UNREACHABLE();
157 } 159 }
158 // This move will be done by restoring the saved value to the destination. 160 // This move will be done by restoring the saved value to the destination.
159 moves_[index].Eliminate(); 161 moves_[index].Eliminate();
160 } 162 }
161 163
162 164
163 void LGapResolver::RestoreValue() { 165 void LGapResolver::RestoreValue() {
164 DCHECK(in_cycle_); 166 DCHECK(in_cycle_);
165 DCHECK(saved_destination_ != NULL); 167 DCHECK(saved_destination_ != NULL);
166 168
167 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. 169 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister.
168 if (saved_destination_->IsRegister()) { 170 if (saved_destination_->IsRegister()) {
169 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); 171 __ mr(cgen_->ToRegister(saved_destination_), kSavedValueRegister);
170 } else if (saved_destination_->IsStackSlot()) { 172 } else if (saved_destination_->IsStackSlot()) {
171 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); 173 __ StoreP(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_));
172 } else if (saved_destination_->IsDoubleRegister()) { 174 } else if (saved_destination_->IsDoubleRegister()) {
173 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), 175 __ fmr(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg);
174 kLithiumScratchDouble);
175 } else if (saved_destination_->IsDoubleStackSlot()) { 176 } else if (saved_destination_->IsDoubleStackSlot()) {
176 __ sdc1(kLithiumScratchDouble, 177 __ stfd(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_));
177 cgen_->ToMemOperand(saved_destination_));
178 } else { 178 } else {
179 UNREACHABLE(); 179 UNREACHABLE();
180 } 180 }
181 181
182 in_cycle_ = false; 182 in_cycle_ = false;
183 saved_destination_ = NULL; 183 saved_destination_ = NULL;
184 } 184 }
185 185
186 186
187 void LGapResolver::EmitMove(int index) { 187 void LGapResolver::EmitMove(int index) {
188 LOperand* source = moves_[index].source(); 188 LOperand* source = moves_[index].source();
189 LOperand* destination = moves_[index].destination(); 189 LOperand* destination = moves_[index].destination();
190 190
191 // Dispatch on the source and destination operand kinds. Not all 191 // Dispatch on the source and destination operand kinds. Not all
192 // combinations are possible. 192 // combinations are possible.
193 193
194 if (source->IsRegister()) { 194 if (source->IsRegister()) {
195 Register source_register = cgen_->ToRegister(source); 195 Register source_register = cgen_->ToRegister(source);
196 if (destination->IsRegister()) { 196 if (destination->IsRegister()) {
197 __ mov(cgen_->ToRegister(destination), source_register); 197 __ mr(cgen_->ToRegister(destination), source_register);
198 } else { 198 } else {
199 DCHECK(destination->IsStackSlot()); 199 DCHECK(destination->IsStackSlot());
200 __ sw(source_register, cgen_->ToMemOperand(destination)); 200 __ StoreP(source_register, cgen_->ToMemOperand(destination));
201 } 201 }
202 } else if (source->IsStackSlot()) { 202 } else if (source->IsStackSlot()) {
203 MemOperand source_operand = cgen_->ToMemOperand(source); 203 MemOperand source_operand = cgen_->ToMemOperand(source);
204 if (destination->IsRegister()) { 204 if (destination->IsRegister()) {
205 __ lw(cgen_->ToRegister(destination), source_operand); 205 __ LoadP(cgen_->ToRegister(destination), source_operand);
206 } else { 206 } else {
207 DCHECK(destination->IsStackSlot()); 207 DCHECK(destination->IsStackSlot());
208 MemOperand destination_operand = cgen_->ToMemOperand(destination); 208 MemOperand destination_operand = cgen_->ToMemOperand(destination);
209 if (in_cycle_) { 209 if (in_cycle_) {
210 if (!destination_operand.OffsetIsInt16Encodable()) { 210 __ LoadP(ip, source_operand);
211 // 'at' is overwritten while saving the value to the destination. 211 __ StoreP(ip, destination_operand);
212 // Therefore we can't use 'at'. It is OK if the read from the source
213 // destroys 'at', since that happens before the value is read.
214 // This uses only a single reg of the double reg-pair.
215 __ lwc1(kLithiumScratchDouble, source_operand);
216 __ swc1(kLithiumScratchDouble, destination_operand);
217 } else {
218 __ lw(at, source_operand);
219 __ sw(at, destination_operand);
220 }
221 } else { 212 } else {
222 __ lw(kLithiumScratchReg, source_operand); 213 __ LoadP(kSavedValueRegister, source_operand);
223 __ sw(kLithiumScratchReg, destination_operand); 214 __ StoreP(kSavedValueRegister, destination_operand);
224 } 215 }
225 } 216 }
226 217
227 } else if (source->IsConstantOperand()) { 218 } else if (source->IsConstantOperand()) {
228 LConstantOperand* constant_source = LConstantOperand::cast(source); 219 LConstantOperand* constant_source = LConstantOperand::cast(source);
229 if (destination->IsRegister()) { 220 if (destination->IsRegister()) {
230 Register dst = cgen_->ToRegister(destination); 221 Register dst = cgen_->ToRegister(destination);
231 Representation r = cgen_->IsSmi(constant_source)
232 ? Representation::Smi() : Representation::Integer32();
233 if (cgen_->IsInteger32(constant_source)) { 222 if (cgen_->IsInteger32(constant_source)) {
234 __ li(dst, Operand(cgen_->ToRepresentation(constant_source, r))); 223 cgen_->EmitLoadIntegerConstant(constant_source, dst);
235 } else { 224 } else {
236 __ li(dst, cgen_->ToHandle(constant_source)); 225 __ Move(dst, cgen_->ToHandle(constant_source));
237 } 226 }
238 } else if (destination->IsDoubleRegister()) { 227 } else if (destination->IsDoubleRegister()) {
239 DoubleRegister result = cgen_->ToDoubleRegister(destination); 228 DoubleRegister result = cgen_->ToDoubleRegister(destination);
240 double v = cgen_->ToDouble(constant_source); 229 double v = cgen_->ToDouble(constant_source);
241 __ Move(result, v); 230 __ LoadDoubleLiteral(result, v, ip);
242 } else { 231 } else {
243 DCHECK(destination->IsStackSlot()); 232 DCHECK(destination->IsStackSlot());
244 DCHECK(!in_cycle_); // Constant moves happen after all cycles are gone. 233 DCHECK(!in_cycle_); // Constant moves happen after all cycles are gone.
245 Representation r = cgen_->IsSmi(constant_source)
246 ? Representation::Smi() : Representation::Integer32();
247 if (cgen_->IsInteger32(constant_source)) { 234 if (cgen_->IsInteger32(constant_source)) {
248 __ li(kLithiumScratchReg, 235 cgen_->EmitLoadIntegerConstant(constant_source, kSavedValueRegister);
249 Operand(cgen_->ToRepresentation(constant_source, r)));
250 } else { 236 } else {
251 __ li(kLithiumScratchReg, cgen_->ToHandle(constant_source)); 237 __ Move(kSavedValueRegister, cgen_->ToHandle(constant_source));
252 } 238 }
253 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); 239 __ StoreP(kSavedValueRegister, cgen_->ToMemOperand(destination));
254 } 240 }
255 241
256 } else if (source->IsDoubleRegister()) { 242 } else if (source->IsDoubleRegister()) {
257 DoubleRegister source_register = cgen_->ToDoubleRegister(source); 243 DoubleRegister source_register = cgen_->ToDoubleRegister(source);
258 if (destination->IsDoubleRegister()) { 244 if (destination->IsDoubleRegister()) {
259 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); 245 __ fmr(cgen_->ToDoubleRegister(destination), source_register);
260 } else { 246 } else {
261 DCHECK(destination->IsDoubleStackSlot()); 247 DCHECK(destination->IsDoubleStackSlot());
262 MemOperand destination_operand = cgen_->ToMemOperand(destination); 248 __ stfd(source_register, cgen_->ToMemOperand(destination));
263 __ sdc1(source_register, destination_operand);
264 } 249 }
265 250
266 } else if (source->IsDoubleStackSlot()) { 251 } else if (source->IsDoubleStackSlot()) {
267 MemOperand source_operand = cgen_->ToMemOperand(source); 252 MemOperand source_operand = cgen_->ToMemOperand(source);
268 if (destination->IsDoubleRegister()) { 253 if (destination->IsDoubleRegister()) {
269 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); 254 __ lfd(cgen_->ToDoubleRegister(destination), source_operand);
270 } else { 255 } else {
271 DCHECK(destination->IsDoubleStackSlot()); 256 DCHECK(destination->IsDoubleStackSlot());
272 MemOperand destination_operand = cgen_->ToMemOperand(destination); 257 MemOperand destination_operand = cgen_->ToMemOperand(destination);
273 if (in_cycle_) { 258 if (in_cycle_) {
274 // kLithiumScratchDouble was used to break the cycle, 259 // kSavedDoubleValueRegister was used to break the cycle,
275 // but kLithiumScratchReg is free. 260 // but kSavedValueRegister is free.
276 MemOperand source_high_operand = 261 #if V8_TARGET_ARCH_PPC64
277 cgen_->ToHighMemOperand(source); 262 __ ld(kSavedValueRegister, source_operand);
263 __ std(kSavedValueRegister, destination_operand);
264 #else
265 MemOperand source_high_operand = cgen_->ToHighMemOperand(source);
278 MemOperand destination_high_operand = 266 MemOperand destination_high_operand =
279 cgen_->ToHighMemOperand(destination); 267 cgen_->ToHighMemOperand(destination);
280 __ lw(kLithiumScratchReg, source_operand); 268 __ lwz(kSavedValueRegister, source_operand);
281 __ sw(kLithiumScratchReg, destination_operand); 269 __ stw(kSavedValueRegister, destination_operand);
282 __ lw(kLithiumScratchReg, source_high_operand); 270 __ lwz(kSavedValueRegister, source_high_operand);
283 __ sw(kLithiumScratchReg, destination_high_operand); 271 __ stw(kSavedValueRegister, destination_high_operand);
272 #endif
284 } else { 273 } else {
285 __ ldc1(kLithiumScratchDouble, source_operand); 274 __ lfd(kScratchDoubleReg, source_operand);
286 __ sdc1(kLithiumScratchDouble, destination_operand); 275 __ stfd(kScratchDoubleReg, destination_operand);
287 } 276 }
288 } 277 }
289 } else { 278 } else {
290 UNREACHABLE(); 279 UNREACHABLE();
291 } 280 }
292 281
293 moves_[index].Eliminate(); 282 moves_[index].Eliminate();
294 } 283 }
295 284
296 285
297 #undef __ 286 #undef __
298 287 }
299 } } // namespace v8::internal 288 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ppc/lithium-gap-resolver-ppc.h ('k') | src/ppc/lithium-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698