Index: test/cctest/compiler/test-run-stubs.cc |
diff --git a/test/cctest/compiler/test-run-stubs.cc b/test/cctest/compiler/test-run-stubs.cc |
index 5c012a3301f56aae43b82080631a3844d214576b..5baa79a57ac531e1df9f59780670806841b3670b 100644 |
--- a/test/cctest/compiler/test-run-stubs.cc |
+++ b/test/cctest/compiler/test-run-stubs.cc |
@@ -106,4 +106,42 @@ TEST(RunStringLengthTFStub) { |
CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); |
} |
+ |
+TEST(RunStringAddTFStub) { |
+ HandleAndZoneScope scope; |
+ Isolate* isolate = scope.main_isolate(); |
+ Zone* zone = scope.main_zone(); |
+ |
+ // Create code and an accompanying descriptor. |
+ StringAddTFStub stub(isolate, STRING_ADD_CHECK_BOTH, NOT_TENURED); |
+ Handle<Code> code = stub.GenerateCode(); |
+ CompilationInfo info(&stub, isolate, zone); |
+ CallDescriptor* descriptor = Linkage::ComputeIncoming(zone, &info); |
+ |
+ // Create a function to call the code using the descriptor. |
+ Graph graph(zone); |
+ CommonOperatorBuilder common(zone); |
+ // FunctionTester (ab)uses a 2-argument function |
+ Node* start = graph.NewNode(common.Start(2)); |
+ // Parameter 0 is the receiver |
+ Node* leftParam = graph.NewNode(common.Parameter(1), start); |
+ Node* rightParam = graph.NewNode(common.Parameter(2), start); |
+ Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); |
+ Node* theCode = graph.NewNode(common.HeapConstant(u)); |
+ Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
+ Node* call = graph.NewNode(common.Call(descriptor), theCode, leftParam, |
+ rightParam, dummyContext, start, start); |
+ Node* ret = graph.NewNode(common.Return(), call, call, start); |
+ Node* end = graph.NewNode(common.End(), ret); |
+ graph.SetStart(start); |
+ graph.SetEnd(end); |
+ FunctionTester ft(&graph); |
+ |
+ // Actuall call through to the stub, verifying its result. |
+ Handle<String> leftArg = ft.Val("links"); |
+ Handle<String> rightArg = ft.Val("rechts"); |
+ Handle<Object> result = ft.Call(leftArg, rightArg).ToHandleChecked(); |
+ CHECK(String::Equals(ft.Val("linksrechts"), Handle<String>::cast(result))); |
+} |
+ |
#endif // V8_TURBOFAN_TARGET |