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

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

Issue 13902013: Improve handling of unary plus. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/full-codegen-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 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 } 1429 }
1430 1430
1431 1431
1432 HValue* HSub::Canonicalize() { 1432 HValue* HSub::Canonicalize() {
1433 if (!representation().IsInteger32()) return this; 1433 if (!representation().IsInteger32()) return this;
1434 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); 1434 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow);
1435 return this; 1435 return this;
1436 } 1436 }
1437 1437
1438 1438
1439 // TODO(svenpanne) Use this in other Canonicalize() functions.
1440 static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) {
1441 return arg1->representation().IsSpecialization() &&
1442 arg2->IsInteger32Constant() &&
1443 arg2->GetInteger32Constant() == identity;
1444 }
1445
1446
1447 HValue* HMul::Canonicalize() {
1448 if (IsIdentityOperation(left(), right(), 1)) return left();
1449 if (IsIdentityOperation(right(), left(), 1)) return right();
1450 return this;
1451 }
1452
1453
1439 HValue* HChange::Canonicalize() { 1454 HValue* HChange::Canonicalize() {
1440 return (from().Equals(to())) ? value() : this; 1455 return (from().Equals(to())) ? value() : this;
1441 } 1456 }
1442 1457
1443 1458
1444 HValue* HWrapReceiver::Canonicalize() { 1459 HValue* HWrapReceiver::Canonicalize() {
1445 if (HasNoUses()) return NULL; 1460 if (HasNoUses()) return NULL;
1446 if (receiver()->type().IsJSObject()) { 1461 if (receiver()->type().IsJSObject()) {
1447 return receiver(); 1462 return receiver();
1448 } 1463 }
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 3585
3571 3586
3572 void HCheckFunction::Verify() { 3587 void HCheckFunction::Verify() {
3573 HInstruction::Verify(); 3588 HInstruction::Verify();
3574 ASSERT(HasNoUses()); 3589 ASSERT(HasNoUses());
3575 } 3590 }
3576 3591
3577 #endif 3592 #endif
3578 3593
3579 } } // namespace v8::internal 3594 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698