Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: address review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, 1197 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id,
1198 TokenPosition token_pos, 1198 TokenPosition token_pos,
1199 const Function& function, 1199 const Function& function,
1200 ArgumentsInfo args_info, 1200 ArgumentsInfo args_info,
1201 LocationSummary* locs, 1201 LocationSummary* locs,
1202 const ICData& ic_data_in) { 1202 const ICData& ic_data_in) {
1203 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); 1203 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original());
1204 const Array& arguments_descriptor = Array::ZoneHandle( 1204 const Array& arguments_descriptor = Array::ZoneHandle(
1205 zone(), ic_data.IsNull() ? args_info.ToArgumentsDescriptor() 1205 zone(), ic_data.IsNull() ? args_info.ToArgumentsDescriptor()
1206 : ic_data.arguments_descriptor()); 1206 : ic_data.arguments_descriptor());
1207 ASSERT(ArgumentsDescriptor(arguments_descriptor).TypeArgsLen() ==
1208 args_info.type_args_len);
1207 if (is_optimizing()) { 1209 if (is_optimizing()) {
1208 EmitOptimizedStaticCall(function, arguments_descriptor, 1210 EmitOptimizedStaticCall(function, arguments_descriptor,
1209 args_info.pushed_argc, deopt_id, token_pos, locs); 1211 args_info.pushed_argc, deopt_id, token_pos, locs);
1210 } else { 1212 } else {
1211 ICData& call_ic_data = ICData::ZoneHandle(zone(), ic_data.raw()); 1213 ICData& call_ic_data = ICData::ZoneHandle(zone(), ic_data.raw());
1212 if (call_ic_data.IsNull()) { 1214 if (call_ic_data.IsNull()) {
1213 const intptr_t kNumArgsChecked = 0; 1215 const intptr_t kNumArgsChecked = 0;
1214 call_ic_data = 1216 call_ic_data =
1215 GetOrAddStaticCallICData(deopt_id, function, arguments_descriptor, 1217 GetOrAddStaticCallICData(deopt_id, function, arguments_descriptor,
1216 kNumArgsChecked) 1218 kNumArgsChecked)
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 intptr_t deopt_id, 1638 intptr_t deopt_id,
1637 const String& target_name, 1639 const String& target_name,
1638 const Array& arguments_descriptor, 1640 const Array& arguments_descriptor,
1639 intptr_t num_args_tested) { 1641 intptr_t num_args_tested) {
1640 if ((deopt_id_to_ic_data_ != NULL) && 1642 if ((deopt_id_to_ic_data_ != NULL) &&
1641 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) { 1643 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) {
1642 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id]; 1644 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id];
1643 ASSERT(res->deopt_id() == deopt_id); 1645 ASSERT(res->deopt_id() == deopt_id);
1644 ASSERT(res->target_name() == target_name.raw()); 1646 ASSERT(res->target_name() == target_name.raw());
1645 ASSERT(res->NumArgsTested() == num_args_tested); 1647 ASSERT(res->NumArgsTested() == num_args_tested);
1648 ASSERT(res->TypeArgsLen() ==
1649 ArgumentsDescriptor(arguments_descriptor).TypeArgsLen());
1646 ASSERT(!res->is_static_call()); 1650 ASSERT(!res->is_static_call());
1647 return res; 1651 return res;
1648 } 1652 }
1649 const ICData& ic_data = 1653 const ICData& ic_data =
1650 ICData::ZoneHandle(zone(), ICData::New(parsed_function().function(), 1654 ICData::ZoneHandle(zone(), ICData::New(parsed_function().function(),
1651 target_name, arguments_descriptor, 1655 target_name, arguments_descriptor,
1652 deopt_id, num_args_tested, false)); 1656 deopt_id, num_args_tested, false));
1653 #if defined(TAG_IC_DATA) 1657 #if defined(TAG_IC_DATA)
1654 ic_data.set_tag(Instruction::kInstanceCall); 1658 ic_data.set_tag(Instruction::kInstanceCall);
1655 #endif 1659 #endif
1656 if (deopt_id_to_ic_data_ != NULL) { 1660 if (deopt_id_to_ic_data_ != NULL) {
1657 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; 1661 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data;
1658 } 1662 }
1659 ASSERT(!ic_data.is_static_call()); 1663 ASSERT(!ic_data.is_static_call());
1660 return &ic_data; 1664 return &ic_data;
1661 } 1665 }
1662 1666
1663 1667
1664 const ICData* FlowGraphCompiler::GetOrAddStaticCallICData( 1668 const ICData* FlowGraphCompiler::GetOrAddStaticCallICData(
1665 intptr_t deopt_id, 1669 intptr_t deopt_id,
1666 const Function& target, 1670 const Function& target,
1667 const Array& arguments_descriptor, 1671 const Array& arguments_descriptor,
1668 intptr_t num_args_tested) { 1672 intptr_t num_args_tested) {
1669 if ((deopt_id_to_ic_data_ != NULL) && 1673 if ((deopt_id_to_ic_data_ != NULL) &&
1670 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) { 1674 ((*deopt_id_to_ic_data_)[deopt_id] != NULL)) {
1671 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id]; 1675 const ICData* res = (*deopt_id_to_ic_data_)[deopt_id];
1672 ASSERT(res->deopt_id() == deopt_id); 1676 ASSERT(res->deopt_id() == deopt_id);
1673 ASSERT(res->target_name() == target.name()); 1677 ASSERT(res->target_name() == target.name());
1674 ASSERT(res->NumArgsTested() == num_args_tested); 1678 ASSERT(res->NumArgsTested() == num_args_tested);
1679 ASSERT(res->TypeArgsLen() ==
1680 ArgumentsDescriptor(arguments_descriptor).TypeArgsLen());
1675 ASSERT(res->is_static_call()); 1681 ASSERT(res->is_static_call());
1676 return res; 1682 return res;
1677 } 1683 }
1678 const ICData& ic_data = ICData::ZoneHandle( 1684 const ICData& ic_data = ICData::ZoneHandle(
1679 zone(), 1685 zone(),
1680 ICData::New(parsed_function().function(), 1686 ICData::New(parsed_function().function(),
1681 String::Handle(zone(), target.name()), arguments_descriptor, 1687 String::Handle(zone(), target.name()), arguments_descriptor,
1682 deopt_id, num_args_tested, true)); 1688 deopt_id, num_args_tested, true));
1683 ic_data.AddTarget(target); 1689 ic_data.AddTarget(target);
1684 #if defined(TAG_IC_DATA) 1690 #if defined(TAG_IC_DATA)
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 2018
2013 2019
2014 void FlowGraphCompiler::FrameStateClear() { 2020 void FlowGraphCompiler::FrameStateClear() {
2015 ASSERT(!is_optimizing()); 2021 ASSERT(!is_optimizing());
2016 frame_state_.TruncateTo(0); 2022 frame_state_.TruncateTo(0);
2017 } 2023 }
2018 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) 2024 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC)
2019 2025
2020 2026
2021 } // namespace dart 2027 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698