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

Unified Diff: runtime/vm/aot_optimizer.cc

Issue 2572423004: Reapply "Save and restore feedback from JIT." (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/aot_optimizer.cc
diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc
index 00131579c16799ad18408bc5371c31cd49c62e3e..93501ec22d2a20ce6b26dec3902564d3ff997271 100644
--- a/runtime/vm/aot_optimizer.cc
+++ b/runtime/vm/aot_optimizer.cc
@@ -100,32 +100,6 @@ void AotOptimizer::ApplyICData() {
}
-void AotOptimizer::PopulateWithICData() {
- ASSERT(current_iterator_ == NULL);
- for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator();
- !block_it.Done(); block_it.Advance()) {
- ForwardInstructionIterator it(block_it.Current());
- for (; !it.Done(); it.Advance()) {
- Instruction* instr = it.Current();
- if (instr->IsInstanceCall()) {
- InstanceCallInstr* call = instr->AsInstanceCall();
- if (!call->HasICData()) {
- const Array& arguments_descriptor = Array::Handle(
- zone(), ArgumentsDescriptor::New(call->ArgumentCount(),
- call->argument_names()));
- const ICData& ic_data = ICData::ZoneHandle(
- zone(), ICData::New(function(), call->function_name(),
- arguments_descriptor, call->deopt_id(),
- call->checked_argument_count(), false));
- call->set_ic_data(&ic_data);
- }
- }
- }
- current_iterator_ = NULL;
- }
-}
-
-
bool AotOptimizer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) {
if ((precompiler_ == NULL) || !precompiler_->get_runtime_type_is_unique()) {
return false;
@@ -1550,47 +1524,51 @@ void AotOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
return;
}
- TypeRangeCache* cache = thread()->type_range_cache();
- intptr_t lower_limit, upper_limit;
- if (cache != NULL &&
- cache->InstanceOfHasClassRange(type, &lower_limit, &upper_limit)) {
- // left.instanceof(type) =>
- // _classRangeCheck(left.cid, lower_limit, upper_limit)
-
- LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
- InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
- ConstantInstr* lower_cid =
- flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
- ConstantInstr* upper_cid =
- flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(upper_limit)));
-
- ZoneGrowableArray<PushArgumentInstr*>* args =
- new (Z) ZoneGrowableArray<PushArgumentInstr*>(3);
- PushArgumentInstr* arg = new (Z) PushArgumentInstr(new (Z) Value(left_cid));
- InsertBefore(call, arg, NULL, FlowGraph::kEffect);
- args->Add(arg);
- arg = new (Z) PushArgumentInstr(new (Z) Value(lower_cid));
- InsertBefore(call, arg, NULL, FlowGraph::kEffect);
- args->Add(arg);
- arg = new (Z) PushArgumentInstr(new (Z) Value(upper_cid));
- InsertBefore(call, arg, NULL, FlowGraph::kEffect);
- args->Add(arg);
-
- const Library& dart_internal =
- Library::Handle(Z, Library::InternalLibrary());
- const String& target_name = negate ? Symbols::_classRangeCheckNegative()
- : Symbols::_classRangeCheck();
- const Function& target = Function::ZoneHandle(
- Z, dart_internal.LookupFunctionAllowPrivate(target_name));
- ASSERT(!target.IsNull());
- ASSERT(target.IsRecognized() && target.always_inline());
-
- StaticCallInstr* new_call =
- new (Z) StaticCallInstr(call->token_pos(), target,
- Object::null_array(), // argument_names
- args, call->deopt_id());
- ReplaceCall(call, new_call);
- return;
+ if (precompiler_ != NULL) {
+ TypeRangeCache* cache = precompiler_->type_range_cache();
+ intptr_t lower_limit, upper_limit;
+ if (cache != NULL &&
+ cache->InstanceOfHasClassRange(type, &lower_limit, &upper_limit)) {
+ // left.instanceof(type) =>
+ // _classRangeCheck(left.cid, lower_limit, upper_limit)
+
+ LoadClassIdInstr* left_cid =
+ new (Z) LoadClassIdInstr(new (Z) Value(left));
+ InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
+ ConstantInstr* lower_cid =
+ flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
+ ConstantInstr* upper_cid =
+ flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(upper_limit)));
+
+ ZoneGrowableArray<PushArgumentInstr*>* args =
+ new (Z) ZoneGrowableArray<PushArgumentInstr*>(3);
+ PushArgumentInstr* arg =
+ new (Z) PushArgumentInstr(new (Z) Value(left_cid));
+ InsertBefore(call, arg, NULL, FlowGraph::kEffect);
+ args->Add(arg);
+ arg = new (Z) PushArgumentInstr(new (Z) Value(lower_cid));
+ InsertBefore(call, arg, NULL, FlowGraph::kEffect);
+ args->Add(arg);
+ arg = new (Z) PushArgumentInstr(new (Z) Value(upper_cid));
+ InsertBefore(call, arg, NULL, FlowGraph::kEffect);
+ args->Add(arg);
+
+ const Library& dart_internal =
+ Library::Handle(Z, Library::InternalLibrary());
+ const String& target_name = negate ? Symbols::_classRangeCheckNegative()
+ : Symbols::_classRangeCheck();
+ const Function& target = Function::ZoneHandle(
+ Z, dart_internal.LookupFunctionAllowPrivate(target_name));
+ ASSERT(!target.IsNull());
+ ASSERT(target.IsRecognized() && target.always_inline());
+
+ StaticCallInstr* new_call =
+ new (Z) StaticCallInstr(call->token_pos(), target,
+ Object::null_array(), // argument_names
+ args, call->deopt_id());
+ ReplaceCall(call, new_call);
+ return;
+ }
}
const ICData& unary_checks =

Powered by Google App Engine
This is Rietveld 408576698