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

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

Issue 470593002: Unify MachineType and RepType. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
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/common-node-cache.h" 7 #include "src/compiler/common-node-cache.h"
8 #include "src/compiler/graph.h" 8 #include "src/compiler/graph.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 Runtime::FunctionForId(Runtime::kAllocateHeapNumber); 166 Runtime::FunctionForId(Runtime::kAllocateHeapNumber);
167 DCHECK_EQ(0, fn->nargs); 167 DCHECK_EQ(0, fn->nargs);
168 CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor( 168 CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor(
169 fn->function_id, 0, Operator::kNoProperties); 169 fn->function_id, 0, Operator::kNoProperties);
170 Node* heap_number = 170 Node* heap_number =
171 graph()->NewNode(common()->Call(desc), CEntryStubConstant(), 171 graph()->NewNode(common()->Call(desc), CEntryStubConstant(),
172 ExternalConstant(ExternalReference(fn, isolate())), 172 ExternalConstant(ExternalReference(fn, isolate())),
173 Int32Constant(0), context, effect, if_true); 173 Int32Constant(0), context, effect, if_true);
174 174
175 Node* store = graph()->NewNode( 175 Node* store = graph()->NewNode(
176 machine()->Store(kMachineFloat64, kNoWriteBarrier), heap_number, 176 machine()->Store(kMachFloat64, kNoWriteBarrier), heap_number,
177 Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), number, effect, 177 Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), number, effect,
178 heap_number); 178 heap_number);
179 179
180 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 180 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
181 Node* smi = graph()->NewNode(common()->Projection(0), add); 181 Node* smi = graph()->NewNode(common()->Projection(0), add);
182 182
183 Node* merge = graph()->NewNode(common()->Merge(2), store, if_false); 183 Node* merge = graph()->NewNode(common()->Merge(2), store, if_false);
184 Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge); 184 Node* phi = graph()->NewNode(common()->Phi(2), heap_number, smi, merge);
185 185
186 return Replace(phi); 186 return Replace(phi);
(...skipping 12 matching lines...) Expand all
199 template <> 199 template <>
200 Reduction ChangeLowering<4>::ChangeTaggedToFloat64(Node* val, Node* effect, 200 Reduction ChangeLowering<4>::ChangeTaggedToFloat64(Node* val, Node* effect,
201 Node* control) { 201 Node* control) {
202 Node* branch = graph()->NewNode( 202 Node* branch = graph()->NewNode(
203 common()->Branch(), 203 common()->Branch(),
204 graph()->NewNode(machine()->Word32And(), val, Int32Constant(kSmiTagMask)), 204 graph()->NewNode(machine()->Word32And(), val, Int32Constant(kSmiTagMask)),
205 control); 205 control);
206 206
207 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 207 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
208 Node* load = graph()->NewNode( 208 Node* load = graph()->NewNode(
209 machine()->Load(kMachineFloat64), val, 209 machine()->Load(kMachFloat64), val,
210 Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true); 210 Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true);
211 211
212 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 212 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
213 Node* number = graph()->NewNode( 213 Node* number = graph()->NewNode(
214 machine()->ChangeInt32ToFloat64(), 214 machine()->ChangeInt32ToFloat64(),
215 graph()->NewNode( 215 graph()->NewNode(
216 machine()->Word32Sar(), val, 216 machine()->Word32Sar(), val,
217 Int32Constant(SmiTagging<4>::kSmiShiftSize + kSmiTagSize))); 217 Int32Constant(SmiTagging<4>::kSmiShiftSize + kSmiTagSize)));
218 218
219 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 219 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
220 Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge); 220 Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge);
221 221
222 return Replace(phi); 222 return Replace(phi);
223 } 223 }
224 224
225 225
226 template <> 226 template <>
227 Reduction ChangeLowering<8>::ChangeTaggedToFloat64(Node* val, Node* effect, 227 Reduction ChangeLowering<8>::ChangeTaggedToFloat64(Node* val, Node* effect,
228 Node* control) { 228 Node* control) {
229 Node* branch = graph()->NewNode( 229 Node* branch = graph()->NewNode(
230 common()->Branch(), 230 common()->Branch(),
231 graph()->NewNode(machine()->Word64And(), val, Int32Constant(kSmiTagMask)), 231 graph()->NewNode(machine()->Word64And(), val, Int32Constant(kSmiTagMask)),
232 control); 232 control);
233 233
234 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 234 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
235 Node* load = graph()->NewNode( 235 Node* load = graph()->NewNode(
236 machine()->Load(kMachineFloat64), val, 236 machine()->Load(kMachFloat64), val,
237 Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true); 237 Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true);
238 238
239 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 239 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
240 Node* number = graph()->NewNode( 240 Node* number = graph()->NewNode(
241 machine()->ChangeInt32ToFloat64(), 241 machine()->ChangeInt32ToFloat64(),
242 graph()->NewNode( 242 graph()->NewNode(
243 machine()->ConvertInt64ToInt32(), 243 machine()->ConvertInt64ToInt32(),
244 graph()->NewNode( 244 graph()->NewNode(
245 machine()->Word64Sar(), val, 245 machine()->Word64Sar(), val,
246 Int32Constant(SmiTagging<8>::kSmiShiftSize + kSmiTagSize)))); 246 Int32Constant(SmiTagging<8>::kSmiShiftSize + kSmiTagSize))));
247 247
248 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 248 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
249 Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge); 249 Node* phi = graph()->NewNode(common()->Phi(2), load, number, merge);
250 250
251 return Replace(phi); 251 return Replace(phi);
252 } 252 }
253 253
254 254
255 template class ChangeLowering<4>; 255 template class ChangeLowering<4>;
256 template class ChangeLowering<8>; 256 template class ChangeLowering<8>;
257 257
258 } // namespace compiler 258 } // namespace compiler
259 } // namespace internal 259 } // namespace internal
260 } // namespace v8 260 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/ia32/instruction-selector-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698