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

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

Issue 850013003: [turbofan] Fix truncation/representation sloppiness wrt. bool/bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes/Cleanups Created 5 years, 11 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/simplified-operator-reducer.h ('k') | src/compiler/typer.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-operator-reducer.h" 5 #include "src/compiler/simplified-operator-reducer.h"
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 HeapObjectMatcher<HeapObject> m(node->InputAt(0)); 47 HeapObjectMatcher<HeapObject> m(node->InputAt(0));
48 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->false_value()))) { 48 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->false_value()))) {
49 return ReplaceInt32(0); 49 return ReplaceInt32(0);
50 } 50 }
51 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->true_value()))) { 51 if (m.Is(Unique<HeapObject>::CreateImmovable(factory()->true_value()))) {
52 return ReplaceInt32(1); 52 return ReplaceInt32(1);
53 } 53 }
54 if (m.IsChangeBitToBool()) return Replace(m.node()->InputAt(0)); 54 if (m.IsChangeBitToBool()) return Replace(m.node()->InputAt(0));
55 break; 55 break;
56 } 56 }
57 case IrOpcode::kChangeWord32ToBit:
58 return ReduceChangeWord32ToBit(node);
59 case IrOpcode::kChangeFloat64ToTagged: { 57 case IrOpcode::kChangeFloat64ToTagged: {
60 Float64Matcher m(node->InputAt(0)); 58 Float64Matcher m(node->InputAt(0));
61 if (m.HasValue()) return ReplaceNumber(m.Value()); 59 if (m.HasValue()) return ReplaceNumber(m.Value());
62 break; 60 break;
63 } 61 }
64 case IrOpcode::kChangeInt32ToTagged: { 62 case IrOpcode::kChangeInt32ToTagged: {
65 Int32Matcher m(node->InputAt(0)); 63 Int32Matcher m(node->InputAt(0));
66 if (m.HasValue()) return ReplaceNumber(m.Value()); 64 if (m.HasValue()) return ReplaceNumber(m.Value());
67 break; 65 break;
68 } 66 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 Node* length = graph()->NewNode(simplified()->LoadField(access), input, 129 Node* length = graph()->NewNode(simplified()->LoadField(access), input,
132 graph()->start(), graph()->start()); 130 graph()->start(), graph()->start());
133 Node* compare = graph()->NewNode(simplified()->NumberEqual(), length, 131 Node* compare = graph()->NewNode(simplified()->NumberEqual(), length,
134 jsgraph()->ZeroConstant()); 132 jsgraph()->ZeroConstant());
135 return Change(node, simplified()->BooleanNot(), compare); 133 return Change(node, simplified()->BooleanNot(), compare);
136 } 134 }
137 return NoChange(); 135 return NoChange();
138 } 136 }
139 137
140 138
141 Reduction SimplifiedOperatorReducer::ReduceChangeWord32ToBit(Node* node) {
142 Node* const input = NodeProperties::GetValueInput(node, 0);
143 Type* const input_type = NodeProperties::GetBounds(input).upper;
144 if (input_type->Is(jsgraph()->ZeroOneRangeType())) {
145 // ChangeWord32ToBit(x:bit) => x
146 return Replace(input);
147 }
148 return NoChange();
149 }
150
151
152 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, 139 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op,
153 Node* a) { 140 Node* a) {
154 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op)); 141 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op));
155 DCHECK_LE(1, node->InputCount()); 142 DCHECK_LE(1, node->InputCount());
156 node->set_op(op); 143 node->set_op(op);
157 node->ReplaceInput(0, a); 144 node->ReplaceInput(0, a);
158 return Changed(node); 145 return Changed(node);
159 } 146 }
160 147
161 148
(...skipping 30 matching lines...) Expand all
192 } 179 }
193 180
194 181
195 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { 182 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
196 return jsgraph()->machine(); 183 return jsgraph()->machine();
197 } 184 }
198 185
199 } // namespace compiler 186 } // namespace compiler
200 } // namespace internal 187 } // namespace internal
201 } // namespace v8 188 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator-reducer.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698