| 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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 MachineType use_type = | 417 MachineType use_type = |
| 418 static_cast<MachineType>((use & kTypeMask) | output); | 418 static_cast<MachineType>((use & kTypeMask) | output); |
| 419 for (Edge const edge : node->input_edges()) { | 419 for (Edge const edge : node->input_edges()) { |
| 420 // TODO(titzer): it'd be nice to have distinguished edge kinds here. | 420 // TODO(titzer): it'd be nice to have distinguished edge kinds here. |
| 421 ProcessInput(node, edge.index(), values > 0 ? use_type : 0); | 421 ProcessInput(node, edge.index(), values > 0 ? use_type : 0); |
| 422 values--; | 422 values--; |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 | 426 |
| 427 void VisitStateValues(Node* node) { |
| 428 if (phase_ == PROPAGATE) { |
| 429 for (int i = 0; i < node->InputCount(); i++) { |
| 430 Enqueue(node->InputAt(i), kTypeAny); |
| 431 } |
| 432 } else { |
| 433 Zone* zone = jsgraph_->zone(); |
| 434 ZoneVector<MachineType>* types = |
| 435 new (zone->New(sizeof(ZoneVector<MachineType>))) |
| 436 ZoneVector<MachineType>(node->InputCount(), zone); |
| 437 for (int i = 0; i < node->InputCount(); i++) { |
| 438 MachineTypeUnion input_type = GetInfo(node->InputAt(i))->output; |
| 439 (*types)[i] = static_cast<MachineType>(input_type); |
| 440 } |
| 441 node->set_op(jsgraph_->common()->TypedStateValues(types)); |
| 442 } |
| 443 SetOutput(node, kMachAnyTagged); |
| 444 } |
| 445 |
| 427 const Operator* Int32Op(Node* node) { | 446 const Operator* Int32Op(Node* node) { |
| 428 return changer_->Int32OperatorFor(node->opcode()); | 447 return changer_->Int32OperatorFor(node->opcode()); |
| 429 } | 448 } |
| 430 | 449 |
| 431 const Operator* Uint32Op(Node* node) { | 450 const Operator* Uint32Op(Node* node) { |
| 432 return changer_->Uint32OperatorFor(node->opcode()); | 451 return changer_->Uint32OperatorFor(node->opcode()); |
| 433 } | 452 } |
| 434 | 453 |
| 435 const Operator* Float64Op(Node* node) { | 454 const Operator* Float64Op(Node* node) { |
| 436 return changer_->Float64OperatorFor(node->opcode()); | 455 return changer_->Float64OperatorFor(node->opcode()); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 return VisitFloat64Cmp(node); | 1051 return VisitFloat64Cmp(node); |
| 1033 case IrOpcode::kFloat64ExtractLowWord32: | 1052 case IrOpcode::kFloat64ExtractLowWord32: |
| 1034 case IrOpcode::kFloat64ExtractHighWord32: | 1053 case IrOpcode::kFloat64ExtractHighWord32: |
| 1035 return VisitUnop(node, kMachFloat64, kMachInt32); | 1054 return VisitUnop(node, kMachFloat64, kMachInt32); |
| 1036 case IrOpcode::kFloat64InsertLowWord32: | 1055 case IrOpcode::kFloat64InsertLowWord32: |
| 1037 case IrOpcode::kFloat64InsertHighWord32: | 1056 case IrOpcode::kFloat64InsertHighWord32: |
| 1038 return VisitBinop(node, kMachFloat64, kMachInt32, kMachFloat64); | 1057 return VisitBinop(node, kMachFloat64, kMachInt32, kMachFloat64); |
| 1039 case IrOpcode::kLoadStackPointer: | 1058 case IrOpcode::kLoadStackPointer: |
| 1040 return VisitLeaf(node, kMachPtr); | 1059 return VisitLeaf(node, kMachPtr); |
| 1041 case IrOpcode::kStateValues: | 1060 case IrOpcode::kStateValues: |
| 1042 for (int i = 0; i < node->InputCount(); i++) { | 1061 VisitStateValues(node); |
| 1043 ProcessInput(node, i, kTypeAny); | |
| 1044 } | |
| 1045 SetOutput(node, kMachAnyTagged); | |
| 1046 break; | 1062 break; |
| 1047 default: | 1063 default: |
| 1048 VisitInputs(node); | 1064 VisitInputs(node); |
| 1049 break; | 1065 break; |
| 1050 } | 1066 } |
| 1051 } | 1067 } |
| 1052 | 1068 |
| 1053 void DeferReplacement(Node* node, Node* replacement) { | 1069 void DeferReplacement(Node* node, Node* replacement) { |
| 1054 TRACE("defer replacement #%d:%s with #%d:%s\n", node->id(), | 1070 TRACE("defer replacement #%d:%s with #%d:%s\n", node->id(), |
| 1055 node->op()->mnemonic(), replacement->id(), | 1071 node->op()->mnemonic(), replacement->id(), |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 | 1610 |
| 1595 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1611 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 1596 node->set_op(machine()->IntLessThanOrEqual()); | 1612 node->set_op(machine()->IntLessThanOrEqual()); |
| 1597 node->ReplaceInput(0, StringComparison(node, true)); | 1613 node->ReplaceInput(0, StringComparison(node, true)); |
| 1598 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1614 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1599 } | 1615 } |
| 1600 | 1616 |
| 1601 } // namespace compiler | 1617 } // namespace compiler |
| 1602 } // namespace internal | 1618 } // namespace internal |
| 1603 } // namespace v8 | 1619 } // namespace v8 |
| OLD | NEW |