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

Unified Diff: test/cctest/compiler/test-run-stubs.cc

Issue 1150673002: Add a TurboFan skeleton for StringAddStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed frame construction logic Created 5 years, 7 months 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 | « src/runtime.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698