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

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

Issue 9114041: Merge r10374 to the 3.6 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.6
Patch Set: Created 8 years, 11 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/arm/lithium-codegen-arm.h ('k') | src/version.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 2012 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
11 // with the distribution. 11 // with the distribution.
(...skipping 15 matching lines...) Expand all
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "arm/lithium-gap-resolver-arm.h" 30 #include "arm/lithium-gap-resolver-arm.h"
31 #include "arm/lithium-codegen-arm.h" 31 #include "arm/lithium-codegen-arm.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 static const Register kSavedValueRegister = { 9 }; 36 static const Register kSavedValueRegister = { 9 };
37 static const DoubleRegister kSavedDoubleValueRegister = { 0 };
38 37
39 LGapResolver::LGapResolver(LCodeGen* owner) 38 LGapResolver::LGapResolver(LCodeGen* owner)
40 : cgen_(owner), moves_(32), root_index_(0), in_cycle_(false), 39 : cgen_(owner), moves_(32), root_index_(0), in_cycle_(false),
41 saved_destination_(NULL) { } 40 saved_destination_(NULL) { }
42 41
43 42
44 void LGapResolver::Resolve(LParallelMove* parallel_move) { 43 void LGapResolver::Resolve(LParallelMove* parallel_move) {
45 ASSERT(moves_.is_empty()); 44 ASSERT(moves_.is_empty());
46 // Build up a worklist of moves. 45 // Build up a worklist of moves.
47 BuildInitialMoveList(parallel_move); 46 BuildInitialMoveList(parallel_move);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); 164 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source()));
166 ASSERT(!in_cycle_); 165 ASSERT(!in_cycle_);
167 in_cycle_ = true; 166 in_cycle_ = true;
168 LOperand* source = moves_[index].source(); 167 LOperand* source = moves_[index].source();
169 saved_destination_ = moves_[index].destination(); 168 saved_destination_ = moves_[index].destination();
170 if (source->IsRegister()) { 169 if (source->IsRegister()) {
171 __ mov(kSavedValueRegister, cgen_->ToRegister(source)); 170 __ mov(kSavedValueRegister, cgen_->ToRegister(source));
172 } else if (source->IsStackSlot()) { 171 } else if (source->IsStackSlot()) {
173 __ ldr(kSavedValueRegister, cgen_->ToMemOperand(source)); 172 __ ldr(kSavedValueRegister, cgen_->ToMemOperand(source));
174 } else if (source->IsDoubleRegister()) { 173 } else if (source->IsDoubleRegister()) {
175 __ vmov(kSavedDoubleValueRegister, cgen_->ToDoubleRegister(source)); 174 __ vmov(kScratchDoubleReg, cgen_->ToDoubleRegister(source));
176 } else if (source->IsDoubleStackSlot()) { 175 } else if (source->IsDoubleStackSlot()) {
177 __ vldr(kSavedDoubleValueRegister, cgen_->ToMemOperand(source)); 176 __ vldr(kScratchDoubleReg, cgen_->ToMemOperand(source));
178 } else { 177 } else {
179 UNREACHABLE(); 178 UNREACHABLE();
180 } 179 }
181 // This move will be done by restoring the saved value to the destination. 180 // This move will be done by restoring the saved value to the destination.
182 moves_[index].Eliminate(); 181 moves_[index].Eliminate();
183 } 182 }
184 183
185 184
186 void LGapResolver::RestoreValue() { 185 void LGapResolver::RestoreValue() {
187 ASSERT(in_cycle_); 186 ASSERT(in_cycle_);
188 ASSERT(saved_destination_ != NULL); 187 ASSERT(saved_destination_ != NULL);
189 188
190 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister. 189 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister.
191 if (saved_destination_->IsRegister()) { 190 if (saved_destination_->IsRegister()) {
192 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); 191 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister);
193 } else if (saved_destination_->IsStackSlot()) { 192 } else if (saved_destination_->IsStackSlot()) {
194 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); 193 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_));
195 } else if (saved_destination_->IsDoubleRegister()) { 194 } else if (saved_destination_->IsDoubleRegister()) {
196 __ vmov(cgen_->ToDoubleRegister(saved_destination_), 195 __ vmov(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg);
197 kSavedDoubleValueRegister);
198 } else if (saved_destination_->IsDoubleStackSlot()) { 196 } else if (saved_destination_->IsDoubleStackSlot()) {
199 __ vstr(kSavedDoubleValueRegister, 197 __ vstr(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_));
200 cgen_->ToMemOperand(saved_destination_));
201 } else { 198 } else {
202 UNREACHABLE(); 199 UNREACHABLE();
203 } 200 }
204 201
205 in_cycle_ = false; 202 in_cycle_ = false;
206 saved_destination_ = NULL; 203 saved_destination_ = NULL;
207 } 204 }
208 205
209 206
210 void LGapResolver::EmitMove(int index) { 207 void LGapResolver::EmitMove(int index) {
(...skipping 17 matching lines...) Expand all
228 if (destination->IsRegister()) { 225 if (destination->IsRegister()) {
229 __ ldr(cgen_->ToRegister(destination), source_operand); 226 __ ldr(cgen_->ToRegister(destination), source_operand);
230 } else { 227 } else {
231 ASSERT(destination->IsStackSlot()); 228 ASSERT(destination->IsStackSlot());
232 MemOperand destination_operand = cgen_->ToMemOperand(destination); 229 MemOperand destination_operand = cgen_->ToMemOperand(destination);
233 if (in_cycle_) { 230 if (in_cycle_) {
234 if (!destination_operand.OffsetIsUint12Encodable()) { 231 if (!destination_operand.OffsetIsUint12Encodable()) {
235 // ip is overwritten while saving the value to the destination. 232 // ip is overwritten while saving the value to the destination.
236 // Therefore we can't use ip. It is OK if the read from the source 233 // Therefore we can't use ip. It is OK if the read from the source
237 // destroys ip, since that happens before the value is read. 234 // destroys ip, since that happens before the value is read.
238 __ vldr(kSavedDoubleValueRegister.low(), source_operand); 235 __ vldr(kScratchDoubleReg.low(), source_operand);
239 __ vstr(kSavedDoubleValueRegister.low(), destination_operand); 236 __ vstr(kScratchDoubleReg.low(), destination_operand);
240 } else { 237 } else {
241 __ ldr(ip, source_operand); 238 __ ldr(ip, source_operand);
242 __ str(ip, destination_operand); 239 __ str(ip, destination_operand);
243 } 240 }
244 } else { 241 } else {
245 __ ldr(kSavedValueRegister, source_operand); 242 __ ldr(kSavedValueRegister, source_operand);
246 __ str(kSavedValueRegister, destination_operand); 243 __ str(kSavedValueRegister, destination_operand);
247 } 244 }
248 } 245 }
249 246
(...skipping 29 matching lines...) Expand all
279 // but kSavedValueRegister is free. 276 // but kSavedValueRegister is free.
280 MemOperand source_high_operand = 277 MemOperand source_high_operand =
281 cgen_->ToHighMemOperand(source); 278 cgen_->ToHighMemOperand(source);
282 MemOperand destination_high_operand = 279 MemOperand destination_high_operand =
283 cgen_->ToHighMemOperand(destination); 280 cgen_->ToHighMemOperand(destination);
284 __ ldr(kSavedValueRegister, source_operand); 281 __ ldr(kSavedValueRegister, source_operand);
285 __ str(kSavedValueRegister, destination_operand); 282 __ str(kSavedValueRegister, destination_operand);
286 __ ldr(kSavedValueRegister, source_high_operand); 283 __ ldr(kSavedValueRegister, source_high_operand);
287 __ str(kSavedValueRegister, destination_high_operand); 284 __ str(kSavedValueRegister, destination_high_operand);
288 } else { 285 } else {
289 __ vldr(kSavedDoubleValueRegister, source_operand); 286 __ vldr(kScratchDoubleReg, source_operand);
290 __ vstr(kSavedDoubleValueRegister, destination_operand); 287 __ vstr(kScratchDoubleReg, destination_operand);
291 } 288 }
292 } 289 }
293 } else { 290 } else {
294 UNREACHABLE(); 291 UNREACHABLE();
295 } 292 }
296 293
297 moves_[index].Eliminate(); 294 moves_[index].Eliminate();
298 } 295 }
299 296
300 297
301 #undef __ 298 #undef __
302 299
303 } } // namespace v8::internal 300 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698