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

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

Issue 694353006: [turbofan] Fix branch hints for ChangeInt32ToTagged and ChangeTaggedToUI32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 145 Node* branch =
146 graph()->NewNode(common()->Branch(BranchHint::kTrue), ovf, control); 146 graph()->NewNode(common()->Branch(BranchHint::kFalse), ovf, control);
147 147
148 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 148 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
149 Node* heap_number = AllocateHeapNumberWithValue( 149 Node* heap_number = AllocateHeapNumberWithValue(
150 graph()->NewNode(machine()->ChangeInt32ToFloat64(), val), if_true); 150 graph()->NewNode(machine()->ChangeInt32ToFloat64(), val), if_true);
151 151
152 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 152 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
153 Node* smi = graph()->NewNode(common()->Projection(0), add); 153 Node* smi = graph()->NewNode(common()->Projection(0), add);
154 154
155 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 155 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
156 Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), heap_number, 156 Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), heap_number,
157 smi, merge); 157 smi, merge);
158 158
159 return Replace(phi); 159 return Replace(phi);
160 } 160 }
161 161
162 162
163 Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control, 163 Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control,
164 Signedness signedness) { 164 Signedness signedness) {
165 STATIC_ASSERT(kSmiTag == 0); 165 STATIC_ASSERT(kSmiTag == 0);
166 STATIC_ASSERT(kSmiTagMask == 1); 166 STATIC_ASSERT(kSmiTagMask == 1);
167 167
168 Node* tag = graph()->NewNode(machine()->WordAnd(), val, 168 Node* tag = graph()->NewNode(machine()->WordAnd(), val,
169 jsgraph()->IntPtrConstant(kSmiTagMask)); 169 jsgraph()->IntPtrConstant(kSmiTagMask));
170 Node* branch = graph()->NewNode(common()->Branch(), tag, control); 170 Node* branch =
171 graph()->NewNode(common()->Branch(BranchHint::kFalse), tag, control);
171 172
172 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 173 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
173 const Operator* op = (signedness == kSigned) 174 const Operator* op = (signedness == kSigned)
174 ? machine()->ChangeFloat64ToInt32() 175 ? machine()->ChangeFloat64ToInt32()
175 : machine()->ChangeFloat64ToUint32(); 176 : machine()->ChangeFloat64ToUint32();
176 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true)); 177 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));
177 178
178 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 179 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
179 Node* number = ChangeSmiToInt32(val); 180 Node* number = ChangeSmiToInt32(val);
180 181
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 251 }
251 252
252 253
253 MachineOperatorBuilder* ChangeLowering::machine() const { 254 MachineOperatorBuilder* ChangeLowering::machine() const {
254 return jsgraph()->machine(); 255 return jsgraph()->machine();
255 } 256 }
256 257
257 } // namespace compiler 258 } // namespace compiler
258 } // namespace internal 259 } // namespace internal
259 } // namespace v8 260 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698