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

Side by Side Diff: src/virtual-frame-arm.cc

Issue 42017: Fix issue 265 by handling extra statement state on the frame based on... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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/virtual-frame-arm.h ('k') | src/virtual-frame-ia32.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 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (stack_pointer_ < expected->stack_pointer_) { 161 if (stack_pointer_ < expected->stack_pointer_) {
162 int difference = expected->stack_pointer_ - stack_pointer_; 162 int difference = expected->stack_pointer_ - stack_pointer_;
163 stack_pointer_ = expected->stack_pointer_; 163 stack_pointer_ = expected->stack_pointer_;
164 __ sub(sp, sp, Operand(difference * kPointerSize)); 164 __ sub(sp, sp, Operand(difference * kPointerSize));
165 } 165 }
166 166
167 MergeMoveRegistersToMemory(expected); 167 MergeMoveRegistersToMemory(expected);
168 MergeMoveRegistersToRegisters(expected); 168 MergeMoveRegistersToRegisters(expected);
169 MergeMoveMemoryToRegisters(expected); 169 MergeMoveMemoryToRegisters(expected);
170 170
171 // Fix any sync bit problems. 171 // Fix any sync bit problems from the bottom-up, stopping when we
172 for (int i = 0; i <= stack_pointer_; i++) { 172 // hit the stack pointer or the top of the frame if the stack
173 // pointer is floating above the frame.
174 int limit = Min(stack_pointer_, elements_.length() - 1);
175 for (int i = 0; i <= limit; i++) {
173 FrameElement source = elements_[i]; 176 FrameElement source = elements_[i];
174 FrameElement target = expected->elements_[i]; 177 FrameElement target = expected->elements_[i];
175 if (source.is_synced() && !target.is_synced()) { 178 if (source.is_synced() && !target.is_synced()) {
176 elements_[i].clear_sync(); 179 elements_[i].clear_sync();
177 } else if (!source.is_synced() && target.is_synced()) { 180 } else if (!source.is_synced() && target.is_synced()) {
178 SyncElementAt(i); 181 SyncElementAt(i);
179 } 182 }
180 } 183 }
181 184
182 // Adjust the stack point downard if necessary. 185 // Adjust the stack point downard if necessary.
183 if (stack_pointer_ > expected->stack_pointer_) { 186 if (stack_pointer_ > expected->stack_pointer_) {
184 int difference = stack_pointer_ - expected->stack_pointer_; 187 int difference = stack_pointer_ - expected->stack_pointer_;
185 stack_pointer_ = expected->stack_pointer_; 188 stack_pointer_ = expected->stack_pointer_;
186 __ add(sp, sp, Operand(difference * kPointerSize)); 189 __ add(sp, sp, Operand(difference * kPointerSize));
187 } 190 }
188 191
189 // At this point, the frames should be identical. 192 // At this point, the frames should be identical.
190 ASSERT(Equals(expected)); 193 ASSERT(Equals(expected));
191 } 194 }
192 195
193 196
194 void VirtualFrame::MergeMoveRegistersToMemory(VirtualFrame* expected) { 197 void VirtualFrame::MergeMoveRegistersToMemory(VirtualFrame* expected) {
195 ASSERT(stack_pointer_ >= expected->stack_pointer_); 198 ASSERT(stack_pointer_ >= expected->stack_pointer_);
196 199
197 // Move registers, constants, and copies to memory. Perform moves 200 // Move registers, constants, and copies to memory. Perform moves
198 // from the top downward in the frame in order to leave the backing 201 // from the top downward in the frame in order to leave the backing
199 // stores of copies in registers. 202 // stores of copies in registers.
200 // 203 // On ARM, all elements are in memory.
201 // Moving memory-backed copies to memory requires a spare register
202 // for the memory-to-memory moves. Since we are performing a merge,
203 // we use esi (which is already saved in the frame). We keep track
204 // of the index of the frame element esi is caching or kIllegalIndex
205 // if esi has not been disturbed.
206 204
207 for (int i = 0; i < elements_.length(); i++) { 205 #ifdef DEBUG
206 int start = Min(stack_pointer_, elements_.length() - 1);
207 for (int i = start; i >= 0; i--) {
208 ASSERT(elements_[i].is_memory()); 208 ASSERT(elements_[i].is_memory());
209 ASSERT(expected->elements_[i].is_memory()); 209 ASSERT(expected->elements_[i].is_memory());
210 } 210 }
211 #endif
211 } 212 }
212 213
213 214
214 void VirtualFrame::MergeMoveRegistersToRegisters(VirtualFrame* expected) { 215 void VirtualFrame::MergeMoveRegistersToRegisters(VirtualFrame* expected) {
215 } 216 }
216 217
217 218
218 void VirtualFrame::MergeMoveMemoryToRegisters(VirtualFrame *expected) { 219 void VirtualFrame::MergeMoveMemoryToRegisters(VirtualFrame *expected) {
219 } 220 }
220 221
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 ASSERT(stack_pointer_ == elements_.length() - 1); 473 ASSERT(stack_pointer_ == elements_.length() - 1);
473 elements_.Add(FrameElement::MemoryElement()); 474 elements_.Add(FrameElement::MemoryElement());
474 stack_pointer_++; 475 stack_pointer_++;
475 __ push(reg); 476 __ push(reg);
476 } 477 }
477 478
478 479
479 #undef __ 480 #undef __
480 481
481 } } // namespace v8::internal 482 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/virtual-frame-arm.h ('k') | src/virtual-frame-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698