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

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

Issue 529893002: Fix representation change insertion for phis. (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 | « 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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/representation-change.h" 10 #include "src/compiler/representation-change.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 void VisitFloat64Cmp(Node* node) { VisitBinop(node, kMachFloat64, kRepBit); } 248 void VisitFloat64Cmp(Node* node) { VisitBinop(node, kMachFloat64, kRepBit); }
249 void VisitInt32Cmp(Node* node) { VisitBinop(node, kMachInt32, kRepBit); } 249 void VisitInt32Cmp(Node* node) { VisitBinop(node, kMachInt32, kRepBit); }
250 void VisitUint32Cmp(Node* node) { VisitBinop(node, kMachUint32, kRepBit); } 250 void VisitUint32Cmp(Node* node) { VisitBinop(node, kMachUint32, kRepBit); }
251 void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); } 251 void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); }
252 void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); } 252 void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); }
253 253
254 // Helper for handling phis. 254 // Helper for handling phis.
255 void VisitPhi(Node* node, MachineTypeUnion use) { 255 void VisitPhi(Node* node, MachineTypeUnion use) {
256 // First, propagate the usage information to inputs of the phi. 256 // First, propagate the usage information to inputs of the phi.
257 int values = OperatorProperties::GetValueInputCount(node->op()); 257 int values = OperatorProperties::GetValueInputCount(node->op());
Michael Starzinger 2014/09/02 08:37:01 nit: Can we move the values into the condition (i.
titzer 2014/09/02 10:14:58 Done.
258 Node::Inputs inputs = node->inputs(); 258 if (!lower()) {
259 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
260 ++iter, --values) {
261 // Propagate {use} of the phi to value inputs, and 0 to control. 259 // Propagate {use} of the phi to value inputs, and 0 to control.
262 // TODO(titzer): it'd be nice to have distinguished edge kinds here. 260 Node::Inputs inputs = node->inputs();
263 ProcessInput(node, iter.index(), values > 0 ? use : 0); 261 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
262 ++iter, --values) {
263 // TODO(titzer): it'd be nice to have distinguished edge kinds here.
264 ProcessInput(node, iter.index(), values > 0 ? use : 0);
265 }
264 } 266 }
265 // Phis adapt to whatever output representation their uses demand, 267 // Phis adapt to whatever output representation their uses demand,
266 // pushing representation changes to their inputs. 268 // pushing representation changes to their inputs.
267 MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask; 269 MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask;
268 MachineTypeUnion use_type = GetUseInfo(node) & kTypeMask; 270 MachineTypeUnion use_type = GetUseInfo(node) & kTypeMask;
269 MachineTypeUnion rep = 0; 271 MachineTypeUnion rep = 0;
270 if (use_rep & kRepTagged) { 272 if (use_rep & kRepTagged) {
271 rep = kRepTagged; // Tagged overrides everything. 273 rep = kRepTagged; // Tagged overrides everything.
272 } else if (use_rep & kRepFloat64) { 274 } else if (use_rep & kRepFloat64) {
273 rep = kRepFloat64; 275 rep = kRepFloat64;
(...skipping 15 matching lines...) Expand all
289 } else if (use_type & kTypeInt32 || use_type & kTypeUint32) { 291 } else if (use_type & kTypeInt32 || use_type & kTypeUint32) {
290 rep = kRepWord32; 292 rep = kRepWord32;
291 } else if (use_type & kTypeBool) { 293 } else if (use_type & kTypeBool) {
292 rep = kRepBit; 294 rep = kRepBit;
293 } else { 295 } else {
294 UNREACHABLE(); // should have at least a usage type! 296 UNREACHABLE(); // should have at least a usage type!
295 } 297 }
296 } 298 }
297 // Preserve the usage type, but set the representation. 299 // Preserve the usage type, but set the representation.
298 Type* upper = NodeProperties::GetBounds(node).upper; 300 Type* upper = NodeProperties::GetBounds(node).upper;
299 SetOutput(node, rep | changer_->TypeFromUpperBound(upper)); 301 MachineTypeUnion output_type = rep | changer_->TypeFromUpperBound(upper);
302 SetOutput(node, output_type);
303
304 if (lower()) {
305 // Convert inputs to the output representation of this phi.
306 Node::Inputs inputs = node->inputs();
307 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
308 ++iter, --values) {
309 // TODO(titzer): it'd be nice to have distinguished edge kinds here.
310 ProcessInput(node, iter.index(), values > 0 ? output_type : 0);
311 }
312 }
300 } 313 }
301 314
302 Operator* Int32Op(Node* node) { 315 Operator* Int32Op(Node* node) {
303 return changer_->Int32OperatorFor(node->opcode()); 316 return changer_->Int32OperatorFor(node->opcode());
304 } 317 }
305 318
306 Operator* Uint32Op(Node* node) { 319 Operator* Uint32Op(Node* node) {
307 return changer_->Uint32OperatorFor(node->opcode()); 320 return changer_->Uint32OperatorFor(node->opcode());
308 } 321 }
309 322
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 WriteBarrierKind kind = ComputeWriteBarrierKind( 816 WriteBarrierKind kind = ComputeWriteBarrierKind(
804 access.base_is_tagged, access.machine_type, access.type); 817 access.base_is_tagged, access.machine_type, access.type);
805 node->set_op(machine_.Store(access.machine_type, kind)); 818 node->set_op(machine_.Store(access.machine_type, kind));
806 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 819 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
807 } 820 }
808 821
809 822
810 } // namespace compiler 823 } // namespace compiler
811 } // namespace internal 824 } // namespace internal
812 } // namespace v8 825 } // 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