Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/torque/test-torque.cc')
-rw-r--r--deps/v8/test/cctest/torque/test-torque.cc44
1 files changed, 40 insertions, 4 deletions
diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc
index 9442dab6f5e..0fd9cc4f660 100644
--- a/deps/v8/test/cctest/torque/test-torque.cc
+++ b/deps/v8/test/cctest/torque/test-torque.cc
@@ -19,6 +19,7 @@
#include "src/strings/char-predicates.h"
#include "test/cctest/compiler/code-assembler-tester.h"
#include "test/cctest/compiler/function-tester.h"
+#include "torque-generated/exported-class-definitions-tq-inl.h"
namespace v8 {
namespace internal {
@@ -113,8 +114,7 @@ TEST(TestBuiltinSpecialization) {
CodeAssemblerTester asm_tester(isolate, 0);
TestTorqueAssembler m(asm_tester.state());
{
- TNode<Object> temp = m.SmiConstant(0);
- m.TestBuiltinSpecialization(m.UncheckedCast<Context>(temp));
+ m.TestBuiltinSpecialization();
m.Return(m.UndefinedConstant());
}
FunctionTester ft(asm_tester.GenerateCode(), 0);
@@ -170,8 +170,7 @@ TEST(TestFunctionPointerToGeneric) {
CodeAssemblerTester asm_tester(isolate, 0);
TestTorqueAssembler m(asm_tester.state());
{
- TNode<Object> temp = m.SmiConstant(0);
- m.TestFunctionPointerToGeneric(m.UncheckedCast<Context>(temp));
+ m.TestFunctionPointerToGeneric();
m.Return(m.UndefinedConstant());
}
FunctionTester ft(asm_tester.GenerateCode(), 0);
@@ -694,6 +693,43 @@ TEST(TestBitFieldStore) {
}
}
+TEST(TestBitFieldInit) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ const int kNumParams = 4;
+ CodeAssemblerTester asm_tester(isolate, kNumParams);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ // Untag all of the parameters to get plain integer values.
+ TNode<BoolT> a =
+ m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(0))));
+ TNode<Uint16T> b =
+ m.UncheckedCast<Uint16T>(m.Unsigned(m.SmiToInt32(m.Parameter(1))));
+ TNode<Uint32T> c =
+ m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(2))));
+ TNode<BoolT> d =
+ m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(3))));
+
+ // Call the Torque-defined macro, which verifies that reading each bitfield
+ // out of val yields the correct result.
+ m.TestBitFieldInit(a, b, c, d);
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
+
+ // Test every possible bit combination for this 8-bit value.
+ for (int a = 0; a <= 1; ++a) {
+ for (int b = 0; b <= 7; ++b) {
+ for (int c = 0; c <= 7; ++c) {
+ for (int d = 0; d <= 1; ++d) {
+ ft.Call(ft.Val(a), ft.Val(b), ft.Val(c), ft.Val(d));
+ }
+ }
+ }
+ }
+}
+
TEST(TestBitFieldUintptrOps) {
CcTest::InitializeVM();
Isolate* isolate(CcTest::i_isolate());