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 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3107 | 3107 |
3108 case Token::VOID: { | 3108 case Token::VOID: { |
3109 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3109 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
3110 VisitForEffect(expr->expression()); | 3110 VisitForEffect(expr->expression()); |
3111 context()->Plug(Heap::kUndefinedValueRootIndex); | 3111 context()->Plug(Heap::kUndefinedValueRootIndex); |
3112 break; | 3112 break; |
3113 } | 3113 } |
3114 | 3114 |
3115 case Token::NOT: { | 3115 case Token::NOT: { |
3116 Comment cmnt(masm_, "[ UnaryOperation (NOT)"); | 3116 Comment cmnt(masm_, "[ UnaryOperation (NOT)"); |
3117 Label materialize_true, materialize_false; | 3117 if (context()->IsEffect()) { |
3118 Label* if_true = NULL; | 3118 // Unary NOT has no side effects so it's only necessary to visit the |
3119 Label* if_false = NULL; | 3119 // subexpression. Match the optimizing compiler by not branching. |
3120 Label* fall_through = NULL; | 3120 VisitForEffect(expr->expression()); |
3121 // Notice that the labels are swapped. | 3121 } else { |
3122 context()->PrepareTest(&materialize_true, &materialize_false, | 3122 Label materialize_true, materialize_false; |
3123 &if_false, &if_true, &fall_through); | 3123 Label* if_true = NULL; |
3124 if (context()->IsTest()) ForwardBailoutToChild(expr); | 3124 Label* if_false = NULL; |
3125 VisitForControl(expr->expression(), if_true, if_false, fall_through); | 3125 Label* fall_through = NULL; |
3126 context()->Plug(if_false, if_true); // Labels swapped. | 3126 // Notice that the labels are swapped. |
| 3127 context()->PrepareTest(&materialize_true, &materialize_false, |
| 3128 &if_false, &if_true, &fall_through); |
| 3129 if (context()->IsTest()) ForwardBailoutToChild(expr); |
| 3130 VisitForControl(expr->expression(), if_true, if_false, fall_through); |
| 3131 context()->Plug(if_false, if_true); // Labels swapped. |
| 3132 } |
3127 break; | 3133 break; |
3128 } | 3134 } |
3129 | 3135 |
3130 case Token::TYPEOF: { | 3136 case Token::TYPEOF: { |
3131 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 3137 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
3132 { StackValueContext context(this); | 3138 { StackValueContext context(this); |
3133 VisitForTypeofValue(expr->expression()); | 3139 VisitForTypeofValue(expr->expression()); |
3134 } | 3140 } |
3135 __ CallRuntime(Runtime::kTypeof, 1); | 3141 __ CallRuntime(Runtime::kTypeof, 1); |
3136 context()->Plug(rax); | 3142 context()->Plug(rax); |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3762 __ ret(0); | 3768 __ ret(0); |
3763 } | 3769 } |
3764 | 3770 |
3765 | 3771 |
3766 #undef __ | 3772 #undef __ |
3767 | 3773 |
3768 | 3774 |
3769 } } // namespace v8::internal | 3775 } } // namespace v8::internal |
3770 | 3776 |
3771 #endif // V8_TARGET_ARCH_X64 | 3777 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |