Index: runtime/vm/object.h |
diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
index de2d3aeb02cbc6a2a2f2128d92eb3a42afc90431..b1fd0e35b5578eeec77a67ae658e43783464c9bf 100644 |
--- a/runtime/vm/object.h |
+++ b/runtime/vm/object.h |
@@ -1665,6 +1665,18 @@ class Function : public Object { |
RawClass* origin() const; |
RawScript* script() const; |
+ void set_regexp(const JSRegExp& value) const; |
+ RawJSRegExp* regexp() const; |
+ |
+ // Set and get the class id this function is specialized for. Only set for |
+ // irregexp functions. |
+ void set_regexp_cid(intptr_t regexp_cid) { |
+ raw_ptr()->regexp_cid_ = regexp_cid; |
+ } |
+ intptr_t regexp_cid() const { |
+ return raw_ptr()->regexp_cid_; |
+ } |
+ |
RawAbstractType* result_type() const { return raw_ptr()->result_type_; } |
void set_result_type(const AbstractType& value) const; |
@@ -1793,6 +1805,7 @@ class Function : public Object { |
case RawFunction::kMethodExtractor: |
case RawFunction::kNoSuchMethodDispatcher: |
case RawFunction::kInvokeFieldDispatcher: |
+ case RawFunction::kIrregexpFunction: |
return true; |
case RawFunction::kClosureFunction: |
case RawFunction::kConstructor: |
@@ -1814,6 +1827,7 @@ class Function : public Object { |
case RawFunction::kImplicitGetter: |
case RawFunction::kImplicitSetter: |
case RawFunction::kImplicitStaticFinalGetter: |
+ case RawFunction::kIrregexpFunction: |
return true; |
case RawFunction::kClosureFunction: |
case RawFunction::kConstructor: |
@@ -2055,6 +2069,11 @@ class Function : public Object { |
return kind() == RawFunction::kClosureFunction; |
} |
+ // Returns true if this function represents a generated irregexp function. |
+ bool IsIrregexpFunction() const { |
+ return kind() == RawFunction::kIrregexpFunction; |
+ } |
+ |
// Returns true if this function represents an implicit closure function. |
bool IsImplicitClosureFunction() const; |
@@ -7200,11 +7219,47 @@ class JSRegExp : public Instance { |
bool is_multi_line() const { return (flags() & kMultiLine); } |
RawString* pattern() const { return raw_ptr()->pattern_; } |
+ |
RawSmi* num_bracket_expressions() const { |
return raw_ptr()->num_bracket_expressions_; |
} |
+ static intptr_t function_offset(intptr_t cid) { |
+ switch (cid) { |
+ case kOneByteStringCid: |
+ return OFFSET_OF(RawJSRegExp, one_byte_function_); |
+ case kTwoByteStringCid: |
+ return OFFSET_OF(RawJSRegExp, two_byte_function_); |
+ case kExternalOneByteStringCid: |
+ return OFFSET_OF(RawJSRegExp, external_one_byte_function_); |
+ case kExternalTwoByteStringCid: |
+ return OFFSET_OF(RawJSRegExp, external_two_byte_function_); |
+ } |
+ |
+ UNREACHABLE(); |
+ return -1; |
+ } |
+ |
+ RawFunction* function(intptr_t cid) const { |
+ switch (cid) { |
+ case kOneByteStringCid: |
+ return raw_ptr()->one_byte_function_; |
+ case kTwoByteStringCid: |
+ return raw_ptr()->two_byte_function_; |
+ case kExternalOneByteStringCid: |
+ return raw_ptr()->external_one_byte_function_; |
+ case kExternalTwoByteStringCid: |
+ return raw_ptr()->external_two_byte_function_; |
+ } |
+ |
+ UNREACHABLE(); |
+ return Function::null(); |
+ } |
+ |
void set_pattern(const String& pattern) const; |
+ void set_function(intptr_t cid, const Function& value); |
+ void set_sample_subject(intptr_t cid, const String& value) const; |
Vyacheslav Egorov (Google)
2014/10/07 15:48:30
is set_sample_subject still used from somewhere?
|
+ |
void set_num_bracket_expressions(intptr_t value) const; |
void set_is_global() const { set_flags(flags() | kGlobal); } |
void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } |