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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 __ bind(&merge_labels_[i]); | 266 __ bind(&merge_labels_[i]); |
267 | 267 |
268 // Loop over the remaining (non-null) reaching frames, | 268 // Loop over the remaining (non-null) reaching frames, |
269 // looking for any that can share merge code with this one. | 269 // looking for any that can share merge code with this one. |
270 for (int j = 0; j < i; j++) { | 270 for (int j = 0; j < i; j++) { |
271 VirtualFrame* other = reaching_frames_[j]; | 271 VirtualFrame* other = reaching_frames_[j]; |
272 if (other != NULL && other->Equals(cgen_->frame())) { | 272 if (other != NULL && other->Equals(cgen_->frame())) { |
273 // Set the reaching frame element to null to avoid | 273 // Set the reaching frame element to null to avoid |
274 // processing it later, and then bind its entry label. | 274 // processing it later, and then bind its entry label. |
275 delete other; | |
276 reaching_frames_[j] = NULL; | 275 reaching_frames_[j] = NULL; |
277 __ bind(&merge_labels_[j]); | 276 __ bind(&merge_labels_[j]); |
278 } | 277 } |
279 } | 278 } |
280 | 279 |
281 // Emit the merge code. | 280 // Emit the merge code. |
282 cgen_->frame()->MergeTo(entry_frame_); | 281 cgen_->frame()->MergeTo(entry_frame_); |
283 } else if (i == reaching_frames_.length() - 1 && had_fall_through) { | 282 } else if (i == reaching_frames_.length() - 1 && had_fall_through) { |
284 // If this is the fall through, and it didn't need merge | 283 // If this is the fall through, and it didn't need merge |
285 // code, we need to pick up the frame so we can jump around | 284 // code, we need to pick up the frame so we can jump around |
(...skipping 16 matching lines...) Expand all Loading... |
302 // There is certainly a current frame equal to the entry frame. | 301 // There is certainly a current frame equal to the entry frame. |
303 // Bind the entry frame label. | 302 // Bind the entry frame label. |
304 __ bind(&entry_label_); | 303 __ bind(&entry_label_); |
305 | 304 |
306 // There may be unprocessed reaching frames that did not need | 305 // There may be unprocessed reaching frames that did not need |
307 // merge code. They will have unbound merge labels. Bind their | 306 // merge code. They will have unbound merge labels. Bind their |
308 // merge labels to be the same as the entry label and deallocate | 307 // merge labels to be the same as the entry label and deallocate |
309 // them. | 308 // them. |
310 for (int i = 0; i < reaching_frames_.length(); i++) { | 309 for (int i = 0; i < reaching_frames_.length(); i++) { |
311 if (!merge_labels_[i].is_bound()) { | 310 if (!merge_labels_[i].is_bound()) { |
312 delete reaching_frames_[i]; | |
313 reaching_frames_[i] = NULL; | 311 reaching_frames_[i] = NULL; |
314 __ bind(&merge_labels_[i]); | 312 __ bind(&merge_labels_[i]); |
315 } | 313 } |
316 } | 314 } |
317 | 315 |
318 // There are non-NULL reaching frames with bound labels for each | 316 // There are non-NULL reaching frames with bound labels for each |
319 // merge block, but only on backward targets. | 317 // merge block, but only on backward targets. |
320 } else { | 318 } else { |
321 // There were no forward jumps. There must be a current frame and | 319 // There were no forward jumps. There must be a current frame and |
322 // this must be a bidirectional target. | 320 // this must be a bidirectional target. |
(...skipping 11 matching lines...) Expand all Loading... |
334 } | 332 } |
335 | 333 |
336 is_linked_ = false; | 334 is_linked_ = false; |
337 is_bound_ = true; | 335 is_bound_ = true; |
338 } | 336 } |
339 | 337 |
340 #undef __ | 338 #undef __ |
341 | 339 |
342 | 340 |
343 } } // namespace v8::internal | 341 } } // namespace v8::internal |
OLD | NEW |