| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 cgen()->frame()->SpillAll(); | 157 cgen()->frame()->SpillAll(); |
| 158 VirtualFrame* target_frame = new VirtualFrame(cgen()->frame()); | 158 VirtualFrame* target_frame = new VirtualFrame(cgen()->frame()); |
| 159 target_frame->Adjust(1); | 159 target_frame->Adjust(1); |
| 160 // We do not expect a call with a preconfigured entry frame. | 160 // We do not expect a call with a preconfigured entry frame. |
| 161 ASSERT(entry_frame_ == NULL); | 161 ASSERT(entry_frame_ == NULL); |
| 162 AddReachingFrame(target_frame); | 162 AddReachingFrame(target_frame); |
| 163 __ call(&merge_labels_.last()); | 163 __ call(&merge_labels_.last()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 | 166 |
| 167 void JumpTarget::DoBind(int mergable_elements) { | 167 void JumpTarget::DoBind() { |
| 168 ASSERT(cgen() != NULL); | 168 ASSERT(cgen() != NULL); |
| 169 ASSERT(!is_bound()); | 169 ASSERT(!is_bound()); |
| 170 | 170 |
| 171 // Live non-frame registers are not allowed at the start of a basic | 171 // Live non-frame registers are not allowed at the start of a basic |
| 172 // block. | 172 // block. |
| 173 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); | 173 ASSERT(!cgen()->has_valid_frame() || cgen()->HasValidEntryRegisters()); |
| 174 | 174 |
| 175 // Fast case: the jump target was manually configured with an entry | 175 // Fast case: the jump target was manually configured with an entry |
| 176 // frame to use. | 176 // frame to use. |
| 177 if (entry_frame_ != NULL) { | 177 if (entry_frame_ != NULL) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 203 int difference = frame->stack_pointer_ - (frame->element_count() - 1); | 203 int difference = frame->stack_pointer_ - (frame->element_count() - 1); |
| 204 if (difference > 0) { | 204 if (difference > 0) { |
| 205 frame->stack_pointer_ -= difference; | 205 frame->stack_pointer_ -= difference; |
| 206 __ add(Operand(esp), Immediate(difference * kPointerSize)); | 206 __ add(Operand(esp), Immediate(difference * kPointerSize)); |
| 207 } | 207 } |
| 208 } else { | 208 } else { |
| 209 ASSERT(direction_ == BIDIRECTIONAL); | 209 ASSERT(direction_ == BIDIRECTIONAL); |
| 210 // Fast case: no forward jumps, possible backward ones. Remove | 210 // Fast case: no forward jumps, possible backward ones. Remove |
| 211 // constants and copies above the watermark on the fall-through | 211 // constants and copies above the watermark on the fall-through |
| 212 // frame and use it as the entry frame. | 212 // frame and use it as the entry frame. |
| 213 cgen()->frame()->MakeMergable(mergable_elements); | 213 cgen()->frame()->MakeMergable(); |
| 214 entry_frame_ = new VirtualFrame(cgen()->frame()); | 214 entry_frame_ = new VirtualFrame(cgen()->frame()); |
| 215 } | 215 } |
| 216 __ bind(&entry_label_); | 216 __ bind(&entry_label_); |
| 217 return; | 217 return; |
| 218 } | 218 } |
| 219 | 219 |
| 220 if (direction_ == FORWARD_ONLY && | 220 if (direction_ == FORWARD_ONLY && |
| 221 !cgen()->has_valid_frame() && | 221 !cgen()->has_valid_frame() && |
| 222 reaching_frames_.length() == 1) { | 222 reaching_frames_.length() == 1) { |
| 223 // Fast case: no fall-through, a single forward jump, and no | 223 // Fast case: no fall-through, a single forward jump, and no |
| (...skipping 21 matching lines...) Expand all Loading... |
| 245 // is owned by the reaching frames for now. | 245 // is owned by the reaching frames for now. |
| 246 bool had_fall_through = false; | 246 bool had_fall_through = false; |
| 247 if (cgen()->has_valid_frame()) { | 247 if (cgen()->has_valid_frame()) { |
| 248 had_fall_through = true; | 248 had_fall_through = true; |
| 249 AddReachingFrame(cgen()->frame()); // Return value ignored. | 249 AddReachingFrame(cgen()->frame()); // Return value ignored. |
| 250 RegisterFile empty; | 250 RegisterFile empty; |
| 251 cgen()->SetFrame(NULL, &empty); | 251 cgen()->SetFrame(NULL, &empty); |
| 252 } | 252 } |
| 253 | 253 |
| 254 // Compute the frame to use for entry to the block. | 254 // Compute the frame to use for entry to the block. |
| 255 ComputeEntryFrame(mergable_elements); | 255 ComputeEntryFrame(); |
| 256 | 256 |
| 257 // Some moves required to merge to an expected frame require purely | 257 // Some moves required to merge to an expected frame require purely |
| 258 // frame state changes, and do not require any code generation. | 258 // frame state changes, and do not require any code generation. |
| 259 // Perform those first to increase the possibility of finding equal | 259 // Perform those first to increase the possibility of finding equal |
| 260 // frames below. | 260 // frames below. |
| 261 for (int i = 0; i < reaching_frames_.length(); i++) { | 261 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 262 if (reaching_frames_[i] != NULL) { | 262 if (reaching_frames_[i] != NULL) { |
| 263 reaching_frames_[i]->PrepareMergeTo(entry_frame_); | 263 reaching_frames_[i]->PrepareMergeTo(entry_frame_); |
| 264 } | 264 } |
| 265 } | 265 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 cgen()->frame()->MergeTo(entry_frame_); | 359 cgen()->frame()->MergeTo(entry_frame_); |
| 360 } | 360 } |
| 361 | 361 |
| 362 __ bind(&entry_label_); | 362 __ bind(&entry_label_); |
| 363 } | 363 } |
| 364 | 364 |
| 365 #undef __ | 365 #undef __ |
| 366 | 366 |
| 367 | 367 |
| 368 } } // namespace v8::internal | 368 } } // namespace v8::internal |
| OLD | NEW |