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

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

Issue 1969843002: VM: Another fix for precompiling with >1 iterations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | runtime/vm/flag_list.h » ('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/aot_optimizer.h" 5 #include "vm/aot_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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 } 117 }
118 118
119 119
120 // TODO(srdjan): Test/support other number types as well. 120 // TODO(srdjan): Test/support other number types as well.
121 static bool IsNumberCid(intptr_t cid) { 121 static bool IsNumberCid(intptr_t cid) {
122 return (cid == kSmiCid) || (cid == kDoubleCid); 122 return (cid == kSmiCid) || (cid == kDoubleCid);
123 } 123 }
124 124
125 125
126 // Returns named function that is a unique dynamic target, i.e.,
127 // - the target is identified by its name alone, since it occurs only once.
128 // - target's class has no subclasses, and neither is subclassed, i.e.,
129 // the receiver type can be only the function's class.
130 // Returns Function::null() if there is no unique dynamic target for
131 // given 'fname'. 'fname' must be a symbol.
126 static void GetUniqueDynamicTarget(Isolate* isolate, 132 static void GetUniqueDynamicTarget(Isolate* isolate,
127 const String& fname, 133 const String& fname,
128 Object* function) { 134 Object* function) {
129 UniqueFunctionsSet functions_set( 135 UniqueFunctionsSet functions_set(
130 isolate->object_store()->unique_dynamic_targets()); 136 isolate->object_store()->unique_dynamic_targets());
131 ASSERT(fname.IsSymbol()); 137 ASSERT(fname.IsSymbol());
132 *function = functions_set.GetOrNull(fname); 138 *function = functions_set.GetOrNull(fname);
133 ASSERT(functions_set.Release().raw() == 139 ASSERT(functions_set.Release().raw() ==
134 isolate->object_store()->unique_dynamic_targets()); 140 isolate->object_store()->unique_dynamic_targets());
135 } 141 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 216 }
211 call->set_ic_data(&ic_data); 217 call->set_ic_data(&ic_data);
212 return true; 218 return true;
213 } 219 }
214 220
215 if (isolate()->object_store()->unique_dynamic_targets() != Array::null()) { 221 if (isolate()->object_store()->unique_dynamic_targets() != Array::null()) {
216 // Check if the target is unique. 222 // Check if the target is unique.
217 Function& target_function = Function::Handle(Z); 223 Function& target_function = Function::Handle(Z);
218 GetUniqueDynamicTarget(isolate(), call->function_name(), &target_function); 224 GetUniqueDynamicTarget(isolate(), call->function_name(), &target_function);
219 // Calls with named arguments must be resolved/checked at runtime. 225 // Calls with named arguments must be resolved/checked at runtime.
220 String& error_message = String::Handle(Z);
221 if (!target_function.IsNull() && 226 if (!target_function.IsNull() &&
222 !target_function.HasOptionalNamedParameters() && 227 !target_function.HasOptionalNamedParameters() &&
223 target_function.AreValidArgumentCounts(call->ArgumentCount(), 0, 228 target_function.AreValidArgumentCounts(call->ArgumentCount(), 0,
224 &error_message)) { 229 /* error_message = */ NULL)) {
225 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id(); 230 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id();
226 const ICData& ic_data = ICData::ZoneHandle(Z, 231 const ICData& ic_data = ICData::ZoneHandle(Z,
227 ICData::NewFrom(*call->ic_data(), 1)); 232 ICData::NewFrom(*call->ic_data(), 1));
228 ic_data.AddReceiverCheck(cid, target_function); 233 ic_data.AddReceiverCheck(cid, target_function);
229 call->set_ic_data(&ic_data); 234 call->set_ic_data(&ic_data);
230 return true; 235 return true;
231 } 236 }
232 } 237 }
233 238
234 return false; 239 return false;
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 2776
2772 // Discard the environment from the original instruction because the store 2777 // Discard the environment from the original instruction because the store
2773 // can't deoptimize. 2778 // can't deoptimize.
2774 instr->RemoveEnvironment(); 2779 instr->RemoveEnvironment();
2775 ReplaceCall(instr, store); 2780 ReplaceCall(instr, store);
2776 return true; 2781 return true;
2777 } 2782 }
2778 2783
2779 2784
2780 } // namespace dart 2785 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flag_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698