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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } | 298 } |
299 __ bind(&merge_labels_[i]); | 299 __ bind(&merge_labels_[i]); |
300 | 300 |
301 // Loop over the remaining (non-null) reaching frames, | 301 // Loop over the remaining (non-null) reaching frames, |
302 // looking for any that can share merge code with this one. | 302 // looking for any that can share merge code with this one. |
303 for (int j = 0; j < i; j++) { | 303 for (int j = 0; j < i; j++) { |
304 VirtualFrame* other = reaching_frames_[j]; | 304 VirtualFrame* other = reaching_frames_[j]; |
305 if (other != NULL && other->Equals(cgen_->frame())) { | 305 if (other != NULL && other->Equals(cgen_->frame())) { |
306 // Set the reaching frame element to null to avoid | 306 // Set the reaching frame element to null to avoid |
307 // processing it later, and then bind its entry label. | 307 // processing it later, and then bind its entry label. |
308 delete other; | |
309 reaching_frames_[j] = NULL; | 308 reaching_frames_[j] = NULL; |
310 __ bind(&merge_labels_[j]); | 309 __ bind(&merge_labels_[j]); |
311 } | 310 } |
312 } | 311 } |
313 | 312 |
314 // Emit the merge code. | 313 // Emit the merge code. |
315 cgen_->frame()->MergeTo(entry_frame_); | 314 cgen_->frame()->MergeTo(entry_frame_); |
316 } else if (i == reaching_frames_.length() - 1 && had_fall_through) { | 315 } else if (i == reaching_frames_.length() - 1 && had_fall_through) { |
317 // If this is the fall through frame, and it didn't need | 316 // If this is the fall through frame, and it didn't need |
318 // merge code, we need to pick up the frame so we can jump | 317 // merge code, we need to pick up the frame so we can jump |
(...skipping 16 matching lines...) Expand all Loading... |
335 // There is certainly a current frame equal to the entry frame. | 334 // There is certainly a current frame equal to the entry frame. |
336 // Bind the entry frame label. | 335 // Bind the entry frame label. |
337 __ bind(&entry_label_); | 336 __ bind(&entry_label_); |
338 | 337 |
339 // There may be unprocessed reaching frames that did not need | 338 // There may be unprocessed reaching frames that did not need |
340 // merge code. They will have unbound merge labels. Bind their | 339 // merge code. They will have unbound merge labels. Bind their |
341 // merge labels to be the same as the entry label and deallocate | 340 // merge labels to be the same as the entry label and deallocate |
342 // them. | 341 // them. |
343 for (int i = 0; i < reaching_frames_.length(); i++) { | 342 for (int i = 0; i < reaching_frames_.length(); i++) { |
344 if (!merge_labels_[i].is_bound()) { | 343 if (!merge_labels_[i].is_bound()) { |
345 delete reaching_frames_[i]; | |
346 reaching_frames_[i] = NULL; | 344 reaching_frames_[i] = NULL; |
347 __ bind(&merge_labels_[i]); | 345 __ bind(&merge_labels_[i]); |
348 } | 346 } |
349 } | 347 } |
350 | 348 |
351 // There are non-NULL reaching frames with bound labels for each | 349 // There are non-NULL reaching frames with bound labels for each |
352 // merge block, but only on backward targets. | 350 // merge block, but only on backward targets. |
353 } else { | 351 } else { |
354 // There were no forward jumps. There must be a current frame and | 352 // There were no forward jumps. There must be a current frame and |
355 // this must be a bidirectional target. | 353 // this must be a bidirectional target. |
(...skipping 11 matching lines...) Expand all Loading... |
367 } | 365 } |
368 | 366 |
369 is_linked_ = false; | 367 is_linked_ = false; |
370 is_bound_ = true; | 368 is_bound_ = true; |
371 } | 369 } |
372 | 370 |
373 #undef __ | 371 #undef __ |
374 | 372 |
375 | 373 |
376 } } // namespace v8::internal | 374 } } // namespace v8::internal |
OLD | NEW |