Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1467 return false; | 1467 return false; |
| 1468 } | 1468 } |
| 1469 AddCheckClass(call->ArgumentAt(0), | 1469 AddCheckClass(call->ArgumentAt(0), |
| 1470 ICData::ZoneHandle( | 1470 ICData::ZoneHandle( |
| 1471 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | 1471 call->ic_data()->AsUnaryClassChecksForArgNr(0)), |
| 1472 call->deopt_id(), | 1472 call->deopt_id(), |
| 1473 call->env(), | 1473 call->env(), |
| 1474 call); | 1474 call); |
| 1475 intptr_t mask = 0; | 1475 intptr_t mask = 0; |
| 1476 if (getter == MethodRecognizer::kFloat32x4Shuffle) { | 1476 if (getter == MethodRecognizer::kFloat32x4Shuffle) { |
| 1477 // Extract shuffle mask. | |
| 1477 ASSERT(call->ArgumentCount() == 2); | 1478 ASSERT(call->ArgumentCount() == 2); |
| 1478 // Extract shuffle mask. | |
| 1479 Definition* mask_definition = call->ArgumentAt(1); | 1479 Definition* mask_definition = call->ArgumentAt(1); |
| 1480 ASSERT(mask_definition->IsConstant()); | 1480 ASSERT(mask_definition->IsConstant()); |
| 1481 ConstantInstr* constant_instruction = mask_definition->AsConstant(); | 1481 ConstantInstr* constant_instruction = mask_definition->AsConstant(); |
| 1482 const Object& constant_mask = constant_instruction->value(); | 1482 const Object& constant_mask = constant_instruction->value(); |
| 1483 ASSERT(constant_mask.IsSmi()); | 1483 ASSERT(constant_mask.IsSmi()); |
| 1484 mask = Smi::Cast(constant_mask).Value(); | 1484 mask = Smi::Cast(constant_mask).Value(); |
| 1485 ASSERT(mask >= 0); | 1485 ASSERT(mask >= 0); |
| 1486 ASSERT(mask <= 255); | 1486 ASSERT(mask <= 255); |
| 1487 } | 1487 } |
| 1488 Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr( | 1488 if ((getter == MethodRecognizer::kFloat32x4Shuffle) || |
| 1489 getter, | 1489 (getter == MethodRecognizer::kFloat32x4ShuffleX) || |
| 1490 new Value(call->ArgumentAt(0)), | 1490 (getter == MethodRecognizer::kFloat32x4ShuffleY) || |
| 1491 mask, | 1491 (getter == MethodRecognizer::kFloat32x4ShuffleZ) || |
| 1492 call->deopt_id()); | 1492 (getter == MethodRecognizer::kFloat32x4ShuffleW)) { |
| 1493 ReplaceCall(call, instr); | 1493 Float32x4ShuffleInstr* instr = new Float32x4ShuffleInstr( |
| 1494 return true; | 1494 getter, |
| 1495 new Value(call->ArgumentAt(0)), | |
| 1496 mask, | |
| 1497 call->deopt_id()); | |
| 1498 ReplaceCall(call, instr); | |
| 1499 return true; | |
| 1500 } else if (getter == MethodRecognizer::kFloat32x4GetSignMask) { | |
|
srdjan
2013/08/16 00:19:59
It may be better to do
if (getter == MethodRecogn
Cutch
2013/08/19 17:23:22
Done.
| |
| 1501 Float32x4GetSignMaskInstr* instr = new Float32x4GetSignMaskInstr( | |
| 1502 new Value(call->ArgumentAt(0)), | |
| 1503 call->deopt_id()); | |
| 1504 ReplaceCall(call, instr); | |
| 1505 return true; | |
| 1506 } else { | |
| 1507 UNIMPLEMENTED(); | |
| 1508 return false; | |
| 1509 } | |
| 1510 UNREACHABLE(); | |
| 1511 return false; | |
| 1495 } | 1512 } |
| 1496 | 1513 |
| 1497 | 1514 |
| 1498 bool FlowGraphOptimizer::InlineUint32x4Getter(InstanceCallInstr* call, | 1515 bool FlowGraphOptimizer::InlineUint32x4Getter(InstanceCallInstr* call, |
| 1499 MethodRecognizer::Kind getter) { | 1516 MethodRecognizer::Kind getter) { |
| 1500 if (!ShouldInlineSimd()) { | 1517 if (!ShouldInlineSimd()) { |
| 1501 return false; | 1518 return false; |
| 1502 } | 1519 } |
| 1503 AddCheckClass(call->ArgumentAt(0), | 1520 AddCheckClass(call->ArgumentAt(0), |
| 1504 ICData::ZoneHandle( | 1521 ICData::ZoneHandle( |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1642 if (!ic_data.HasOneTarget()) { | 1659 if (!ic_data.HasOneTarget()) { |
| 1643 // Target is not only StringBase_get_isEmpty. | 1660 // Target is not only StringBase_get_isEmpty. |
| 1644 return false; | 1661 return false; |
| 1645 } | 1662 } |
| 1646 InlineStringIsEmptyGetter(call); | 1663 InlineStringIsEmptyGetter(call); |
| 1647 return true; | 1664 return true; |
| 1648 case MethodRecognizer::kFloat32x4ShuffleX: | 1665 case MethodRecognizer::kFloat32x4ShuffleX: |
| 1649 case MethodRecognizer::kFloat32x4ShuffleY: | 1666 case MethodRecognizer::kFloat32x4ShuffleY: |
| 1650 case MethodRecognizer::kFloat32x4ShuffleZ: | 1667 case MethodRecognizer::kFloat32x4ShuffleZ: |
| 1651 case MethodRecognizer::kFloat32x4ShuffleW: | 1668 case MethodRecognizer::kFloat32x4ShuffleW: |
| 1669 case MethodRecognizer::kFloat32x4GetSignMask: | |
| 1652 if (!ic_data.HasReceiverClassId(kFloat32x4Cid) || | 1670 if (!ic_data.HasReceiverClassId(kFloat32x4Cid) || |
| 1653 !ic_data.HasOneTarget()) { | 1671 !ic_data.HasOneTarget()) { |
| 1654 return false; | 1672 return false; |
| 1655 } | 1673 } |
| 1656 return InlineFloat32x4Getter(call, recognized_kind); | 1674 return InlineFloat32x4Getter(call, recognized_kind); |
| 1657 case MethodRecognizer::kUint32x4GetFlagX: | 1675 case MethodRecognizer::kUint32x4GetFlagX: |
| 1658 case MethodRecognizer::kUint32x4GetFlagY: | 1676 case MethodRecognizer::kUint32x4GetFlagY: |
| 1659 case MethodRecognizer::kUint32x4GetFlagZ: | 1677 case MethodRecognizer::kUint32x4GetFlagZ: |
| 1660 case MethodRecognizer::kUint32x4GetFlagW: { | 1678 case MethodRecognizer::kUint32x4GetFlagW: { |
| 1661 if (!ic_data.HasReceiverClassId(kUint32x4Cid) || | 1679 if (!ic_data.HasReceiverClassId(kUint32x4Cid) || |
| (...skipping 4800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6462 Float32x4ConstructorInstr* instr) { | 6480 Float32x4ConstructorInstr* instr) { |
| 6463 SetValue(instr, non_constant_); | 6481 SetValue(instr, non_constant_); |
| 6464 } | 6482 } |
| 6465 | 6483 |
| 6466 | 6484 |
| 6467 void ConstantPropagator::VisitFloat32x4Shuffle(Float32x4ShuffleInstr* instr) { | 6485 void ConstantPropagator::VisitFloat32x4Shuffle(Float32x4ShuffleInstr* instr) { |
| 6468 SetValue(instr, non_constant_); | 6486 SetValue(instr, non_constant_); |
| 6469 } | 6487 } |
| 6470 | 6488 |
| 6471 | 6489 |
| 6490 void ConstantPropagator::VisitFloat32x4GetSignMask( | |
| 6491 Float32x4GetSignMaskInstr* instr) { | |
| 6492 SetValue(instr, non_constant_); | |
| 6493 } | |
| 6494 | |
| 6495 | |
| 6472 void ConstantPropagator::VisitFloat32x4Zero(Float32x4ZeroInstr* instr) { | 6496 void ConstantPropagator::VisitFloat32x4Zero(Float32x4ZeroInstr* instr) { |
| 6473 SetValue(instr, non_constant_); | 6497 SetValue(instr, non_constant_); |
| 6474 } | 6498 } |
| 6475 | 6499 |
| 6476 | 6500 |
| 6477 void ConstantPropagator::VisitFloat32x4Splat(Float32x4SplatInstr* instr) { | 6501 void ConstantPropagator::VisitFloat32x4Splat(Float32x4SplatInstr* instr) { |
| 6478 SetValue(instr, non_constant_); | 6502 SetValue(instr, non_constant_); |
| 6479 } | 6503 } |
| 6480 | 6504 |
| 6481 | 6505 |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7494 } | 7518 } |
| 7495 | 7519 |
| 7496 // Insert materializations at environment uses. | 7520 // Insert materializations at environment uses. |
| 7497 for (intptr_t i = 0; i < exits.length(); i++) { | 7521 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7498 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7522 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 7499 } | 7523 } |
| 7500 } | 7524 } |
| 7501 | 7525 |
| 7502 | 7526 |
| 7503 } // namespace dart | 7527 } // namespace dart |
| OLD | NEW |