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

Unified Diff: runtime/vm/object.cc

Issue 17554003: Change static calls in unoptimized code to always call via a stub. Using ICData, the call count of … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/object.cc
===================================================================
--- runtime/vm/object.cc (revision 24288)
+++ runtime/vm/object.cc (working copy)
@@ -8529,6 +8529,25 @@
#endif // DEBUG
+// Used for unoptimized static calls when no class-ids are checked.
+void ICData::AddTarget(const Function& target) const {
+ ASSERT(num_args_tested() == 0);
+ // Can add only once.
+ ASSERT(NumberOfChecks() == 0);
+ const intptr_t old_num = NumberOfChecks();
hausner 2013/06/21 20:52:22 Nit: suggest to switch the above two lines and cha
srdjan 2013/06/21 23:32:20 Done.
+ Array& data = Array::Handle(ic_data());
+ const intptr_t new_len = data.Length() + TestEntryLength();
+ data = Array::Grow(data, new_len, Heap::kOld);
+ set_ic_data(data);
+ WriteSentinel(data);
+ intptr_t data_pos = old_num * TestEntryLength();
+ ASSERT(!target.IsNull());
+ data.SetAt(data_pos++, target);
+ const Smi& value = Smi::Handle(Smi::New(0));
+ data.SetAt(data_pos, value);
+}
+
+
void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids,
const Function& target) const {
DEBUG_ASSERT(!HasCheck(class_ids));
@@ -8799,7 +8818,7 @@
intptr_t deopt_id,
intptr_t num_args_tested) {
ASSERT(Object::icdata_class() != Class::null());
- ASSERT(num_args_tested > 0);
+ ASSERT(num_args_tested >= 0);
ICData& result = ICData::Handle();
{
// IC data objects are long living objects, allocate them in old generation.
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | runtime/vm/stub_code_mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698