| 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 | 1475 |
| 1476 static int HighestCountFirst(const CidTarget* a, const CidTarget* b) { | 1476 static int HighestCountFirst(const CidTarget* a, const CidTarget* b) { |
| 1477 // Negative if 'a' should sort before 'b'. | 1477 // Negative if 'a' should sort before 'b'. |
| 1478 return b->count - a->count; | 1478 return b->count - a->count; |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 | 1481 |
| 1482 // Returns 'sorted' array in decreasing count order. | 1482 // Returns 'sorted' array in decreasing count order. |
| 1483 // The expected number of elements to sort is less than 10. | 1483 // The expected number of elements to sort is less than 10. |
| 1484 void FlowGraphCompiler::SortICDataByCount(const ICData& ic_data, | 1484 void FlowGraphCompiler::SortICDataByCount(const ICData& ic_data, |
| 1485 GrowableArray<CidTarget>* sorted) { | 1485 GrowableArray<CidTarget>* sorted, |
| 1486 bool drop_smi) { |
| 1486 ASSERT(ic_data.NumArgsTested() == 1); | 1487 ASSERT(ic_data.NumArgsTested() == 1); |
| 1487 const intptr_t len = ic_data.NumberOfChecks(); | 1488 const intptr_t len = ic_data.NumberOfChecks(); |
| 1488 sorted->Clear(); | 1489 sorted->Clear(); |
| 1489 | 1490 |
| 1490 for (int i = 0; i < len; i++) { | 1491 for (int i = 0; i < len; i++) { |
| 1491 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1492 intptr_t receiver_cid = ic_data.GetReceiverClassIdAt(i); |
| 1493 if (drop_smi && (receiver_cid == kSmiCid)) continue; |
| 1494 sorted->Add(CidTarget(receiver_cid, |
| 1492 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1495 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
| 1493 ic_data.GetCountAt(i))); | 1496 ic_data.GetCountAt(i))); |
| 1494 } | 1497 } |
| 1495 sorted->Sort(HighestCountFirst); | 1498 sorted->Sort(HighestCountFirst); |
| 1496 } | 1499 } |
| 1497 | 1500 |
| 1498 | 1501 |
| 1499 const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData( | 1502 const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData( |
| 1500 intptr_t deopt_id, | 1503 intptr_t deopt_id, |
| 1501 const String& target_name, | 1504 const String& target_name, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 case kUnboxedMint: | 1574 case kUnboxedMint: |
| 1572 return mint_class(); | 1575 return mint_class(); |
| 1573 default: | 1576 default: |
| 1574 UNREACHABLE(); | 1577 UNREACHABLE(); |
| 1575 return Class::ZoneHandle(); | 1578 return Class::ZoneHandle(); |
| 1576 } | 1579 } |
| 1577 } | 1580 } |
| 1578 | 1581 |
| 1579 | 1582 |
| 1580 } // namespace dart | 1583 } // namespace dart |
| OLD | NEW |