| 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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 } | 974 } |
| 975 | 975 |
| 976 | 976 |
| 977 void FlowGraphCompiler::GenerateInstanceCall( | 977 void FlowGraphCompiler::GenerateInstanceCall( |
| 978 intptr_t deopt_id, | 978 intptr_t deopt_id, |
| 979 intptr_t token_pos, | 979 intptr_t token_pos, |
| 980 intptr_t argument_count, | 980 intptr_t argument_count, |
| 981 LocationSummary* locs, | 981 LocationSummary* locs, |
| 982 const ICData& ic_data) { | 982 const ICData& ic_data) { |
| 983 ASSERT(!ic_data.IsNull()); | 983 ASSERT(!ic_data.IsNull()); |
| 984 ASSERT(FLAG_propagate_ic_data || (ic_data.NumberOfUsedChecks() == 0)); | |
| 985 uword label_address = 0; | 984 uword label_address = 0; |
| 986 StubCode* stub_code = isolate()->stub_code(); | 985 StubCode* stub_code = isolate()->stub_code(); |
| 987 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { | 986 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
| 988 // Emit IC call that will count and thus may need reoptimization at | 987 // Emit IC call that will count and thus may need reoptimization at |
| 989 // function entry. | 988 // function entry. |
| 990 ASSERT(!is_optimizing() | 989 ASSERT(!is_optimizing() |
| 991 || may_reoptimize() | 990 || may_reoptimize() |
| 992 || flow_graph().IsCompiledForOsr()); | 991 || flow_graph().IsCompiledForOsr()); |
| 993 switch (ic_data.NumArgsTested()) { | 992 switch (ic_data.NumArgsTested()) { |
| 994 case 1: | 993 case 1: |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) { | 1529 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) { |
| 1531 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id]; | 1530 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id]; |
| 1532 ASSERT(res->deopt_id() == deopt_id); | 1531 ASSERT(res->deopt_id() == deopt_id); |
| 1533 ASSERT(res->target_name() == target_name.raw()); | 1532 ASSERT(res->target_name() == target_name.raw()); |
| 1534 ASSERT(res->NumArgsTested() == num_args_tested); | 1533 ASSERT(res->NumArgsTested() == num_args_tested); |
| 1535 return res; | 1534 return res; |
| 1536 } | 1535 } |
| 1537 const ICData& ic_data = ICData::ZoneHandle(zone(), ICData::New( | 1536 const ICData& ic_data = ICData::ZoneHandle(zone(), ICData::New( |
| 1538 parsed_function().function(), target_name, | 1537 parsed_function().function(), target_name, |
| 1539 arguments_descriptor, deopt_id, num_args_tested)); | 1538 arguments_descriptor, deopt_id, num_args_tested)); |
| 1540 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1539 if (deopt_id_to_ic_data_ != NULL) { |
| 1540 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
| 1541 } |
| 1541 return &ic_data; | 1542 return &ic_data; |
| 1542 } | 1543 } |
| 1543 | 1544 |
| 1544 | 1545 |
| 1545 const ICData* FlowGraphCompiler::GetOrAddStaticCallICData( | 1546 const ICData* FlowGraphCompiler::GetOrAddStaticCallICData( |
| 1546 intptr_t deopt_id, | 1547 intptr_t deopt_id, |
| 1547 const Function& target, | 1548 const Function& target, |
| 1548 const Array& arguments_descriptor, | 1549 const Array& arguments_descriptor, |
| 1549 intptr_t num_args_tested) { | 1550 intptr_t num_args_tested) { |
| 1550 if ((deopt_id_to_ic_data_ != NULL) && | 1551 if ((deopt_id_to_ic_data_ != NULL) && |
| 1551 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) { | 1552 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) { |
| 1552 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id]; | 1553 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id]; |
| 1553 ASSERT(res->deopt_id() == deopt_id); | 1554 ASSERT(res->deopt_id() == deopt_id); |
| 1554 ASSERT(res->target_name() == target.name()); | 1555 ASSERT(res->target_name() == target.name()); |
| 1555 ASSERT(res->NumArgsTested() == num_args_tested); | 1556 ASSERT(res->NumArgsTested() == num_args_tested); |
| 1556 return res; | 1557 return res; |
| 1557 } | 1558 } |
| 1558 const ICData& ic_data = ICData::ZoneHandle(zone(), ICData::New( | 1559 const ICData& ic_data = ICData::ZoneHandle(zone(), ICData::New( |
| 1559 parsed_function().function(), String::Handle(zone(), target.name()), | 1560 parsed_function().function(), String::Handle(zone(), target.name()), |
| 1560 arguments_descriptor, deopt_id, num_args_tested)); | 1561 arguments_descriptor, deopt_id, num_args_tested)); |
| 1561 ic_data.AddTarget(target); | 1562 ic_data.AddTarget(target); |
| 1562 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1563 if (deopt_id_to_ic_data_ != NULL) { |
| 1564 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
| 1565 } |
| 1563 return &ic_data; | 1566 return &ic_data; |
| 1564 } | 1567 } |
| 1565 | 1568 |
| 1566 | 1569 |
| 1567 intptr_t FlowGraphCompiler::GetOptimizationThreshold() const { | 1570 intptr_t FlowGraphCompiler::GetOptimizationThreshold() const { |
| 1568 intptr_t threshold; | 1571 intptr_t threshold; |
| 1569 if (is_optimizing()) { | 1572 if (is_optimizing()) { |
| 1570 threshold = FLAG_reoptimization_counter_threshold; | 1573 threshold = FLAG_reoptimization_counter_threshold; |
| 1571 } else if (parsed_function_.function().IsIrregexpFunction()) { | 1574 } else if (parsed_function_.function().IsIrregexpFunction()) { |
| 1572 threshold = FLAG_regexp_optimization_counter_threshold; | 1575 threshold = FLAG_regexp_optimization_counter_threshold; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 | 1683 |
| 1681 | 1684 |
| 1682 void FlowGraphCompiler::FrameStateClear() { | 1685 void FlowGraphCompiler::FrameStateClear() { |
| 1683 ASSERT(!is_optimizing()); | 1686 ASSERT(!is_optimizing()); |
| 1684 frame_state_.TruncateTo(0); | 1687 frame_state_.TruncateTo(0); |
| 1685 } | 1688 } |
| 1686 #endif | 1689 #endif |
| 1687 | 1690 |
| 1688 | 1691 |
| 1689 } // namespace dart | 1692 } // namespace dart |
| OLD | NEW |