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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 181183004: VM: Improve receiver class check in polymorphic inlining. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: improved polymorphic ClassCheck ia32 Created 6 years, 10 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/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 33059)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -84,10 +84,17 @@
}
+static int LowestFirst(const intptr_t* a, const intptr_t* b) {
+ return *a - *b;
+}
+
+
CheckClassInstr::CheckClassInstr(Value* value,
intptr_t deopt_id,
const ICData& unary_checks)
- : unary_checks_(unary_checks), licm_hoisted_(false) {
+ : unary_checks_(unary_checks),
+ cids_(unary_checks.NumberOfChecks()),
+ licm_hoisted_(false) {
ASSERT(unary_checks.IsZoneHandle());
// Expected useful check data.
ASSERT(!unary_checks_.IsNull());
@@ -98,6 +105,10 @@
// Otherwise use CheckSmiInstr.
ASSERT((unary_checks_.NumberOfChecks() != 1) ||
(unary_checks_.GetReceiverClassIdAt(0) != kSmiCid));
+ for (intptr_t i = 0; i < unary_checks.NumberOfChecks(); ++i) {
+ cids_.Add(unary_checks.GetReceiverClassIdAt(i));
+ }
+ cids_.Sort(LowestFirst);
}
@@ -140,6 +151,13 @@
}
+bool CheckClassInstr::IsDenseSwitch() const {
+ return unary_checks().GetReceiverClassIdAt(0) != kSmiCid
+ && cids_.length() > 2
+ && cids_[cids_.length() - 1] - cids_[0] < kBitsPerWord;
+}
+
+
bool LoadFieldInstr::IsUnboxedLoad() const {
return FLAG_unbox_numeric_fields
&& (field() != NULL)

Powered by Google App Engine
This is Rietveld 408576698