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

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

Issue 10778029: Allow uint32 value on optimized frames if they are consumed by safe operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: arm and x64 ports Created 8 years, 4 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
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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 return HasNoUses() ? NULL : this; 868 return HasNoUses() ? NULL : this;
869 } 869 }
870 870
871 871
872 HValue* HBitwise::Canonicalize() { 872 HValue* HBitwise::Canonicalize() {
873 if (!representation().IsInteger32()) return this; 873 if (!representation().IsInteger32()) return this;
874 // If x is an int32, then x & -1 == x, x | 0 == x and x ^ 0 == x. 874 // If x is an int32, then x & -1 == x, x | 0 == x and x ^ 0 == x.
875 int32_t nop_constant = (op() == Token::BIT_AND) ? -1 : 0; 875 int32_t nop_constant = (op() == Token::BIT_AND) ? -1 : 0;
876 if (left()->IsConstant() && 876 if (left()->IsConstant() &&
877 HConstant::cast(left())->HasInteger32Value() && 877 HConstant::cast(left())->HasInteger32Value() &&
878 HConstant::cast(left())->Integer32Value() == nop_constant) { 878 HConstant::cast(left())->Integer32Value() == nop_constant &&
879 !right()->CheckFlag(kUint32)) {
879 return right(); 880 return right();
880 } 881 }
881 if (right()->IsConstant() && 882 if (right()->IsConstant() &&
882 HConstant::cast(right())->HasInteger32Value() && 883 HConstant::cast(right())->HasInteger32Value() &&
883 HConstant::cast(right())->Integer32Value() == nop_constant) { 884 HConstant::cast(right())->Integer32Value() == nop_constant &&
885 !left()->CheckFlag(kUint32)) {
884 return left(); 886 return left();
885 } 887 }
886 return this; 888 return this;
887 } 889 }
888 890
889 891
890 HValue* HBitNot::Canonicalize() { 892 HValue* HBitNot::Canonicalize() {
891 // Optimize ~~x, a common pattern used for ToInt32(x). 893 // Optimize ~~x, a common pattern used for ToInt32(x).
892 if (value()->IsBitNot()) { 894 if (value()->IsBitNot()) {
893 HValue* result = HBitNot::cast(value())->value(); 895 HValue* result = HBitNot::cast(value())->value();
894 ASSERT(result->representation().IsInteger32()); 896 ASSERT(result->representation().IsInteger32());
895 return result; 897 if (!result->CheckFlag(kUint32)) {
898 return result;
899 }
896 } 900 }
897 return this; 901 return this;
898 } 902 }
899 903
900 904
901 HValue* HAdd::Canonicalize() { 905 HValue* HAdd::Canonicalize() {
902 if (!representation().IsInteger32()) return this; 906 if (!representation().IsInteger32()) return this;
903 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); 907 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow);
904 return this; 908 return this;
905 } 909 }
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 2626
2623 2627
2624 void HCheckPrototypeMaps::Verify() { 2628 void HCheckPrototypeMaps::Verify() {
2625 HInstruction::Verify(); 2629 HInstruction::Verify();
2626 ASSERT(HasNoUses()); 2630 ASSERT(HasNoUses());
2627 } 2631 }
2628 2632
2629 #endif 2633 #endif
2630 2634
2631 } } // namespace v8::internal 2635 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698