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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 // Value is false so it's needed. | 894 // Value is false so it's needed. |
895 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 895 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
896 __ push(ip); | 896 __ push(ip); |
897 case Expression::kTest: // Fall through. | 897 case Expression::kTest: // Fall through. |
898 case Expression::kValueTest: | 898 case Expression::kValueTest: |
899 __ jmp(false_label_); | 899 __ jmp(false_label_); |
900 break; | 900 break; |
901 } | 901 } |
902 break; | 902 break; |
903 | 903 |
| 904 case Token::NOT: { |
| 905 ASSERT_EQ(Expression::kTest, expr->expression()->context()); |
| 906 |
| 907 Label push_true; |
| 908 Label push_false; |
| 909 Label done; |
| 910 Label* saved_true = true_label_; |
| 911 Label* saved_false = false_label_; |
| 912 switch (expr->context()) { |
| 913 case Expression::kUninitialized: |
| 914 UNREACHABLE(); |
| 915 break; |
| 916 |
| 917 case Expression::kValue: |
| 918 true_label_ = &push_false; |
| 919 false_label_ = &push_true; |
| 920 Visit(expr->expression()); |
| 921 __ bind(&push_true); |
| 922 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
| 923 __ push(ip); |
| 924 __ jmp(&done); |
| 925 __ bind(&push_false); |
| 926 __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
| 927 __ push(ip); |
| 928 __ bind(&done); |
| 929 break; |
| 930 |
| 931 case Expression::kEffect: |
| 932 true_label_ = &done; |
| 933 false_label_ = &done; |
| 934 Visit(expr->expression()); |
| 935 __ bind(&done); |
| 936 break; |
| 937 |
| 938 case Expression::kTest: |
| 939 true_label_ = saved_false; |
| 940 false_label_ = saved_true; |
| 941 Visit(expr->expression()); |
| 942 break; |
| 943 |
| 944 case Expression::kValueTest: |
| 945 true_label_ = saved_false; |
| 946 false_label_ = &push_true; |
| 947 Visit(expr->expression()); |
| 948 __ bind(&push_true); |
| 949 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
| 950 __ push(ip); |
| 951 __ jmp(saved_true); |
| 952 break; |
| 953 |
| 954 case Expression::kTestValue: |
| 955 true_label_ = &push_false; |
| 956 false_label_ = saved_true; |
| 957 Visit(expr->expression()); |
| 958 __ bind(&push_false); |
| 959 __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
| 960 __ push(ip); |
| 961 __ jmp(saved_false); |
| 962 break; |
| 963 } |
| 964 true_label_ = saved_true; |
| 965 false_label_ = saved_false; |
| 966 break; |
| 967 } |
| 968 |
904 default: | 969 default: |
905 UNREACHABLE(); | 970 UNREACHABLE(); |
906 } | 971 } |
907 } | 972 } |
908 | 973 |
909 | 974 |
910 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { | 975 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { |
911 switch (expr->op()) { | 976 switch (expr->op()) { |
912 case Token::COMMA: | 977 case Token::COMMA: |
913 ASSERT_EQ(Expression::kEffect, expr->left()->context()); | 978 ASSERT_EQ(Expression::kEffect, expr->left()->context()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 | 1011 |
947 break; | 1012 break; |
948 } | 1013 } |
949 default: | 1014 default: |
950 UNREACHABLE(); | 1015 UNREACHABLE(); |
951 } | 1016 } |
952 } | 1017 } |
953 | 1018 |
954 | 1019 |
955 } } // namespace v8::internal | 1020 } } // namespace v8::internal |
OLD | NEW |