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

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

Issue 1634153002: [Interpreter] Adds support for const/let variables to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Refactored VisitVariableAssignment. Created 4 years, 11 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
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 c24bcc907272f8a7ab2f6a414a91dede705ab1d7..dfc98ffc7110304c4f76339d257c433fd77f9900 100644
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -2603,7 +2603,6 @@ TEST(JumpWithConstantsAndWideConstants) {
TEST(BytecodeGraphBuilderDoExpressions) {
bool old_flag = FLAG_harmony_do_expressions;
FLAG_harmony_do_expressions = true;
-
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
Zone* zone = scope.main_zone();
@@ -2633,6 +2632,30 @@ TEST(BytecodeGraphBuilderDoExpressions) {
FLAG_harmony_do_expressions = old_flag;
}
+TEST(JumpOnHole) {
rmcilroy 2016/02/03 12:28:26 Could you replicate the test-interpreter tests her
mythria 2016/02/04 10:28:53 Done. Now I have a 1500 line cl :)
+ HandleAndZoneScope scope;
+ Isolate* isolate = scope.main_isolate();
+ Zone* zone = scope.main_zone();
+ Factory* factory = isolate->factory();
+ // TODO(mythria): Add tests to check JumpIfHole. Initializing 'this' via super
+ // calls uses JumpIfHole.
+ ExpectedSnippet<0> snippets[] = {
+ {"let x = 1; x = 2; return x;", {factory->NewNumberFromInt(2)}},
+ {"const x = 3; return x;", {factory->NewNumberFromInt(3)}},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ ScopedVector<char> script(1024);
+ SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
+ snippets[i].code_snippet, kFunctionName);
+
+ BytecodeGraphTester tester(isolate, zone, script.start());
+ auto callable = tester.GetCallable<>();
+ Handle<Object> return_value = callable().ToHandleChecked();
+ CHECK(return_value->SameValue(*snippets[i].return_value()));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698