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

Unified Diff: runtime/vm/object.cc

Issue 11642003: Create and cache method extraction stub in the ICData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: lazyly inject extractors as getters into class Created 7 years, 11 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/parser.h » ('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 40fc1b7d493c1cd948df846dd8975645efac5334..4542f6ddf04a4de104b25b321abe50f2144c756f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1436,6 +1436,7 @@ bool Class::HasInstanceFields() const {
return false;
}
+
void Class::SetFunctions(const Array& value) const {
ASSERT(!value.IsNull());
#if defined(DEBUG)
@@ -1451,6 +1452,14 @@ void Class::SetFunctions(const Array& value) const {
}
+void Class::AddFunction(const Function& function) const {
+ const Array& arr = Array::Handle(functions());
+ const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1));
+ new_arr.SetAt(arr.Length(), function);
+ SetFunctions(new_arr);
+}
+
+
void Class::AddClosureFunction(const Function& function) const {
GrowableObjectArray& closures =
GrowableObjectArray::Handle(raw_ptr()->closure_functions_);
@@ -3220,6 +3229,21 @@ void Function::set_closure_allocation_stub(const Code& value) const {
}
+RawFunction* Function::extracted_method_closure() const {
+ ASSERT(kind() == RawFunction::kMethodExtractor);
+ const Object& obj = Object::Handle(raw_ptr()->data_);
+ ASSERT(obj.IsFunction());
+ return Function::Cast(obj).raw();
+}
+
+
+void Function::set_extracted_method_closure(const Function& value) const {
+ ASSERT(kind() == RawFunction::kMethodExtractor);
+ ASSERT(raw_ptr()->data_ == Object::null());
+ set_data(value);
+}
+
+
RawFunction* Function::parent_function() const {
if (IsClosureFunction()) {
const Object& obj = Object::Handle(raw_ptr()->data_);
@@ -4309,6 +4333,9 @@ const char* Function::ToCString() const {
case RawFunction::kConstImplicitGetter:
kind_str = " const-getter";
break;
+ case RawFunction::kMethodExtractor:
+ kind_str = " method-extractor";
+ break;
default:
UNREACHABLE();
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698