Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 2df05ebc05a0cb6bd6e704d4c8132bca632468ab..7f2a25fa4db610d00a07609272db589158e573b5 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -3229,6 +3229,37 @@ void Function::set_closure_allocation_stub(const Code& value) const { |
} |
+RawFunction* Function::method_extractor() const { |
+ ASSERT(IsImplicitClosureFunction()); |
+ const Object& obj = Object::Handle(raw_ptr()->data_); |
+ ASSERT(!obj.IsNull()); |
+ return ClosureData::Cast(obj).method_extractor(); |
+} |
+ |
+ |
+void Function::set_method_extractor(const Function& value) const { |
+ ASSERT(IsImplicitClosureFunction()); |
+ const Object& obj = Object::Handle(raw_ptr()->data_); |
+ ASSERT(!obj.IsNull()); |
+ ClosureData::Cast(obj).set_method_extractor(value); |
+} |
+ |
+ |
+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_); |
@@ -4333,6 +4364,9 @@ const char* Function::ToCString() const { |
case RawFunction::kConstImplicitGetter: |
kind_str = " const-getter"; |
break; |
+ case RawFunction::kMethodExtractor: |
+ kind_str = " method-extractor"; |
+ break; |
default: |
UNREACHABLE(); |
} |
@@ -4366,6 +4400,13 @@ void ClosureData::set_closure_allocation_stub(const Code& value) const { |
} |
+void ClosureData::set_method_extractor(const Function& value) const { |
+ ASSERT(!value.IsNull()); |
+ ASSERT(raw_ptr()->method_extractor_ == Function::null()); |
+ StorePointer(&raw_ptr()->method_extractor_, value.raw()); |
+} |
+ |
+ |
void ClosureData::set_parent_function(const Function& value) const { |
StorePointer(&raw_ptr()->parent_function_, value.raw()); |
} |