OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 // Clear the dirty bits for the range of elements in | 155 // Clear the dirty bits for the range of elements in |
156 // [min(stack_pointer_ + 1,begin), end]. | 156 // [min(stack_pointer_ + 1,begin), end]. |
157 void VirtualFrame::SyncRange(int begin, int end) { | 157 void VirtualFrame::SyncRange(int begin, int end) { |
158 ASSERT(begin >= 0); | 158 ASSERT(begin >= 0); |
159 ASSERT(end < element_count()); | 159 ASSERT(end < element_count()); |
160 // Sync elements below the range if they have not been materialized | 160 // Sync elements below the range if they have not been materialized |
161 // on the stack. | 161 // on the stack. |
162 int start = Min(begin, stack_pointer_ + 1); | 162 int start = Min(begin, stack_pointer_ + 1); |
163 | 163 |
164 // Emit normal 'push' instructions for elements above stack pointer | 164 // If positive we have to adjust the stack pointer. |
165 // and use mov instructions if we are below stack pointer. | 165 int delta = end - stack_pointer_; |
| 166 if (delta > 0) { |
| 167 stack_pointer_ = end; |
| 168 __ sub(Operand(esp), Immediate(delta * kPointerSize)); |
| 169 } |
| 170 |
166 for (int i = start; i <= end; i++) { | 171 for (int i = start; i <= end; i++) { |
167 if (!elements_[i].is_synced()) { | 172 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i); |
168 if (i <= stack_pointer_) { | |
169 SyncElementBelowStackPointer(i); | |
170 } else { | |
171 SyncElementByPushing(i); | |
172 } | |
173 } | |
174 } | 173 } |
175 } | 174 } |
176 | 175 |
177 | 176 |
178 void VirtualFrame::MakeMergable() { | 177 void VirtualFrame::MakeMergable() { |
179 for (int i = 0; i < element_count(); i++) { | 178 for (int i = 0; i < element_count(); i++) { |
180 FrameElement element = elements_[i]; | 179 FrameElement element = elements_[i]; |
181 | 180 |
182 if (element.is_constant() || element.is_copy()) { | 181 if (element.is_constant() || element.is_copy()) { |
183 if (element.is_synced()) { | 182 if (element.is_synced()) { |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 ASSERT(stack_pointer_ == element_count() - 1); | 1078 ASSERT(stack_pointer_ == element_count() - 1); |
1080 elements_.Add(FrameElement::MemoryElement()); | 1079 elements_.Add(FrameElement::MemoryElement()); |
1081 stack_pointer_++; | 1080 stack_pointer_++; |
1082 __ push(immediate); | 1081 __ push(immediate); |
1083 } | 1082 } |
1084 | 1083 |
1085 | 1084 |
1086 #undef __ | 1085 #undef __ |
1087 | 1086 |
1088 } } // namespace v8::internal | 1087 } } // namespace v8::internal |
OLD | NEW |