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

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: sync and work in progress 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 ArgumentsDescriptor args_desc(call->GetArgumentsDescriptor(Z));
141 Array::Handle(Z, ArgumentsDescriptor::New(call->ArgumentCount(),
142 call->argument_names()));
143 ArgumentsDescriptor args_desc(args_desc_array);
144 bool allow_add = false; 141 bool allow_add = false;
145 const Function& function = Function::Handle( 142 const Function& function = Function::Handle(
146 Z, Resolver::ResolveDynamicForReceiverClass( 143 Z, Resolver::ResolveDynamicForReceiverClass(
147 receiver_class, call->function_name(), args_desc, allow_add)); 144 receiver_class, call->function_name(), args_desc, allow_add));
148 if (function.IsNull()) { 145 if (function.IsNull()) {
149 return false; 146 return false;
150 } 147 }
151 148
152 // Create new ICData, do not modify the one attached to the instruction 149 // Create new ICData, do not modify the one attached to the instruction
153 // since it is attached to the assembly instruction itself. 150 // since it is attached to the assembly instruction itself.
(...skipping 10 matching lines...) Expand all
164 call->set_ic_data(&ic_data); 161 call->set_ic_data(&ic_data);
165 return true; 162 return true;
166 } 163 }
167 164
168 // Check if getter or setter in function's class and class is currently leaf. 165 // 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) || 166 if (FLAG_guess_icdata_cid && ((call->token_kind() == Token::kGET) ||
170 (call->token_kind() == Token::kSET))) { 167 (call->token_kind() == Token::kSET))) {
171 const Class& owner_class = Class::Handle(Z, function().Owner()); 168 const Class& owner_class = Class::Handle(Z, function().Owner());
172 if (!owner_class.is_abstract() && !CHA::HasSubclasses(owner_class) && 169 if (!owner_class.is_abstract() && !CHA::HasSubclasses(owner_class) &&
173 !CHA::IsImplemented(owner_class)) { 170 !CHA::IsImplemented(owner_class)) {
174 const Array& args_desc_array = 171 const int kTypeArgsLen = 0;
175 Array::Handle(Z, ArgumentsDescriptor::New(call->ArgumentCount(), 172 ASSERT(call->type_args_len() == kTypeArgsLen);
176 call->argument_names())); 173 const Array& args_desc_array = Array::Handle(
174 Z, ArgumentsDescriptor::New(kTypeArgsLen, call->ArgumentCount(),
175 call->argument_names()));
177 ArgumentsDescriptor args_desc(args_desc_array); 176 ArgumentsDescriptor args_desc(args_desc_array);
178 bool allow_add = false; 177 bool allow_add = false;
179 const Function& function = Function::Handle( 178 const Function& function = Function::Handle(
180 Z, Resolver::ResolveDynamicForReceiverClass( 179 Z, Resolver::ResolveDynamicForReceiverClass(
181 owner_class, call->function_name(), args_desc, allow_add)); 180 owner_class, call->function_name(), args_desc, allow_add));
182 if (!function.IsNull()) { 181 if (!function.IsNull()) {
183 const ICData& ic_data = ICData::ZoneHandle( 182 const ICData& ic_data = ICData::ZoneHandle(
184 Z, ICData::NewFrom(*call->ic_data(), class_ids.length())); 183 Z, ICData::NewFrom(*call->ic_data(), class_ids.length()));
185 ic_data.AddReceiverCheck(owner_class.id(), function); 184 ic_data.AddReceiverCheck(owner_class.id(), function);
186 call->set_ic_data(&ic_data); 185 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 1812 // Discard the environment from the original instruction because the store
1814 // can't deoptimize. 1813 // can't deoptimize.
1815 instr->RemoveEnvironment(); 1814 instr->RemoveEnvironment();
1816 ReplaceCall(instr, store); 1815 ReplaceCall(instr, store);
1817 return true; 1816 return true;
1818 } 1817 }
1819 1818
1820 1819
1821 } // namespace dart 1820 } // namespace dart
1822 #endif // DART_PRECOMPILED_RUNTIME 1821 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698