OLD | NEW |
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/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (machine()->Is64()) { | 135 if (machine()->Is64()) { |
136 return Replace( | 136 return Replace( |
137 graph()->NewNode(machine()->Word64Shl(), | 137 graph()->NewNode(machine()->Word64Shl(), |
138 graph()->NewNode(machine()->ChangeInt32ToInt64(), val), | 138 graph()->NewNode(machine()->ChangeInt32ToInt64(), val), |
139 SmiShiftBitsConstant())); | 139 SmiShiftBitsConstant())); |
140 } | 140 } |
141 | 141 |
142 Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), val, val); | 142 Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), val, val); |
143 Node* ovf = graph()->NewNode(common()->Projection(1), add); | 143 Node* ovf = graph()->NewNode(common()->Projection(1), add); |
144 | 144 |
145 Node* branch = graph()->NewNode(common()->Branch(), ovf, control); | 145 Node* branch = |
| 146 graph()->NewNode(common()->Branch(BranchHint::kTrue), ovf, control); |
146 | 147 |
147 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 148 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
148 Node* heap_number = AllocateHeapNumberWithValue( | 149 Node* heap_number = AllocateHeapNumberWithValue( |
149 graph()->NewNode(machine()->ChangeInt32ToFloat64(), val), if_true); | 150 graph()->NewNode(machine()->ChangeInt32ToFloat64(), val), if_true); |
150 | 151 |
151 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 152 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
152 Node* smi = graph()->NewNode(common()->Projection(0), add); | 153 Node* smi = graph()->NewNode(common()->Projection(0), add); |
153 | 154 |
154 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); | 155 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
155 Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), heap_number, | 156 Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), heap_number, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 return Replace(phi); | 209 return Replace(phi); |
209 } | 210 } |
210 | 211 |
211 | 212 |
212 Reduction ChangeLowering::ChangeUint32ToTagged(Node* val, Node* control) { | 213 Reduction ChangeLowering::ChangeUint32ToTagged(Node* val, Node* control) { |
213 STATIC_ASSERT(kSmiTag == 0); | 214 STATIC_ASSERT(kSmiTag == 0); |
214 STATIC_ASSERT(kSmiTagMask == 1); | 215 STATIC_ASSERT(kSmiTagMask == 1); |
215 | 216 |
216 Node* cmp = graph()->NewNode(machine()->Uint32LessThanOrEqual(), val, | 217 Node* cmp = graph()->NewNode(machine()->Uint32LessThanOrEqual(), val, |
217 SmiMaxValueConstant()); | 218 SmiMaxValueConstant()); |
218 Node* branch = graph()->NewNode(common()->Branch(), cmp, control); | 219 Node* branch = |
| 220 graph()->NewNode(common()->Branch(BranchHint::kTrue), cmp, control); |
219 | 221 |
220 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 222 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
221 Node* smi = graph()->NewNode( | 223 Node* smi = graph()->NewNode( |
222 machine()->WordShl(), | 224 machine()->WordShl(), |
223 machine()->Is64() | 225 machine()->Is64() |
224 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), val) | 226 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), val) |
225 : val, | 227 : val, |
226 SmiShiftBitsConstant()); | 228 SmiShiftBitsConstant()); |
227 | 229 |
228 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 230 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
(...skipping 19 matching lines...) Expand all Loading... |
248 } | 250 } |
249 | 251 |
250 | 252 |
251 MachineOperatorBuilder* ChangeLowering::machine() const { | 253 MachineOperatorBuilder* ChangeLowering::machine() const { |
252 return jsgraph()->machine(); | 254 return jsgraph()->machine(); |
253 } | 255 } |
254 | 256 |
255 } // namespace compiler | 257 } // namespace compiler |
256 } // namespace internal | 258 } // namespace internal |
257 } // namespace v8 | 259 } // namespace v8 |
OLD | NEW |