Commit b22e6cfd authored by Irina Yatsenko's avatar Irina Yatsenko Committed by Commit Bot

Torquefy a few types

JSRegExp, JSRegExpResult, JSRegExpStringIterator, AccessorInfo, AccessorPair, BreakPoint, BreakPointInfo

Change-Id: I51c557af543d2169dfc5da8bf5105a9eb03ff711

Bug: v8:8952
Change-Id: I51c557af543d2169dfc5da8bf5105a9eb03ff711
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1499696
Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60070}
parent 69bc0157
......@@ -12,6 +12,7 @@
#include 'src/objects/bigint.h'
#include 'src/objects/js-generator.h'
#include 'src/objects/js-promise.h'
#include 'src/objects/js-regexp-string-iterator.h'
#include 'src/objects/module.h'
#include 'src/objects/stack-frame-info.h'
......@@ -94,6 +95,8 @@ extern class FixedDoubleArray extends FixedArrayBase {
floats[length]: float64;
}
extern class ByteArray extends FixedArrayBase {}
// These intrinsics should never be called from Torque code. They're used
// internally by the 'new' operator and only declared here because it's simpler
// than building the definition from C++.
......@@ -635,6 +638,42 @@ extern class PromiseReaction extends Struct {
promise_or_capability: JSPromise | PromiseCapability | Undefined;
}
extern class JSRegExp extends JSObject {
data: FixedArray | Undefined;
source: String | Undefined;
flags: Smi | Undefined;
}
extern class JSRegExpResult extends JSArray {
index: Object;
input: Object;
groups: Object;
}
extern class JSRegExpStringIterator extends JSObject {
iterating_reg_exp: Object;
iterated_string: String;
flags: Smi;
}
extern class AccessorInfo extends Struct {
name: Object;
flags: Smi;
expected_receiver_type: Object;
setter: Foreign | Zero;
getter: Foreign | Zero;
js_getter: Foreign | Zero;
data: Object;
}
extern class AccessorPair extends Struct {
getter: Object;
setter: Object;
}
extern class BreakPoint extends Tuple2 {}
extern class BreakPointInfo extends Tuple2 {}
extern macro Is64(): constexpr bool;
extern macro SelectBooleanConstant(bool): Boolean;
......
......@@ -1598,6 +1598,8 @@ void SmallOrderedNameDictionary::SmallOrderedNameDictionaryVerify(
void JSRegExp::JSRegExpVerify(Isolate* isolate) {
JSObjectVerify(isolate);
CHECK(data()->IsUndefined(isolate) || data()->IsFixedArray());
CHECK(source()->IsUndefined(isolate) || source()->IsString());
CHECK(flags()->IsUndefined() || flags()->IsSmi());
switch (TypeTag()) {
case JSRegExp::ATOM: {
FixedArray arr = FixedArray::cast(data());
......
......@@ -76,19 +76,9 @@ class AccessorInfo : public Struct {
static int AppendUnique(Isolate* isolate, Handle<Object> descriptors,
Handle<FixedArray> array, int valid_descriptors);
// Layout description.
#define ACCESSOR_INFO_FIELDS(V) \
V(kNameOffset, kTaggedSize) \
V(kFlagsOffset, kTaggedSize) \
V(kExpectedReceiverTypeOffset, kTaggedSize) \
V(kSetterOffset, kTaggedSize) \
V(kGetterOffset, kTaggedSize) \
V(kJsGetterOffset, kTaggedSize) \
V(kDataOffset, kTaggedSize) \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, ACCESSOR_INFO_FIELDS)
#undef ACCESSOR_INFO_FIELDS
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ACCESSOR_INFO_FIELDS)
private:
inline bool HasExpectedReceiverType();
......
......@@ -37,16 +37,9 @@ class JSRegExpStringIterator : public JSObject {
DECL_VERIFIER(JSRegExpStringIterator)
// Layout description.
#define JS_REGEXP_STRING_ITERATOR_FIELDS(V) \
V(kIteratingRegExpOffset, kTaggedSize) \
V(kIteratedStringOffset, kTaggedSize) \
V(kFlagsOffset, kTaggedSize) \
/* Header size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
JS_REGEXP_STRING_ITERATOR_FIELDS)
#undef JS_REGEXP_STRING_ITERATOR_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(
JSObject::kHeaderSize,
TORQUE_GENERATED_JSREG_EXP_STRING_ITERATOR_FIELDS)
static const int kDoneBit = 0;
static const int kGlobalBit = 1;
......
......@@ -122,18 +122,12 @@ class JSRegExp : public JSObject {
DECL_PRINTER(JSRegExp)
DECL_VERIFIER(JSRegExp)
// Layout description.
#define JS_REGEXP_FIELDS(V) \
V(kDataOffset, kTaggedSize) \
V(kSourceOffset, kTaggedSize) \
V(kFlagsOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0) \
/* This is already an in-object field. */ \
V(kLastIndexOffset, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_REGEXP_FIELDS)
#undef JS_REGEXP_FIELDS
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
TORQUE_GENERATED_JSREG_EXP_FIELDS)
/* This is already an in-object field. */
// TODO(v8:8944): improve handling of in-object fields
static constexpr int kLastIndexOffset = kSize;
// Indices in the data array.
static const int kTagIndex = 0;
......@@ -194,16 +188,9 @@ DEFINE_OPERATORS_FOR_FLAGS(JSRegExp::Flags)
// After creation the result must be treated as a JSArray in all regards.
class JSRegExpResult : public JSArray {
public:
// Layout description.
#define REG_EXP_RESULT_FIELDS(V) \
V(kIndexOffset, kTaggedSize) \
V(kInputOffset, kTaggedSize) \
V(kGroupsOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSArray::kSize, REG_EXP_RESULT_FIELDS)
#undef REG_EXP_RESULT_FIELDS
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(JSArray::kSize,
TORQUE_GENERATED_JSREG_EXP_RESULT_FIELDS)
// Indices of in-object properties.
static const int kIndexIndex = 0;
......
......@@ -93,15 +93,9 @@ class AccessorPair : public Struct {
DECL_PRINTER(AccessorPair)
DECL_VERIFIER(AccessorPair)
// Layout description.
#define ACCESSOR_PAIR_FIELDS(V) \
V(kGetterOffset, kTaggedSize) \
V(kSetterOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, ACCESSOR_PAIR_FIELDS)
#undef ACCESSOR_PAIR_FIELDS
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ACCESSOR_PAIR_FIELDS)
OBJECT_CONSTRUCTORS(AccessorPair, Struct);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment