summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/torque/test-torque.cc
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.cc88
1 files changed, 87 insertions, 1 deletions
diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc
index 75d80329f5..8b67233963 100644
--- a/deps/v8/test/cctest/torque/test-torque.cc
+++ b/deps/v8/test/cctest/torque/test-torque.cc
@@ -19,7 +19,6 @@
#include "src/strings/char-predicates.h"
#include "test/cctest/compiler/code-assembler-tester.h"
#include "test/cctest/compiler/function-tester.h"
-#include "torque-generated/builtins-test-gen-tq.h"
namespace v8 {
namespace internal {
@@ -499,6 +498,93 @@ TEST(TestStaticAssert) {
ft.Call();
}
+TEST(TestLoadEliminationFixed) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestLoadEliminationFixed(
+ m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ asm_tester.GenerateCode();
+}
+
+TEST(TestLoadEliminationVariable) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestLoadEliminationVariable(
+ m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ asm_tester.GenerateCode();
+}
+
+TEST(TestRedundantArrayElementCheck) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.Return(m.TestRedundantArrayElementCheck(
+ m.UncheckedCast<Context>(m.HeapConstant(context))));
+ }
+ asm_tester.GenerateCode();
+}
+
+TEST(TestRedundantSmiCheck) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.Return(m.TestRedundantSmiCheck(
+ m.UncheckedCast<Context>(m.HeapConstant(context))));
+ }
+ asm_tester.GenerateCode();
+}
+
+TEST(TestGenericStruct1) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestGenericStruct1();
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestGenericStruct2) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ { m.Return(m.TestGenericStruct2().fst); }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8