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

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

Issue 144963003: A64: add missing files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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/a64/lithium-gap-resolver-a64.h ('k') | src/a64/macro-assembler-a64.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 2013 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.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
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 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "arm/lithium-gap-resolver-arm.h" 30 #include "a64/lithium-gap-resolver-a64.h"
31 #include "arm/lithium-codegen-arm.h" 31 #include "a64/lithium-codegen-a64.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 static const Register kSavedValueRegister = { 9 }; 36 // We use the root register to spill a value while breaking a cycle in parallel
37 // moves. We don't need access to roots while resolving the move list and using
38 // the root register has two advantages:
39 // - It is not in crankshaft allocatable registers list, so it can't interfere
40 // with any of the moves we are resolving.
41 // - We don't need to push it on the stack, as we can reload it with its value
42 // once we have resolved a cycle.
43 const Register LGapResolver::kSavedValue = root;
44
37 45
38 LGapResolver::LGapResolver(LCodeGen* owner) 46 LGapResolver::LGapResolver(LCodeGen* owner)
39 : cgen_(owner), moves_(32, owner->zone()), root_index_(0), in_cycle_(false), 47 : cgen_(owner), moves_(32, owner->zone()), root_index_(0), in_cycle_(false),
40 saved_destination_(NULL) { } 48 saved_destination_(NULL), need_to_restore_root_(false) { }
41 49
42 50
51 #define __ ACCESS_MASM(cgen_->masm())
52
43 void LGapResolver::Resolve(LParallelMove* parallel_move) { 53 void LGapResolver::Resolve(LParallelMove* parallel_move) {
44 ASSERT(moves_.is_empty()); 54 ASSERT(moves_.is_empty());
55
45 // Build up a worklist of moves. 56 // Build up a worklist of moves.
46 BuildInitialMoveList(parallel_move); 57 BuildInitialMoveList(parallel_move);
47 58
48 for (int i = 0; i < moves_.length(); ++i) { 59 for (int i = 0; i < moves_.length(); ++i) {
49 LMoveOperands move = moves_[i]; 60 LMoveOperands move = moves_[i];
50 // Skip constants to perform them last. They don't block other moves 61
62 // Skip constants to perform them last. They don't block other moves
51 // and skipping such moves with register destinations keeps those 63 // and skipping such moves with register destinations keeps those
52 // registers free for the whole algorithm. 64 // registers free for the whole algorithm.
53 if (!move.IsEliminated() && !move.source()->IsConstantOperand()) { 65 if (!move.IsEliminated() && !move.source()->IsConstantOperand()) {
54 root_index_ = i; // Any cycle is found when by reaching this move again. 66 root_index_ = i; // Any cycle is found when we reach this move again.
55 PerformMove(i); 67 PerformMove(i);
56 if (in_cycle_) { 68 if (in_cycle_) RestoreValue();
57 RestoreValue();
58 }
59 } 69 }
60 } 70 }
61 71
62 // Perform the moves with constant sources. 72 // Perform the moves with constant sources.
63 for (int i = 0; i < moves_.length(); ++i) { 73 for (int i = 0; i < moves_.length(); ++i) {
64 if (!moves_[i].IsEliminated()) { 74 LMoveOperands move = moves_[i];
65 ASSERT(moves_[i].source()->IsConstantOperand()); 75
76 if (!move.IsEliminated()) {
77 ASSERT(move.source()->IsConstantOperand());
66 EmitMove(i); 78 EmitMove(i);
67 } 79 }
68 } 80 }
69 81
82 if (need_to_restore_root_) {
83 ASSERT(kSavedValue.Is(root));
84 __ InitializeRootRegister();
85 }
86
70 moves_.Rewind(0); 87 moves_.Rewind(0);
71 } 88 }
72 89
73 90
74 void LGapResolver::BuildInitialMoveList(LParallelMove* parallel_move) { 91 void LGapResolver::BuildInitialMoveList(LParallelMove* parallel_move) {
75 // Perform a linear sweep of the moves to add them to the initial list of 92 // Perform a linear sweep of the moves to add them to the initial list of
76 // moves to perform, ignoring any move that is redundant (the source is 93 // moves to perform, ignoring any move that is redundant (the source is
77 // the same as the destination, the destination is ignored and 94 // the same as the destination, the destination is ignored and
78 // unallocated, or the move was already eliminated). 95 // unallocated, or the move was already eliminated).
79 const ZoneList<LMoveOperands>* moves = parallel_move->move_operands(); 96 const ZoneList<LMoveOperands>* moves = parallel_move->move_operands();
80 for (int i = 0; i < moves->length(); ++i) { 97 for (int i = 0; i < moves->length(); ++i) {
81 LMoveOperands move = moves->at(i); 98 LMoveOperands move = moves->at(i);
82 if (!move.IsRedundant()) moves_.Add(move, cgen_->zone()); 99 if (!move.IsRedundant()) moves_.Add(move, cgen_->zone());
83 } 100 }
84 Verify(); 101 Verify();
85 } 102 }
86 103
87 104
88 void LGapResolver::PerformMove(int index) { 105 void LGapResolver::PerformMove(int index) {
89 // Each call to this function performs a move and deletes it from the move 106 // Each call to this function performs a move and deletes it from the move
90 // graph. We first recursively perform any move blocking this one. We 107 // graph. We first recursively perform any move blocking this one. We
91 // mark a move as "pending" on entry to PerformMove in order to detect 108 // mark a move as "pending" on entry to PerformMove in order to detect
92 // cycles in the move graph. 109 // cycles in the move graph.
110 LMoveOperands& current_move = moves_[index];
93 111
94 // We can only find a cycle, when doing a depth-first traversal of moves, 112 ASSERT(!current_move.IsPending());
95 // be encountering the starting move again. So by spilling the source of 113 ASSERT(!current_move.IsRedundant());
96 // the starting move, we break the cycle. All moves are then unblocked,
97 // and the starting move is completed by writing the spilled value to
98 // its destination. All other moves from the spilled source have been
99 // completed prior to breaking the cycle.
100 // An additional complication is that moves to MemOperands with large
101 // offsets (more than 1K or 4K) require us to spill this spilled value to
102 // the stack, to free up the register.
103 ASSERT(!moves_[index].IsPending());
104 ASSERT(!moves_[index].IsRedundant());
105 114
106 // Clear this move's destination to indicate a pending move. The actual 115 // Clear this move's destination to indicate a pending move. The actual
107 // destination is saved in a stack allocated local. Multiple moves can 116 // destination is saved in a stack allocated local. Multiple moves can
108 // be pending because this function is recursive. 117 // be pending because this function is recursive.
109 ASSERT(moves_[index].source() != NULL); // Or else it will look eliminated. 118 ASSERT(current_move.source() != NULL); // Otherwise it will look eliminated.
110 LOperand* destination = moves_[index].destination(); 119 LOperand* destination = current_move.destination();
111 moves_[index].set_destination(NULL); 120 current_move.set_destination(NULL);
112 121
113 // Perform a depth-first traversal of the move graph to resolve 122 // Perform a depth-first traversal of the move graph to resolve
114 // dependencies. Any unperformed, unpending move with a source the same 123 // dependencies. Any unperformed, unpending move with a source the same
115 // as this one's destination blocks this one so recursively perform all 124 // as this one's destination blocks this one so recursively perform all
116 // such moves. 125 // such moves.
117 for (int i = 0; i < moves_.length(); ++i) { 126 for (int i = 0; i < moves_.length(); ++i) {
118 LMoveOperands other_move = moves_[i]; 127 LMoveOperands other_move = moves_[i];
119 if (other_move.Blocks(destination) && !other_move.IsPending()) { 128 if (other_move.Blocks(destination) && !other_move.IsPending()) {
120 PerformMove(i); 129 PerformMove(i);
121 // If there is a blocking, pending move it must be moves_[root_index_] 130 // If there is a blocking, pending move it must be moves_[root_index_]
122 // and all other moves with the same source as moves_[root_index_] are 131 // and all other moves with the same source as moves_[root_index_] are
123 // sucessfully executed (because they are cycle-free) by this loop. 132 // sucessfully executed (because they are cycle-free) by this loop.
124 } 133 }
125 } 134 }
126 135
127 // We are about to resolve this move and don't need it marked as 136 // We are about to resolve this move and don't need it marked as
128 // pending, so restore its destination. 137 // pending, so restore its destination.
129 moves_[index].set_destination(destination); 138 current_move.set_destination(destination);
130 139
131 // The move may be blocked on a pending move, which must be the starting move. 140 // The move may be blocked on a pending move, which must be the starting move.
132 // In this case, we have a cycle, and we save the source of this move to 141 // In this case, we have a cycle, and we save the source of this move to
133 // a scratch register to break it. 142 // a scratch register to break it.
134 LMoveOperands other_move = moves_[root_index_]; 143 LMoveOperands other_move = moves_[root_index_];
135 if (other_move.Blocks(destination)) { 144 if (other_move.Blocks(destination)) {
136 ASSERT(other_move.IsPending()); 145 ASSERT(other_move.IsPending());
137 BreakCycle(index); 146 BreakCycle(index);
138 return; 147 return;
139 } 148 }
140 149
141 // This move is no longer blocked. 150 // This move is no longer blocked.
142 EmitMove(index); 151 EmitMove(index);
143 } 152 }
144 153
145 154
146 void LGapResolver::Verify() { 155 void LGapResolver::Verify() {
147 #ifdef ENABLE_SLOW_ASSERTS 156 TODO_UNIMPLEMENTED("LGapResolver::Verify");
148 // No operand should be the destination for more than one move.
149 for (int i = 0; i < moves_.length(); ++i) {
150 LOperand* destination = moves_[i].destination();
151 for (int j = i + 1; j < moves_.length(); ++j) {
152 SLOW_ASSERT(!destination->Equals(moves_[j].destination()));
153 }
154 }
155 #endif
156 } 157 }
157 158
158 #define __ ACCESS_MASM(cgen_->masm())
159
160 void LGapResolver::BreakCycle(int index) { 159 void LGapResolver::BreakCycle(int index) {
161 // We save in a register the value that should end up in the source of
162 // moves_[root_index]. After performing all moves in the tree rooted
163 // in that move, we save the value to that source.
164 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); 160 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source()));
165 ASSERT(!in_cycle_); 161 ASSERT(!in_cycle_);
162
163 // We use a register which is not allocatable by crankshaft to break the cycle
164 // to be sure it doesn't interfere with the moves we are resolving.
165 ASSERT(!kSavedValue.IsAllocatable());
166 need_to_restore_root_ = true;
167
168 // We save in a register the source of that move and we remember its
169 // destination. Then we mark this move as resolved so the cycle is
170 // broken and we can perform the other moves.
166 in_cycle_ = true; 171 in_cycle_ = true;
167 LOperand* source = moves_[index].source(); 172 LOperand* source = moves_[index].source();
168 saved_destination_ = moves_[index].destination(); 173 saved_destination_ = moves_[index].destination();
174
169 if (source->IsRegister()) { 175 if (source->IsRegister()) {
170 __ mov(kSavedValueRegister, cgen_->ToRegister(source)); 176 __ Mov(kSavedValue, cgen_->ToRegister(source));
171 } else if (source->IsStackSlot()) { 177 } else if (source->IsStackSlot()) {
172 __ ldr(kSavedValueRegister, cgen_->ToMemOperand(source)); 178 UNIMPLEMENTED();
173 } else if (source->IsDoubleRegister()) { 179 } else if (source->IsDoubleRegister()) {
174 __ vmov(kScratchDoubleReg, cgen_->ToDoubleRegister(source)); 180 // TODO(all): We should use a double register to store the value to avoid
181 // the penalty of the mov across register banks. We are going to reserve
182 // d31 to hold 0.0 value. We could clobber this register while breaking the
183 // cycle and restore it after like we do with the root register.
184 // LGapResolver::RestoreValue() will need to be updated as well when we'll
185 // do that.
186 __ Fmov(kSavedValue, cgen_->ToDoubleRegister(source));
175 } else if (source->IsDoubleStackSlot()) { 187 } else if (source->IsDoubleStackSlot()) {
176 __ vldr(kScratchDoubleReg, cgen_->ToMemOperand(source)); 188 UNIMPLEMENTED();
177 } else { 189 } else {
178 UNREACHABLE(); 190 UNREACHABLE();
179 } 191 }
180 // This move will be done by restoring the saved value to the destination. 192
193 // Mark this move as resolved.
194 // This move will be actually performed by moving the saved value to this
195 // move's destination in LGapResolver::RestoreValue().
181 moves_[index].Eliminate(); 196 moves_[index].Eliminate();
182 } 197 }
183 198
184 199
185 void LGapResolver::RestoreValue() { 200 void LGapResolver::RestoreValue() {
186 ASSERT(in_cycle_); 201 ASSERT(in_cycle_);
187 ASSERT(saved_destination_ != NULL); 202 ASSERT(saved_destination_ != NULL);
188 203
189 // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister.
190 if (saved_destination_->IsRegister()) { 204 if (saved_destination_->IsRegister()) {
191 __ mov(cgen_->ToRegister(saved_destination_), kSavedValueRegister); 205 __ Mov(cgen_->ToRegister(saved_destination_), kSavedValue);
192 } else if (saved_destination_->IsStackSlot()) { 206 } else if (saved_destination_->IsStackSlot()) {
193 __ str(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_)); 207 UNIMPLEMENTED();
194 } else if (saved_destination_->IsDoubleRegister()) { 208 } else if (saved_destination_->IsDoubleRegister()) {
195 __ vmov(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg); 209 __ Fmov(cgen_->ToDoubleRegister(saved_destination_), kSavedValue);
196 } else if (saved_destination_->IsDoubleStackSlot()) { 210 } else if (saved_destination_->IsDoubleStackSlot()) {
197 __ vstr(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_)); 211 UNIMPLEMENTED();
198 } else { 212 } else {
199 UNREACHABLE(); 213 UNREACHABLE();
200 } 214 }
201 215
202 in_cycle_ = false; 216 in_cycle_ = false;
203 saved_destination_ = NULL; 217 saved_destination_ = NULL;
204 } 218 }
205 219
206 220
207 void LGapResolver::EmitMove(int index) { 221 void LGapResolver::EmitMove(int index) {
208 LOperand* source = moves_[index].source(); 222 LOperand* source = moves_[index].source();
209 LOperand* destination = moves_[index].destination(); 223 LOperand* destination = moves_[index].destination();
210 224
211 // Dispatch on the source and destination operand kinds. Not all 225 // Dispatch on the source and destination operand kinds. Not all
212 // combinations are possible. 226 // combinations are possible.
213 227
214 if (source->IsRegister()) { 228 if (source->IsRegister()) {
215 Register source_register = cgen_->ToRegister(source); 229 Register source_register = cgen_->ToRegister(source);
216 if (destination->IsRegister()) { 230 if (destination->IsRegister()) {
217 __ mov(cgen_->ToRegister(destination), source_register); 231 __ Mov(cgen_->ToRegister(destination), source_register);
218 } else { 232 } else {
219 ASSERT(destination->IsStackSlot()); 233 ASSERT(destination->IsStackSlot());
220 __ str(source_register, cgen_->ToMemOperand(destination)); 234 __ Str(source_register, cgen_->ToMemOperand(destination));
221 } 235 }
222
223 } else if (source->IsStackSlot()) { 236 } else if (source->IsStackSlot()) {
224 MemOperand source_operand = cgen_->ToMemOperand(source); 237 MemOperand source_operand = cgen_->ToMemOperand(source);
225 if (destination->IsRegister()) { 238 if (destination->IsRegister()) {
226 __ ldr(cgen_->ToRegister(destination), source_operand); 239 __ Ldr(cgen_->ToRegister(destination), source_operand);
227 } else { 240 } else {
228 ASSERT(destination->IsStackSlot()); 241 ASSERT(destination->IsStackSlot());
229 MemOperand destination_operand = cgen_->ToMemOperand(destination); 242 EmitStackSlotMove(index);
230 if (in_cycle_) {
231 if (!destination_operand.OffsetIsUint12Encodable()) {
232 // ip is overwritten while saving the value to the destination.
233 // Therefore we can't use ip. It is OK if the read from the source
234 // destroys ip, since that happens before the value is read.
235 __ vldr(kScratchDoubleReg.low(), source_operand);
236 __ vstr(kScratchDoubleReg.low(), destination_operand);
237 } else {
238 __ ldr(ip, source_operand);
239 __ str(ip, destination_operand);
240 }
241 } else {
242 __ ldr(kSavedValueRegister, source_operand);
243 __ str(kSavedValueRegister, destination_operand);
244 }
245 } 243 }
246
247 } else if (source->IsConstantOperand()) { 244 } else if (source->IsConstantOperand()) {
248 LConstantOperand* constant_source = LConstantOperand::cast(source); 245 LConstantOperand* constant_source = LConstantOperand::cast(source);
249 if (destination->IsRegister()) { 246 if (destination->IsRegister()) {
250 Register dst = cgen_->ToRegister(destination); 247 Register dst = cgen_->ToRegister(destination);
251 if (cgen_->IsSmi(constant_source)) { 248 if (cgen_->IsSmi(constant_source)) {
252 __ mov(dst, Operand(cgen_->ToSmi(constant_source))); 249 __ Mov(dst, Operand(cgen_->ToSmi(constant_source)));
253 } else if (cgen_->IsInteger32(constant_source)) { 250 } else if (cgen_->IsInteger32Constant(constant_source)) {
254 __ mov(dst, Operand(cgen_->ToInteger32(constant_source))); 251 __ Mov(dst, cgen_->ToInteger32(constant_source));
255 } else { 252 } else {
256 __ LoadObject(dst, cgen_->ToHandle(constant_source)); 253 __ LoadObject(dst, cgen_->ToHandle(constant_source));
257 } 254 }
258 } else { 255 } else {
259 ASSERT(destination->IsStackSlot()); 256 ASSERT(destination->IsStackSlot());
260 ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone. 257 ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone.
258 need_to_restore_root_ = true;
261 if (cgen_->IsSmi(constant_source)) { 259 if (cgen_->IsSmi(constant_source)) {
262 __ mov(kSavedValueRegister, Operand(cgen_->ToSmi(constant_source))); 260 __ Mov(kSavedValue, Operand(cgen_->ToSmi(constant_source)));
263 } else if (cgen_->IsInteger32(constant_source)) { 261 } else if (cgen_->IsInteger32Constant(constant_source)) {
264 __ mov(kSavedValueRegister, 262 __ Mov(kSavedValue, cgen_->ToInteger32(constant_source));
265 Operand(cgen_->ToInteger32(constant_source)));
266 } else { 263 } else {
267 __ LoadObject(kSavedValueRegister, 264 __ LoadObject(kSavedValue, cgen_->ToHandle(constant_source));
268 cgen_->ToHandle(constant_source));
269 } 265 }
270 __ str(kSavedValueRegister, cgen_->ToMemOperand(destination)); 266 __ Str(kSavedValue, cgen_->ToMemOperand(destination));
271 } 267 }
272
273 } else if (source->IsDoubleRegister()) { 268 } else if (source->IsDoubleRegister()) {
274 DwVfpRegister source_register = cgen_->ToDoubleRegister(source); 269 DoubleRegister src = cgen_->ToDoubleRegister(source);
275 if (destination->IsDoubleRegister()) { 270 if (destination->IsDoubleRegister()) {
276 __ vmov(cgen_->ToDoubleRegister(destination), source_register); 271 __ Fmov(cgen_->ToDoubleRegister(destination), src);
277 } else { 272 } else {
278 ASSERT(destination->IsDoubleStackSlot()); 273 ASSERT(destination->IsDoubleStackSlot());
279 __ vstr(source_register, cgen_->ToMemOperand(destination)); 274 __ Str(src, cgen_->ToMemOperand(destination));
280 } 275 }
281
282 } else if (source->IsDoubleStackSlot()) { 276 } else if (source->IsDoubleStackSlot()) {
283 MemOperand source_operand = cgen_->ToMemOperand(source); 277 MemOperand src = cgen_->ToMemOperand(source);
284 if (destination->IsDoubleRegister()) { 278 if (destination->IsDoubleRegister()) {
285 __ vldr(cgen_->ToDoubleRegister(destination), source_operand); 279 __ Ldr(cgen_->ToDoubleRegister(destination), src);
286 } else { 280 } else {
287 ASSERT(destination->IsDoubleStackSlot()); 281 // TODO(all): double stack slot to double stack slot move.
288 MemOperand destination_operand = cgen_->ToMemOperand(destination); 282 UNIMPLEMENTED();
289 if (in_cycle_) {
290 // kSavedDoubleValueRegister was used to break the cycle,
291 // but kSavedValueRegister is free.
292 MemOperand source_high_operand =
293 cgen_->ToHighMemOperand(source);
294 MemOperand destination_high_operand =
295 cgen_->ToHighMemOperand(destination);
296 __ ldr(kSavedValueRegister, source_operand);
297 __ str(kSavedValueRegister, destination_operand);
298 __ ldr(kSavedValueRegister, source_high_operand);
299 __ str(kSavedValueRegister, destination_high_operand);
300 } else {
301 __ vldr(kScratchDoubleReg, source_operand);
302 __ vstr(kScratchDoubleReg, destination_operand);
303 }
304 } 283 }
305 } else { 284 } else {
306 UNREACHABLE(); 285 UNREACHABLE();
307 } 286 }
308 287
288 // The move has been emitted, we can eliminate it.
309 moves_[index].Eliminate(); 289 moves_[index].Eliminate();
310 } 290 }
311 291
312 292
313 #undef __ 293 void LGapResolver::EmitStackSlotMove(int index) {
294 // We need a temp register to perform a stack slot to stack slot move, and
295 // the register must not be involved in breaking cycles.
296
297 // Use the Crankshaft double scratch register as the temporary.
298 DoubleRegister temp = crankshaft_fp_scratch;
299
300 LOperand* src = moves_[index].source();
301 LOperand* dst = moves_[index].destination();
302
303 ASSERT(src->IsStackSlot());
304 ASSERT(dst->IsStackSlot());
305 __ Ldr(temp, cgen_->ToMemOperand(src));
306 __ Str(temp, cgen_->ToMemOperand(dst));
307 }
314 308
315 } } // namespace v8::internal 309 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-gap-resolver-a64.h ('k') | src/a64/macro-assembler-a64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698