Line data Source code
1 : #ifndef V8_TORQUE_TEST_FROM_DSL_BASE_H__
2 : #define V8_TORQUE_TEST_FROM_DSL_BASE_H__
3 :
4 : #include "src/compiler/code-assembler.h"
5 : #include "src/code-stub-assembler.h"
6 : #include "src/utils.h"
7 : #include "torque-generated/class-definitions-from-dsl.h"
8 :
9 : namespace v8 {
10 : namespace internal {
11 :
12 696 : class TestBuiltinsFromDSLAssembler {
13 : public:
14 696 : explicit TestBuiltinsFromDSLAssembler(compiler::CodeAssemblerState* state) : state_(state), ca_(state) { USE(state_, ca_); }
15 : compiler::TNode<BoolT> ElementsKindTestHelper1(ElementsKind p_kind);
16 : compiler::TNode<BoolT> ElementsKindTestHelper2(ElementsKind p_kind);
17 : bool ElementsKindTestHelper3(ElementsKind p_kind);
18 : void LabelTestHelper1(compiler::CodeAssemblerLabel* label_Label1);
19 : void LabelTestHelper2(compiler::CodeAssemblerLabel* label_Label2, compiler::TypedCodeAssemblerVariable<Smi>* label_Label2_parameter_0);
20 : void LabelTestHelper3(compiler::CodeAssemblerLabel* label_Label3, compiler::TypedCodeAssemblerVariable<Oddball>* label_Label3_parameter_0, compiler::TypedCodeAssemblerVariable<Smi>* label_Label3_parameter_1);
21 : void TestConstexpr1();
22 : void TestConstexprIf();
23 : void TestConstexprReturn();
24 : compiler::TNode<Oddball> TestGotoLabel();
25 : compiler::TNode<Oddball> TestGotoLabelWithOneParameter();
26 : compiler::TNode<Oddball> TestGotoLabelWithTwoParameters();
27 : void TestBuiltinSpecialization(compiler::TNode<Context> p_c);
28 : void LabelTestHelper4(bool p_flag, compiler::CodeAssemblerLabel* label_Label4, compiler::CodeAssemblerLabel* label_Label5);
29 : compiler::TNode<BoolT> CallLabelTestHelper4(bool p_flag);
30 : compiler::TNode<Oddball> TestPartiallyUnusedLabel();
31 : compiler::TNode<Object> GenericMacroTest20UT5ATSmi10HeapObject(compiler::TNode<Object> p_param2);
32 : compiler::TNode<Object> GenericMacroTestWithLabels20UT5ATSmi10HeapObject(compiler::TNode<Object> p_param2, compiler::CodeAssemblerLabel* label_Y);
33 : void TestMacroSpecialization();
34 : compiler::TNode<Oddball> TestFunctionPointers(compiler::TNode<Context> p_context);
35 : compiler::TNode<Oddball> TestVariableRedeclaration(compiler::TNode<Context> p_context);
36 : compiler::TNode<Smi> TestTernaryOperator(compiler::TNode<Smi> p_x);
37 : void TestFunctionPointerToGeneric(compiler::TNode<Context> p_c);
38 : compiler::TNode<BuiltinPtr> TestTypeAlias(compiler::TNode<BuiltinPtr> p_x);
39 : compiler::TNode<Oddball> TestUnsafeCast(compiler::TNode<Context> p_context, compiler::TNode<Number> p_n);
40 : void TestHexLiteral();
41 : void TestLargeIntegerLiterals(compiler::TNode<Context> p_c);
42 : void TestMultilineAssert();
43 : void TestNewlineInString();
44 : int31_t kConstexprConst();
45 : compiler::TNode<IntPtrT> kIntptrConst();
46 : compiler::TNode<Smi> kSmiConst();
47 : void TestModuleConstBindings();
48 : void TestLocalConstBindings();
49 : struct TestStructA {
50 : compiler::TNode<FixedArray> indexes;
51 : compiler::TNode<Smi> i;
52 : compiler::TNode<Number> k;
53 :
54 0 : std::tuple<compiler::TNode<FixedArray>, compiler::TNode<Smi>, compiler::TNode<Number>> Flatten() const {
55 0 : return std::tuple_cat(std::make_tuple(indexes), std::make_tuple(i), std::make_tuple(k));
56 : }
57 : };
58 : struct TestStructB {
59 : TestBuiltinsFromDSLAssembler::TestStructA x;
60 : compiler::TNode<Smi> y;
61 :
62 : std::tuple<compiler::TNode<FixedArray>, compiler::TNode<Smi>, compiler::TNode<Number>, compiler::TNode<Smi>> Flatten() const {
63 : return std::tuple_cat(x.Flatten(), std::make_tuple(y));
64 : }
65 : };
66 : compiler::TNode<Smi> TestStruct1(TestBuiltinsFromDSLAssembler::TestStructA p_i);
67 : TestBuiltinsFromDSLAssembler::TestStructA TestStruct2(compiler::TNode<Context> p_context);
68 : TestBuiltinsFromDSLAssembler::TestStructA TestStruct3(compiler::TNode<Context> p_context);
69 : struct TestStructC {
70 : TestBuiltinsFromDSLAssembler::TestStructA x;
71 : TestBuiltinsFromDSLAssembler::TestStructA y;
72 :
73 : std::tuple<compiler::TNode<FixedArray>, compiler::TNode<Smi>, compiler::TNode<Number>, compiler::TNode<FixedArray>, compiler::TNode<Smi>, compiler::TNode<Number>> Flatten() const {
74 : return std::tuple_cat(x.Flatten(), y.Flatten());
75 : }
76 : };
77 : TestBuiltinsFromDSLAssembler::TestStructC TestStruct4(compiler::TNode<Context> p_context);
78 : void CallTestStructInLabel(compiler::TNode<Context> p_context);
79 : void TestForLoop();
80 : void TestSubtyping(compiler::TNode<Smi> p_x);
81 : compiler::TNode<Int32T> TypeswitchExample(compiler::TNode<Context> p_context, compiler::TNode<Object> p_x);
82 : void TestTypeswitch(compiler::TNode<Context> p_context);
83 : void TestTypeswitchAsanLsanFailure(compiler::TNode<Context> p_context, compiler::TNode<Object> p_obj);
84 : void TestGenericOverload(compiler::TNode<Context> p_context);
85 : void TestEquality(compiler::TNode<Context> p_context);
86 : void BoolToBranch(compiler::TNode<BoolT> p_x, compiler::CodeAssemblerLabel* label_Taken, compiler::CodeAssemblerLabel* label_NotTaken);
87 : compiler::TNode<BoolT> TestOrAnd1(compiler::TNode<BoolT> p_x, compiler::TNode<BoolT> p_y, compiler::TNode<BoolT> p_z);
88 : compiler::TNode<BoolT> TestOrAnd2(compiler::TNode<BoolT> p_x, compiler::TNode<BoolT> p_y, compiler::TNode<BoolT> p_z);
89 : compiler::TNode<BoolT> TestOrAnd3(compiler::TNode<BoolT> p_x, compiler::TNode<BoolT> p_y, compiler::TNode<BoolT> p_z);
90 : compiler::TNode<BoolT> TestAndOr1(compiler::TNode<BoolT> p_x, compiler::TNode<BoolT> p_y, compiler::TNode<BoolT> p_z);
91 : compiler::TNode<BoolT> TestAndOr2(compiler::TNode<BoolT> p_x, compiler::TNode<BoolT> p_y, compiler::TNode<BoolT> p_z);
92 : compiler::TNode<BoolT> TestAndOr3(compiler::TNode<BoolT> p_x, compiler::TNode<BoolT> p_y, compiler::TNode<BoolT> p_z);
93 : void TestLogicalOperators();
94 : compiler::TNode<Smi> TestCall(compiler::TNode<Smi> p_i, compiler::CodeAssemblerLabel* label_A);
95 : void TestOtherwiseWithCode1();
96 : void TestOtherwiseWithCode2();
97 : void TestOtherwiseWithCode3();
98 : void TestForwardLabel();
99 : void TestQualifiedAccess(compiler::TNode<Context> p_context);
100 : compiler::TNode<Smi> TestCatch1(compiler::TNode<Context> p_context);
101 : void TestCatch2Wrapper(compiler::TNode<Context> p_context);
102 : compiler::TNode<Smi> TestCatch2(compiler::TNode<Context> p_context);
103 : void TestCatch3WrapperWithLabel(compiler::TNode<Context> p_context, compiler::CodeAssemblerLabel* label_Abort);
104 : compiler::TNode<Smi> TestCatch3(compiler::TNode<Context> p_context);
105 : void TestIterator(compiler::TNode<Context> p_context, compiler::TNode<Object> p_o, compiler::TNode<Map> p_map);
106 : void TestFrame1(compiler::TNode<Context> p_context);
107 : void TestNew(compiler::TNode<Context> p_context);
108 : struct TestInner {
109 : compiler::TNode<Int32T> x;
110 : compiler::TNode<Int32T> y;
111 :
112 : std::tuple<compiler::TNode<Int32T>, compiler::TNode<Int32T>> Flatten() const {
113 : return std::tuple_cat(std::make_tuple(x), std::make_tuple(y));
114 : }
115 : };
116 : struct TestOuter {
117 : compiler::TNode<Int32T> a;
118 : TestBuiltinsFromDSLAssembler::TestInner b;
119 : compiler::TNode<Int32T> c;
120 :
121 : std::tuple<compiler::TNode<Int32T>, compiler::TNode<Int32T>, compiler::TNode<Int32T>, compiler::TNode<Int32T>> Flatten() const {
122 : return std::tuple_cat(std::make_tuple(a), b.Flatten(), std::make_tuple(c));
123 : }
124 : };
125 : struct TestCustomStructConstructor {
126 : compiler::TNode<Int32T> a;
127 : compiler::TNode<Smi> b;
128 : compiler::TNode<Int32T> c;
129 : compiler::TNode<Smi> d;
130 :
131 : std::tuple<compiler::TNode<Int32T>, compiler::TNode<Smi>, compiler::TNode<Int32T>, compiler::TNode<Smi>> Flatten() const {
132 : return std::tuple_cat(std::make_tuple(a), std::make_tuple(b), std::make_tuple(c), std::make_tuple(d));
133 : }
134 : };
135 : void TestStructConstructor(compiler::TNode<Context> p_context);
136 : class TestClassWithAllTypes : public JSObject {
137 : public:
138 : DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kSize, TEST_CLASS_WITH_ALL_TYPES_FIELDS)
139 : };
140 : void TestClassWithAllTypesLoadsAndStores(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_t, compiler::TNode<RawPtrT> p_r, compiler::TNode<Int32T> p_v1, compiler::TNode<Uint32T> p_v2, compiler::TNode<Int32T> p_v3, compiler::TNode<Uint32T> p_v4);
141 : void TestInternalClass(compiler::TNode<Context> p_context);
142 : struct _ThisStructTestClassWithAllTypes {
143 : BaseBuiltinsFromDSLAssembler::_ThisStructJSObject _super;
144 : compiler::TNode<Int32T> a;
145 : compiler::TNode<Uint32T> b;
146 : compiler::TNode<Uint32T> b2;
147 : compiler::TNode<Uint32T> b3;
148 : compiler::TNode<Int32T> c;
149 : compiler::TNode<Uint32T> d;
150 : compiler::TNode<Int32T> e;
151 : compiler::TNode<Uint32T> f;
152 : compiler::TNode<RawPtrT> g;
153 : compiler::TNode<IntPtrT> h;
154 : compiler::TNode<UintPtrT> i;
155 :
156 : std::tuple<compiler::TNode<Map>, compiler::TNode<Object>, compiler::TNode<FixedArrayBase>, compiler::TNode<Int32T>, compiler::TNode<Uint32T>, compiler::TNode<Uint32T>, compiler::TNode<Uint32T>, compiler::TNode<Int32T>, compiler::TNode<Uint32T>, compiler::TNode<Int32T>, compiler::TNode<Uint32T>, compiler::TNode<RawPtrT>, compiler::TNode<IntPtrT>, compiler::TNode<UintPtrT>> Flatten() const {
157 : return std::tuple_cat(_super.Flatten(), std::make_tuple(a), std::make_tuple(b), std::make_tuple(b2), std::make_tuple(b3), std::make_tuple(c), std::make_tuple(d), std::make_tuple(e), std::make_tuple(f), std::make_tuple(g), std::make_tuple(h), std::make_tuple(i));
158 : }
159 : };
160 : compiler::TNode<Int32T> LoadTestClassWithAllTypesA(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
161 : void StoreTestClassWithAllTypesA(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Int32T> p_v);
162 : compiler::TNode<Uint32T> LoadTestClassWithAllTypesB(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
163 : void StoreTestClassWithAllTypesB(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint32T> p_v);
164 : compiler::TNode<Uint32T> LoadTestClassWithAllTypesB2(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
165 : void StoreTestClassWithAllTypesB2(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint32T> p_v);
166 : compiler::TNode<Uint32T> LoadTestClassWithAllTypesB3(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
167 : void StoreTestClassWithAllTypesB3(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint32T> p_v);
168 : compiler::TNode<Int32T> LoadTestClassWithAllTypesC(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
169 : void StoreTestClassWithAllTypesC(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Int32T> p_v);
170 : compiler::TNode<Uint32T> LoadTestClassWithAllTypesD(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
171 : void StoreTestClassWithAllTypesD(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint32T> p_v);
172 : compiler::TNode<Int32T> LoadTestClassWithAllTypesE(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
173 : void StoreTestClassWithAllTypesE(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Int32T> p_v);
174 : compiler::TNode<Uint32T> LoadTestClassWithAllTypesF(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
175 : void StoreTestClassWithAllTypesF(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint32T> p_v);
176 : compiler::TNode<RawPtrT> LoadTestClassWithAllTypesG(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
177 : void StoreTestClassWithAllTypesG(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<RawPtrT> p_v);
178 : compiler::TNode<IntPtrT> LoadTestClassWithAllTypesH(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
179 : void StoreTestClassWithAllTypesH(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<IntPtrT> p_v);
180 : compiler::TNode<UintPtrT> LoadTestClassWithAllTypesI(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
181 : void StoreTestClassWithAllTypesI(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<UintPtrT> p_v);
182 : struct _ThisStructInternalClass {
183 : compiler::TNode<Smi> a;
184 : compiler::TNode<Number> b;
185 :
186 : std::tuple<compiler::TNode<Smi>, compiler::TNode<Number>> Flatten() const {
187 : return std::tuple_cat(std::make_tuple(a), std::make_tuple(b));
188 : }
189 : };
190 : compiler::TNode<Smi> LoadInternalClassA(compiler::TNode<FixedArray> p_o);
191 : void StoreInternalClassA(compiler::TNode<FixedArray> p_o, compiler::TNode<Smi> p_v);
192 : compiler::TNode<Number> LoadInternalClassB(compiler::TNode<FixedArray> p_o);
193 : void StoreInternalClassB(compiler::TNode<FixedArray> p_o, compiler::TNode<Number> p_v);
194 : void _method_InternalClass_Flip(compiler::TNode<FixedArray> p_this, compiler::CodeAssemblerLabel* label_NotASmi);
195 : compiler::TNode<Object> GenericMacroTest5ATSmi(compiler::TNode<Smi> p_param);
196 : compiler::TNode<Object> GenericMacroTestWithLabels5ATSmi(compiler::TNode<Smi> p_param, compiler::CodeAssemblerLabel* label_X);
197 : compiler::TNode<Object> IncrementIfSmi34UT12ATHeapNumber5ATSmi10FixedArray(compiler::TNode<Object> p_x);
198 : compiler::TNode<Smi> ExampleGenericOverload5ATSmi(compiler::TNode<Smi> p_o);
199 : compiler::TNode<Object> ExampleGenericOverload20UT5ATSmi10HeapObject(compiler::TNode<Object> p_o);
200 : private:
201 : compiler::CodeAssemblerState* const state_;
202 : compiler::CodeAssembler ca_;};
203 :
204 : } // namespace internal
205 : } // namespace v8
206 :
207 : #endif // V8_TORQUE_TEST_FROM_DSL_BASE_H__
|