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 9a01eda0e109a6241c9ae63ea0cd517238990dc8..d9955bb550bce74f1a709a0e8ce48524531edb8d 100644 |
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
@@ -2426,6 +2426,31 @@ TEST(JumpWithConstantsAndWideConstants) { |
} |
} |
+TEST(JumpOnHole) { |
+ 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 |