#ifndef V8_OBJECTS_REGEXP_MATCH_INFO_H_
#define V8_OBJECTS_REGEXP_MATCH_INFO_H_
#include "src/base/compiler-specific.h"
#include "src/objects/fixed-array.h"
#include "src/objects/objects.h"
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
class Object;
class String;
#include "torque-generated/src/objects/regexp-match-info-tq.inc"
class RegExpMatchInfoShape final : public AllStatic {
public:
using ElementT = Smi;
using CompressionScheme = SmiCompressionScheme;
static constexpr RootIndex kMapRootIndex = RootIndex::kRegExpMatchInfoMap;
static constexpr bool kLengthEqualsCapacity = true;
V8_ARRAY_EXTRA_FIELDS({
TaggedMember<Smi> number_of_capture_registers_;
TaggedMember<String> last_subject_;
TaggedMember<Object> last_input_;
});
};
V8_OBJECT class RegExpMatchInfo
: public TaggedArrayBase<RegExpMatchInfo, RegExpMatchInfoShape> {
using Super = TaggedArrayBase<RegExpMatchInfo, RegExpMatchInfoShape>;
public:
using Shape = RegExpMatchInfoShape;
V8_EXPORT_PRIVATE static DirectHandle<RegExpMatchInfo> New(
Isolate* isolate, int capture_count,
AllocationType allocation = AllocationType::kYoung);
static DirectHandle<RegExpMatchInfo> ReserveCaptures(
Isolate* isolate, DirectHandle<RegExpMatchInfo> match_info,
int capture_count);
inline int number_of_capture_registers() const;
inline void set_number_of_capture_registers(int value);
inline Tagged<String> last_subject() const;
inline void set_last_subject(Tagged<String> value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline Tagged<Object> last_input() const;
inline void set_last_input(Tagged<Object> value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline int capture(int index) const;
inline void set_capture(int index, int value);
static constexpr int capture_start_index(int capture_index) {
return capture_index * 2;
}
static constexpr int capture_end_index(int capture_index) {
return capture_index * 2 + 1;
}
static constexpr int kMinCapacity = 2;
DECL_PRINTER(RegExpMatchInfo)
DECL_VERIFIER(RegExpMatchInfo)
class BodyDescriptor;
} V8_OBJECT_END;
}
}
#include "src/objects/object-macros-undef.h"
#endif