Skip to content

Commit e8bddac

Browse files
authored
src: apply ABI-breaking API simplifications
c566a04, 06bb6b4 and 3aaeb30 included recent modifications of the C++ API that had mechanisms for ABI compatibility in place so that they would not be breaking changes. This commit removes these compatibility mechanisms. PR-URL: #46705 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 43c380e commit e8bddac

File tree

3 files changed

+11
-49
lines changed

3 files changed

+11
-49
lines changed

src/api/environment.cc

+1-21
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
269269

270270
auto* modify_code_generation_from_strings_callback =
271271
ModifyCodeGenerationFromStrings;
272-
if (s.flags & ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK &&
273-
s.modify_code_generation_from_strings_callback) {
272+
if (s.modify_code_generation_from_strings_callback != nullptr) {
274273
modify_code_generation_from_strings_callback =
275274
s.modify_code_generation_from_strings_callback;
276275
}
@@ -382,18 +381,6 @@ Isolate* NewIsolate(std::shared_ptr<ArrayBufferAllocator> allocator,
382381
settings);
383382
}
384383

385-
Isolate* NewIsolate(ArrayBufferAllocator* allocator,
386-
uv_loop_t* event_loop,
387-
MultiIsolatePlatform* platform) {
388-
return NewIsolate(allocator, event_loop, platform, nullptr);
389-
}
390-
391-
Isolate* NewIsolate(std::shared_ptr<ArrayBufferAllocator> allocator,
392-
uv_loop_t* event_loop,
393-
MultiIsolatePlatform* platform) {
394-
return NewIsolate(allocator, event_loop, platform, nullptr);
395-
}
396-
397384
IsolateData* CreateIsolateData(
398385
Isolate* isolate,
399386
uv_loop_t* loop,
@@ -405,13 +392,6 @@ IsolateData* CreateIsolateData(
405392
return new IsolateData(isolate, loop, platform, allocator, snapshot_data);
406393
}
407394

408-
IsolateData* CreateIsolateData(Isolate* isolate,
409-
uv_loop_t* loop,
410-
MultiIsolatePlatform* platform,
411-
ArrayBufferAllocator* allocator) {
412-
return CreateIsolateData(isolate, loop, platform, allocator, nullptr);
413-
}
414-
415395
void FreeIsolateData(IsolateData* isolate_data) {
416396
delete isolate_data;
417397
}

src/node.cc

-4
Original file line numberDiff line numberDiff line change
@@ -1270,10 +1270,6 @@ int Start(int argc, char** argv) {
12701270
return static_cast<int>(StartInternal(argc, argv));
12711271
}
12721272

1273-
int Stop(Environment* env) {
1274-
return Stop(env, StopFlags::kNoFlags);
1275-
}
1276-
12771273
int Stop(Environment* env, StopFlags::Flags flags) {
12781274
env->ExitEnv(flags);
12791275
return 0;

src/node.h

+10-24
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ NODE_EXTERN int Start(int argc, char* argv[]);
317317

318318
// Tear down Node.js while it is running (there are active handles
319319
// in the loop and / or actively executing JavaScript code).
320-
NODE_EXTERN int Stop(Environment* env);
321-
NODE_EXTERN int Stop(Environment* env, StopFlags::Flags flags);
320+
NODE_EXTERN int Stop(Environment* env,
321+
StopFlags::Flags flags = StopFlags::kNoFlags);
322322

323323
// Set up per-process state needed to run Node.js. This will consume arguments
324324
// from argv, fill exec_argv, and possibly add errors resulting from parsing
@@ -463,7 +463,7 @@ enum IsolateSettingsFlags {
463463
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
464464
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
465465
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3,
466-
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 1 << 4,
466+
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 0, /* legacy no-op */
467467
};
468468

469469
struct IsolateSettings {
@@ -565,25 +565,17 @@ NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate);
565565
// This is a convenience method equivalent to using SetIsolateCreateParams(),
566566
// Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(),
567567
// Isolate::Initialize(), and SetIsolateUpForNode().
568-
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
569-
struct uv_loop_s* event_loop,
570-
MultiIsolatePlatform* platform = nullptr);
571-
// TODO(addaleax): Merge with the function definition above.
572-
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
573-
struct uv_loop_s* event_loop,
574-
MultiIsolatePlatform* platform,
575-
const EmbedderSnapshotData* snapshot_data,
576-
const IsolateSettings& settings = {});
577568
NODE_EXTERN v8::Isolate* NewIsolate(
578-
std::shared_ptr<ArrayBufferAllocator> allocator,
569+
ArrayBufferAllocator* allocator,
579570
struct uv_loop_s* event_loop,
580-
MultiIsolatePlatform* platform);
581-
// TODO(addaleax): Merge with the function definition above.
571+
MultiIsolatePlatform* platform,
572+
const EmbedderSnapshotData* snapshot_data = nullptr,
573+
const IsolateSettings& settings = {});
582574
NODE_EXTERN v8::Isolate* NewIsolate(
583575
std::shared_ptr<ArrayBufferAllocator> allocator,
584576
struct uv_loop_s* event_loop,
585577
MultiIsolatePlatform* platform,
586-
const EmbedderSnapshotData* snapshot_data,
578+
const EmbedderSnapshotData* snapshot_data = nullptr,
587579
const IsolateSettings& settings = {});
588580

589581
// Creates a new context with Node.js-specific tweaks.
@@ -603,14 +595,8 @@ NODE_EXTERN IsolateData* CreateIsolateData(
603595
v8::Isolate* isolate,
604596
struct uv_loop_s* loop,
605597
MultiIsolatePlatform* platform = nullptr,
606-
ArrayBufferAllocator* allocator = nullptr);
607-
// TODO(addaleax): Merge with the function definition above.
608-
NODE_EXTERN IsolateData* CreateIsolateData(
609-
v8::Isolate* isolate,
610-
struct uv_loop_s* loop,
611-
MultiIsolatePlatform* platform,
612-
ArrayBufferAllocator* allocator,
613-
const EmbedderSnapshotData* snapshot_data);
598+
ArrayBufferAllocator* allocator = nullptr,
599+
const EmbedderSnapshotData* snapshot_data = nullptr);
614600
NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data);
615601

616602
struct ThreadId {

0 commit comments

Comments
 (0)