Index: test/cctest/test-code-stub-assembler.cc |
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc |
index 8657819c60eea82bc158313875fe75f21f014efc..4115021727aae61112c2fe8f1047f2e056686909 100644 |
--- a/test/cctest/test-code-stub-assembler.cc |
+++ b/test/cctest/test-code-stub-assembler.cc |
@@ -1927,5 +1927,40 @@ TEST(BuildAppendJSArrayFastDoubleElementsObject) { |
isolate->heap()->undefined_value(), Smi::FromInt(6), 6, 4); |
} |
+namespace { |
+ |
+template <typename Stub, typename... Args> |
+void Recompile(Args... args) { |
+ Stub stub(args...); |
+ stub.DeleteStubFromCacheForTesting(); |
+ stub.GetCode(); |
+} |
+ |
+} // namespace |
+ |
+TEST(CodeStubAssemblerGraphsCorrectness) { |
+ // The test does not work with interpreter because bytecode handlers taken |
+ // from the snapshot already refer to precompiled stubs from the snapshot |
+ // and there is no way to trigger bytecode handlers recompilation. |
+ if (FLAG_ignition || FLAG_turbo) return; |
+ |
+ v8::Isolate::CreateParams create_params; |
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
+ v8::Isolate* v8_isolate = v8::Isolate::New(create_params); |
+ Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); |
+ |
+ { |
+ v8::Isolate::Scope isolate_scope(v8_isolate); |
+ LocalContext env(v8_isolate); |
+ v8::HandleScope scope(v8_isolate); |
+ |
+ FLAG_csa_verify = true; |
+ |
+ // Recompile some stubs here. |
+ Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF)); |
+ } |
+ v8_isolate->Dispose(); |
+} |
+ |
} // namespace internal |
} // namespace v8 |