Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/fast-codegen-x64.cc

Issue 343057: Add unary not operator to fast compiler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/fast-codegen-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 // Value is false so it's needed. 935 // Value is false so it's needed.
936 __ PushRoot(Heap::kUndefinedValueRootIndex); 936 __ PushRoot(Heap::kUndefinedValueRootIndex);
937 // Fall through. 937 // Fall through.
938 case Expression::kTest: // Fall through. 938 case Expression::kTest: // Fall through.
939 case Expression::kValueTest: 939 case Expression::kValueTest:
940 __ jmp(false_label_); 940 __ jmp(false_label_);
941 break; 941 break;
942 } 942 }
943 break; 943 break;
944 944
945 case Token::NOT: {
946 ASSERT_EQ(Expression::kTest, expr->expression()->context());
947
948 Label push_true;
949 Label push_false;
950 Label done;
951 Label* saved_true = true_label_;
952 Label* saved_false = false_label_;
953 switch (expr->context()) {
954 case Expression::kUninitialized:
955 UNREACHABLE();
956 break;
957
958 case Expression::kValue:
959 true_label_ = &push_false;
960 false_label_ = &push_true;
961 Visit(expr->expression());
962 __ bind(&push_true);
963 __ PushRoot(Heap::kTrueValueRootIndex);
964 __ jmp(&done);
965 __ bind(&push_false);
966 __ PushRoot(Heap::kFalseValueRootIndex);
967 __ bind(&done);
968 break;
969
970 case Expression::kEffect:
971 true_label_ = &done;
972 false_label_ = &done;
973 Visit(expr->expression());
974 __ bind(&done);
975 break;
976
977 case Expression::kTest:
978 true_label_ = saved_false;
979 false_label_ = saved_true;
980 Visit(expr->expression());
981 break;
982
983 case Expression::kValueTest:
984 true_label_ = saved_false;
985 false_label_ = &push_true;
986 Visit(expr->expression());
987 __ bind(&push_true);
988 __ PushRoot(Heap::kTrueValueRootIndex);
989 __ jmp(saved_true);
990 break;
991
992 case Expression::kTestValue:
993 true_label_ = &push_false;
994 false_label_ = saved_true;
995 Visit(expr->expression());
996 __ bind(&push_false);
997 __ PushRoot(Heap::kFalseValueRootIndex);
998 __ jmp(saved_false);
999 break;
1000 }
1001 true_label_ = saved_true;
1002 false_label_ = saved_false;
1003 break;
1004 }
1005
945 default: 1006 default:
946 UNREACHABLE(); 1007 UNREACHABLE();
947 } 1008 }
948 } 1009 }
949 1010
950 1011
951 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { 1012 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
952 switch (expr->op()) { 1013 switch (expr->op()) {
953 case Token::COMMA: 1014 case Token::COMMA:
954 ASSERT_EQ(Expression::kEffect, expr->left()->context()); 1015 ASSERT_EQ(Expression::kEffect, expr->left()->context());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 1047
987 break; 1048 break;
988 } 1049 }
989 default: 1050 default:
990 UNREACHABLE(); 1051 UNREACHABLE();
991 } 1052 }
992 } 1053 }
993 1054
994 1055
995 } } // namespace v8::internal 1056 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/fast-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698