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 @@ ...@@ -12,6 +12,7 @@
#include 'src/objects/bigint.h' #include 'src/objects/bigint.h'
#include 'src/objects/js-generator.h' #include 'src/objects/js-generator.h'
#include 'src/objects/js-promise.h' #include 'src/objects/js-promise.h'
#include 'src/objects/js-regexp-string-iterator.h'
#include 'src/objects/module.h' #include 'src/objects/module.h'
#include 'src/objects/stack-frame-info.h' #include 'src/objects/stack-frame-info.h'
...@@ -94,6 +95,8 @@ extern class FixedDoubleArray extends FixedArrayBase { ...@@ -94,6 +95,8 @@ extern class FixedDoubleArray extends FixedArrayBase {
floats[length]: float64; floats[length]: float64;
} }
extern class ByteArray extends FixedArrayBase {}
// These intrinsics should never be called from Torque code. They're used // 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 // internally by the 'new' operator and only declared here because it's simpler
// than building the definition from C++. // than building the definition from C++.
...@@ -635,6 +638,42 @@ extern class PromiseReaction extends Struct { ...@@ -635,6 +638,42 @@ extern class PromiseReaction extends Struct {
promise_or_capability: JSPromise | PromiseCapability | Undefined; 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 Is64(): constexpr bool;
extern macro SelectBooleanConstant(bool): Boolean; extern macro SelectBooleanConstant(bool): Boolean;
......
...@@ -1598,6 +1598,8 @@ void SmallOrderedNameDictionary::SmallOrderedNameDictionaryVerify( ...@@ -1598,6 +1598,8 @@ void SmallOrderedNameDictionary::SmallOrderedNameDictionaryVerify(
void JSRegExp::JSRegExpVerify(Isolate* isolate) { void JSRegExp::JSRegExpVerify(Isolate* isolate) {
JSObjectVerify(isolate); JSObjectVerify(isolate);
CHECK(data()->IsUndefined(isolate) || data()->IsFixedArray()); CHECK(data()->IsUndefined(isolate) || data()->IsFixedArray());
CHECK(source()->IsUndefined(isolate) || source()->IsString());
CHECK(flags()->IsUndefined() || flags()->IsSmi());
switch (TypeTag()) { switch (TypeTag()) {
case JSRegExp::ATOM: { case JSRegExp::ATOM: {
FixedArray arr = FixedArray::cast(data()); FixedArray arr = FixedArray::cast(data());
......
...@@ -76,19 +76,9 @@ class AccessorInfo : public Struct { ...@@ -76,19 +76,9 @@ class AccessorInfo : public Struct {
static int AppendUnique(Isolate* isolate, Handle<Object> descriptors, static int AppendUnique(Isolate* isolate, Handle<Object> descriptors,
Handle<FixedArray> array, int valid_descriptors); Handle<FixedArray> array, int valid_descriptors);
// Layout description. // Layout description.
#define ACCESSOR_INFO_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
V(kNameOffset, kTaggedSize) \ TORQUE_GENERATED_ACCESSOR_INFO_FIELDS)
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
private: private:
inline bool HasExpectedReceiverType(); inline bool HasExpectedReceiverType();
......
...@@ -37,16 +37,9 @@ class JSRegExpStringIterator : public JSObject { ...@@ -37,16 +37,9 @@ class JSRegExpStringIterator : public JSObject {
DECL_VERIFIER(JSRegExpStringIterator) DECL_VERIFIER(JSRegExpStringIterator)
// Layout description. // Layout description.
#define JS_REGEXP_STRING_ITERATOR_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(
V(kIteratingRegExpOffset, kTaggedSize) \ JSObject::kHeaderSize,
V(kIteratedStringOffset, kTaggedSize) \ TORQUE_GENERATED_JSREG_EXP_STRING_ITERATOR_FIELDS)
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
static const int kDoneBit = 0; static const int kDoneBit = 0;
static const int kGlobalBit = 1; static const int kGlobalBit = 1;
......
...@@ -122,18 +122,12 @@ class JSRegExp : public JSObject { ...@@ -122,18 +122,12 @@ class JSRegExp : public JSObject {
DECL_PRINTER(JSRegExp) DECL_PRINTER(JSRegExp)
DECL_VERIFIER(JSRegExp) DECL_VERIFIER(JSRegExp)
// Layout description. // Layout description.
#define JS_REGEXP_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
V(kDataOffset, kTaggedSize) \ TORQUE_GENERATED_JSREG_EXP_FIELDS)
V(kSourceOffset, kTaggedSize) \ /* This is already an in-object field. */
V(kFlagsOffset, kTaggedSize) \ // TODO(v8:8944): improve handling of in-object fields
/* Total size. */ \ static constexpr int kLastIndexOffset = kSize;
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
// Indices in the data array. // Indices in the data array.
static const int kTagIndex = 0; static const int kTagIndex = 0;
...@@ -194,16 +188,9 @@ DEFINE_OPERATORS_FOR_FLAGS(JSRegExp::Flags) ...@@ -194,16 +188,9 @@ DEFINE_OPERATORS_FOR_FLAGS(JSRegExp::Flags)
// After creation the result must be treated as a JSArray in all regards. // After creation the result must be treated as a JSArray in all regards.
class JSRegExpResult : public JSArray { class JSRegExpResult : public JSArray {
public: public:
// Layout description. // Layout description.
#define REG_EXP_RESULT_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(JSArray::kSize,
V(kIndexOffset, kTaggedSize) \ TORQUE_GENERATED_JSREG_EXP_RESULT_FIELDS)
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
// Indices of in-object properties. // Indices of in-object properties.
static const int kIndexIndex = 0; static const int kIndexIndex = 0;
......
...@@ -93,15 +93,9 @@ class AccessorPair : public Struct { ...@@ -93,15 +93,9 @@ class AccessorPair : public Struct {
DECL_PRINTER(AccessorPair) DECL_PRINTER(AccessorPair)
DECL_VERIFIER(AccessorPair) DECL_VERIFIER(AccessorPair)
// Layout description. // Layout description.
#define ACCESSOR_PAIR_FIELDS(V) \ DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
V(kGetterOffset, kTaggedSize) \ TORQUE_GENERATED_ACCESSOR_PAIR_FIELDS)
V(kSetterOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, ACCESSOR_PAIR_FIELDS)
#undef ACCESSOR_PAIR_FIELDS
OBJECT_CONSTRUCTORS(AccessorPair, Struct); 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