| 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 3006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3017 | 3017 |
| 3018 case Token::VOID: { | 3018 case Token::VOID: { |
| 3019 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3019 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
| 3020 VisitForEffect(expr->expression()); | 3020 VisitForEffect(expr->expression()); |
| 3021 context()->Plug(Heap::kUndefinedValueRootIndex); | 3021 context()->Plug(Heap::kUndefinedValueRootIndex); |
| 3022 break; | 3022 break; |
| 3023 } | 3023 } |
| 3024 | 3024 |
| 3025 case Token::NOT: { | 3025 case Token::NOT: { |
| 3026 Comment cmnt(masm_, "[ UnaryOperation (NOT)"); | 3026 Comment cmnt(masm_, "[ UnaryOperation (NOT)"); |
| 3027 Label materialize_true, materialize_false; | 3027 if (context()->IsEffect()) { |
| 3028 Label* if_true = NULL; | 3028 // Unary NOT has no side effects so it's only necessary to visit the |
| 3029 Label* if_false = NULL; | 3029 // subexpression. Match the optimizing compiler by not branching. |
| 3030 Label* fall_through = NULL; | 3030 VisitForEffect(expr->expression()); |
| 3031 // Notice that the labels are swapped. | 3031 } else { |
| 3032 context()->PrepareTest(&materialize_true, &materialize_false, | 3032 Label materialize_true, materialize_false; |
| 3033 &if_false, &if_true, &fall_through); | 3033 Label* if_true = NULL; |
| 3034 if (context()->IsTest()) ForwardBailoutToChild(expr); | 3034 Label* if_false = NULL; |
| 3035 VisitForControl(expr->expression(), if_true, if_false, fall_through); | 3035 Label* fall_through = NULL; |
| 3036 context()->Plug(if_false, if_true); // Labels swapped. | 3036 // Notice that the labels are swapped. |
| 3037 context()->PrepareTest(&materialize_true, &materialize_false, |
| 3038 &if_false, &if_true, &fall_through); |
| 3039 if (context()->IsTest()) ForwardBailoutToChild(expr); |
| 3040 VisitForControl(expr->expression(), if_true, if_false, fall_through); |
| 3041 context()->Plug(if_false, if_true); // Labels swapped. |
| 3042 } |
| 3037 break; | 3043 break; |
| 3038 } | 3044 } |
| 3039 | 3045 |
| 3040 case Token::TYPEOF: { | 3046 case Token::TYPEOF: { |
| 3041 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 3047 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
| 3042 { StackValueContext context(this); | 3048 { StackValueContext context(this); |
| 3043 VisitForTypeofValue(expr->expression()); | 3049 VisitForTypeofValue(expr->expression()); |
| 3044 } | 3050 } |
| 3045 __ CallRuntime(Runtime::kTypeof, 1); | 3051 __ CallRuntime(Runtime::kTypeof, 1); |
| 3046 context()->Plug(rax); | 3052 context()->Plug(rax); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3634 __ ret(0); | 3640 __ ret(0); |
| 3635 } | 3641 } |
| 3636 | 3642 |
| 3637 | 3643 |
| 3638 #undef __ | 3644 #undef __ |
| 3639 | 3645 |
| 3640 | 3646 |
| 3641 } } // namespace v8::internal | 3647 } } // namespace v8::internal |
| 3642 | 3648 |
| 3643 #endif // V8_TARGET_ARCH_X64 | 3649 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |