summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/torque
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-03-12 09:01:49 +0100
committerMichaël Zasso <targos@protonmail.com>2019-03-14 18:49:21 +0100
commit7b48713334469818661fe276cf571de9c7899f2d (patch)
tree4dbda49ac88db76ce09dc330a0cb587e68e139ba /deps/v8/test/cctest/torque
parent8549ac09b256666cf5275224ec58fab9939ff32e (diff)
downloadnode-new-7b48713334469818661fe276cf571de9c7899f2d.tar.gz
deps: update V8 to 7.3.492.25
PR-URL: https://github.com/nodejs/node/pull/25852 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/test/cctest/torque')
-rw-r--r--deps/v8/test/cctest/torque/test-torque.cc187
1 files changed, 162 insertions, 25 deletions
diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc
index c339aa4134..0941795bd6 100644
--- a/deps/v8/test/cctest/torque/test-torque.cc
+++ b/deps/v8/test/cctest/torque/test-torque.cc
@@ -4,6 +4,7 @@
#include <cmath>
+#include "src/api-inl.h"
#include "src/base/utils/random-number-generator.h"
#include "src/builtins/builtins-promise-gen.h"
#include "src/builtins/builtins-string-gen.h"
@@ -29,12 +30,19 @@ namespace {
typedef CodeAssemblerLabel Label;
typedef CodeAssemblerVariable Variable;
+class TestTorqueAssembler : public CodeStubAssembler,
+ public TestBuiltinsFromDSLAssembler {
+ public:
+ explicit TestTorqueAssembler(CodeAssemblerState* state)
+ : CodeStubAssembler(state), TestBuiltinsFromDSLAssembler(state) {}
+};
+
} // namespace
TEST(TestConstexpr1) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestConstexpr1();
m.Return(m.UndefinedConstant());
@@ -46,7 +54,7 @@ TEST(TestConstexpr1) {
TEST(TestConstexprIf) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestConstexprIf();
m.Return(m.UndefinedConstant());
@@ -58,7 +66,7 @@ TEST(TestConstexprIf) {
TEST(TestConstexprReturn) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestConstexprReturn();
m.Return(m.UndefinedConstant());
@@ -70,7 +78,7 @@ TEST(TestConstexprReturn) {
TEST(TestGotoLabel) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestGotoLabel()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
@@ -79,7 +87,7 @@ TEST(TestGotoLabel) {
TEST(TestGotoLabelWithOneParameter) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestGotoLabelWithOneParameter()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
@@ -88,7 +96,7 @@ TEST(TestGotoLabelWithOneParameter) {
TEST(TestGotoLabelWithTwoParameters) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestGotoLabelWithTwoParameters()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
@@ -97,7 +105,7 @@ TEST(TestGotoLabelWithTwoParameters) {
TEST(TestPartiallyUnusedLabel) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{ m.Return(m.TestPartiallyUnusedLabel()); }
FunctionTester ft(asm_tester.GenerateCode(), 0);
ft.CheckCall(ft.true_value());
@@ -106,7 +114,7 @@ TEST(TestPartiallyUnusedLabel) {
TEST(TestBuiltinSpecialization) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
Node* temp = m.SmiConstant(0);
m.TestBuiltinSpecialization(m.UncheckedCast<Context>(temp));
@@ -119,7 +127,7 @@ TEST(TestBuiltinSpecialization) {
TEST(TestMacroSpecialization) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestMacroSpecialization();
m.Return(m.UndefinedConstant());
@@ -132,7 +140,7 @@ TEST(TestFunctionPointers) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 0;
CodeAssemblerTester asm_tester(isolate, kNumParams);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
TNode<Context> context =
m.UncheckedCast<Context>(m.Parameter(kNumParams + 2));
@@ -146,7 +154,7 @@ TEST(TestTernaryOperator) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
TNode<Smi> arg = m.UncheckedCast<Smi>(m.Parameter(0));
m.Return(m.TestTernaryOperator(arg));
@@ -163,7 +171,7 @@ TEST(TestTernaryOperator) {
TEST(TestFunctionPointerToGeneric) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
Node* temp = m.SmiConstant(0);
m.TestFunctionPointerToGeneric(m.UncheckedCast<Context>(temp));
@@ -176,7 +184,7 @@ TEST(TestFunctionPointerToGeneric) {
TEST(TestUnsafeCast) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
Node* temp = m.SmiConstant(0);
Node* n = m.SmiConstant(10);
@@ -190,7 +198,7 @@ TEST(TestUnsafeCast) {
TEST(TestHexLiteral) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestHexLiteral();
m.Return(m.UndefinedConstant());
@@ -202,7 +210,7 @@ TEST(TestHexLiteral) {
TEST(TestModuleConstBindings) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestModuleConstBindings();
m.Return(m.UndefinedConstant());
@@ -214,7 +222,7 @@ TEST(TestModuleConstBindings) {
TEST(TestLocalConstBindings) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestLocalConstBindings();
m.Return(m.UndefinedConstant());
@@ -226,7 +234,7 @@ TEST(TestLocalConstBindings) {
TEST(TestForLoop) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestForLoop();
m.Return(m.UndefinedConstant());
@@ -236,11 +244,15 @@ TEST(TestForLoop) {
}
TEST(TestTypeswitch) {
- Isolate* isolate(CcTest::InitIsolateOnce());
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
- m.TestTypeswitch();
+ m.TestTypeswitch(m.UncheckedCast<Context>(m.HeapConstant(context)));
m.Return(m.UndefinedConstant());
}
FunctionTester ft(asm_tester.GenerateCode(), 0);
@@ -248,11 +260,15 @@ TEST(TestTypeswitch) {
}
TEST(TestGenericOverload) {
- Isolate* isolate(CcTest::InitIsolateOnce());
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
- m.TestGenericOverload();
+ m.TestGenericOverload(m.UncheckedCast<Context>(m.HeapConstant(context)));
m.Return(m.UndefinedConstant());
}
FunctionTester ft(asm_tester.GenerateCode(), 0);
@@ -262,7 +278,7 @@ TEST(TestGenericOverload) {
TEST(TestLogicalOperators) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestLogicalOperators();
m.Return(m.UndefinedConstant());
@@ -274,7 +290,7 @@ TEST(TestLogicalOperators) {
TEST(TestOtherwiseAndLabels) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
- TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ TestTorqueAssembler m(asm_tester.state());
{
m.TestOtherwiseWithCode1();
m.TestOtherwiseWithCode2();
@@ -286,6 +302,127 @@ TEST(TestOtherwiseAndLabels) {
ft.Call();
}
+TEST(TestCatch1) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ TNode<Smi> result =
+ m.TestCatch1(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ USE(result);
+ CSA_ASSERT(&m, m.WordEqual(result, m.SmiConstant(1)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestCatch2) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ TNode<Smi> result =
+ m.TestCatch2(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ USE(result);
+ CSA_ASSERT(&m, m.WordEqual(result, m.SmiConstant(2)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestCatch3) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ TNode<Smi> result =
+ m.TestCatch3(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ USE(result);
+ CSA_ASSERT(&m, m.WordEqual(result, m.SmiConstant(2)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestLookup) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestQualifiedAccess(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestFrame1) {
+ 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.TestFrame1(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestNew) {
+ 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.TestNew(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestStructConstructor) {
+ 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.TestStructConstructor(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8