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

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

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: Created 3 years, 7 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
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 #ifndef DART_PRECOMPILED_RUNTIME 4 #ifndef DART_PRECOMPILED_RUNTIME
5 #include "vm/jit_optimizer.h" 5 #include "vm/jit_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/branch_optimizer.h" 8 #include "vm/branch_optimizer.h"
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 if (all_cids_known) { 131 if (all_cids_known) {
132 const Class& receiver_class = 132 const Class& receiver_class =
133 Class::Handle(Z, isolate()->class_table()->At(class_ids[0])); 133 Class::Handle(Z, isolate()->class_table()->At(class_ids[0]));
134 if (!receiver_class.is_finalized()) { 134 if (!receiver_class.is_finalized()) {
135 // Do not eagerly finalize classes. ResolveDynamicForReceiverClass can 135 // Do not eagerly finalize classes. ResolveDynamicForReceiverClass can
136 // cause class finalization, since callee's receiver class may not be 136 // cause class finalization, since callee's receiver class may not be
137 // finalized yet. 137 // finalized yet.
138 return false; 138 return false;
139 } 139 }
140 const Array& args_desc_array = 140 const Array& args_desc_array = Array::Handle(
141 Array::Handle(Z, ArgumentsDescriptor::New(call->ArgumentCount(), 141 Z, ArgumentsDescriptor::New(
142 call->argument_names())); 142 call->type_args_len(),
143 call->ArgumentCount() - (call->type_args_len() > 0 ? 1 : 0),
144 call->argument_names()));
143 ArgumentsDescriptor args_desc(args_desc_array); 145 ArgumentsDescriptor args_desc(args_desc_array);
144 bool allow_add = false; 146 bool allow_add = false;
145 const Function& function = Function::Handle( 147 const Function& function = Function::Handle(
146 Z, Resolver::ResolveDynamicForReceiverClass( 148 Z, Resolver::ResolveDynamicForReceiverClass(
147 receiver_class, call->function_name(), args_desc, allow_add)); 149 receiver_class, call->function_name(), args_desc, allow_add));
148 if (function.IsNull()) { 150 if (function.IsNull()) {
149 return false; 151 return false;
150 } 152 }
151 153
152 // Create new ICData, do not modify the one attached to the instruction 154 // Create new ICData, do not modify the one attached to the instruction
(...skipping 11 matching lines...) Expand all
164 call->set_ic_data(&ic_data); 166 call->set_ic_data(&ic_data);
165 return true; 167 return true;
166 } 168 }
167 169
168 // Check if getter or setter in function's class and class is currently leaf. 170 // Check if getter or setter in function's class and class is currently leaf.
169 if (FLAG_guess_icdata_cid && ((call->token_kind() == Token::kGET) || 171 if (FLAG_guess_icdata_cid && ((call->token_kind() == Token::kGET) ||
170 (call->token_kind() == Token::kSET))) { 172 (call->token_kind() == Token::kSET))) {
171 const Class& owner_class = Class::Handle(Z, function().Owner()); 173 const Class& owner_class = Class::Handle(Z, function().Owner());
172 if (!owner_class.is_abstract() && !CHA::HasSubclasses(owner_class) && 174 if (!owner_class.is_abstract() && !CHA::HasSubclasses(owner_class) &&
173 !CHA::IsImplemented(owner_class)) { 175 !CHA::IsImplemented(owner_class)) {
174 const Array& args_desc_array = 176 const int kTypeArgsLen = 0;
175 Array::Handle(Z, ArgumentsDescriptor::New(call->ArgumentCount(), 177 ASSERT(call->type_args_len() == kTypeArgsLen);
176 call->argument_names())); 178 const Array& args_desc_array = Array::Handle(
179 Z, ArgumentsDescriptor::New(kTypeArgsLen, call->ArgumentCount(),
180 call->argument_names()));
177 ArgumentsDescriptor args_desc(args_desc_array); 181 ArgumentsDescriptor args_desc(args_desc_array);
178 bool allow_add = false; 182 bool allow_add = false;
179 const Function& function = Function::Handle( 183 const Function& function = Function::Handle(
180 Z, Resolver::ResolveDynamicForReceiverClass( 184 Z, Resolver::ResolveDynamicForReceiverClass(
181 owner_class, call->function_name(), args_desc, allow_add)); 185 owner_class, call->function_name(), args_desc, allow_add));
182 if (!function.IsNull()) { 186 if (!function.IsNull()) {
183 const ICData& ic_data = ICData::ZoneHandle( 187 const ICData& ic_data = ICData::ZoneHandle(
184 Z, ICData::NewFrom(*call->ic_data(), class_ids.length())); 188 Z, ICData::NewFrom(*call->ic_data(), class_ids.length()));
185 ic_data.AddReceiverCheck(owner_class.id(), function); 189 ic_data.AddReceiverCheck(owner_class.id(), function);
186 call->set_ic_data(&ic_data); 190 call->set_ic_data(&ic_data);
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 // Discard the environment from the original instruction because the store 1817 // Discard the environment from the original instruction because the store
1814 // can't deoptimize. 1818 // can't deoptimize.
1815 instr->RemoveEnvironment(); 1819 instr->RemoveEnvironment();
1816 ReplaceCall(instr, store); 1820 ReplaceCall(instr, store);
1817 return true; 1821 return true;
1818 } 1822 }
1819 1823
1820 1824
1821 } // namespace dart 1825 } // namespace dart
1822 #endif // DART_PRECOMPILED_RUNTIME 1826 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698