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

Unified Diff: runtime/vm/object.cc

Issue 10826285: Optimize equality for case when all targets are Object.equals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 10611)
+++ runtime/vm/object.cc (working copy)
@@ -7615,6 +7615,36 @@
}
+bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const {
+ if (NumberOfChecks() == 0) return false;
+ Class& cls = Class::Handle();
+ for (intptr_t i = 0; i < NumberOfChecks(); i++) {
+ cls = Function::Handle(GetTargetAt(i)).owner();
+ if (cls.id() != owner_cid) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+bool ICData::AllReceiversAreNumbers() const {
+ if (NumberOfChecks() == 0) return false;
+ Class& cls = Class::Handle();
+ for (intptr_t i = 0; i < NumberOfChecks(); i++) {
+ cls = Function::Handle(GetTargetAt(i)).owner();
+ const intptr_t cid = cls.id();
+ if ((cid != kSmiCid) &&
+ (cid != kMintCid) &&
+ (cid != kBigintCid) &&
+ (cid != kDoubleCid)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
RawICData* ICData::New(const Function& function,
const String& target_name,
intptr_t deopt_id,
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698