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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 1467193002: [turbofan] Simplify representations selection for phi. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | test/cctest/compiler/test-simplified-lowering.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool); 440 VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool);
441 } 441 }
442 void VisitUint64Cmp(Node* node) { 442 void VisitUint64Cmp(Node* node) {
443 VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool); 443 VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool);
444 } 444 }
445 445
446 // Infer representation for phi-like nodes. 446 // Infer representation for phi-like nodes.
447 static MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) { 447 static MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) {
448 // Phis adapt to the output representation their uses demand. 448 // Phis adapt to the output representation their uses demand.
449 Type* upper = NodeProperties::GetType(node); 449 Type* upper = NodeProperties::GetType(node);
450 if ((use & kRepMask) == kRepFloat32) { 450 if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) {
451 // only float32 uses. 451 // We are within 32 bits range => pick kRepWord32.
452 return kRepFloat32; 452 return kRepWord32;
453 } else if ((use & kRepMask) == kRepFloat64) { 453 } else if (!CanObserveNonWord32(use)) {
454 // only float64 uses. 454 // We only use 32 bits.
455 return kRepFloat64; 455 return kRepWord32;
456 } else if ((use & kRepMask) == kRepTagged) {
457 // only tagged uses.
458 return kRepTagged;
459 } else if (upper->Is(Type::Integral32())) {
460 // Integer within [-2^31, 2^32[ range.
461 if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) {
462 // multiple uses, but we are within 32 bits range => pick kRepWord32.
463 return kRepWord32;
464 } else if (!CanObserveNonWord32(use)) {
465 // We only use 32 bits.
466 return kRepWord32;
467 } else {
468 return kRepFloat64;
469 }
470 } else if (upper->Is(Type::Boolean())) { 456 } else if (upper->Is(Type::Boolean())) {
471 // multiple uses => pick kRepBit. 457 // multiple uses => pick kRepBit.
472 return kRepBit; 458 return kRepBit;
473 } else if (upper->Is(Type::Number())) { 459 } else if (upper->Is(Type::Number())) {
474 // multiple uses => pick kRepFloat64. 460 // multiple uses => pick kRepFloat64.
475 return kRepFloat64; 461 return kRepFloat64;
476 } else if (upper->Is(Type::Internal())) { 462 } else if (upper->Is(Type::Internal())) {
477 return kMachPtr; 463 return kMachPtr;
478 } 464 }
479 return kRepTagged; 465 return kRepTagged;
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 ReplaceEffectUses(node, comparison); 1645 ReplaceEffectUses(node, comparison);
1660 node->ReplaceInput(0, comparison); 1646 node->ReplaceInput(0, comparison);
1661 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1647 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1662 node->TrimInputCount(2); 1648 node->TrimInputCount(2);
1663 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); 1649 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual());
1664 } 1650 }
1665 1651
1666 } // namespace compiler 1652 } // namespace compiler
1667 } // namespace internal 1653 } // namespace internal
1668 } // namespace v8 1654 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698