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 692 : class V8_EXPORT_PRIVATE TestBuiltinsFromDSLAssembler {
13 : public:
14 692 : 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 : std::tuple<compiler::TNode<FixedArray>, compiler::TNode<Smi>, compiler::TNode<Number>> Flatten() const {
55 : 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 : void TestStructConstructor(compiler::TNode<Context> p_context);
126 : class TestClassWithAllTypes : public JSObject {
127 : public:
128 : DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kSize, TORQUE_GENERATED_TEST_CLASS_WITH_ALL_TYPES_FIELDS)
129 : };
130 : void TestClassWithAllTypesLoadsAndStores(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_t, compiler::TNode<RawPtrT> p_r, compiler::TNode<Int8T> p_v1, compiler::TNode<Uint8T> p_v2, compiler::TNode<Int16T> p_v3, compiler::TNode<Uint16T> p_v4);
131 : compiler::TNode<FixedArray> NewInternalClass(compiler::TNode<Smi> p_x);
132 : void TestInternalClass(compiler::TNode<Context> p_context);
133 : struct StructWithConst {
134 : compiler::TNode<Object> a;
135 : compiler::TNode<Int32T> b;
136 :
137 : std::tuple<compiler::TNode<Object>, compiler::TNode<Int32T>> Flatten() const {
138 : return std::tuple_cat(std::make_tuple(a), std::make_tuple(b));
139 : }
140 : };
141 : void TestConstInStructs();
142 : struct TestIterator {
143 : compiler::TNode<Smi> count;
144 :
145 : std::tuple<compiler::TNode<Smi>> Flatten() const {
146 : return std::tuple_cat(std::make_tuple(count));
147 : }
148 : };
149 : compiler::TNode<Object> TestNewFixedArrayFromSpread(compiler::TNode<Context> p_context);
150 : void TestReferences();
151 : compiler::TNode<Int8T> LoadTestClassWithAllTypesA(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
152 : void StoreTestClassWithAllTypesA(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Int8T> p_v);
153 : compiler::TNode<Uint8T> LoadTestClassWithAllTypesB(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
154 : void StoreTestClassWithAllTypesB(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint8T> p_v);
155 : compiler::TNode<Uint8T> LoadTestClassWithAllTypesB2(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
156 : void StoreTestClassWithAllTypesB2(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint8T> p_v);
157 : compiler::TNode<Uint8T> LoadTestClassWithAllTypesB3(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
158 : void StoreTestClassWithAllTypesB3(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint8T> p_v);
159 : compiler::TNode<Int16T> LoadTestClassWithAllTypesC(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
160 : void StoreTestClassWithAllTypesC(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Int16T> p_v);
161 : compiler::TNode<Uint16T> LoadTestClassWithAllTypesD(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
162 : void StoreTestClassWithAllTypesD(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint16T> p_v);
163 : compiler::TNode<Int32T> LoadTestClassWithAllTypesE(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
164 : void StoreTestClassWithAllTypesE(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Int32T> p_v);
165 : compiler::TNode<Uint32T> LoadTestClassWithAllTypesF(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
166 : void StoreTestClassWithAllTypesF(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<Uint32T> p_v);
167 : compiler::TNode<RawPtrT> LoadTestClassWithAllTypesG(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
168 : void StoreTestClassWithAllTypesG(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<RawPtrT> p_v);
169 : compiler::TNode<IntPtrT> LoadTestClassWithAllTypesH(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
170 : void StoreTestClassWithAllTypesH(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<IntPtrT> p_v);
171 : compiler::TNode<UintPtrT> LoadTestClassWithAllTypesI(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o);
172 : void StoreTestClassWithAllTypesI(compiler::TNode<TestBuiltinsFromDSLAssembler::TestClassWithAllTypes> p_o, compiler::TNode<UintPtrT> p_v);
173 : compiler::TNode<Smi> LoadInternalClassA(compiler::TNode<FixedArray> p_o);
174 : void StoreInternalClassA(compiler::TNode<FixedArray> p_o, compiler::TNode<Smi> p_v);
175 : compiler::TNode<Number> LoadInternalClassB(compiler::TNode<FixedArray> p_o);
176 : void StoreInternalClassB(compiler::TNode<FixedArray> p_o, compiler::TNode<Number> p_v);
177 : void _method_InternalClass_Flip(compiler::TNode<FixedArray> p_this, compiler::CodeAssemblerLabel* label_NotASmi);
178 : compiler::TNode<Smi> LoadSmiPairA(compiler::TNode<FixedArray> p_o);
179 : void StoreSmiPairA(compiler::TNode<FixedArray> p_o, compiler::TNode<Smi> p_v);
180 : compiler::TNode<Smi> LoadSmiPairB(compiler::TNode<FixedArray> p_o);
181 : void StoreSmiPairB(compiler::TNode<FixedArray> p_o, compiler::TNode<Smi> p_v);
182 : CodeStubAssembler::Reference _method_SmiPair_GetA(compiler::TNode<FixedArray> p_this);
183 : compiler::TNode<Object> GenericMacroTest5ATSmi(compiler::TNode<Smi> p_param);
184 : compiler::TNode<Object> GenericMacroTestWithLabels5ATSmi(compiler::TNode<Smi> p_param, compiler::CodeAssemblerLabel* label_X);
185 : compiler::TNode<Object> IncrementIfSmi32UT5ATSmi10FixedArray10HeapNumber(compiler::TNode<Object> p_x);
186 : compiler::TNode<Smi> ExampleGenericOverload5ATSmi(compiler::TNode<Smi> p_o);
187 : compiler::TNode<Object> ExampleGenericOverload20UT5ATSmi10HeapObject(compiler::TNode<Object> p_o);
188 : void Swap5ATSmi(CodeStubAssembler::Reference p_a, CodeStubAssembler::Reference p_b);
189 : private:
190 : compiler::CodeAssemblerState* const state_;
191 : compiler::CodeAssembler ca_;
192 : };
193 :
194 : } // namespace internal
195 : } // namespace v8
196 :
197 : #endif // V8_TORQUE_TEST_FROM_DSL_BASE_H__
|