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 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3775 | 3775 |
3776 case Token::VOID: { | 3776 case Token::VOID: { |
3777 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3777 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
3778 VisitForEffect(expr->expression()); | 3778 VisitForEffect(expr->expression()); |
3779 context()->Plug(Factory::undefined_value()); | 3779 context()->Plug(Factory::undefined_value()); |
3780 break; | 3780 break; |
3781 } | 3781 } |
3782 | 3782 |
3783 case Token::NOT: { | 3783 case Token::NOT: { |
3784 Comment cmnt(masm_, "[ UnaryOperation (NOT)"); | 3784 Comment cmnt(masm_, "[ UnaryOperation (NOT)"); |
3785 | 3785 if (context()->IsEffect()) { |
3786 Label materialize_true, materialize_false; | 3786 // Unary NOT has no side effects so it's only necessary to visit the |
3787 Label* if_true = NULL; | 3787 // subexpression. Match the optimizing compiler by not branching. |
3788 Label* if_false = NULL; | 3788 VisitForEffect(expr->expression()); |
3789 Label* fall_through = NULL; | 3789 } else { |
3790 // Notice that the labels are swapped. | 3790 Label materialize_true, materialize_false; |
3791 context()->PrepareTest(&materialize_true, &materialize_false, | 3791 Label* if_true = NULL; |
3792 &if_false, &if_true, &fall_through); | 3792 Label* if_false = NULL; |
3793 if (context()->IsTest()) ForwardBailoutToChild(expr); | 3793 Label* fall_through = NULL; |
3794 VisitForControl(expr->expression(), if_true, if_false, fall_through); | 3794 // Notice that the labels are swapped. |
3795 context()->Plug(if_false, if_true); // Labels swapped. | 3795 context()->PrepareTest(&materialize_true, &materialize_false, |
| 3796 &if_false, &if_true, &fall_through); |
| 3797 if (context()->IsTest()) ForwardBailoutToChild(expr); |
| 3798 VisitForControl(expr->expression(), if_true, if_false, fall_through); |
| 3799 context()->Plug(if_false, if_true); // Labels swapped. |
| 3800 } |
3796 break; | 3801 break; |
3797 } | 3802 } |
3798 | 3803 |
3799 case Token::TYPEOF: { | 3804 case Token::TYPEOF: { |
3800 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 3805 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
3801 { StackValueContext context(this); | 3806 { StackValueContext context(this); |
3802 VisitForTypeofValue(expr->expression()); | 3807 VisitForTypeofValue(expr->expression()); |
3803 } | 3808 } |
3804 __ CallRuntime(Runtime::kTypeof, 1); | 3809 __ CallRuntime(Runtime::kTypeof, 1); |
3805 context()->Plug(eax); | 3810 context()->Plug(eax); |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4430 // And return. | 4435 // And return. |
4431 __ ret(0); | 4436 __ ret(0); |
4432 } | 4437 } |
4433 | 4438 |
4434 | 4439 |
4435 #undef __ | 4440 #undef __ |
4436 | 4441 |
4437 } } // namespace v8::internal | 4442 } } // namespace v8::internal |
4438 | 4443 |
4439 #endif // V8_TARGET_ARCH_IA32 | 4444 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |