Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 8cd3bbb90576e9ccfe9527de5ba1006daa204d28..557e24d1cb25531d2803c31f2bac394f9f7eef91 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -5388,6 +5388,9 @@ const char* Function::KindToCString(RawFunction::Kind kind) { |
case RawFunction::kInvokeFieldDispatcher: |
return "kInvokeFieldDispatcher"; |
break; |
+ case RawFunction::kIrregexpFunction: |
+ return "kIrregexpFunction"; |
+ break; |
default: |
UNREACHABLE(); |
return NULL; |
@@ -5473,6 +5476,29 @@ void Function::set_owner(const Object& value) const { |
} |
+RawJSRegExp* Function::regexp() const { |
+ ASSERT(kind() == RawFunction::kIrregexpFunction); |
+ const Object& obj = Object::Handle(raw_ptr()->data_); |
+ return JSRegExp::Cast(obj).raw(); |
+} |
+ |
+ |
+void Function::set_regexp(const JSRegExp& value) const { |
+ ASSERT(kind() == RawFunction::kIrregexpFunction); |
+ ASSERT(raw_ptr()->data_ == Object::null()); |
+ set_data(value); |
+} |
+ |
+ |
+void Function::set_regexp_cid(intptr_t regexp_cid) const { |
+ ASSERT((regexp_cid == kIllegalCid) || |
+ (kind() == RawFunction::kIrregexpFunction)); |
+ ASSERT((regexp_cid == kIllegalCid) || |
+ RawObject::IsStringClassId(regexp_cid)); |
+ StoreNonPointer(&raw_ptr()->regexp_cid_, regexp_cid); |
+} |
+ |
+ |
void Function::set_result_type(const AbstractType& value) const { |
ASSERT(!value.IsNull()); |
StorePointer(&raw_ptr()->result_type_, value.raw()); |
@@ -6153,6 +6179,7 @@ RawFunction* Function::New(const String& name, |
result.set_num_optional_parameters(0); |
result.set_usage_counter(0); |
result.set_deoptimization_counter(0); |
+ result.set_regexp_cid(kIllegalCid); |
result.set_optimized_instruction_count(0); |
result.set_optimized_call_site_count(0); |
result.set_is_optimizable(is_native ? false : true); |
@@ -6181,6 +6208,7 @@ RawFunction* Function::Clone(const Class& new_owner) const { |
clone.ClearCode(); |
clone.set_usage_counter(0); |
clone.set_deoptimization_counter(0); |
+ clone.set_regexp_cid(kIllegalCid); |
clone.set_optimized_instruction_count(0); |
clone.set_optimized_call_site_count(0); |
clone.set_ic_data_array(Array::Handle()); |
@@ -6748,6 +6776,9 @@ const char* Function::ToCString() const { |
case RawFunction::kInvokeFieldDispatcher: |
kind_str = "invoke-field-dispatcher"; |
break; |
+ case RawFunction::kIrregexpFunction: |
+ kind_str = "irregexp-function"; |
+ break; |
default: |
UNREACHABLE(); |
} |
@@ -20091,6 +20122,11 @@ void JSRegExp::set_pattern(const String& pattern) const { |
} |
+void JSRegExp::set_function(intptr_t cid, const Function& value) const { |
+ StorePointer(FunctionAddr(cid), value.raw()); |
+} |
+ |
+ |
void JSRegExp::set_num_bracket_expressions(intptr_t value) const { |
StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); |
} |