| 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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 const ElementAccess& access = ElementAccessOf(node->op()); | 1337 const ElementAccess& access = ElementAccessOf(node->op()); |
| 1338 Type* type = NodeProperties::GetType(node->InputAt(2)); | 1338 Type* type = NodeProperties::GetType(node->InputAt(2)); |
| 1339 node->set_op(machine()->Store( | 1339 node->set_op(machine()->Store( |
| 1340 StoreRepresentation(access.machine_type, | 1340 StoreRepresentation(access.machine_type, |
| 1341 ComputeWriteBarrierKind(access.base_is_tagged, | 1341 ComputeWriteBarrierKind(access.base_is_tagged, |
| 1342 access.machine_type, type)))); | 1342 access.machine_type, type)))); |
| 1343 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 1343 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 | 1346 |
| 1347 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { | 1347 Node* SimplifiedLowering::StringComparison(Node* node) { |
| 1348 Runtime::FunctionId f = | 1348 Operator::Properties properties = node->op()->properties(); |
| 1349 requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals; | 1349 Callable callable = CodeFactory::StringCompare(isolate()); |
| 1350 ExternalReference ref(f, jsgraph()->isolate()); | 1350 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
| 1351 Operator::Properties props = node->op()->properties(); | 1351 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 1352 // TODO(mstarzinger): We should call StringCompareStub here instead, once an | 1352 isolate(), zone(), callable.descriptor(), 0, flags, properties); |
| 1353 // interface descriptor is available for it. | 1353 return graph()->NewNode( |
| 1354 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); | 1354 common()->Call(desc), jsgraph()->HeapConstant(callable.code()), |
| 1355 return graph()->NewNode(common()->Call(desc), | 1355 NodeProperties::GetValueInput(node, 0), |
| 1356 jsgraph()->CEntryStubConstant(1), | 1356 NodeProperties::GetValueInput(node, 1), jsgraph()->NoContextConstant()); |
| 1357 NodeProperties::GetValueInput(node, 0), | |
| 1358 NodeProperties::GetValueInput(node, 1), | |
| 1359 jsgraph()->ExternalConstant(ref), | |
| 1360 jsgraph()->Int32Constant(2), | |
| 1361 jsgraph()->NoContextConstant()); | |
| 1362 } | 1357 } |
| 1363 | 1358 |
| 1364 | 1359 |
| 1365 Node* SimplifiedLowering::Int32Div(Node* const node) { | 1360 Node* SimplifiedLowering::Int32Div(Node* const node) { |
| 1366 Int32BinopMatcher m(node); | 1361 Int32BinopMatcher m(node); |
| 1367 Node* const zero = jsgraph()->Int32Constant(0); | 1362 Node* const zero = jsgraph()->Int32Constant(0); |
| 1368 Node* const minus_one = jsgraph()->Int32Constant(-1); | 1363 Node* const minus_one = jsgraph()->Int32Constant(-1); |
| 1369 Node* const lhs = m.left().node(); | 1364 Node* const lhs = m.left().node(); |
| 1370 Node* const rhs = m.right().node(); | 1365 Node* const rhs = m.right().node(); |
| 1371 | 1366 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 Type* const rhs_type = NodeProperties::GetType(rhs); | 1612 Type* const rhs_type = NodeProperties::GetType(rhs); |
| 1618 if (!rhs_type->Is(zero_thirtyone_range_)) { | 1613 if (!rhs_type->Is(zero_thirtyone_range_)) { |
| 1619 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, | 1614 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, |
| 1620 jsgraph()->Int32Constant(0x1f))); | 1615 jsgraph()->Int32Constant(0x1f))); |
| 1621 } | 1616 } |
| 1622 } | 1617 } |
| 1623 | 1618 |
| 1624 | 1619 |
| 1625 void SimplifiedLowering::DoStringEqual(Node* node) { | 1620 void SimplifiedLowering::DoStringEqual(Node* node) { |
| 1626 node->set_op(machine()->WordEqual()); | 1621 node->set_op(machine()->WordEqual()); |
| 1627 node->ReplaceInput(0, StringComparison(node, false)); | 1622 node->ReplaceInput(0, StringComparison(node)); |
| 1628 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1623 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1629 } | 1624 } |
| 1630 | 1625 |
| 1631 | 1626 |
| 1632 void SimplifiedLowering::DoStringLessThan(Node* node) { | 1627 void SimplifiedLowering::DoStringLessThan(Node* node) { |
| 1633 node->set_op(machine()->IntLessThan()); | 1628 node->set_op(machine()->IntLessThan()); |
| 1634 node->ReplaceInput(0, StringComparison(node, true)); | 1629 node->ReplaceInput(0, StringComparison(node)); |
| 1635 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1630 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1636 } | 1631 } |
| 1637 | 1632 |
| 1638 | 1633 |
| 1639 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1634 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 1640 node->set_op(machine()->IntLessThanOrEqual()); | 1635 node->set_op(machine()->IntLessThanOrEqual()); |
| 1641 node->ReplaceInput(0, StringComparison(node, true)); | 1636 node->ReplaceInput(0, StringComparison(node)); |
| 1642 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1637 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1643 } | 1638 } |
| 1644 | 1639 |
| 1645 } // namespace compiler | 1640 } // namespace compiler |
| 1646 } // namespace internal | 1641 } // namespace internal |
| 1647 } // namespace v8 | 1642 } // namespace v8 |
| OLD | NEW |