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

Unified Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1437873002: [Interpreter] Add support for Call bytecode to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mythri_load
Patch Set: Update to directly build bytecode in unittest Created 5 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
Index: test/cctest/compiler/test-run-bytecode-graph-builder.cc
diff --git a/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
index bdbb1163537a710e82999fe48c33d4d56d4353fd..052959290efb14f8564fef5695f94fedc5c7d5e7 100644
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -331,6 +331,41 @@ TEST(BytecodeGraphBuilderNamedLoad) {
}
}
+
+TEST(BytecodeGraphBuilderPropertyCall) {
+ HandleAndZoneScope scope;
+ Isolate* isolate = scope.main_isolate();
+ Zone* zone = scope.main_zone();
+ Factory* factory = isolate->factory();
+
+ ExpectedSnippet<1> snippets[] = {
+ {"return p1.func();",
+ {factory->NewNumberFromInt(25),
+ BytecodeGraphTester::NewObject("({func() { return 25; }})")}},
+ {"return p1.func('abc');",
+ {factory->NewStringFromStaticChars("abc"),
+ BytecodeGraphTester::NewObject("({func(a) { return a; }})")}},
+ {"return p1.func(1, 2, 3, 4, 5, 6, 7, 8);",
+ {factory->NewNumberFromInt(36),
+ BytecodeGraphTester::NewObject(
+ "({func(a, b, c, d, e, f, g, h) {\n"
+ " return a + b + c + d + e + f + g + h;}})")}},
+ };
+
+ size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
+ for (size_t i = 0; i < num_snippets; i++) {
+ ScopedVector<char> script(2048);
+ SNPrintF(script, "function %s(p1) { %s };\n%s({func() {}});", kFunctionName,
+ snippets[i].code_snippet, kFunctionName);
+
+ BytecodeGraphTester tester(isolate, zone, script.start());
+ auto callable = tester.GetCallable<Handle<Object>>();
+ Handle<Object> return_value =
+ callable(snippets[i].parameter(0)).ToHandleChecked();
+ CHECK(return_value->SameValue(*snippets[i].return_value()));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698