11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_cibitfield struct JSRegExpFlags extends uint31 {
61cb0ef41Sopenharmony_ci  global: bool: 1 bit;
71cb0ef41Sopenharmony_ci  ignore_case: bool: 1 bit;
81cb0ef41Sopenharmony_ci  multiline: bool: 1 bit;
91cb0ef41Sopenharmony_ci  sticky: bool: 1 bit;
101cb0ef41Sopenharmony_ci  unicode: bool: 1 bit;
111cb0ef41Sopenharmony_ci  dot_all: bool: 1 bit;
121cb0ef41Sopenharmony_ci  linear: bool: 1 bit;
131cb0ef41Sopenharmony_ci  has_indices: bool: 1 bit;
141cb0ef41Sopenharmony_ci}
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciextern class JSRegExp extends JSObject {
171cb0ef41Sopenharmony_ci  data: FixedArray|Undefined;
181cb0ef41Sopenharmony_ci  source: String|Undefined;
191cb0ef41Sopenharmony_ci  flags: SmiTagged<JSRegExpFlags>|Undefined;
201cb0ef41Sopenharmony_ci}
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci// Note: Although a condition for a FastJSRegExp is having a positive smi
231cb0ef41Sopenharmony_ci// lastIndex (see RegExpBuiltinsAssembler::BranchIfFastRegExp), it is possible
241cb0ef41Sopenharmony_ci// for this to change without transitioning the transient type. As a precaution,
251cb0ef41Sopenharmony_ci// validate the lastIndex is positive smi when used in fast paths.
261cb0ef41Sopenharmony_citransient type FastJSRegExp extends JSRegExp;
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ciextern operator '.global' macro
291cb0ef41Sopenharmony_ciRegExpBuiltinsAssembler::FastFlagGetterGlobal(FastJSRegExp): bool;
301cb0ef41Sopenharmony_ciextern operator '.unicode' macro
311cb0ef41Sopenharmony_ciRegExpBuiltinsAssembler::FastFlagGetterUnicode(FastJSRegExp): bool;
321cb0ef41Sopenharmony_ciextern operator '.lastIndex' macro
331cb0ef41Sopenharmony_ciRegExpBuiltinsAssembler::FastLoadLastIndex(FastJSRegExp): Smi;
341cb0ef41Sopenharmony_ciextern operator '.lastIndex=' macro
351cb0ef41Sopenharmony_ciRegExpBuiltinsAssembler::FastStoreLastIndex(FastJSRegExp, Smi): void;
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci@doNotGenerateCast
381cb0ef41Sopenharmony_ciextern class JSRegExpConstructor extends JSFunction
391cb0ef41Sopenharmony_ci    generates 'TNode<JSFunction>';
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ciextern shape JSRegExpResult extends JSArray {
421cb0ef41Sopenharmony_ci  // In-object properties:
431cb0ef41Sopenharmony_ci  // The below fields are externally exposed.
441cb0ef41Sopenharmony_ci  index: JSAny;
451cb0ef41Sopenharmony_ci  input: JSAny;
461cb0ef41Sopenharmony_ci  groups: JSAny;
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci  // The below fields are for internal use only.
491cb0ef41Sopenharmony_ci  names: FixedArray|Undefined;
501cb0ef41Sopenharmony_ci  regexp_input: String;
511cb0ef41Sopenharmony_ci  regexp_last_index: Smi;
521cb0ef41Sopenharmony_ci}
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ciextern shape JSRegExpResultWithIndices extends JSRegExpResult {
551cb0ef41Sopenharmony_ci  indices: JSAny;
561cb0ef41Sopenharmony_ci}
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ciextern shape JSRegExpResultIndices extends JSArray {
591cb0ef41Sopenharmony_ci  // In-object properties:
601cb0ef41Sopenharmony_ci  // The groups field is externally exposed.
611cb0ef41Sopenharmony_ci  groups: JSAny;
621cb0ef41Sopenharmony_ci}
63