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

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

Issue 685993003: [turbofan] Lower NumberModulus to Uint32Mod if both inputs are Unsigned32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 503
504 bool CanObserveNonInt32(MachineTypeUnion use) { 504 bool CanObserveNonInt32(MachineTypeUnion use) {
505 return (use & (kTypeUint32 | kTypeNumber | kTypeAny)) != 0; 505 return (use & (kTypeUint32 | kTypeNumber | kTypeAny)) != 0;
506 } 506 }
507 507
508 bool CanObserveMinusZero(MachineTypeUnion use) { 508 bool CanObserveMinusZero(MachineTypeUnion use) {
509 // TODO(turbofan): technically Uint32 cannot observe minus zero either. 509 // TODO(turbofan): technically Uint32 cannot observe minus zero either.
510 return (use & (kTypeUint32 | kTypeNumber | kTypeAny)) != 0; 510 return (use & (kTypeUint32 | kTypeNumber | kTypeAny)) != 0;
511 } 511 }
512 512
513 bool CanObserveNaN(MachineTypeUnion use) {
514 return (use & (kTypeNumber | kTypeAny)) != 0;
515 }
516
513 bool CanObserveNonUint32(MachineTypeUnion use) { 517 bool CanObserveNonUint32(MachineTypeUnion use) {
514 return (use & (kTypeInt32 | kTypeNumber | kTypeAny)) != 0; 518 return (use & (kTypeInt32 | kTypeNumber | kTypeAny)) != 0;
515 } 519 }
516 520
517 // Dispatching routine for visiting the node {node} with the usage {use}. 521 // Dispatching routine for visiting the node {node} with the usage {use}.
518 // Depending on the operator, propagate new usage info to the inputs. 522 // Depending on the operator, propagate new usage info to the inputs.
519 void VisitNode(Node* node, MachineTypeUnion use, 523 void VisitNode(Node* node, MachineTypeUnion use,
520 SimplifiedLowering* lowering) { 524 SimplifiedLowering* lowering) {
521 switch (node->opcode()) { 525 switch (node->opcode()) {
522 //------------------------------------------------------------------ 526 //------------------------------------------------------------------
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 if (lower()) node->set_op(Float64Op(node)); 704 if (lower()) node->set_op(Float64Op(node));
701 break; 705 break;
702 } 706 }
703 case IrOpcode::kNumberModulus: { 707 case IrOpcode::kNumberModulus: {
704 if (CanLowerToInt32Binop(node, use)) { 708 if (CanLowerToInt32Binop(node, use)) {
705 // => signed Int32Mod 709 // => signed Int32Mod
706 VisitInt32Binop(node); 710 VisitInt32Binop(node);
707 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 711 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
708 break; 712 break;
709 } 713 }
710 if (CanLowerToUint32Binop(node, use)) { 714 if (BothInputsAre(node, Type::Unsigned32()) && !CanObserveNaN(use)) {
711 // => unsigned Uint32Mod 715 // => unsigned Uint32Mod
712 VisitUint32Binop(node); 716 VisitUint32Binop(node);
713 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node)); 717 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node));
714 break; 718 break;
715 } 719 }
716 // => Float64Mod 720 // => Float64Mod
717 VisitFloat64Binop(node); 721 VisitFloat64Binop(node);
718 if (lower()) node->set_op(Float64Op(node)); 722 if (lower()) node->set_op(Float64Op(node));
719 break; 723 break;
720 } 724 }
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 1524
1521 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1525 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1522 node->set_op(machine()->IntLessThanOrEqual()); 1526 node->set_op(machine()->IntLessThanOrEqual());
1523 node->ReplaceInput(0, StringComparison(node, true)); 1527 node->ReplaceInput(0, StringComparison(node, true));
1524 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1528 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1525 } 1529 }
1526 1530
1527 } // namespace compiler 1531 } // namespace compiler
1528 } // namespace internal 1532 } // namespace internal
1529 } // namespace v8 1533 } // 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