| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // but that responsibility really lies in the typed lowering phase. | 531 // but that responsibility really lies in the typed lowering phase. |
| 532 #define DEFINE_JS_CASE(x) case IrOpcode::k##x: | 532 #define DEFINE_JS_CASE(x) case IrOpcode::k##x: |
| 533 JS_OP_LIST(DEFINE_JS_CASE) | 533 JS_OP_LIST(DEFINE_JS_CASE) |
| 534 #undef DEFINE_JS_CASE | 534 #undef DEFINE_JS_CASE |
| 535 VisitInputs(node); | 535 VisitInputs(node); |
| 536 return SetOutput(node, kRepTagged); | 536 return SetOutput(node, kRepTagged); |
| 537 | 537 |
| 538 //------------------------------------------------------------------ | 538 //------------------------------------------------------------------ |
| 539 // Simplified operators. | 539 // Simplified operators. |
| 540 //------------------------------------------------------------------ | 540 //------------------------------------------------------------------ |
| 541 case IrOpcode::kAnyToBoolean: { | |
| 542 VisitUnop(node, kMachAnyTagged, kTypeBool | kRepTagged); | |
| 543 if (lower()) { | |
| 544 // AnyToBoolean(x) => Call(ToBooleanStub, x, no-context) | |
| 545 Operator::Properties properties = node->op()->properties(); | |
| 546 Callable callable = CodeFactory::ToBoolean( | |
| 547 jsgraph_->isolate(), ToBooleanStub::RESULT_AS_ODDBALL); | |
| 548 CallDescriptor::Flags flags = CallDescriptor::kPatchableCallSite; | |
| 549 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | |
| 550 jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0, | |
| 551 flags, properties); | |
| 552 node->set_op(jsgraph_->common()->Call(desc)); | |
| 553 node->InsertInput(jsgraph_->zone(), 0, | |
| 554 jsgraph_->HeapConstant(callable.code())); | |
| 555 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); | |
| 556 } | |
| 557 break; | |
| 558 } | |
| 559 case IrOpcode::kBooleanNot: { | 541 case IrOpcode::kBooleanNot: { |
| 560 if (lower()) { | 542 if (lower()) { |
| 561 MachineTypeUnion input = GetInfo(node->InputAt(0))->output; | 543 MachineTypeUnion input = GetInfo(node->InputAt(0))->output; |
| 562 if (input & kRepBit) { | 544 if (input & kRepBit) { |
| 563 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) | 545 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) |
| 564 node->set_op(lowering->machine()->Word32Equal()); | 546 node->set_op(lowering->machine()->Word32Equal()); |
| 565 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); | 547 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); |
| 566 } else { | 548 } else { |
| 567 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) | 549 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) |
| 568 node->set_op(lowering->machine()->WordEqual()); | 550 node->set_op(lowering->machine()->WordEqual()); |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 | 1576 |
| 1595 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1577 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 1596 node->set_op(machine()->IntLessThanOrEqual()); | 1578 node->set_op(machine()->IntLessThanOrEqual()); |
| 1597 node->ReplaceInput(0, StringComparison(node, true)); | 1579 node->ReplaceInput(0, StringComparison(node, true)); |
| 1598 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1580 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1599 } | 1581 } |
| 1600 | 1582 |
| 1601 } // namespace compiler | 1583 } // namespace compiler |
| 1602 } // namespace internal | 1584 } // namespace internal |
| 1603 } // namespace v8 | 1585 } // namespace v8 |
| OLD | NEW |