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

Side by Side Diff: runtime/vm/object.h

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Explicitly null IC-Data, whitespace fixes in tests. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 bool HasInstantiatedSignature() const; 1658 bool HasInstantiatedSignature() const;
1659 1659
1660 // Build a string of the form 'T, {b: B, c: C} representing the user 1660 // Build a string of the form 'T, {b: B, c: C} representing the user
1661 // visible formal parameters of the function. 1661 // visible formal parameters of the function.
1662 RawString* UserVisibleFormalParameters() const; 1662 RawString* UserVisibleFormalParameters() const;
1663 1663
1664 RawClass* Owner() const; 1664 RawClass* Owner() const;
1665 RawClass* origin() const; 1665 RawClass* origin() const;
1666 RawScript* script() const; 1666 RawScript* script() const;
1667 1667
1668 void set_regexp(const JSRegExp& value) const;
1669 RawJSRegExp* regexp() const;
1670
1671 // Set and get the class id this function is specialized for. Only set for
1672 // irregexp functions.
1673 void set_regexp_cid(intptr_t regexp_cid) {
1674 raw_ptr()->regexp_cid_ = regexp_cid;
1675 }
1676 intptr_t regexp_cid() const {
1677 return raw_ptr()->regexp_cid_;
1678 }
1679
1668 RawAbstractType* result_type() const { return raw_ptr()->result_type_; } 1680 RawAbstractType* result_type() const { return raw_ptr()->result_type_; }
1669 void set_result_type(const AbstractType& value) const; 1681 void set_result_type(const AbstractType& value) const;
1670 1682
1671 RawAbstractType* ParameterTypeAt(intptr_t index) const; 1683 RawAbstractType* ParameterTypeAt(intptr_t index) const;
1672 void SetParameterTypeAt(intptr_t index, const AbstractType& value) const; 1684 void SetParameterTypeAt(intptr_t index, const AbstractType& value) const;
1673 RawArray* parameter_types() const { return raw_ptr()->parameter_types_; } 1685 RawArray* parameter_types() const { return raw_ptr()->parameter_types_; }
1674 void set_parameter_types(const Array& value) const; 1686 void set_parameter_types(const Array& value) const;
1675 1687
1676 // Parameter names are valid for all valid parameter indices, and are not 1688 // Parameter names are valid for all valid parameter indices, and are not
1677 // limited to named optional parameters. 1689 // limited to named optional parameters.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 } 1798 }
1787 switch (kind()) { 1799 switch (kind()) {
1788 case RawFunction::kRegularFunction: 1800 case RawFunction::kRegularFunction:
1789 case RawFunction::kGetterFunction: 1801 case RawFunction::kGetterFunction:
1790 case RawFunction::kSetterFunction: 1802 case RawFunction::kSetterFunction:
1791 case RawFunction::kImplicitGetter: 1803 case RawFunction::kImplicitGetter:
1792 case RawFunction::kImplicitSetter: 1804 case RawFunction::kImplicitSetter:
1793 case RawFunction::kMethodExtractor: 1805 case RawFunction::kMethodExtractor:
1794 case RawFunction::kNoSuchMethodDispatcher: 1806 case RawFunction::kNoSuchMethodDispatcher:
1795 case RawFunction::kInvokeFieldDispatcher: 1807 case RawFunction::kInvokeFieldDispatcher:
1808 case RawFunction::kIrregexpFunction:
1796 return true; 1809 return true;
1797 case RawFunction::kClosureFunction: 1810 case RawFunction::kClosureFunction:
1798 case RawFunction::kConstructor: 1811 case RawFunction::kConstructor:
1799 case RawFunction::kImplicitStaticFinalGetter: 1812 case RawFunction::kImplicitStaticFinalGetter:
1800 return false; 1813 return false;
1801 default: 1814 default:
1802 UNREACHABLE(); 1815 UNREACHABLE();
1803 return false; 1816 return false;
1804 } 1817 }
1805 } 1818 }
1806 bool IsStaticFunction() const { 1819 bool IsStaticFunction() const {
1807 if (!is_static()) { 1820 if (!is_static()) {
1808 return false; 1821 return false;
1809 } 1822 }
1810 switch (kind()) { 1823 switch (kind()) {
1811 case RawFunction::kRegularFunction: 1824 case RawFunction::kRegularFunction:
1812 case RawFunction::kGetterFunction: 1825 case RawFunction::kGetterFunction:
1813 case RawFunction::kSetterFunction: 1826 case RawFunction::kSetterFunction:
1814 case RawFunction::kImplicitGetter: 1827 case RawFunction::kImplicitGetter:
1815 case RawFunction::kImplicitSetter: 1828 case RawFunction::kImplicitSetter:
1816 case RawFunction::kImplicitStaticFinalGetter: 1829 case RawFunction::kImplicitStaticFinalGetter:
1830 case RawFunction::kIrregexpFunction:
1817 return true; 1831 return true;
1818 case RawFunction::kClosureFunction: 1832 case RawFunction::kClosureFunction:
1819 case RawFunction::kConstructor: 1833 case RawFunction::kConstructor:
1820 return false; 1834 return false;
1821 default: 1835 default:
1822 UNREACHABLE(); 1836 UNREACHABLE();
1823 return false; 1837 return false;
1824 } 1838 }
1825 } 1839 }
1826 bool IsInFactoryScope() const; 1840 bool IsInFactoryScope() const;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 bool IsImplicitSetterFunction() const { 2062 bool IsImplicitSetterFunction() const {
2049 return kind() == RawFunction::kImplicitSetter; 2063 return kind() == RawFunction::kImplicitSetter;
2050 } 2064 }
2051 2065
2052 // Returns true if this function represents a (possibly implicit) closure 2066 // Returns true if this function represents a (possibly implicit) closure
2053 // function. 2067 // function.
2054 bool IsClosureFunction() const { 2068 bool IsClosureFunction() const {
2055 return kind() == RawFunction::kClosureFunction; 2069 return kind() == RawFunction::kClosureFunction;
2056 } 2070 }
2057 2071
2072 // Returns true if this function represents a generated irregexp function.
2073 bool IsIrregexpFunction() const {
2074 return kind() == RawFunction::kIrregexpFunction;
2075 }
2076
2058 // Returns true if this function represents an implicit closure function. 2077 // Returns true if this function represents an implicit closure function.
2059 bool IsImplicitClosureFunction() const; 2078 bool IsImplicitClosureFunction() const;
2060 2079
2061 // Returns true if this function represents a non implicit closure function. 2080 // Returns true if this function represents a non implicit closure function.
2062 bool IsNonImplicitClosureFunction() const { 2081 bool IsNonImplicitClosureFunction() const {
2063 return IsClosureFunction() && !IsImplicitClosureFunction(); 2082 return IsClosureFunction() && !IsImplicitClosureFunction();
2064 } 2083 }
2065 2084
2066 // Returns true if this function represents an implicit static closure 2085 // Returns true if this function represents an implicit static closure
2067 // function. 2086 // function.
(...skipping 5125 matching lines...) Expand 10 before | Expand all | Expand 10 after
7193 7212
7194 bool is_initialized() const { return (type() != kUnitialized); } 7213 bool is_initialized() const { return (type() != kUnitialized); }
7195 bool is_simple() const { return (type() == kSimple); } 7214 bool is_simple() const { return (type() == kSimple); }
7196 bool is_complex() const { return (type() == kComplex); } 7215 bool is_complex() const { return (type() == kComplex); }
7197 7216
7198 bool is_global() const { return (flags() & kGlobal); } 7217 bool is_global() const { return (flags() & kGlobal); }
7199 bool is_ignore_case() const { return (flags() & kIgnoreCase); } 7218 bool is_ignore_case() const { return (flags() & kIgnoreCase); }
7200 bool is_multi_line() const { return (flags() & kMultiLine); } 7219 bool is_multi_line() const { return (flags() & kMultiLine); }
7201 7220
7202 RawString* pattern() const { return raw_ptr()->pattern_; } 7221 RawString* pattern() const { return raw_ptr()->pattern_; }
7222
7203 RawSmi* num_bracket_expressions() const { 7223 RawSmi* num_bracket_expressions() const {
7204 return raw_ptr()->num_bracket_expressions_; 7224 return raw_ptr()->num_bracket_expressions_;
7205 } 7225 }
7206 7226
7227 static intptr_t function_offset(intptr_t cid) {
7228 switch (cid) {
7229 case kOneByteStringCid:
7230 return OFFSET_OF(RawJSRegExp, one_byte_function_);
7231 case kTwoByteStringCid:
7232 return OFFSET_OF(RawJSRegExp, two_byte_function_);
7233 case kExternalOneByteStringCid:
7234 return OFFSET_OF(RawJSRegExp, external_one_byte_function_);
7235 case kExternalTwoByteStringCid:
7236 return OFFSET_OF(RawJSRegExp, external_two_byte_function_);
7237 }
7238
7239 UNREACHABLE();
7240 return -1;
7241 }
7242
7243 RawFunction* function(intptr_t cid) const {
7244 switch (cid) {
7245 case kOneByteStringCid:
7246 return raw_ptr()->one_byte_function_;
7247 case kTwoByteStringCid:
7248 return raw_ptr()->two_byte_function_;
7249 case kExternalOneByteStringCid:
7250 return raw_ptr()->external_one_byte_function_;
7251 case kExternalTwoByteStringCid:
7252 return raw_ptr()->external_two_byte_function_;
7253 }
7254
7255 UNREACHABLE();
7256 return Function::null();
7257 }
7258
7207 void set_pattern(const String& pattern) const; 7259 void set_pattern(const String& pattern) const;
7260 void set_function(intptr_t cid, const Function& value);
7261 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?
7262
7208 void set_num_bracket_expressions(intptr_t value) const; 7263 void set_num_bracket_expressions(intptr_t value) const;
7209 void set_is_global() const { set_flags(flags() | kGlobal); } 7264 void set_is_global() const { set_flags(flags() | kGlobal); }
7210 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } 7265 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); }
7211 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } 7266 void set_is_multi_line() const { set_flags(flags() | kMultiLine); }
7212 void set_is_simple() const { set_type(kSimple); } 7267 void set_is_simple() const { set_type(kSimple); }
7213 void set_is_complex() const { set_type(kComplex); } 7268 void set_is_complex() const { set_type(kComplex); }
7214 7269
7215 void* GetDataStartAddress() const; 7270 void* GetDataStartAddress() const;
7216 static RawJSRegExp* FromDataStartAddress(void* data); 7271 static RawJSRegExp* FromDataStartAddress(void* data);
7217 const char* Flags() const; 7272 const char* Flags() const;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
7513 7568
7514 7569
7515 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7570 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7516 intptr_t index) { 7571 intptr_t index) {
7517 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7572 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7518 } 7573 }
7519 7574
7520 } // namespace dart 7575 } // namespace dart
7521 7576
7522 #endif // VM_OBJECT_H_ 7577 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698