| 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/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 new ZoneGrowableArray<Value*>(call->ArgumentCount()); | 1495 new ZoneGrowableArray<Value*>(call->ArgumentCount()); |
| 1496 for (intptr_t i = 0; i < call->ArgumentCount(); i++) { | 1496 for (intptr_t i = 0; i < call->ArgumentCount(); i++) { |
| 1497 args->Add(new Value(call->ArgumentAt(i))); | 1497 args->Add(new Value(call->ArgumentAt(i))); |
| 1498 } | 1498 } |
| 1499 InvokeMathCFunctionInstr* invoke = | 1499 InvokeMathCFunctionInstr* invoke = |
| 1500 new InvokeMathCFunctionInstr(args, call, recognized_kind); | 1500 new InvokeMathCFunctionInstr(args, call, recognized_kind); |
| 1501 ReplaceCall(call, invoke); | 1501 ReplaceCall(call, invoke); |
| 1502 } | 1502 } |
| 1503 | 1503 |
| 1504 | 1504 |
| 1505 static bool IsSupportedByteArrayCid(intptr_t cid) { | 1505 static bool IsSupportedByteArrayViewCid(intptr_t cid) { |
| 1506 switch (cid) { | 1506 switch (cid) { |
| 1507 case kInt8ArrayCid: | 1507 case kInt8ArrayCid: |
| 1508 case kUint8ArrayCid: | 1508 case kUint8ArrayCid: |
| 1509 case kUint8ClampedArrayCid: | 1509 case kUint8ClampedArrayCid: |
| 1510 case kExternalUint8ArrayCid: | |
| 1511 case kExternalUint8ClampedArrayCid: | |
| 1512 case kInt16ArrayCid: | 1510 case kInt16ArrayCid: |
| 1513 case kUint16ArrayCid: | 1511 case kUint16ArrayCid: |
| 1514 case kInt32ArrayCid: | 1512 case kInt32ArrayCid: |
| 1515 case kUint32ArrayCid: | 1513 case kUint32ArrayCid: |
| 1516 case kFloat32ArrayCid: | 1514 case kFloat32ArrayCid: |
| 1517 case kFloat64ArrayCid: | 1515 case kFloat64ArrayCid: |
| 1518 return true; | 1516 return true; |
| 1519 default: | 1517 default: |
| 1520 return false; | 1518 return false; |
| 1521 } | 1519 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 recognized_kind); | 1634 recognized_kind); |
| 1637 ReplaceCall(call, d2d_instr); | 1635 ReplaceCall(call, d2d_instr); |
| 1638 } | 1636 } |
| 1639 return true; | 1637 return true; |
| 1640 default: | 1638 default: |
| 1641 // Unsupported method. | 1639 // Unsupported method. |
| 1642 return false; | 1640 return false; |
| 1643 } | 1641 } |
| 1644 } | 1642 } |
| 1645 | 1643 |
| 1646 if (IsSupportedByteArrayCid(class_ids[0]) && | 1644 if (IsSupportedByteArrayViewCid(class_ids[0]) && |
| 1647 (ic_data.NumberOfChecks() == 1)) { | 1645 (ic_data.NumberOfChecks() == 1)) { |
| 1648 // For elements that may not fit into a smi on all platforms, check if | 1646 // For elements that may not fit into a smi on all platforms, check if |
| 1649 // elements fit into a smi or the platform supports unboxed mints. | 1647 // elements fit into a smi or the platform supports unboxed mints. |
| 1650 if ((recognized_kind == MethodRecognizer::kByteArrayBaseGetInt32) || | 1648 if ((recognized_kind == MethodRecognizer::kByteArrayBaseGetInt32) || |
| 1651 (recognized_kind == MethodRecognizer::kByteArrayBaseGetUint32) || | 1649 (recognized_kind == MethodRecognizer::kByteArrayBaseGetUint32) || |
| 1652 (recognized_kind == MethodRecognizer::kByteArrayBaseSetInt32) || | 1650 (recognized_kind == MethodRecognizer::kByteArrayBaseSetInt32) || |
| 1653 (recognized_kind == MethodRecognizer::kByteArrayBaseSetUint32)) { | 1651 (recognized_kind == MethodRecognizer::kByteArrayBaseSetUint32)) { |
| 1654 if (!CanUnboxInt32()) return false; | 1652 if (!CanUnboxInt32()) return false; |
| 1655 } | 1653 } |
| 1656 | 1654 |
| (...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4708 if (changed) { | 4706 if (changed) { |
| 4709 // We may have changed the block order and the dominator tree. | 4707 // We may have changed the block order and the dominator tree. |
| 4710 flow_graph->DiscoverBlocks(); | 4708 flow_graph->DiscoverBlocks(); |
| 4711 GrowableArray<BitVector*> dominance_frontier; | 4709 GrowableArray<BitVector*> dominance_frontier; |
| 4712 flow_graph->ComputeDominators(&dominance_frontier); | 4710 flow_graph->ComputeDominators(&dominance_frontier); |
| 4713 } | 4711 } |
| 4714 } | 4712 } |
| 4715 | 4713 |
| 4716 | 4714 |
| 4717 } // namespace dart | 4715 } // namespace dart |
| OLD | NEW |