| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 base::bits::IsPowerOfTwo32(output & kRepMask)); | 287 base::bits::IsPowerOfTwo32(output & kRepMask)); |
| 288 GetInfo(node)->set_output_type(output); | 288 GetInfo(node)->set_output_type(output); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool BothInputsAre(Node* node, Type* type) { | 291 bool BothInputsAre(Node* node, Type* type) { |
| 292 DCHECK_EQ(2, node->InputCount()); | 292 DCHECK_EQ(2, node->InputCount()); |
| 293 return NodeProperties::GetType(node->InputAt(0))->Is(type) && | 293 return NodeProperties::GetType(node->InputAt(0))->Is(type) && |
| 294 NodeProperties::GetType(node->InputAt(1))->Is(type); | 294 NodeProperties::GetType(node->InputAt(1))->Is(type); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void ProcessTruncateWord32Input(Node* node, int index) { | |
| 298 Node* input = node->InputAt(index); | |
| 299 if (phase_ == PROPAGATE) { | |
| 300 // In the propagate phase, propagate the usage information backward. | |
| 301 Enqueue(input, UseInfo::TruncatingWord32()); | |
| 302 } else { | |
| 303 // In the change phase, insert a change before the use if necessary. | |
| 304 MachineTypeUnion output = GetInfo(input)->output_type(); | |
| 305 if ((output & (kRepBit | kRepWord8 | kRepWord16 | kRepWord32)) == 0) { | |
| 306 // Output representation doesn't match usage. | |
| 307 TRACE(" truncate-to-int32: #%d:%s(@%d #%d:%s) ", node->id(), | |
| 308 node->op()->mnemonic(), index, input->id(), | |
| 309 input->op()->mnemonic()); | |
| 310 TRACE(" from "); | |
| 311 PrintInfo(output); | |
| 312 TRACE("\n"); | |
| 313 Node* n = changer_->GetTruncatedWord32For(input, output); | |
| 314 node->ReplaceInput(index, n); | |
| 315 } | |
| 316 } | |
| 317 } | |
| 318 | |
| 319 void EnqueueInputUse(Node* node, int index, UseInfo use) { | 297 void EnqueueInputUse(Node* node, int index, UseInfo use) { |
| 320 Enqueue(node->InputAt(index), use); | 298 Enqueue(node->InputAt(index), use); |
| 321 } | 299 } |
| 322 | 300 |
| 323 void ConvertInput(Node* node, int index, UseInfo use) { | 301 void ConvertInput(Node* node, int index, UseInfo use) { |
| 324 Node* input = node->InputAt(index); | 302 Node* input = node->InputAt(index); |
| 325 // In the change phase, insert a change before the use if necessary. | 303 // In the change phase, insert a change before the use if necessary. |
| 326 if (use.preferred() == kMachNone) | 304 if (use.preferred() == kMachNone) |
| 327 return; // No input requirement on the use. | 305 return; // No input requirement on the use. |
| 328 MachineTypeUnion output = GetInfo(input)->output_type(); | 306 MachineTypeUnion output = GetInfo(input)->output_type(); |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 ReplaceEffectUses(node, comparison); | 1597 ReplaceEffectUses(node, comparison); |
| 1620 node->ReplaceInput(0, comparison); | 1598 node->ReplaceInput(0, comparison); |
| 1621 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1599 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1622 node->TrimInputCount(2); | 1600 node->TrimInputCount(2); |
| 1623 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); | 1601 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); |
| 1624 } | 1602 } |
| 1625 | 1603 |
| 1626 } // namespace compiler | 1604 } // namespace compiler |
| 1627 } // namespace internal | 1605 } // namespace internal |
| 1628 } // namespace v8 | 1606 } // namespace v8 |
| OLD | NEW |