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

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

Issue 517123004: [turbofan] Use enum instead of bool for parameter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/change-lowering.h ('k') | 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/change-lowering.h" 5 #include "src/compiler/change-lowering.h"
6 #include "src/compiler/machine-operator.h" 6 #include "src/compiler/machine-operator.h"
7 7
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 10 matching lines...) Expand all
21 return ChangeBitToBool(node->InputAt(0), control); 21 return ChangeBitToBool(node->InputAt(0), control);
22 case IrOpcode::kChangeBoolToBit: 22 case IrOpcode::kChangeBoolToBit:
23 return ChangeBoolToBit(node->InputAt(0)); 23 return ChangeBoolToBit(node->InputAt(0));
24 case IrOpcode::kChangeFloat64ToTagged: 24 case IrOpcode::kChangeFloat64ToTagged:
25 return ChangeFloat64ToTagged(node->InputAt(0), control); 25 return ChangeFloat64ToTagged(node->InputAt(0), control);
26 case IrOpcode::kChangeInt32ToTagged: 26 case IrOpcode::kChangeInt32ToTagged:
27 return ChangeInt32ToTagged(node->InputAt(0), control); 27 return ChangeInt32ToTagged(node->InputAt(0), control);
28 case IrOpcode::kChangeTaggedToFloat64: 28 case IrOpcode::kChangeTaggedToFloat64:
29 return ChangeTaggedToFloat64(node->InputAt(0), control); 29 return ChangeTaggedToFloat64(node->InputAt(0), control);
30 case IrOpcode::kChangeTaggedToInt32: 30 case IrOpcode::kChangeTaggedToInt32:
31 return ChangeTaggedToI32(node->InputAt(0), control, true); 31 return ChangeTaggedToUI32(node->InputAt(0), control, kSigned);
32 case IrOpcode::kChangeTaggedToUint32: 32 case IrOpcode::kChangeTaggedToUint32:
33 return ChangeTaggedToI32(node->InputAt(0), control, false); 33 return ChangeTaggedToUI32(node->InputAt(0), control, kUnsigned);
34 case IrOpcode::kChangeUint32ToTagged: 34 case IrOpcode::kChangeUint32ToTagged:
35 return ChangeUint32ToTagged(node->InputAt(0), control); 35 return ChangeUint32ToTagged(node->InputAt(0), control);
36 default: 36 default:
37 return NoChange(); 37 return NoChange();
38 } 38 }
39 UNREACHABLE(); 39 UNREACHABLE();
40 return NoChange(); 40 return NoChange();
41 } 41 }
42 42
43 43
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 161 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
162 Node* smi = graph()->NewNode(common()->Projection(0), add); 162 Node* smi = graph()->NewNode(common()->Projection(0), add);
163 163
164 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 164 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
165 Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge); 165 Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge);
166 166
167 return Replace(phi); 167 return Replace(phi);
168 } 168 }
169 169
170 170
171 Reduction ChangeLowering::ChangeTaggedToI32(Node* val, Node* control, 171 Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control,
172 bool is_signed) { 172 Signedness signedness) {
173 STATIC_ASSERT(kSmiTag == 0); 173 STATIC_ASSERT(kSmiTag == 0);
174 STATIC_ASSERT(kSmiTagMask == 1); 174 STATIC_ASSERT(kSmiTagMask == 1);
175 175
176 Node* tag = graph()->NewNode(machine()->WordAnd(), val, 176 Node* tag = graph()->NewNode(machine()->WordAnd(), val,
177 jsgraph()->Int32Constant(kSmiTagMask)); 177 jsgraph()->Int32Constant(kSmiTagMask));
178 Node* branch = graph()->NewNode(common()->Branch(), tag, control); 178 Node* branch = graph()->NewNode(common()->Branch(), tag, control);
179 179
180 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 180 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
181 Operator* op = is_signed ? machine()->ChangeFloat64ToInt32() 181 Operator* op = (signedness == kSigned) ? machine()->ChangeFloat64ToInt32()
182 : machine()->ChangeFloat64ToUint32(); 182 : machine()->ChangeFloat64ToUint32();
183 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true)); 183 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));
184 184
185 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 185 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
186 Node* number = ChangeSmiToInt32(val); 186 Node* number = ChangeSmiToInt32(val);
187 187
188 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 188 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
189 Node* phi = graph()->NewNode(common()->Phi(2), change, number, merge); 189 Node* phi = graph()->NewNode(common()->Phi(2), change, number, merge);
190 190
191 return Replace(phi); 191 return Replace(phi);
192 } 192 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } 247 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); }
248 248
249 249
250 CommonOperatorBuilder* ChangeLowering::common() const { 250 CommonOperatorBuilder* ChangeLowering::common() const {
251 return jsgraph()->common(); 251 return jsgraph()->common();
252 } 252 }
253 253
254 } // namespace compiler 254 } // namespace compiler
255 } // namespace internal 255 } // namespace internal
256 } // namespace v8 256 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698