Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 | 434 |
| 435 void FullCodeGenerator::StackValueContext::Plug(Register reg) const { | 435 void FullCodeGenerator::StackValueContext::Plug(Register reg) const { |
| 436 __ push(reg); | 436 __ push(reg); |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 void FullCodeGenerator::TestContext::Plug(Register reg) const { | 440 void FullCodeGenerator::TestContext::Plug(Register reg) const { |
| 441 // For simplicity we always test the accumulator register. | 441 // For simplicity we always test the accumulator register. |
| 442 __ Move(result_register(), reg); | 442 __ Move(result_register(), reg); |
| 443 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 443 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
| 444 codegen()->DoTest(true_label_, false_label_, fall_through_); | 444 codegen()->DoTest(condition_, true_label_, false_label_, fall_through_); |
| 445 } | 445 } |
| 446 | 446 |
| 447 | 447 |
| 448 void FullCodeGenerator::EffectContext::PlugTOS() const { | 448 void FullCodeGenerator::EffectContext::PlugTOS() const { |
| 449 __ Drop(1); | 449 __ Drop(1); |
| 450 } | 450 } |
| 451 | 451 |
| 452 | 452 |
| 453 void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const { | 453 void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const { |
| 454 __ pop(result_register()); | 454 __ pop(result_register()); |
| 455 } | 455 } |
| 456 | 456 |
| 457 | 457 |
| 458 void FullCodeGenerator::StackValueContext::PlugTOS() const { | 458 void FullCodeGenerator::StackValueContext::PlugTOS() const { |
| 459 } | 459 } |
| 460 | 460 |
| 461 | 461 |
| 462 void FullCodeGenerator::TestContext::PlugTOS() const { | 462 void FullCodeGenerator::TestContext::PlugTOS() const { |
| 463 // For simplicity we always test the accumulator register. | 463 // For simplicity we always test the accumulator register. |
| 464 __ pop(result_register()); | 464 __ pop(result_register()); |
| 465 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 465 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
| 466 codegen()->DoTest(true_label_, false_label_, fall_through_); | 466 codegen()->DoTest(condition_, true_label_, false_label_, fall_through_); |
| 467 } | 467 } |
| 468 | 468 |
| 469 | 469 |
| 470 void FullCodeGenerator::EffectContext::PrepareTest( | 470 void FullCodeGenerator::EffectContext::PrepareTest( |
| 471 Label* materialize_true, | 471 Label* materialize_true, |
| 472 Label* materialize_false, | 472 Label* materialize_false, |
| 473 Label** if_true, | 473 Label** if_true, |
| 474 Label** if_false, | 474 Label** if_false, |
| 475 Label** fall_through) const { | 475 Label** fall_through) const { |
| 476 // In an effect context, the true and the false case branch to the | 476 // In an effect context, the true and the false case branch to the |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 ForwardBailoutToChild(expr); | 737 ForwardBailoutToChild(expr); |
| 738 | 738 |
| 739 } else if (context()->IsAccumulatorValue()) { | 739 } else if (context()->IsAccumulatorValue()) { |
| 740 VisitForAccumulatorValue(left); | 740 VisitForAccumulatorValue(left); |
| 741 // We want the value in the accumulator for the test, and on the stack in | 741 // We want the value in the accumulator for the test, and on the stack in |
| 742 // case we need it. | 742 // case we need it. |
| 743 __ push(result_register()); | 743 __ push(result_register()); |
| 744 Label discard, restore; | 744 Label discard, restore; |
| 745 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 745 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
| 746 if (is_logical_and) { | 746 if (is_logical_and) { |
| 747 DoTest(&discard, &restore, &restore); | 747 DoTest(expr, &discard, &restore, &restore); |
|
fschneider
2011/06/10 09:18:18
Shouldn't the test of the left subexpressions get
Kevin Millikin (Chromium)
2011/06/10 09:35:06
I think you could do it either way (as long as the
Sven Panne
2011/06/14 08:04:48
Done.
| |
| 748 } else { | 748 } else { |
| 749 DoTest(&restore, &discard, &restore); | 749 DoTest(expr, &restore, &discard, &restore); |
| 750 } | 750 } |
| 751 __ bind(&restore); | 751 __ bind(&restore); |
| 752 __ pop(result_register()); | 752 __ pop(result_register()); |
| 753 __ jmp(&done); | 753 __ jmp(&done); |
| 754 __ bind(&discard); | 754 __ bind(&discard); |
| 755 __ Drop(1); | 755 __ Drop(1); |
| 756 PrepareForBailoutForId(right_id, NO_REGISTERS); | 756 PrepareForBailoutForId(right_id, NO_REGISTERS); |
| 757 | 757 |
| 758 } else if (context()->IsStackValue()) { | 758 } else if (context()->IsStackValue()) { |
| 759 VisitForAccumulatorValue(left); | 759 VisitForAccumulatorValue(left); |
| 760 // We want the value in the accumulator for the test, and on the stack in | 760 // We want the value in the accumulator for the test, and on the stack in |
| 761 // case we need it. | 761 // case we need it. |
| 762 __ push(result_register()); | 762 __ push(result_register()); |
| 763 Label discard; | 763 Label discard; |
| 764 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 764 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
| 765 if (is_logical_and) { | 765 if (is_logical_and) { |
| 766 DoTest(&discard, &done, &discard); | 766 DoTest(expr, &discard, &done, &discard); |
| 767 } else { | 767 } else { |
| 768 DoTest(&done, &discard, &discard); | 768 DoTest(expr, &done, &discard, &discard); |
| 769 } | 769 } |
| 770 __ bind(&discard); | 770 __ bind(&discard); |
| 771 __ Drop(1); | 771 __ Drop(1); |
| 772 PrepareForBailoutForId(right_id, NO_REGISTERS); | 772 PrepareForBailoutForId(right_id, NO_REGISTERS); |
| 773 | 773 |
| 774 } else { | 774 } else { |
| 775 ASSERT(context()->IsEffect()); | 775 ASSERT(context()->IsEffect()); |
| 776 Label eval_right; | 776 Label eval_right; |
| 777 if (is_logical_and) { | 777 if (is_logical_and) { |
| 778 VisitForControl(left, &eval_right, &done, &eval_right); | 778 VisitForControl(left, &eval_right, &done, &eval_right); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1290 __ Drop(stack_depth); | 1290 __ Drop(stack_depth); |
| 1291 __ PopTryHandler(); | 1291 __ PopTryHandler(); |
| 1292 return 0; | 1292 return 0; |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 | 1295 |
| 1296 #undef __ | 1296 #undef __ |
| 1297 | 1297 |
| 1298 | 1298 |
| 1299 } } // namespace v8::internal | 1299 } } // namespace v8::internal |
| OLD | NEW |