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

Unified Diff: src/hydrogen-instructions.cc

Issue 14244023: Inline isUint32() method from HConstant, which was only used in one place. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use IsInteger32Constant() and GetInteger32Constant() Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 0aabfbc43229198f181ec9f76d4aaf4724228f4f..cb50de6d984bf5cc49a4546373b835e27b4a3d47 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -648,6 +648,11 @@ int32_t HValue::GetInteger32Constant() {
}
+bool HValue::EqualsInteger32Constant(int32_t value) {
+ return IsInteger32Constant() && GetInteger32Constant() == value;
+}
+
+
void HValue::SetOperandAt(int index, HValue* value) {
RegisterUse(index, value);
InternalSetOperandAt(index, value);
@@ -1393,15 +1398,11 @@ HValue* HBitwise::Canonicalize() {
if (!representation().IsInteger32()) return this;
// If x is an int32, then x & -1 == x, x | 0 == x and x ^ 0 == x.
int32_t nop_constant = (op() == Token::BIT_AND) ? -1 : 0;
- if (left()->IsConstant() &&
- HConstant::cast(left())->HasInteger32Value() &&
- HConstant::cast(left())->Integer32Value() == nop_constant &&
+ if (left()->EqualsInteger32Constant(nop_constant) &&
!right()->CheckFlag(kUint32)) {
return right();
}
- if (right()->IsConstant() &&
- HConstant::cast(right())->HasInteger32Value() &&
- HConstant::cast(right())->Integer32Value() == nop_constant &&
+ if (right()->EqualsInteger32Constant(nop_constant) &&
!left()->CheckFlag(kUint32)) {
return left();
}
@@ -1439,8 +1440,7 @@ HValue* HSub::Canonicalize() {
// TODO(svenpanne) Use this in other Canonicalize() functions.
static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) {
return arg1->representation().IsSpecialization() &&
- arg2->IsInteger32Constant() &&
- arg2->GetInteger32Constant() == identity;
+ arg2->EqualsInteger32Constant(identity);
}
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698