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

Unified Diff: runtime/vm/object.cc

Issue 10702195: Equality compare should record two arguments in IC data. INline double equality comparison. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « 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 9640)
+++ runtime/vm/object.cc (working copy)
@@ -7190,6 +7190,7 @@
intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const {
+ ASSERT(index < NumberOfChecks());
const Array& data = Array::Handle(ic_data());
const intptr_t data_pos = index * TestEntryLength();
Smi& smi = Smi::Handle();
@@ -7217,6 +7218,37 @@
}
+RawICData* ICData::AsUnaryClassChecks() const {
+ ASSERT(!IsNull());
+ ASSERT(num_args_tested() > 0);
+ if (num_args_tested() == 1) return raw();
+ const intptr_t kNumArgsTested = 1;
+ ICData& result = ICData::Handle(ICData::New(
+ Function::Handle(function()),
+ String::Handle(target_name()),
+ id(),
+ kNumArgsTested));
+ for (intptr_t i = 0; i < NumberOfChecks(); i++) {
+ const intptr_t class_id = GetReceiverClassIdAt(i);
+ intptr_t duplicate_class_id = -1;
+ for (intptr_t k = 0; k < result.NumberOfChecks(); k++) {
+ if (class_id == result.GetReceiverClassIdAt(k)) {
+ duplicate_class_id = k;
+ break;
+ }
+ }
+ if (duplicate_class_id >= 0) {
+ ASSERT(result.GetTargetAt(duplicate_class_id) == GetTargetAt(i));
+ } else {
+ // This will make sure that Smi is first if it exists.
+ result.AddReceiverCheck(class_id,
+ Function::Handle(GetTargetAt(i)));
+ }
+ }
+ return result.raw();
+}
+
+
RawICData* ICData::New(const Function& function,
const String& target_name,
intptr_t id,
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698