| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // block. | 155 // block. |
| 156 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); | 156 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); |
| 157 | 157 |
| 158 if (direction_ == FORWARD_ONLY) { | 158 if (direction_ == FORWARD_ONLY) { |
| 159 // A simple case: no forward jumps and no possible backward jumps. | 159 // A simple case: no forward jumps and no possible backward jumps. |
| 160 if (!is_linked()) { | 160 if (!is_linked()) { |
| 161 // The stack pointer can be floating above the top of the | 161 // The stack pointer can be floating above the top of the |
| 162 // virtual frame before the bind. Afterward, it should not. | 162 // virtual frame before the bind. Afterward, it should not. |
| 163 ASSERT(cgen()->has_valid_frame()); | 163 ASSERT(cgen()->has_valid_frame()); |
| 164 VirtualFrame* frame = cgen()->frame(); | 164 VirtualFrame* frame = cgen()->frame(); |
| 165 int difference = | 165 int difference = frame->stack_pointer_ - (frame->element_count() - 1); |
| 166 frame->stack_pointer_ - (frame->elements_.length() - 1); | |
| 167 if (difference > 0) { | 166 if (difference > 0) { |
| 168 frame->stack_pointer_ -= difference; | 167 frame->stack_pointer_ -= difference; |
| 169 __ add(sp, sp, Operand(difference * kPointerSize)); | 168 __ add(sp, sp, Operand(difference * kPointerSize)); |
| 170 } | 169 } |
| 171 __ bind(&entry_label_); | 170 __ bind(&entry_label_); |
| 172 return; | 171 return; |
| 173 } | 172 } |
| 174 | 173 |
| 175 // Another simple case: no fall through, a single forward jump, | 174 // Another simple case: no fall through, a single forward jump, |
| 176 // and no possible backward jumps. | 175 // and no possible backward jumps. |
| 177 if (!cgen()->has_valid_frame() && reaching_frames_.length() == 1) { | 176 if (!cgen()->has_valid_frame() && reaching_frames_.length() == 1) { |
| 178 // Pick up the only reaching frame, take ownership of it, and | 177 // Pick up the only reaching frame, take ownership of it, and |
| 179 // use it for the block about to be emitted. | 178 // use it for the block about to be emitted. |
| 180 VirtualFrame* frame = reaching_frames_[0]; | 179 VirtualFrame* frame = reaching_frames_[0]; |
| 181 RegisterFile reserved = RegisterAllocator::Reserved(); | 180 RegisterFile reserved = RegisterAllocator::Reserved(); |
| 182 cgen()->SetFrame(frame, &reserved); | 181 cgen()->SetFrame(frame, &reserved); |
| 183 reaching_frames_[0] = NULL; | 182 reaching_frames_[0] = NULL; |
| 184 __ bind(&merge_labels_[0]); | 183 __ bind(&merge_labels_[0]); |
| 185 | 184 |
| 186 // The stack pointer can be floating above the top of the | 185 // The stack pointer can be floating above the top of the |
| 187 // virtual frame before the bind. Afterward, it should not. | 186 // virtual frame before the bind. Afterward, it should not. |
| 188 int difference = | 187 int difference = frame->stack_pointer_ - (frame->element_count() - 1); |
| 189 frame->stack_pointer_ - (frame->elements_.length() - 1); | |
| 190 if (difference > 0) { | 188 if (difference > 0) { |
| 191 frame->stack_pointer_ -= difference; | 189 frame->stack_pointer_ -= difference; |
| 192 __ add(sp, sp, Operand(difference * kPointerSize)); | 190 __ add(sp, sp, Operand(difference * kPointerSize)); |
| 193 } | 191 } |
| 194 __ bind(&entry_label_); | 192 __ bind(&entry_label_); |
| 195 return; | 193 return; |
| 196 } | 194 } |
| 197 } | 195 } |
| 198 | 196 |
| 199 // If there is a current frame, record it as the fall-through. It | 197 // If there is a current frame, record it as the fall-through. It |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 cgen()->frame()->MergeTo(entry_frame_); | 314 cgen()->frame()->MergeTo(entry_frame_); |
| 317 } | 315 } |
| 318 | 316 |
| 319 __ bind(&entry_label_); | 317 __ bind(&entry_label_); |
| 320 } | 318 } |
| 321 | 319 |
| 322 #undef __ | 320 #undef __ |
| 323 | 321 |
| 324 | 322 |
| 325 } } // namespace v8::internal | 323 } } // namespace v8::internal |
| OLD | NEW |