OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // for possible reuse as a backward merge block. | 355 // for possible reuse as a backward merge block. |
356 RegisterFile empty; | 356 RegisterFile empty; |
357 cgen()->SetFrame(new VirtualFrame(reaching_frames_[0]), &empty); | 357 cgen()->SetFrame(new VirtualFrame(reaching_frames_[0]), &empty); |
358 __ bind(&merge_labels_[0]); | 358 __ bind(&merge_labels_[0]); |
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 |
| 366 void BreakTarget::Jump() { |
| 367 // Drop leftover statement state from the frame before merging, without |
| 368 // emitting code. |
| 369 ASSERT(cgen()->has_valid_frame()); |
| 370 int count = cgen()->frame()->height() - expected_height_; |
| 371 cgen()->frame()->ForgetElements(count); |
| 372 DoJump(); |
| 373 } |
| 374 |
| 375 |
| 376 void BreakTarget::Jump(Result* arg) { |
| 377 // Drop leftover statement state from the frame before merging, without |
| 378 // emitting code. |
| 379 ASSERT(cgen()->has_valid_frame()); |
| 380 int count = cgen()->frame()->height() - expected_height_; |
| 381 cgen()->frame()->ForgetElements(count); |
| 382 cgen()->frame()->Push(arg); |
| 383 DoJump(); |
| 384 } |
| 385 |
| 386 |
| 387 void BreakTarget::Bind() { |
| 388 #ifdef DEBUG |
| 389 // All the forward-reaching frames should have been adjusted at the |
| 390 // jumps to this target. |
| 391 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 392 ASSERT(reaching_frames_[i] == NULL || |
| 393 reaching_frames_[i]->height() == expected_height_); |
| 394 } |
| 395 #endif |
| 396 // Drop leftover statement state from the frame before merging, even on |
| 397 // the fall through. This is so we can bind the return target with state |
| 398 // on the frame. |
| 399 if (cgen()->has_valid_frame()) { |
| 400 int count = cgen()->frame()->height() - expected_height_; |
| 401 cgen()->frame()->ForgetElements(count); |
| 402 } |
| 403 DoBind(); |
| 404 } |
| 405 |
| 406 |
| 407 void BreakTarget::Bind(Result* arg) { |
| 408 #ifdef DEBUG |
| 409 // All the forward-reaching frames should have been adjusted at the |
| 410 // jumps to this target. |
| 411 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 412 ASSERT(reaching_frames_[i] == NULL || |
| 413 reaching_frames_[i]->height() == expected_height_ + 1); |
| 414 } |
| 415 #endif |
| 416 // Drop leftover statement state from the frame before merging, even on |
| 417 // the fall through. This is so we can bind the return target with state |
| 418 // on the frame. |
| 419 if (cgen()->has_valid_frame()) { |
| 420 int count = cgen()->frame()->height() - expected_height_; |
| 421 cgen()->frame()->ForgetElements(count); |
| 422 cgen()->frame()->Push(arg); |
| 423 } |
| 424 DoBind(); |
| 425 *arg = cgen()->frame()->Pop(); |
| 426 } |
| 427 |
| 428 |
365 #undef __ | 429 #undef __ |
366 | 430 |
367 | 431 |
368 } } // namespace v8::internal | 432 } } // namespace v8::internal |
OLD | NEW |