GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: backport f3cad8cec656 · nodejs/node@361a643

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • deps/v8
    • src/api
      • api.cc
    • test/cctest
      • test-serialize.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/v8/src/api/api.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/api/api.cc
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ SnapshotCreator::SnapshotCreator(const intptr_t* external_references,
483483

484484
SnapshotCreator::~SnapshotCreator() {
485485
SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
486-
DCHECK(data->created_);
487486
Isolate* isolate = data->isolate_;
488487
isolate->Exit();
489488
isolate->Dispose();
@@ -590,8 +589,12 @@ StartupData SnapshotCreator::CreateBlob(
590589
SnapshotCreator::FunctionCodeHandling function_code_handling) {
591590
SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
592591
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(data->isolate_);
593-
DCHECK(!data->created_);
594-
DCHECK(!data->default_context_.IsEmpty());
592+
Utils::ApiCheck(!data->created_, "v8::SnapshotCreator::CreateBlob",
593+
"CreateBlob() cannot be called more than once on the same "
594+
"SnapshotCreator.");
595+
Utils::ApiCheck(
596+
!data->default_context_.IsEmpty(), "v8::SnapshotCreator::CreateBlob",
597+
"CreateBlob() cannot be called before the default context is set.");
595598

596599
const int num_additional_contexts = static_cast<int>(data->contexts_.Size());
597600
const int num_contexts = num_additional_contexts + 1; // The default context.
Collapse file

‎deps/v8/test/cctest/test-serialize.cc‎

Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-serialize.cc
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,6 +2840,31 @@ TEST(Regress503552) {
28402840
delete cache_data;
28412841
}
28422842

2843+
UNINITIALIZED_TEST(SnapshotCreatorBlobNotCreated) {
2844+
DisableAlwaysOpt();
2845+
DisableEmbeddedBlobRefcounting();
2846+
{
2847+
v8::SnapshotCreator creator;
2848+
v8::Isolate* isolate = creator.GetIsolate();
2849+
{
2850+
v8::HandleScope handle_scope(isolate);
2851+
v8::Local<v8::Context> context = v8::Context::New(isolate);
2852+
v8::Context::Scope context_scope(context);
2853+
v8::TryCatch try_catch(isolate);
2854+
v8::Local<v8::String> code = v8_str("throw new Error('test');");
2855+
CHECK(v8::Script::Compile(context, code)
2856+
.ToLocalChecked()
2857+
->Run(context)
2858+
.IsEmpty());
2859+
CHECK(try_catch.HasCaught());
2860+
}
2861+
// SnapshotCreator should be destroyed just fine even when no
2862+
// blob is created.
2863+
}
2864+
2865+
FreeCurrentEmbeddedBlob();
2866+
}
2867+
28432868
UNINITIALIZED_TEST(SnapshotCreatorMultipleContexts) {
28442869
DisableAlwaysOpt();
28452870
DisableEmbeddedBlobRefcounting();

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.