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

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

Issue 614713002: Relax representation requirement in FrameStates. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 2 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/machine-type.h ('k') | test/unittests/compiler/instruction-selector-unittest.h » ('j') | 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph-inl.h" 10 #include "src/compiler/graph-inl.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 Node::Inputs inputs = node->inputs(); 277 Node::Inputs inputs = node->inputs();
278 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); 278 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
279 ++iter, --values) { 279 ++iter, --values) {
280 // TODO(titzer): it'd be nice to have distinguished edge kinds here. 280 // TODO(titzer): it'd be nice to have distinguished edge kinds here.
281 ProcessInput(node, iter.index(), values > 0 ? use : 0); 281 ProcessInput(node, iter.index(), values > 0 ? use : 0);
282 } 282 }
283 } 283 }
284 // Phis adapt to whatever output representation their uses demand, 284 // Phis adapt to whatever output representation their uses demand,
285 // pushing representation changes to their inputs. 285 // pushing representation changes to their inputs.
286 MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask; 286 MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask;
287 MachineTypeUnion use_type = GetUseInfo(node) & kTypeMask; 287 Type* upper = NodeProperties::GetBounds(node).upper;
288 MachineTypeUnion phi_type = changer_->TypeFromUpperBound(upper);
288 MachineTypeUnion rep = 0; 289 MachineTypeUnion rep = 0;
289 if (use_rep & kRepTagged) { 290 if (use_rep & kRepTagged) {
290 rep = kRepTagged; // Tagged overrides everything. 291 rep = kRepTagged; // Tagged overrides everything.
291 } else if (use_rep & kRepFloat32) { 292 } else if (use_rep & kRepFloat32) {
292 rep = kRepFloat32; 293 rep = kRepFloat32;
293 } else if (use_rep & kRepFloat64) { 294 } else if (use_rep & kRepFloat64) {
294 rep = kRepFloat64; 295 rep = kRepFloat64;
295 } else if (use_rep & kRepWord64) { 296 } else if (use_rep & kRepWord64) {
296 rep = kRepWord64; 297 rep = kRepWord64;
297 } else if (use_rep & kRepWord32) { 298 } else if (use_rep & kRepWord32) {
298 rep = kRepWord32; 299 if (phi_type & kTypeNumber) {
300 rep = kRepFloat64;
301 } else {
302 rep = kRepWord32;
303 }
299 } else if (use_rep & kRepBit) { 304 } else if (use_rep & kRepBit) {
300 rep = kRepBit; 305 rep = kRepBit;
301 } else { 306 } else {
302 // There was no representation associated with any of the uses. 307 // There was no representation associated with any of the uses.
303 // TODO(titzer): Select the best rep using phi's type, not the usage type? 308 if (phi_type & kTypeAny) {
304 if (use_type & kTypeAny) {
305 rep = kRepTagged; 309 rep = kRepTagged;
306 } else if (use_type & kTypeNumber) { 310 } else if (phi_type & kTypeNumber) {
307 rep = kRepFloat64; 311 rep = kRepFloat64;
308 } else if (use_type & kTypeInt64 || use_type & kTypeUint64) { 312 } else if (phi_type & kTypeInt64 || phi_type & kTypeUint64) {
309 rep = kRepWord64; 313 rep = kRepWord64;
310 } else if (use_type & kTypeInt32 || use_type & kTypeUint32) { 314 } else if (phi_type & kTypeInt32 || phi_type & kTypeUint32) {
311 rep = kRepWord32; 315 rep = kRepWord32;
312 } else if (use_type & kTypeBool) { 316 } else if (phi_type & kTypeBool) {
313 rep = kRepBit; 317 rep = kRepBit;
314 } else { 318 } else {
315 UNREACHABLE(); // should have at least a usage type! 319 UNREACHABLE(); // should have at least a usage type!
316 } 320 }
317 } 321 }
318 // Preserve the usage type, but set the representation. 322 // Preserve the usage type, but set the representation.
319 Type* upper = NodeProperties::GetBounds(node).upper; 323 MachineTypeUnion output_type = rep | phi_type;
320 MachineTypeUnion output_type = rep | changer_->TypeFromUpperBound(upper);
321 SetOutput(node, output_type); 324 SetOutput(node, output_type);
322 325
323 if (lower()) { 326 if (lower()) {
324 int values = OperatorProperties::GetValueInputCount(node->op()); 327 int values = OperatorProperties::GetValueInputCount(node->op());
325 328
326 // Update the phi operator. 329 // Update the phi operator.
327 MachineType type = static_cast<MachineType>(output_type); 330 MachineType type = static_cast<MachineType>(output_type);
328 if (type != OpParameter<MachineType>(node)) { 331 if (type != OpParameter<MachineType>(node)) {
329 node->set_op(lowering->common()->Phi(type, values)); 332 node->set_op(lowering->common()->Phi(type, values));
330 } 333 }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 case IrOpcode::kFloat64Mod: 724 case IrOpcode::kFloat64Mod:
722 return VisitFloat64Binop(node); 725 return VisitFloat64Binop(node);
723 case IrOpcode::kFloat64Sqrt: 726 case IrOpcode::kFloat64Sqrt:
724 return VisitUnop(node, kMachFloat64, kMachFloat64); 727 return VisitUnop(node, kMachFloat64, kMachFloat64);
725 case IrOpcode::kFloat64Equal: 728 case IrOpcode::kFloat64Equal:
726 case IrOpcode::kFloat64LessThan: 729 case IrOpcode::kFloat64LessThan:
727 case IrOpcode::kFloat64LessThanOrEqual: 730 case IrOpcode::kFloat64LessThanOrEqual:
728 return VisitFloat64Cmp(node); 731 return VisitFloat64Cmp(node);
729 case IrOpcode::kLoadStackPointer: 732 case IrOpcode::kLoadStackPointer:
730 return VisitLeaf(node, kMachPtr); 733 return VisitLeaf(node, kMachPtr);
734 case IrOpcode::kStateValues:
735 for (int i = 0; i < node->InputCount(); i++) {
736 ProcessInput(node, i, kTypeAny);
737 }
738 SetOutput(node, kMachAnyTagged);
739 break;
731 default: 740 default:
732 VisitInputs(node); 741 VisitInputs(node);
733 break; 742 break;
734 } 743 }
735 } 744 }
736 745
737 void DeferReplacement(Node* node, Node* replacement) { 746 void DeferReplacement(Node* node, Node* replacement) {
738 if (replacement->id() < count_) { 747 if (replacement->id() < count_) {
739 // Replace with a previously existing node eagerly. 748 // Replace with a previously existing node eagerly.
740 node->ReplaceUses(replacement); 749 node->ReplaceUses(replacement);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 973 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
965 node->set_op(machine()->IntLessThanOrEqual()); 974 node->set_op(machine()->IntLessThanOrEqual());
966 node->ReplaceInput(0, StringComparison(node, true)); 975 node->ReplaceInput(0, StringComparison(node, true));
967 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 976 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
968 } 977 }
969 978
970 979
971 } // namespace compiler 980 } // namespace compiler
972 } // namespace internal 981 } // namespace internal
973 } // namespace v8 982 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-type.h ('k') | test/unittests/compiler/instruction-selector-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698