| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // the expression stack. | 291 // the expression stack. |
| 292 int stack_pointer = length - 1; | 292 int stack_pointer = length - 1; |
| 293 while (stack_pointer >= entry_frame_->expression_base_index() && | 293 while (stack_pointer >= entry_frame_->expression_base_index() && |
| 294 !entry_frame_->elements_[stack_pointer].is_synced()) { | 294 !entry_frame_->elements_[stack_pointer].is_synced()) { |
| 295 stack_pointer--; | 295 stack_pointer--; |
| 296 } | 296 } |
| 297 entry_frame_->stack_pointer_ = stack_pointer; | 297 entry_frame_->stack_pointer_ = stack_pointer; |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 void JumpTarget::Jump() { |
| 302 DoJump(); |
| 303 } |
| 304 |
| 305 |
| 301 void JumpTarget::Jump(Result* arg) { | 306 void JumpTarget::Jump(Result* arg) { |
| 302 ASSERT(cgen_ != NULL); | 307 ASSERT(cgen_ != NULL); |
| 303 ASSERT(cgen_->has_valid_frame()); | 308 ASSERT(cgen_->has_valid_frame()); |
| 304 | 309 |
| 305 cgen_->frame()->Push(arg); | 310 cgen_->frame()->Push(arg); |
| 306 Jump(); | 311 DoJump(); |
| 307 } | 312 } |
| 308 | 313 |
| 309 | 314 |
| 310 void JumpTarget::Jump(Result* arg0, Result* arg1) { | 315 void JumpTarget::Jump(Result* arg0, Result* arg1) { |
| 311 ASSERT(cgen_ != NULL); | 316 ASSERT(cgen_ != NULL); |
| 312 ASSERT(cgen_->has_valid_frame()); | 317 ASSERT(cgen_->has_valid_frame()); |
| 313 | 318 |
| 314 cgen_->frame()->Push(arg0); | 319 cgen_->frame()->Push(arg0); |
| 315 cgen_->frame()->Push(arg1); | 320 cgen_->frame()->Push(arg1); |
| 316 Jump(); | 321 DoJump(); |
| 317 } | 322 } |
| 318 | 323 |
| 319 | 324 |
| 320 void JumpTarget::Jump(Result* arg0, Result* arg1, Result* arg2) { | 325 void JumpTarget::Jump(Result* arg0, Result* arg1, Result* arg2) { |
| 321 ASSERT(cgen_ != NULL); | 326 ASSERT(cgen_ != NULL); |
| 322 ASSERT(cgen_->has_valid_frame()); | 327 ASSERT(cgen_->has_valid_frame()); |
| 323 | 328 |
| 324 cgen_->frame()->Push(arg0); | 329 cgen_->frame()->Push(arg0); |
| 325 cgen_->frame()->Push(arg1); | 330 cgen_->frame()->Push(arg1); |
| 326 cgen_->frame()->Push(arg2); | 331 cgen_->frame()->Push(arg2); |
| 327 Jump(); | 332 DoJump(); |
| 333 } |
| 334 |
| 335 |
| 336 void JumpTarget::Branch(Condition cc, Hint hint) { |
| 337 DoBranch(cc, hint); |
| 328 } | 338 } |
| 329 | 339 |
| 330 | 340 |
| 331 #ifdef DEBUG | 341 #ifdef DEBUG |
| 332 #define DECLARE_ARGCHECK_VARS(name) \ | 342 #define DECLARE_ARGCHECK_VARS(name) \ |
| 333 Result::Type name##_type = name->type(); \ | 343 Result::Type name##_type = name->type(); \ |
| 334 Register name##_reg = name->is_register() ? name->reg() : no_reg | 344 Register name##_reg = name->is_register() ? name->reg() : no_reg |
| 335 | 345 |
| 336 #define ASSERT_ARGCHECK(name) \ | 346 #define ASSERT_ARGCHECK(name) \ |
| 337 ASSERT(name->type() == name##_type); \ | 347 ASSERT(name->type() == name##_type); \ |
| 338 ASSERT(!name->is_register() || name->reg().is(name##_reg)) | 348 ASSERT(!name->is_register() || name->reg().is(name##_reg)) |
| 339 | 349 |
| 340 #else | 350 #else |
| 341 #define DECLARE_ARGCHECK_VARS(name) do {} while (false) | 351 #define DECLARE_ARGCHECK_VARS(name) do {} while (false) |
| 342 | 352 |
| 343 #define ASSERT_ARGCHECK(name) do {} while (false) | 353 #define ASSERT_ARGCHECK(name) do {} while (false) |
| 344 #endif | 354 #endif |
| 345 | 355 |
| 346 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { | 356 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { |
| 347 ASSERT(cgen_ != NULL); | 357 ASSERT(cgen_ != NULL); |
| 348 ASSERT(cgen_->has_valid_frame()); | 358 ASSERT(cgen_->has_valid_frame()); |
| 349 | 359 |
| 350 // We want to check that non-frame registers at the call site stay in | 360 // We want to check that non-frame registers at the call site stay in |
| 351 // the same registers on the fall-through branch. | 361 // the same registers on the fall-through branch. |
| 352 DECLARE_ARGCHECK_VARS(arg); | 362 DECLARE_ARGCHECK_VARS(arg); |
| 353 | 363 |
| 354 cgen_->frame()->Push(arg); | 364 cgen_->frame()->Push(arg); |
| 355 Branch(cc, hint); | 365 DoBranch(cc, hint); |
| 356 *arg = cgen_->frame()->Pop(); | 366 *arg = cgen_->frame()->Pop(); |
| 357 | 367 |
| 358 ASSERT_ARGCHECK(arg); | 368 ASSERT_ARGCHECK(arg); |
| 359 } | 369 } |
| 360 | 370 |
| 361 | 371 |
| 362 void JumpTarget::Branch(Condition cc, Result* arg0, Result* arg1, Hint hint) { | 372 void JumpTarget::Branch(Condition cc, Result* arg0, Result* arg1, Hint hint) { |
| 363 ASSERT(cgen_ != NULL); | 373 ASSERT(cgen_ != NULL); |
| 364 ASSERT(cgen_->frame() != NULL); | 374 ASSERT(cgen_->frame() != NULL); |
| 365 | 375 |
| 366 // We want to check that non-frame registers at the call site stay in | 376 // We want to check that non-frame registers at the call site stay in |
| 367 // the same registers on the fall-through branch. | 377 // the same registers on the fall-through branch. |
| 368 DECLARE_ARGCHECK_VARS(arg0); | 378 DECLARE_ARGCHECK_VARS(arg0); |
| 369 DECLARE_ARGCHECK_VARS(arg1); | 379 DECLARE_ARGCHECK_VARS(arg1); |
| 370 | 380 |
| 371 cgen_->frame()->Push(arg0); | 381 cgen_->frame()->Push(arg0); |
| 372 cgen_->frame()->Push(arg1); | 382 cgen_->frame()->Push(arg1); |
| 373 Branch(cc, hint); | 383 DoBranch(cc, hint); |
| 374 *arg1 = cgen_->frame()->Pop(); | 384 *arg1 = cgen_->frame()->Pop(); |
| 375 *arg0 = cgen_->frame()->Pop(); | 385 *arg0 = cgen_->frame()->Pop(); |
| 376 | 386 |
| 377 ASSERT_ARGCHECK(arg0); | 387 ASSERT_ARGCHECK(arg0); |
| 378 ASSERT_ARGCHECK(arg1); | 388 ASSERT_ARGCHECK(arg1); |
| 379 } | 389 } |
| 380 | 390 |
| 381 | 391 |
| 382 void JumpTarget::Branch(Condition cc, | 392 void JumpTarget::Branch(Condition cc, |
| 383 Result* arg0, | 393 Result* arg0, |
| 384 Result* arg1, | 394 Result* arg1, |
| 385 Result* arg2, | 395 Result* arg2, |
| 386 Hint hint) { | 396 Hint hint) { |
| 387 ASSERT(cgen_ != NULL); | 397 ASSERT(cgen_ != NULL); |
| 388 ASSERT(cgen_->frame() != NULL); | 398 ASSERT(cgen_->frame() != NULL); |
| 389 | 399 |
| 390 // We want to check that non-frame registers at the call site stay in | 400 // We want to check that non-frame registers at the call site stay in |
| 391 // the same registers on the fall-through branch. | 401 // the same registers on the fall-through branch. |
| 392 DECLARE_ARGCHECK_VARS(arg0); | 402 DECLARE_ARGCHECK_VARS(arg0); |
| 393 DECLARE_ARGCHECK_VARS(arg1); | 403 DECLARE_ARGCHECK_VARS(arg1); |
| 394 DECLARE_ARGCHECK_VARS(arg2); | 404 DECLARE_ARGCHECK_VARS(arg2); |
| 395 | 405 |
| 396 cgen_->frame()->Push(arg0); | 406 cgen_->frame()->Push(arg0); |
| 397 cgen_->frame()->Push(arg1); | 407 cgen_->frame()->Push(arg1); |
| 398 cgen_->frame()->Push(arg2); | 408 cgen_->frame()->Push(arg2); |
| 399 Branch(cc, hint); | 409 DoBranch(cc, hint); |
| 400 *arg2 = cgen_->frame()->Pop(); | 410 *arg2 = cgen_->frame()->Pop(); |
| 401 *arg1 = cgen_->frame()->Pop(); | 411 *arg1 = cgen_->frame()->Pop(); |
| 402 *arg0 = cgen_->frame()->Pop(); | 412 *arg0 = cgen_->frame()->Pop(); |
| 403 | 413 |
| 404 ASSERT_ARGCHECK(arg0); | 414 ASSERT_ARGCHECK(arg0); |
| 405 ASSERT_ARGCHECK(arg1); | 415 ASSERT_ARGCHECK(arg1); |
| 406 ASSERT_ARGCHECK(arg2); | 416 ASSERT_ARGCHECK(arg2); |
| 407 } | 417 } |
| 408 | 418 |
| 409 | 419 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 420 // the same registers on the fall-through branch. | 430 // the same registers on the fall-through branch. |
| 421 DECLARE_ARGCHECK_VARS(arg0); | 431 DECLARE_ARGCHECK_VARS(arg0); |
| 422 DECLARE_ARGCHECK_VARS(arg1); | 432 DECLARE_ARGCHECK_VARS(arg1); |
| 423 DECLARE_ARGCHECK_VARS(arg2); | 433 DECLARE_ARGCHECK_VARS(arg2); |
| 424 DECLARE_ARGCHECK_VARS(arg3); | 434 DECLARE_ARGCHECK_VARS(arg3); |
| 425 | 435 |
| 426 cgen_->frame()->Push(arg0); | 436 cgen_->frame()->Push(arg0); |
| 427 cgen_->frame()->Push(arg1); | 437 cgen_->frame()->Push(arg1); |
| 428 cgen_->frame()->Push(arg2); | 438 cgen_->frame()->Push(arg2); |
| 429 cgen_->frame()->Push(arg3); | 439 cgen_->frame()->Push(arg3); |
| 430 Branch(cc, hint); | 440 DoBranch(cc, hint); |
| 431 *arg3 = cgen_->frame()->Pop(); | 441 *arg3 = cgen_->frame()->Pop(); |
| 432 *arg2 = cgen_->frame()->Pop(); | 442 *arg2 = cgen_->frame()->Pop(); |
| 433 *arg1 = cgen_->frame()->Pop(); | 443 *arg1 = cgen_->frame()->Pop(); |
| 434 *arg0 = cgen_->frame()->Pop(); | 444 *arg0 = cgen_->frame()->Pop(); |
| 435 | 445 |
| 436 ASSERT_ARGCHECK(arg0); | 446 ASSERT_ARGCHECK(arg0); |
| 437 ASSERT_ARGCHECK(arg1); | 447 ASSERT_ARGCHECK(arg1); |
| 438 ASSERT_ARGCHECK(arg2); | 448 ASSERT_ARGCHECK(arg2); |
| 439 ASSERT_ARGCHECK(arg3); | 449 ASSERT_ARGCHECK(arg3); |
| 440 } | 450 } |
| 441 | 451 |
| 452 |
| 453 void BreakTarget::Branch(Condition cc, Result* arg, Hint hint) { |
| 454 ASSERT(cgen_ != NULL); |
| 455 ASSERT(cgen_->has_valid_frame()); |
| 456 |
| 457 int count = cgen_->frame()->height() - expected_height_; |
| 458 if (count > 0) { |
| 459 // We negate and branch here rather than using DoBranch's negate |
| 460 // and branch. This gives us a hook to remove statement state |
| 461 // from the frame. |
| 462 JumpTarget fall_through(cgen_); |
| 463 // Branch to fall through will not negate, because it is a |
| 464 // forward-only target. |
| 465 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); |
| 466 Jump(arg); // May emit merge code here. |
| 467 fall_through.Bind(); |
| 468 } else { |
| 469 DECLARE_ARGCHECK_VARS(arg); |
| 470 cgen_->frame()->Push(arg); |
| 471 DoBranch(cc, hint); |
| 472 *arg = cgen_->frame()->Pop(); |
| 473 ASSERT_ARGCHECK(arg); |
| 474 } |
| 475 } |
| 476 |
| 442 #undef DECLARE_ARGCHECK_VARS | 477 #undef DECLARE_ARGCHECK_VARS |
| 443 #undef ASSERT_ARGCHECK | 478 #undef ASSERT_ARGCHECK |
| 444 | 479 |
| 445 | 480 |
| 481 void JumpTarget::Bind(int mergable_elements) { |
| 482 DoBind(mergable_elements); |
| 483 } |
| 484 |
| 485 |
| 446 void JumpTarget::Bind(Result* arg, int mergable_elements) { | 486 void JumpTarget::Bind(Result* arg, int mergable_elements) { |
| 447 ASSERT(cgen_ != NULL); | 487 ASSERT(cgen_ != NULL); |
| 448 | 488 |
| 449 if (cgen_->has_valid_frame()) { | 489 if (cgen_->has_valid_frame()) { |
| 450 cgen_->frame()->Push(arg); | 490 cgen_->frame()->Push(arg); |
| 451 } | 491 } |
| 452 Bind(mergable_elements); | 492 DoBind(mergable_elements); |
| 453 *arg = cgen_->frame()->Pop(); | 493 *arg = cgen_->frame()->Pop(); |
| 454 } | 494 } |
| 455 | 495 |
| 456 | 496 |
| 457 void JumpTarget::Bind(Result* arg0, Result* arg1, int mergable_elements) { | 497 void JumpTarget::Bind(Result* arg0, Result* arg1, int mergable_elements) { |
| 458 ASSERT(cgen_ != NULL); | 498 ASSERT(cgen_ != NULL); |
| 459 | 499 |
| 460 if (cgen_->has_valid_frame()) { | 500 if (cgen_->has_valid_frame()) { |
| 461 cgen_->frame()->Push(arg0); | 501 cgen_->frame()->Push(arg0); |
| 462 cgen_->frame()->Push(arg1); | 502 cgen_->frame()->Push(arg1); |
| 463 } | 503 } |
| 464 Bind(mergable_elements); | 504 DoBind(mergable_elements); |
| 465 *arg1 = cgen_->frame()->Pop(); | 505 *arg1 = cgen_->frame()->Pop(); |
| 466 *arg0 = cgen_->frame()->Pop(); | 506 *arg0 = cgen_->frame()->Pop(); |
| 467 } | 507 } |
| 468 | 508 |
| 469 | 509 |
| 470 void JumpTarget::Bind(Result* arg0, | 510 void JumpTarget::Bind(Result* arg0, |
| 471 Result* arg1, | 511 Result* arg1, |
| 472 Result* arg2, | 512 Result* arg2, |
| 473 int mergable_elements) { | 513 int mergable_elements) { |
| 474 ASSERT(cgen_ != NULL); | 514 ASSERT(cgen_ != NULL); |
| 475 | 515 |
| 476 if (cgen_->has_valid_frame()) { | 516 if (cgen_->has_valid_frame()) { |
| 477 cgen_->frame()->Push(arg0); | 517 cgen_->frame()->Push(arg0); |
| 478 cgen_->frame()->Push(arg1); | 518 cgen_->frame()->Push(arg1); |
| 479 cgen_->frame()->Push(arg2); | 519 cgen_->frame()->Push(arg2); |
| 480 } | 520 } |
| 481 Bind(mergable_elements); | 521 DoBind(mergable_elements); |
| 482 *arg2 = cgen_->frame()->Pop(); | 522 *arg2 = cgen_->frame()->Pop(); |
| 483 *arg1 = cgen_->frame()->Pop(); | 523 *arg1 = cgen_->frame()->Pop(); |
| 484 *arg0 = cgen_->frame()->Pop(); | 524 *arg0 = cgen_->frame()->Pop(); |
| 485 } | 525 } |
| 486 | 526 |
| 487 | 527 |
| 488 void JumpTarget::Bind(Result* arg0, | 528 void JumpTarget::Bind(Result* arg0, |
| 489 Result* arg1, | 529 Result* arg1, |
| 490 Result* arg2, | 530 Result* arg2, |
| 491 Result* arg3, | 531 Result* arg3, |
| 492 int mergable_elements) { | 532 int mergable_elements) { |
| 493 ASSERT(cgen_ != NULL); | 533 ASSERT(cgen_ != NULL); |
| 494 | 534 |
| 495 if (cgen_->has_valid_frame()) { | 535 if (cgen_->has_valid_frame()) { |
| 496 cgen_->frame()->Push(arg0); | 536 cgen_->frame()->Push(arg0); |
| 497 cgen_->frame()->Push(arg1); | 537 cgen_->frame()->Push(arg1); |
| 498 cgen_->frame()->Push(arg2); | 538 cgen_->frame()->Push(arg2); |
| 499 cgen_->frame()->Push(arg3); | 539 cgen_->frame()->Push(arg3); |
| 500 } | 540 } |
| 501 Bind(mergable_elements); | 541 DoBind(mergable_elements); |
| 502 *arg3 = cgen_->frame()->Pop(); | 542 *arg3 = cgen_->frame()->Pop(); |
| 503 *arg2 = cgen_->frame()->Pop(); | 543 *arg2 = cgen_->frame()->Pop(); |
| 504 *arg1 = cgen_->frame()->Pop(); | 544 *arg1 = cgen_->frame()->Pop(); |
| 505 *arg0 = cgen_->frame()->Pop(); | 545 *arg0 = cgen_->frame()->Pop(); |
| 506 } | 546 } |
| 507 | 547 |
| 508 | 548 |
| 509 void JumpTarget::AddReachingFrame(VirtualFrame* frame) { | 549 void JumpTarget::AddReachingFrame(VirtualFrame* frame) { |
| 510 ASSERT(reaching_frames_.length() == merge_labels_.length()); | 550 ASSERT(reaching_frames_.length() == merge_labels_.length()); |
| 511 Label fresh; | 551 Label fresh; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 541 destination->is_bound_ = is_bound_; | 581 destination->is_bound_ = is_bound_; |
| 542 destination->is_linked_ = is_linked_; | 582 destination->is_linked_ = is_linked_; |
| 543 destination->expected_height_ = expected_height_; | 583 destination->expected_height_ = expected_height_; |
| 544 } | 584 } |
| 545 | 585 |
| 546 | 586 |
| 547 void BreakTarget::Jump() { | 587 void BreakTarget::Jump() { |
| 548 ASSERT(cgen_ != NULL); | 588 ASSERT(cgen_ != NULL); |
| 549 ASSERT(cgen_->has_valid_frame()); | 589 ASSERT(cgen_->has_valid_frame()); |
| 550 | 590 |
| 551 // This is a break target so drop leftover statement state from the | 591 // Drop leftover statement state from the frame before merging. |
| 552 // frame before merging. | |
| 553 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); | 592 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); |
| 554 JumpTarget::Jump(); | 593 DoJump(); |
| 594 } |
| 595 |
| 596 |
| 597 void BreakTarget::Jump(Result* arg) { |
| 598 ASSERT(cgen_ != NULL); |
| 599 ASSERT(cgen_->has_valid_frame()); |
| 600 |
| 601 // Drop leftover statement state from the frame before merging. |
| 602 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); |
| 603 cgen_->frame()->Push(arg); |
| 604 DoJump(); |
| 555 } | 605 } |
| 556 | 606 |
| 557 | 607 |
| 558 void BreakTarget::Branch(Condition cc, Hint hint) { | 608 void BreakTarget::Branch(Condition cc, Hint hint) { |
| 559 ASSERT(cgen_ != NULL); | 609 ASSERT(cgen_ != NULL); |
| 560 ASSERT(cgen_->has_valid_frame()); | 610 ASSERT(cgen_->has_valid_frame()); |
| 561 | 611 |
| 562 int count = cgen_->frame()->height() - expected_height_; | 612 int count = cgen_->frame()->height() - expected_height_; |
| 563 if (count > 0) { | 613 if (count > 0) { |
| 564 // We negate and branch here rather than using | 614 // We negate and branch here rather than using DoBranch's negate |
| 565 // JumpTarget::Branch's negate and branch. This gives us a hook | 615 // and branch. This gives us a hook to remove statement state |
| 566 // to remove statement state from the frame. | 616 // from the frame. |
| 567 JumpTarget fall_through(cgen_); | 617 JumpTarget fall_through(cgen_); |
| 568 // Branch to fall through will not negate, because it is a | 618 // Branch to fall through will not negate, because it is a |
| 569 // forward-only target. | 619 // forward-only target. |
| 570 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); | 620 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); |
| 571 Jump(); // May emit merge code here. | 621 Jump(); // May emit merge code here. |
| 572 fall_through.Bind(); | 622 fall_through.Bind(); |
| 573 } else { | 623 } else { |
| 574 JumpTarget::Branch(cc, hint); | 624 DoBranch(cc, hint); |
| 575 } | 625 } |
| 576 } | 626 } |
| 577 | 627 |
| 578 | 628 |
| 579 void BreakTarget::Bind(int mergable_elements) { | 629 void BreakTarget::Bind(int mergable_elements) { |
| 580 #ifdef DEBUG | 630 #ifdef DEBUG |
| 581 ASSERT(mergable_elements == kAllElements); | |
| 582 ASSERT(cgen_ != NULL); | 631 ASSERT(cgen_ != NULL); |
| 583 // All the forward-reaching frames should have been adjusted at the | 632 // All the forward-reaching frames should have been adjusted at the |
| 584 // jumps to this target. | 633 // jumps to this target. |
| 585 for (int i = 0; i < reaching_frames_.length(); i++) { | 634 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 586 ASSERT(reaching_frames_[i] == NULL || | 635 ASSERT(reaching_frames_[i] == NULL || |
| 587 reaching_frames_[i]->height() == expected_height_); | 636 reaching_frames_[i]->height() == expected_height_); |
| 588 } | 637 } |
| 589 #endif | 638 #endif |
| 590 // This is a break target so we drop leftover statement state from | 639 // Drop leftover statement state from the frame before merging, even |
| 591 // the frame before merging, even on the fall through. This is | 640 // on the fall through. This is so we can bind the return target |
| 592 // because we can bind the return target with state on the frame. | 641 // with state on the frame. |
| 593 if (cgen_->has_valid_frame()) { | 642 if (cgen_->has_valid_frame()) { |
| 594 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); | 643 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); |
| 595 } | 644 } |
| 596 JumpTarget::Bind(mergable_elements); | 645 DoBind(mergable_elements); |
| 646 } |
| 647 |
| 648 |
| 649 void BreakTarget::Bind(Result* arg, int mergable_elements) { |
| 650 #ifdef DEBUG |
| 651 ASSERT(cgen_ != NULL); |
| 652 // All the forward-reaching frames should have been adjusted at the |
| 653 // jumps to this target. |
| 654 for (int i = 0; i < reaching_frames_.length(); i++) { |
| 655 ASSERT(reaching_frames_[i] == NULL || |
| 656 reaching_frames_[i]->height() == expected_height_ + 1); |
| 657 } |
| 658 #endif |
| 659 // Drop leftover statement state from the frame before merging, even |
| 660 // on the fall through. This is so we can bind the return target |
| 661 // with state on the frame. |
| 662 if (cgen_->has_valid_frame()) { |
| 663 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); |
| 664 cgen_->frame()->Push(arg); |
| 665 } |
| 666 DoBind(mergable_elements); |
| 667 *arg = cgen_->frame()->Pop(); |
| 597 } | 668 } |
| 598 | 669 |
| 599 | 670 |
| 600 // ------------------------------------------------------------------------- | 671 // ------------------------------------------------------------------------- |
| 601 // ShadowTarget implementation. | 672 // ShadowTarget implementation. |
| 602 | 673 |
| 603 ShadowTarget::ShadowTarget(BreakTarget* shadowed) { | 674 ShadowTarget::ShadowTarget(BreakTarget* shadowed) { |
| 604 ASSERT(shadowed != NULL); | 675 ASSERT(shadowed != NULL); |
| 605 other_target_ = shadowed; | 676 other_target_ = shadowed; |
| 606 | 677 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 temp.CopyTo(this); | 712 temp.CopyTo(this); |
| 642 temp.Reset(); // So the destructor does not deallocate virtual frames. | 713 temp.Reset(); // So the destructor does not deallocate virtual frames. |
| 643 | 714 |
| 644 #ifdef DEBUG | 715 #ifdef DEBUG |
| 645 is_shadowing_ = false; | 716 is_shadowing_ = false; |
| 646 #endif | 717 #endif |
| 647 } | 718 } |
| 648 | 719 |
| 649 | 720 |
| 650 } } // namespace v8::internal | 721 } } // namespace v8::internal |
| OLD | NEW |