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

Side by Side Diff: src/compiler/machine-operator-reducer.cc

Issue 699573002: [turbofan] Positive dividends are heavily favored for Int32Mod. (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 | no next file » | 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/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler/generic-node-inl.h" 10 #include "src/compiler/generic-node-inl.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 647 }
648 if (m.right().HasValue()) { 648 if (m.right().HasValue()) {
649 Node* const dividend = m.left().node(); 649 Node* const dividend = m.left().node();
650 int32_t const divisor = Abs(m.right().Value()); 650 int32_t const divisor = Abs(m.right().Value());
651 if (base::bits::IsPowerOfTwo32(divisor)) { 651 if (base::bits::IsPowerOfTwo32(divisor)) {
652 uint32_t const mask = divisor - 1; 652 uint32_t const mask = divisor - 1;
653 Node* const zero = Int32Constant(0); 653 Node* const zero = Int32Constant(0);
654 654
655 Node* check = 655 Node* check =
656 graph()->NewNode(machine()->Int32LessThan(), dividend, zero); 656 graph()->NewNode(machine()->Int32LessThan(), dividend, zero);
657 Node* branch = 657 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse),
658 graph()->NewNode(common()->Branch(), check, graph()->start()); 658 check, graph()->start());
659 659
660 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 660 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
661 Node* neg = Int32Sub(zero, Word32And(Int32Sub(zero, dividend), mask)); 661 Node* neg = Int32Sub(zero, Word32And(Int32Sub(zero, dividend), mask));
662 662
663 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 663 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
664 Node* pos = Word32And(dividend, mask); 664 Node* pos = Word32And(dividend, mask);
665 665
666 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 666 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
667 667
668 DCHECK_EQ(3, node->InputCount()); 668 DCHECK_EQ(3, node->InputCount());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 757 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
758 return jsgraph()->machine(); 758 return jsgraph()->machine();
759 } 759 }
760 760
761 761
762 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 762 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
763 763
764 } // namespace compiler 764 } // namespace compiler
765 } // namespace internal 765 } // namespace internal
766 } // namespace v8 766 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698