OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (stack_pointer_ < expected->stack_pointer_) { | 164 if (stack_pointer_ < expected->stack_pointer_) { |
165 int difference = expected->stack_pointer_ - stack_pointer_; | 165 int difference = expected->stack_pointer_ - stack_pointer_; |
166 stack_pointer_ = expected->stack_pointer_; | 166 stack_pointer_ = expected->stack_pointer_; |
167 __ sub(Operand(esp), Immediate(difference * kPointerSize)); | 167 __ sub(Operand(esp), Immediate(difference * kPointerSize)); |
168 } | 168 } |
169 | 169 |
170 MergeMoveRegistersToMemory(expected); | 170 MergeMoveRegistersToMemory(expected); |
171 MergeMoveRegistersToRegisters(expected); | 171 MergeMoveRegistersToRegisters(expected); |
172 MergeMoveMemoryToRegisters(expected); | 172 MergeMoveMemoryToRegisters(expected); |
173 | 173 |
174 // Fix any sync bit problems. | 174 // Fix any sync bit problems from the bottom-up, stopping when we |
175 for (int i = 0; i <= stack_pointer_; i++) { | 175 // hit the stack pointer or the top of the frame if the stack |
| 176 // pointer is floating above the frame. |
| 177 int limit = Min(stack_pointer_, elements_.length() - 1); |
| 178 for (int i = 0; i <= limit; i++) { |
176 FrameElement source = elements_[i]; | 179 FrameElement source = elements_[i]; |
177 FrameElement target = expected->elements_[i]; | 180 FrameElement target = expected->elements_[i]; |
178 if (source.is_synced() && !target.is_synced()) { | 181 if (source.is_synced() && !target.is_synced()) { |
179 elements_[i].clear_sync(); | 182 elements_[i].clear_sync(); |
180 } else if (!source.is_synced() && target.is_synced()) { | 183 } else if (!source.is_synced() && target.is_synced()) { |
181 SyncElementAt(i); | 184 SyncElementAt(i); |
182 } | 185 } |
183 } | 186 } |
184 | 187 |
185 // Adjust the stack point downard if necessary. | 188 // Adjust the stack point downard if necessary. |
(...skipping 16 matching lines...) Expand all Loading... |
202 // stores of copies in registers. | 205 // stores of copies in registers. |
203 // | 206 // |
204 // Moving memory-backed copies to memory requires a spare register | 207 // Moving memory-backed copies to memory requires a spare register |
205 // for the memory-to-memory moves. Since we are performing a merge, | 208 // for the memory-to-memory moves. Since we are performing a merge, |
206 // we use esi (which is already saved in the frame). We keep track | 209 // we use esi (which is already saved in the frame). We keep track |
207 // of the index of the frame element esi is caching or kIllegalIndex | 210 // of the index of the frame element esi is caching or kIllegalIndex |
208 // if esi has not been disturbed. | 211 // if esi has not been disturbed. |
209 int esi_caches = kIllegalIndex; | 212 int esi_caches = kIllegalIndex; |
210 // A "singleton" memory element. | 213 // A "singleton" memory element. |
211 FrameElement memory_element = FrameElement::MemoryElement(); | 214 FrameElement memory_element = FrameElement::MemoryElement(); |
212 for (int i = stack_pointer_; i >= 0; i--) { | 215 // Loop downward from the stack pointer or the top of the frame if |
| 216 // the stack pointer is floating above the frame. |
| 217 int start = Min(stack_pointer_, elements_.length() - 1); |
| 218 for (int i = start; i >= 0; i--) { |
213 FrameElement target = expected->elements_[i]; | 219 FrameElement target = expected->elements_[i]; |
214 if (target.is_memory()) { | 220 if (target.is_memory()) { |
215 FrameElement source = elements_[i]; | 221 FrameElement source = elements_[i]; |
216 switch (source.type()) { | 222 switch (source.type()) { |
217 case FrameElement::INVALID: | 223 case FrameElement::INVALID: |
218 // Not a legal merge move. | 224 // Not a legal merge move. |
219 UNREACHABLE(); | 225 UNREACHABLE(); |
220 break; | 226 break; |
221 | 227 |
222 case FrameElement::MEMORY: | 228 case FrameElement::MEMORY: |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 ASSERT(stack_pointer_ == elements_.length() - 1); | 986 ASSERT(stack_pointer_ == elements_.length() - 1); |
981 elements_.Add(FrameElement::MemoryElement()); | 987 elements_.Add(FrameElement::MemoryElement()); |
982 stack_pointer_++; | 988 stack_pointer_++; |
983 __ push(immediate); | 989 __ push(immediate); |
984 } | 990 } |
985 | 991 |
986 | 992 |
987 #undef __ | 993 #undef __ |
988 | 994 |
989 } } // namespace v8::internal | 995 } } // namespace v8::internal |
OLD | NEW |