Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1165)

Unified Diff: test/cctest/test-code-stub-assembler.cc

Issue 2446543002: [turbofan] Support variable size argument popping in TF-generated functions (Closed)
Patch Set: Fix tests and arm64 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-stubs.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-code-stub-assembler.cc
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
index d25f057b6d9638b2245c6b9e6999d74ec90a6f5f..97bf27bdaf5e4cdc6de79c544bd99e22421c3d8f 100644
--- a/test/cctest/test-code-stub-assembler.cc
+++ b/test/cctest/test-code-stub-assembler.cc
@@ -1729,5 +1729,61 @@ TEST(AllocateNameDictionary) {
}
}
+TEST(PopAndReturnConstant) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+
+ const int kNumParams = 4;
+ const int kNumProgramaticParams = 2;
+ CodeStubAssemblerTester m(isolate, kNumParams - kNumProgramaticParams);
+
+ // Call a function that return |kNumProgramaticParams| parameters in addition
+ // to those specified by the static descriptor. |kNumProgramaticParams| is
+ // specified as a constant.
+ m.PopAndReturn(m.Int32Constant(kNumProgramaticParams),
+ m.SmiConstant(Smi::FromInt(1234)));
+
+ Handle<Code> code = m.GenerateCode();
+ CHECK(!code.is_null());
+
+ FunctionTester ft(code, kNumParams);
+ Handle<Object> result;
+ for (int test_count = 0; test_count < 100; ++test_count) {
+ result = ft.Call(isolate->factory()->undefined_value(),
+ Handle<Smi>(Smi::FromInt(1234), isolate),
+ isolate->factory()->undefined_value(),
+ isolate->factory()->undefined_value())
+ .ToHandleChecked();
+ CHECK_EQ(1234, Handle<Smi>::cast(result)->value());
+ }
+}
+
+TEST(PopAndReturnVariable) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+
+ const int kNumParams = 4;
+ const int kNumProgramaticParams = 2;
+ CodeStubAssemblerTester m(isolate, kNumParams - kNumProgramaticParams);
+
+ // Call a function that return |kNumProgramaticParams| parameters in addition
+ // to those specified by the static descriptor. |kNumProgramaticParams| is
+ // passed in as a parameter to the function so that it can't be recongized as
+ // a constant.
+ m.PopAndReturn(m.SmiUntag(m.Parameter(1)), m.SmiConstant(Smi::FromInt(1234)));
+
+ Handle<Code> code = m.GenerateCode();
+ CHECK(!code.is_null());
+
+ FunctionTester ft(code, kNumParams);
+ Handle<Object> result;
+ for (int test_count = 0; test_count < 100; ++test_count) {
+ result = ft.Call(isolate->factory()->undefined_value(),
+ Handle<Smi>(Smi::FromInt(1234), isolate),
+ isolate->factory()->undefined_value(),
+ Handle<Smi>(Smi::FromInt(kNumProgramaticParams), isolate))
+ .ToHandleChecked();
+ CHECK_EQ(1234, Handle<Smi>::cast(result)->value());
+ }
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/compiler/test-run-stubs.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698