5 #ifndef V8_OBJECTS_JS_REGEXP_H_ 6 #define V8_OBJECTS_JS_REGEXP_H_ 8 #include "src/objects/js-array.h" 11 #include "src/objects/object-macros.h" 38 enum Type { NOT_COMPILED, ATOM, IRREGEXP };
51 static constexpr
int FlagCount() {
return 6; }
53 static int FlagShiftBits(Flag flag) {
56 STATIC_ASSERT(kGlobal == (1 << 0));
59 STATIC_ASSERT(kIgnoreCase == (1 << 1));
62 STATIC_ASSERT(kMultiline == (1 << 2));
65 STATIC_ASSERT(kSticky == (1 << 3));
68 STATIC_ASSERT(kUnicode == (1 << 4));
71 STATIC_ASSERT(kDotAll == (1 << 5));
74 STATIC_ASSERT(FlagCount() == 6);
79 DECL_ACCESSORS(data,
Object)
80 DECL_ACCESSORS(flags,
Object)
81 DECL_ACCESSORS(last_index,
Object)
82 DECL_ACCESSORS(source,
Object)
95 inline Type TypeTag();
97 inline int CaptureCount();
98 inline Flags GetFlags();
100 inline Object* CaptureNameMap();
101 inline Object* DataAt(
int index);
103 inline void SetDataAt(
int index,
Object* value);
105 static int code_index(
bool is_latin1) {
107 return kIrregexpLatin1CodeIndex;
109 return kIrregexpUC16CodeIndex;
120 #define JS_REGEXP_FIELDS(V) \ 121 V(kDataOffset, kTaggedSize) \ 122 V(kSourceOffset, kTaggedSize) \ 123 V(kFlagsOffset, kTaggedSize) \ 127 V(kLastIndexOffset, 0) 129 DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_REGEXP_FIELDS)
130 #undef JS_REGEXP_FIELDS 133 static const int kTagIndex = 0;
134 static const int kSourceIndex = kTagIndex + 1;
135 static const int kFlagsIndex = kSourceIndex + 1;
136 static const int kDataIndex = kFlagsIndex + 1;
140 static const int kAtomPatternIndex = kDataIndex;
142 static const int kAtomDataSize = kAtomPatternIndex + 1;
147 static const int kIrregexpLatin1CodeIndex = kDataIndex;
151 static const int kIrregexpUC16CodeIndex = kDataIndex + 1;
154 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 2;
156 static const int kIrregexpCaptureCountIndex = kDataIndex + 3;
159 static const int kIrregexpCaptureNameMapIndex = kDataIndex + 4;
161 static const int kIrregexpDataSize = kIrregexpCaptureNameMapIndex + 1;
164 static const int kLastIndexFieldIndex = 0;
165 static const int kInObjectFieldCount = 1;
168 static const int kExecFunctionDescriptorIndex = 1;
169 static const int kSymbolMatchFunctionDescriptorIndex = 13;
170 static const int kSymbolReplaceFunctionDescriptorIndex = 14;
171 static const int kSymbolSearchFunctionDescriptorIndex = 15;
172 static const int kSymbolSplitFunctionDescriptorIndex = 16;
173 static const int kSymbolMatchAllFunctionDescriptorIndex = 17;
176 static const int kUninitializedValue = -1;
190 #define REG_EXP_RESULT_FIELDS(V) \ 191 V(kIndexOffset, kTaggedSize) \ 192 V(kInputOffset, kTaggedSize) \ 193 V(kGroupsOffset, kTaggedSize) \ 197 DEFINE_FIELD_OFFSET_CONSTANTS(JSArray::kSize, REG_EXP_RESULT_FIELDS)
198 #undef REG_EXP_RESULT_FIELDS 201 static const int kIndexIndex = 0;
202 static const int kInputIndex = 1;
203 static const int kGroupsIndex = 2;
204 static const int kInObjectPropertyCount = 3;
213 #include "src/objects/object-macros-undef.h" 215 #endif // V8_OBJECTS_JS_REGEXP_H_