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

Unified Diff: runtime/vm/object.cc

Issue 1420433004: Move selector and arguments descriptor into MegamorphicCache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: parne Created 5 years, 2 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') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 3226c9ed0971ebe8c5344e9231596f4a6225b382..c6092b6f187e970c447531e9a0040360fa16968d 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -13940,6 +13940,16 @@ void MegamorphicCache::set_filled_entry_count(intptr_t count) const {
}
+void MegamorphicCache::set_target_name(const String& value) const {
+ StorePointer(&raw_ptr()->target_name_, value.raw());
+}
+
+
+void MegamorphicCache::set_arguments_descriptor(const Array& value) const {
+ StorePointer(&raw_ptr()->args_descriptor_, value.raw());
+}
+
+
RawMegamorphicCache* MegamorphicCache::New() {
MegamorphicCache& result = MegamorphicCache::Handle();
{ RawObject* raw = Object::Allocate(MegamorphicCache::kClassId,
@@ -13948,6 +13958,20 @@ RawMegamorphicCache* MegamorphicCache::New() {
NoSafepointScope no_safepoint;
result ^= raw;
}
+ result.set_filled_entry_count(0);
+ return result.raw();
+}
+
+
+RawMegamorphicCache* MegamorphicCache::New(const String& target_name,
+ const Array& arguments_descriptor) {
+ MegamorphicCache& result = MegamorphicCache::Handle();
+ { RawObject* raw = Object::Allocate(MegamorphicCache::kClassId,
+ MegamorphicCache::InstanceSize(),
+ Heap::kOld);
+ NoSafepointScope no_safepoint;
+ result ^= raw;
+ }
const intptr_t capacity = kInitialCapacity;
const Array& buckets = Array::Handle(
Array::New(kEntryLength * capacity, Heap::kOld));
@@ -13958,6 +13982,8 @@ RawMegamorphicCache* MegamorphicCache::New() {
}
result.set_buckets(buckets);
result.set_mask(capacity - 1);
+ result.set_target_name(target_name);
+ result.set_arguments_descriptor(arguments_descriptor);
result.set_filled_entry_count(0);
return result.raw();
}
@@ -14015,7 +14041,9 @@ void MegamorphicCache::Insert(const Smi& class_id,
const char* MegamorphicCache::ToCString() const {
- return "MegamorphicCache";
+ const String& name = String::Handle(target_name());
+ return OS::SCreate(Thread::Current()->zone(),
+ "MegamorphicCache(%s)", name.ToCString());
}
@@ -14023,11 +14051,14 @@ void MegamorphicCache::PrintJSONImpl(JSONStream* stream, bool ref) const {
JSONObject jsobj(stream);
AddCommonObjectProperties(&jsobj, "Object", ref);
jsobj.AddServiceId(*this);
+ jsobj.AddProperty("_selector", String::Handle(target_name()).ToCString());
if (ref) {
return;
}
jsobj.AddProperty("_buckets", Object::Handle(buckets()));
jsobj.AddProperty("_mask", mask());
+ jsobj.AddProperty("_argumentsDescriptor",
+ Object::Handle(arguments_descriptor()));
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698