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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 10123007: Optimize ~~(expr) in optimized code. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 8 months 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/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 } 863 }
864 if (right()->IsConstant() && 864 if (right()->IsConstant() &&
865 HConstant::cast(right())->HasInteger32Value() && 865 HConstant::cast(right())->HasInteger32Value() &&
866 HConstant::cast(right())->Integer32Value() == nop_constant) { 866 HConstant::cast(right())->Integer32Value() == nop_constant) {
867 return left(); 867 return left();
868 } 868 }
869 return this; 869 return this;
870 } 870 }
871 871
872 872
873 HValue* HBitNot::Canonicalize() {
874 // Optimize ~~x, a common pattern used for ToInt32(x).
875 if (value()->IsBitNot()) {
876 HValue* result = HBitNot::cast(value())->value();
877 ASSERT(result->representation().IsInteger32());
878 return result;
879 }
880 return this;
881 }
882
883
873 HValue* HAdd::Canonicalize() { 884 HValue* HAdd::Canonicalize() {
874 if (!representation().IsInteger32()) return this; 885 if (!representation().IsInteger32()) return this;
875 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); 886 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow);
876 return this; 887 return this;
877 } 888 }
878 889
879 890
880 HValue* HSub::Canonicalize() { 891 HValue* HSub::Canonicalize() {
881 if (!representation().IsInteger32()) return this; 892 if (!representation().IsInteger32()) return this;
882 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); 893 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow);
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 2370
2360 2371
2361 void HCheckPrototypeMaps::Verify() { 2372 void HCheckPrototypeMaps::Verify() {
2362 HInstruction::Verify(); 2373 HInstruction::Verify();
2363 ASSERT(HasNoUses()); 2374 ASSERT(HasNoUses());
2364 } 2375 }
2365 2376
2366 #endif 2377 #endif
2367 2378
2368 } } // namespace v8::internal 2379 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698