src: apply ABI-breaking API simplifications

c566a04c86, 06bb6b42b3 and 3aaeb309b3 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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Anna Henningsen 2023-02-20 11:34:49 +01:00 committed by GitHub
parent 43c380e9b6
commit e8bddac3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 49 deletions

View File

@ -269,8 +269,7 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
auto* modify_code_generation_from_strings_callback = auto* modify_code_generation_from_strings_callback =
ModifyCodeGenerationFromStrings; ModifyCodeGenerationFromStrings;
if (s.flags & ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK && if (s.modify_code_generation_from_strings_callback != nullptr) {
s.modify_code_generation_from_strings_callback) {
modify_code_generation_from_strings_callback = modify_code_generation_from_strings_callback =
s.modify_code_generation_from_strings_callback; s.modify_code_generation_from_strings_callback;
} }
@ -382,18 +381,6 @@ Isolate* NewIsolate(std::shared_ptr<ArrayBufferAllocator> allocator,
settings); settings);
} }
Isolate* NewIsolate(ArrayBufferAllocator* allocator,
uv_loop_t* event_loop,
MultiIsolatePlatform* platform) {
return NewIsolate(allocator, event_loop, platform, nullptr);
}
Isolate* NewIsolate(std::shared_ptr<ArrayBufferAllocator> allocator,
uv_loop_t* event_loop,
MultiIsolatePlatform* platform) {
return NewIsolate(allocator, event_loop, platform, nullptr);
}
IsolateData* CreateIsolateData( IsolateData* CreateIsolateData(
Isolate* isolate, Isolate* isolate,
uv_loop_t* loop, uv_loop_t* loop,
@ -405,13 +392,6 @@ IsolateData* CreateIsolateData(
return new IsolateData(isolate, loop, platform, allocator, snapshot_data); return new IsolateData(isolate, loop, platform, allocator, snapshot_data);
} }
IsolateData* CreateIsolateData(Isolate* isolate,
uv_loop_t* loop,
MultiIsolatePlatform* platform,
ArrayBufferAllocator* allocator) {
return CreateIsolateData(isolate, loop, platform, allocator, nullptr);
}
void FreeIsolateData(IsolateData* isolate_data) { void FreeIsolateData(IsolateData* isolate_data) {
delete isolate_data; delete isolate_data;
} }

View File

@ -1270,10 +1270,6 @@ int Start(int argc, char** argv) {
return static_cast<int>(StartInternal(argc, argv)); return static_cast<int>(StartInternal(argc, argv));
} }
int Stop(Environment* env) {
return Stop(env, StopFlags::kNoFlags);
}
int Stop(Environment* env, StopFlags::Flags flags) { int Stop(Environment* env, StopFlags::Flags flags) {
env->ExitEnv(flags); env->ExitEnv(flags);
return 0; return 0;

View File

@ -317,8 +317,8 @@ NODE_EXTERN int Start(int argc, char* argv[]);
// Tear down Node.js while it is running (there are active handles // Tear down Node.js while it is running (there are active handles
// in the loop and / or actively executing JavaScript code). // in the loop and / or actively executing JavaScript code).
NODE_EXTERN int Stop(Environment* env); NODE_EXTERN int Stop(Environment* env,
NODE_EXTERN int Stop(Environment* env, StopFlags::Flags flags); StopFlags::Flags flags = StopFlags::kNoFlags);
// Set up per-process state needed to run Node.js. This will consume arguments // Set up per-process state needed to run Node.js. This will consume arguments
// from argv, fill exec_argv, and possibly add errors resulting from parsing // from argv, fill exec_argv, and possibly add errors resulting from parsing
@ -463,7 +463,7 @@ enum IsolateSettingsFlags {
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1, DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2, SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3, SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3,
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 1 << 4, ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 0, /* legacy no-op */
}; };
struct IsolateSettings { struct IsolateSettings {
@ -565,25 +565,17 @@ NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate);
// This is a convenience method equivalent to using SetIsolateCreateParams(), // This is a convenience method equivalent to using SetIsolateCreateParams(),
// Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(), // Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(),
// Isolate::Initialize(), and SetIsolateUpForNode(). // Isolate::Initialize(), and SetIsolateUpForNode().
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator, NODE_EXTERN v8::Isolate* NewIsolate(
struct uv_loop_s* event_loop, ArrayBufferAllocator* allocator,
MultiIsolatePlatform* platform = nullptr);
// TODO(addaleax): Merge with the function definition above.
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
struct uv_loop_s* event_loop, struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform, MultiIsolatePlatform* platform,
const EmbedderSnapshotData* snapshot_data, const EmbedderSnapshotData* snapshot_data = nullptr,
const IsolateSettings& settings = {}); const IsolateSettings& settings = {});
NODE_EXTERN v8::Isolate* NewIsolate(
std::shared_ptr<ArrayBufferAllocator> allocator,
struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform);
// TODO(addaleax): Merge with the function definition above.
NODE_EXTERN v8::Isolate* NewIsolate( NODE_EXTERN v8::Isolate* NewIsolate(
std::shared_ptr<ArrayBufferAllocator> allocator, std::shared_ptr<ArrayBufferAllocator> allocator,
struct uv_loop_s* event_loop, struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform, MultiIsolatePlatform* platform,
const EmbedderSnapshotData* snapshot_data, const EmbedderSnapshotData* snapshot_data = nullptr,
const IsolateSettings& settings = {}); const IsolateSettings& settings = {});
// Creates a new context with Node.js-specific tweaks. // Creates a new context with Node.js-specific tweaks.
@ -603,14 +595,8 @@ NODE_EXTERN IsolateData* CreateIsolateData(
v8::Isolate* isolate, v8::Isolate* isolate,
struct uv_loop_s* loop, struct uv_loop_s* loop,
MultiIsolatePlatform* platform = nullptr, MultiIsolatePlatform* platform = nullptr,
ArrayBufferAllocator* allocator = nullptr); ArrayBufferAllocator* allocator = nullptr,
// TODO(addaleax): Merge with the function definition above. const EmbedderSnapshotData* snapshot_data = nullptr);
NODE_EXTERN IsolateData* CreateIsolateData(
v8::Isolate* isolate,
struct uv_loop_s* loop,
MultiIsolatePlatform* platform,
ArrayBufferAllocator* allocator,
const EmbedderSnapshotData* snapshot_data);
NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data); NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data);
struct ThreadId { struct ThreadId {