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

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

Issue 1458603012: [Interpreter] Add CreateClosure to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unneeded includes. 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
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c47db851d28ad059e849fa9f25b81327e4c30852..834b1099df20e320ee266b688a24636229971caa 100644
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -575,6 +575,45 @@ TEST(BytecodeGraphBuilderCallNew) {
}
+TEST(BytecodeGraphBuilderCreateClosure) {
+ HandleAndZoneScope scope;
+ Isolate* isolate = scope.main_isolate();
+ Zone* zone = scope.main_zone();
+ Factory* factory = isolate->factory();
+
+ ExpectedSnippet<0> snippets[] = {
+ {"function f() {\n"
+ " function counter() { this.count = 20; }\n"
+ " var c = new counter();\n"
+ " return c.count;\n"
+ "}; f()",
+ {factory->NewNumberFromInt(20)}},
+ {"function f() {\n"
+ " function counter(arg0) { this.count = 17; this.x = arg0; }\n"
+ " var c = new counter(6);\n"
+ " return c.count + c.x;\n"
+ "}; f()",
+ {factory->NewNumberFromInt(23)}},
+ {"function f() {\n"
+ " function counter(arg0, arg1) {\n"
+ " this.count = 17; this.x = arg0; this.y = arg1;\n"
+ " }\n"
+ " var c = new counter(3, 5);\n"
+ " return c.count + c.x + c.y;\n"
+ "}; f()",
+ {factory->NewNumberFromInt(25)}},
+ };
+
+ size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
+ for (size_t i = 0; i < num_snippets; i++) {
+ BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
+ auto callable = tester.GetCallable<>();
+ Handle<Object> return_value = callable().ToHandleChecked();
+ CHECK(return_value->SameValue(*snippets[i].return_value()));
+ }
+}
+
+
TEST(BytecodeGraphBuilderCallRuntime) {
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698