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

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

Issue 840953003: [turbofan] Correctify representation changes to bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: std::isnan 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/change-lowering.h ('k') | src/compiler/js-graph.h » ('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/change-lowering.h" 5 #include "src/compiler/change-lowering.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/diamond.h" 8 #include "src/compiler/diamond.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
11 #include "src/compiler/machine-operator.h" 11 #include "src/compiler/machine-operator.h"
12 #include "src/compiler/node-properties-inl.h" 12 #include "src/compiler/node-properties-inl.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 namespace compiler { 16 namespace compiler {
17 17
18 ChangeLowering::~ChangeLowering() {} 18 ChangeLowering::~ChangeLowering() {}
19 19
20 20
21 Reduction ChangeLowering::Reduce(Node* node) { 21 Reduction ChangeLowering::Reduce(Node* node) {
22 Node* control = graph()->start(); 22 Node* control = graph()->start();
23 switch (node->opcode()) { 23 switch (node->opcode()) {
24 case IrOpcode::kChangeBitToBool: 24 case IrOpcode::kChangeBitToBool:
25 return ChangeBitToBool(node->InputAt(0), control); 25 return ChangeBitToBool(node->InputAt(0));
26 case IrOpcode::kChangeBoolToBit: 26 case IrOpcode::kChangeBoolToBit:
27 return ChangeBoolToBit(node->InputAt(0)); 27 return ChangeBoolToBit(node->InputAt(0));
28 case IrOpcode::kChangeWord32ToBit:
29 return ChangeWord32ToBit(node->InputAt(0));
30 case IrOpcode::kChangeWord64ToBit:
31 return ChangeWord64ToBit(node->InputAt(0));
28 case IrOpcode::kChangeFloat64ToTagged: 32 case IrOpcode::kChangeFloat64ToTagged:
29 return ChangeFloat64ToTagged(node->InputAt(0), control); 33 return ChangeFloat64ToTagged(node->InputAt(0), control);
30 case IrOpcode::kChangeInt32ToTagged: 34 case IrOpcode::kChangeInt32ToTagged:
31 return ChangeInt32ToTagged(node->InputAt(0), control); 35 return ChangeInt32ToTagged(node->InputAt(0), control);
32 case IrOpcode::kChangeTaggedToFloat64: 36 case IrOpcode::kChangeTaggedToFloat64:
33 return ChangeTaggedToFloat64(node->InputAt(0), control); 37 return ChangeTaggedToFloat64(node->InputAt(0), control);
34 case IrOpcode::kChangeTaggedToInt32: 38 case IrOpcode::kChangeTaggedToInt32:
35 return ChangeTaggedToUI32(node->InputAt(0), control, kSigned); 39 return ChangeTaggedToUI32(node->InputAt(0), control, kSigned);
36 case IrOpcode::kChangeTaggedToUint32: 40 case IrOpcode::kChangeTaggedToUint32:
37 return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned); 41 return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return graph()->NewNode(machine()->WordAnd(), value, 135 return graph()->NewNode(machine()->WordAnd(), value,
132 jsgraph()->IntPtrConstant(kSmiTagMask)); 136 jsgraph()->IntPtrConstant(kSmiTagMask));
133 } 137 }
134 138
135 139
136 Node* ChangeLowering::Uint32LessThanOrEqual(Node* lhs, Node* rhs) { 140 Node* ChangeLowering::Uint32LessThanOrEqual(Node* lhs, Node* rhs) {
137 return graph()->NewNode(machine()->Uint32LessThanOrEqual(), lhs, rhs); 141 return graph()->NewNode(machine()->Uint32LessThanOrEqual(), lhs, rhs);
138 } 142 }
139 143
140 144
141 Reduction ChangeLowering::ChangeBitToBool(Node* val, Node* control) { 145 Reduction ChangeLowering::ChangeBitToBool(Node* value) {
142 MachineType const type = static_cast<MachineType>(kTypeBool | kRepTagged); 146 MachineType const type = static_cast<MachineType>(kTypeBool | kRepTagged);
143 return Replace(graph()->NewNode(common()->Select(type), val, 147 return Replace(graph()->NewNode(common()->Select(type), value,
144 jsgraph()->TrueConstant(), 148 jsgraph()->TrueConstant(),
145 jsgraph()->FalseConstant())); 149 jsgraph()->FalseConstant()));
146 } 150 }
147 151
148 152
149 Reduction ChangeLowering::ChangeBoolToBit(Node* val) { 153 Reduction ChangeLowering::ChangeBoolToBit(Node* value) {
150 return Replace( 154 return Replace(graph()->NewNode(machine()->WordEqual(), value,
151 graph()->NewNode(machine()->WordEqual(), val, jsgraph()->TrueConstant())); 155 jsgraph()->TrueConstant()));
152 } 156 }
153 157
154 158
159 Reduction ChangeLowering::ChangeWord32ToBit(Node* value) {
160 return Replace(
161 graph()->NewNode(machine()->Word32Equal(),
162 graph()->NewNode(machine()->Word32Equal(), value,
163 jsgraph()->Int32Constant(0)),
164 jsgraph()->Int32Constant(0)));
165 }
166
167
168 Reduction ChangeLowering::ChangeWord64ToBit(Node* value) {
169 return Replace(
170 graph()->NewNode(machine()->Word32Equal(),
171 graph()->NewNode(machine()->Word64Equal(), value,
172 jsgraph()->Int64Constant(0)),
173 jsgraph()->Int32Constant(0)));
174 }
175
176
155 Reduction ChangeLowering::ChangeFloat64ToTagged(Node* val, Node* control) { 177 Reduction ChangeLowering::ChangeFloat64ToTagged(Node* val, Node* control) {
156 return Replace(AllocateHeapNumberWithValue(val, control)); 178 return Replace(AllocateHeapNumberWithValue(val, control));
157 } 179 }
158 180
159 181
160 Reduction ChangeLowering::ChangeInt32ToTagged(Node* value, Node* control) { 182 Reduction ChangeLowering::ChangeInt32ToTagged(Node* value, Node* control) {
161 if (machine()->Is64()) { 183 if (machine()->Is64()) {
162 return Replace(graph()->NewNode( 184 return Replace(graph()->NewNode(
163 machine()->Word64Shl(), 185 machine()->Word64Shl(),
164 graph()->NewNode(machine()->ChangeInt32ToInt64(), value), 186 graph()->NewNode(machine()->ChangeInt32ToInt64(), value),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 296 }
275 297
276 298
277 MachineOperatorBuilder* ChangeLowering::machine() const { 299 MachineOperatorBuilder* ChangeLowering::machine() const {
278 return jsgraph()->machine(); 300 return jsgraph()->machine();
279 } 301 }
280 302
281 } // namespace compiler 303 } // namespace compiler
282 } // namespace internal 304 } // namespace internal
283 } // namespace v8 305 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/js-graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698