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

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

Issue 1072353002: [turbofan] Optimize silent hole checks on legacy const context slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 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
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | test/mjsunit/asm/pointer-masking.js » ('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/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return NoChange(); 102 return NoChange();
103 } 103 }
104 104
105 105
106 Reduction CommonOperatorReducer::ReduceSelect(Node* node) { 106 Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
107 DCHECK_EQ(IrOpcode::kSelect, node->opcode()); 107 DCHECK_EQ(IrOpcode::kSelect, node->opcode());
108 Node* cond = NodeProperties::GetValueInput(node, 0); 108 Node* cond = NodeProperties::GetValueInput(node, 0);
109 Node* vtrue = NodeProperties::GetValueInput(node, 1); 109 Node* vtrue = NodeProperties::GetValueInput(node, 1);
110 Node* vfalse = NodeProperties::GetValueInput(node, 2); 110 Node* vfalse = NodeProperties::GetValueInput(node, 2);
111 if (vtrue == vfalse) return Replace(vtrue); 111 if (vtrue == vfalse) return Replace(vtrue);
112 if (cond->opcode() == IrOpcode::kFloat32LessThan) { 112 switch (cond->opcode()) {
113 Float32BinopMatcher mcond(cond); 113 case IrOpcode::kHeapConstant: {
114 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) && 114 HeapObjectMatcher<HeapObject> mcond(cond);
115 vfalse->opcode() == IrOpcode::kFloat32Sub && 115 return Replace(mcond.Value().handle()->BooleanValue() ? vtrue : vfalse);
116 machine()->HasFloat32Abs()) { 116 }
117 Float32BinopMatcher mvfalse(vfalse); 117 case IrOpcode::kFloat32LessThan: {
118 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) { 118 Float32BinopMatcher mcond(cond);
119 return Change(node, machine()->Float32Abs(), vtrue); 119 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
120 vfalse->opcode() == IrOpcode::kFloat32Sub &&
121 machine()->HasFloat32Abs()) {
122 Float32BinopMatcher mvfalse(vfalse);
123 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
124 return Change(node, machine()->Float32Abs(), vtrue);
125 }
120 } 126 }
127 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
128 machine()->HasFloat32Min()) {
129 return Change(node, machine()->Float32Min(), vtrue, vfalse);
130 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
131 machine()->HasFloat32Max()) {
132 return Change(node, machine()->Float32Max(), vtrue, vfalse);
133 }
134 break;
121 } 135 }
122 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) && 136 case IrOpcode::kFloat64LessThan: {
123 machine()->HasFloat32Min()) { 137 Float64BinopMatcher mcond(cond);
124 return Change(node, machine()->Float32Min(), vtrue, vfalse); 138 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
125 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) && 139 vfalse->opcode() == IrOpcode::kFloat64Sub &&
126 machine()->HasFloat32Max()) { 140 machine()->HasFloat64Abs()) {
127 return Change(node, machine()->Float32Max(), vtrue, vfalse); 141 Float64BinopMatcher mvfalse(vfalse);
142 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
143 return Change(node, machine()->Float64Abs(), vtrue);
144 }
145 }
146 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
147 machine()->HasFloat64Min()) {
148 return Change(node, machine()->Float64Min(), vtrue, vfalse);
149 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
150 machine()->HasFloat64Max()) {
151 return Change(node, machine()->Float64Max(), vtrue, vfalse);
152 }
153 break;
128 } 154 }
129 } else if (cond->opcode() == IrOpcode::kFloat64LessThan) { 155 default:
130 Float64BinopMatcher mcond(cond); 156 break;
131 if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
132 vfalse->opcode() == IrOpcode::kFloat64Sub &&
133 machine()->HasFloat64Abs()) {
134 Float64BinopMatcher mvfalse(vfalse);
135 if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
136 return Change(node, machine()->Float64Abs(), vtrue);
137 }
138 }
139 if (mcond.left().Equals(vtrue) && mcond.right().Equals(vfalse) &&
140 machine()->HasFloat64Min()) {
141 return Change(node, machine()->Float64Min(), vtrue, vfalse);
142 } else if (mcond.left().Equals(vfalse) && mcond.right().Equals(vtrue) &&
143 machine()->HasFloat64Max()) {
144 return Change(node, machine()->Float64Max(), vtrue, vfalse);
145 }
146 } 157 }
147 return NoChange(); 158 return NoChange();
148 } 159 }
149 160
150 161
151 Reduction CommonOperatorReducer::Change(Node* node, Operator const* op, 162 Reduction CommonOperatorReducer::Change(Node* node, Operator const* op,
152 Node* a) { 163 Node* a) {
153 node->set_op(op); 164 node->set_op(op);
154 node->ReplaceInput(0, a); 165 node->ReplaceInput(0, a);
155 node->TrimInputCount(1); 166 node->TrimInputCount(1);
(...skipping 19 matching lines...) Expand all
175 Graph* CommonOperatorReducer::graph() const { return jsgraph()->graph(); } 186 Graph* CommonOperatorReducer::graph() const { return jsgraph()->graph(); }
176 187
177 188
178 MachineOperatorBuilder* CommonOperatorReducer::machine() const { 189 MachineOperatorBuilder* CommonOperatorReducer::machine() const {
179 return jsgraph()->machine(); 190 return jsgraph()->machine();
180 } 191 }
181 192
182 } // namespace compiler 193 } // namespace compiler
183 } // namespace internal 194 } // namespace internal
184 } // namespace v8 195 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | test/mjsunit/asm/pointer-masking.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698