| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 | 194 |
| 195 if (!is_linked()) { | 195 if (!is_linked()) { |
| 196 ASSERT(cgen()->has_valid_frame()); | 196 ASSERT(cgen()->has_valid_frame()); |
| 197 if (direction_ == FORWARD_ONLY) { | 197 if (direction_ == FORWARD_ONLY) { |
| 198 // Fast case: no forward jumps and no possible backward jumps. | 198 // Fast case: no forward jumps and no possible backward jumps. |
| 199 // The stack pointer can be floating above the top of the | 199 // The stack pointer can be floating above the top of the |
| 200 // virtual frame before the bind. Afterward, it should not. | 200 // virtual frame before the bind. Afterward, it should not. |
| 201 VirtualFrame* frame = cgen()->frame(); | 201 VirtualFrame* frame = cgen()->frame(); |
| 202 int difference = | 202 int difference = frame->stack_pointer_ - (frame->element_count() - 1); |
| 203 frame->stack_pointer_ - (frame->elements_.length() - 1); | |
| 204 if (difference > 0) { | 203 if (difference > 0) { |
| 205 frame->stack_pointer_ -= difference; | 204 frame->stack_pointer_ -= difference; |
| 206 __ add(Operand(esp), Immediate(difference * kPointerSize)); | 205 __ add(Operand(esp), Immediate(difference * kPointerSize)); |
| 207 } | 206 } |
| 208 } else { | 207 } else { |
| 209 ASSERT(direction_ == BIDIRECTIONAL); | 208 ASSERT(direction_ == BIDIRECTIONAL); |
| 210 // Fast case: no forward jumps, possible backward ones. Remove | 209 // Fast case: no forward jumps, possible backward ones. Remove |
| 211 // constants and copies above the watermark on the fall-through | 210 // constants and copies above the watermark on the fall-through |
| 212 // frame and use it as the entry frame. | 211 // frame and use it as the entry frame. |
| 213 cgen()->frame()->MakeMergable(mergable_elements); | 212 cgen()->frame()->MakeMergable(mergable_elements); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 224 // possible backward jumps. Pick up the only reaching frame, take | 223 // possible backward jumps. Pick up the only reaching frame, take |
| 225 // ownership of it, and use it for the block about to be emitted. | 224 // ownership of it, and use it for the block about to be emitted. |
| 226 VirtualFrame* frame = reaching_frames_[0]; | 225 VirtualFrame* frame = reaching_frames_[0]; |
| 227 RegisterFile reserved = RegisterAllocator::Reserved(); | 226 RegisterFile reserved = RegisterAllocator::Reserved(); |
| 228 cgen()->SetFrame(frame, &reserved); | 227 cgen()->SetFrame(frame, &reserved); |
| 229 reaching_frames_[0] = NULL; | 228 reaching_frames_[0] = NULL; |
| 230 __ bind(&merge_labels_[0]); | 229 __ bind(&merge_labels_[0]); |
| 231 | 230 |
| 232 // The stack pointer can be floating above the top of the | 231 // The stack pointer can be floating above the top of the |
| 233 // virtual frame before the bind. Afterward, it should not. | 232 // virtual frame before the bind. Afterward, it should not. |
| 234 int difference = | 233 int difference = frame->stack_pointer_ - (frame->element_count() - 1); |
| 235 frame->stack_pointer_ - (frame->elements_.length() - 1); | |
| 236 if (difference > 0) { | 234 if (difference > 0) { |
| 237 frame->stack_pointer_ -= difference; | 235 frame->stack_pointer_ -= difference; |
| 238 __ add(Operand(esp), Immediate(difference * kPointerSize)); | 236 __ add(Operand(esp), Immediate(difference * kPointerSize)); |
| 239 } | 237 } |
| 240 | 238 |
| 241 __ bind(&entry_label_); | 239 __ bind(&entry_label_); |
| 242 return; | 240 return; |
| 243 } | 241 } |
| 244 | 242 |
| 245 // If there is a current frame, record it as the fall-through. It | 243 // If there is a current frame, record it as the fall-through. It |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 cgen()->frame()->MergeTo(entry_frame_); | 358 cgen()->frame()->MergeTo(entry_frame_); |
| 361 } | 359 } |
| 362 | 360 |
| 363 __ bind(&entry_label_); | 361 __ bind(&entry_label_); |
| 364 } | 362 } |
| 365 | 363 |
| 366 #undef __ | 364 #undef __ |
| 367 | 365 |
| 368 | 366 |
| 369 } } // namespace v8::internal | 367 } } // namespace v8::internal |
| OLD | NEW |