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

Unified Diff: runtime/vm/precompiler.cc

Issue 2357313003: AOT: Add a separate switchable call state for unlinked calls. (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/precompiler.cc
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index 2981e17dc6cd0931838b631833b0b5fb357db7a9..05141526a1cce07a964625b79d1c61d23d858cc1 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -2112,7 +2112,11 @@ void Precompiler::SwitchICCalls() {
pool_(ObjectPool::Handle(zone)),
entry_(Object::Handle(zone)),
ic_(ICData::Handle(zone)),
- target_code_(Code::Handle(zone)) {
+ target_name_(String::Handle(zone)),
+ args_descriptor_(Array::Handle(zone)),
+ unlinked_(UnlinkedCall::Handle(zone)),
+ target_code_(Code::Handle(zone)),
+ canonical_unlinked_calls_() {
}
void Visit(const Function& function) {
@@ -2130,21 +2134,45 @@ void Precompiler::SwitchICCalls() {
// calls.
ic_ ^= entry_.raw();
ic_.ResetSwitchable(zone_);
+
+ unlinked_ = UnlinkedCall::New();
+ target_name_ = ic_.target_name();
+ unlinked_.set_target_name(target_name_);
+ args_descriptor_ = ic_.arguments_descriptor();
+ unlinked_.set_args_descriptor(args_descriptor_);
+ unlinked_ = DedupUnlinkedCall(unlinked_);
+ pool_.SetObjectAt(i, unlinked_);
} else if (entry_.raw() ==
StubCode::ICCallThroughFunction_entry()->code()) {
- target_code_ = StubCode::ICCallThroughCode_entry()->code();
+ target_code_ = StubCode::UnlinkedCall_entry()->code();
pool_.SetObjectAt(i, target_code_);
}
}
}
+ RawUnlinkedCall* DedupUnlinkedCall(const UnlinkedCall& unlinked) {
+ const UnlinkedCall* canonical_unlinked =
+ canonical_unlinked_calls_.LookupValue(&unlinked);
+ if (canonical_unlinked == NULL) {
+ canonical_unlinked_calls_.Insert(
+ &UnlinkedCall::ZoneHandle(zone_, unlinked.raw()));
+ return unlinked.raw();
+ } else {
+ return canonical_unlinked->raw();
+ }
+ }
+
private:
Zone* zone_;
Code& code_;
ObjectPool& pool_;
Object& entry_;
ICData& ic_;
+ String& target_name_;
+ Array& args_descriptor_;
+ UnlinkedCall& unlinked_;
Code& target_code_;
+ UnlinkedCallSet canonical_unlinked_calls_;
};
ASSERT(!I->compilation_allowed());

Powered by Google App Engine
This is Rietveld 408576698