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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 // Value is false so it's needed. | 919 // Value is false so it's needed. |
920 __ push(Immediate(Factory::undefined_value())); | 920 __ push(Immediate(Factory::undefined_value())); |
921 // Fall through. | 921 // Fall through. |
922 case Expression::kTest: // Fall through. | 922 case Expression::kTest: // Fall through. |
923 case Expression::kValueTest: | 923 case Expression::kValueTest: |
924 __ jmp(false_label_); | 924 __ jmp(false_label_); |
925 break; | 925 break; |
926 } | 926 } |
927 break; | 927 break; |
928 | 928 |
| 929 case Token::NOT: { |
| 930 ASSERT_EQ(Expression::kTest, expr->expression()->context()); |
| 931 |
| 932 Label push_true; |
| 933 Label push_false; |
| 934 Label done; |
| 935 Label* saved_true = true_label_; |
| 936 Label* saved_false = false_label_; |
| 937 switch (expr->context()) { |
| 938 case Expression::kUninitialized: |
| 939 UNREACHABLE(); |
| 940 break; |
| 941 |
| 942 case Expression::kValue: |
| 943 true_label_ = &push_false; |
| 944 false_label_ = &push_true; |
| 945 Visit(expr->expression()); |
| 946 __ bind(&push_true); |
| 947 __ push(Immediate(Factory::true_value())); |
| 948 __ jmp(&done); |
| 949 __ bind(&push_false); |
| 950 __ push(Immediate(Factory::false_value())); |
| 951 __ bind(&done); |
| 952 break; |
| 953 |
| 954 case Expression::kEffect: |
| 955 true_label_ = &done; |
| 956 false_label_ = &done; |
| 957 Visit(expr->expression()); |
| 958 __ bind(&done); |
| 959 break; |
| 960 |
| 961 case Expression::kTest: |
| 962 true_label_ = saved_false; |
| 963 false_label_ = saved_true; |
| 964 Visit(expr->expression()); |
| 965 break; |
| 966 |
| 967 case Expression::kValueTest: |
| 968 true_label_ = saved_false; |
| 969 false_label_ = &push_true; |
| 970 Visit(expr->expression()); |
| 971 __ bind(&push_true); |
| 972 __ push(Immediate(Factory::true_value())); |
| 973 __ jmp(saved_true); |
| 974 break; |
| 975 |
| 976 case Expression::kTestValue: |
| 977 true_label_ = &push_false; |
| 978 false_label_ = saved_true; |
| 979 Visit(expr->expression()); |
| 980 __ bind(&push_false); |
| 981 __ push(Immediate(Factory::false_value())); |
| 982 __ jmp(saved_false); |
| 983 break; |
| 984 } |
| 985 true_label_ = saved_true; |
| 986 false_label_ = saved_false; |
| 987 break; |
| 988 } |
| 989 |
929 default: | 990 default: |
930 UNREACHABLE(); | 991 UNREACHABLE(); |
931 } | 992 } |
932 } | 993 } |
933 | 994 |
934 | 995 |
935 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { | 996 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { |
936 switch (expr->op()) { | 997 switch (expr->op()) { |
937 case Token::COMMA: | 998 case Token::COMMA: |
938 ASSERT_EQ(Expression::kEffect, expr->left()->context()); | 999 ASSERT_EQ(Expression::kEffect, expr->left()->context()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 default: | 1034 default: |
974 UNREACHABLE(); | 1035 UNREACHABLE(); |
975 } | 1036 } |
976 } | 1037 } |
977 | 1038 |
978 | 1039 |
979 #undef __ | 1040 #undef __ |
980 | 1041 |
981 | 1042 |
982 } } // namespace v8::internal | 1043 } } // namespace v8::internal |
OLD | NEW |