Skip to content

Commit

Permalink
src: apply ABI-breaking API simplifications
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored Feb 20, 2023
1 parent 43c380e commit e8bddac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 49 deletions.
22 changes: 1 addition & 21 deletions src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {

auto* modify_code_generation_from_strings_callback =
ModifyCodeGenerationFromStrings;
if (s.flags & ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK &&
s.modify_code_generation_from_strings_callback) {
if (s.modify_code_generation_from_strings_callback != nullptr) {
modify_code_generation_from_strings_callback =
s.modify_code_generation_from_strings_callback;
}
Expand Down Expand Up @@ -382,18 +381,6 @@ Isolate* NewIsolate(std::shared_ptr<ArrayBufferAllocator> allocator,
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(
Isolate* isolate,
uv_loop_t* loop,
Expand All @@ -405,13 +392,6 @@ IsolateData* CreateIsolateData(
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) {
delete isolate_data;
}
Expand Down
4 changes: 0 additions & 4 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1270,10 +1270,6 @@ int Start(int argc, char** argv) {
return static_cast<int>(StartInternal(argc, argv));
}

int Stop(Environment* env) {
return Stop(env, StopFlags::kNoFlags);
}

int Stop(Environment* env, StopFlags::Flags flags) {
env->ExitEnv(flags);
return 0;
Expand Down
34 changes: 10 additions & 24 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ NODE_EXTERN int Start(int argc, char* argv[]);

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

// 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
Expand Down Expand Up @@ -463,7 +463,7 @@ enum IsolateSettingsFlags {
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
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 {
Expand Down Expand Up @@ -565,25 +565,17 @@ NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate);
// This is a convenience method equivalent to using SetIsolateCreateParams(),
// Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(),
// Isolate::Initialize(), and SetIsolateUpForNode().
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform = nullptr);
// TODO(addaleax): Merge with the function definition above.
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform,
const EmbedderSnapshotData* snapshot_data,
const IsolateSettings& settings = {});
NODE_EXTERN v8::Isolate* NewIsolate(
std::shared_ptr<ArrayBufferAllocator> allocator,
ArrayBufferAllocator* allocator,
struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform);
// TODO(addaleax): Merge with the function definition above.
MultiIsolatePlatform* platform,
const EmbedderSnapshotData* snapshot_data = nullptr,
const IsolateSettings& settings = {});
NODE_EXTERN v8::Isolate* NewIsolate(
std::shared_ptr<ArrayBufferAllocator> allocator,
struct uv_loop_s* event_loop,
MultiIsolatePlatform* platform,
const EmbedderSnapshotData* snapshot_data,
const EmbedderSnapshotData* snapshot_data = nullptr,
const IsolateSettings& settings = {});

// Creates a new context with Node.js-specific tweaks.
Expand All @@ -603,14 +595,8 @@ NODE_EXTERN IsolateData* CreateIsolateData(
v8::Isolate* isolate,
struct uv_loop_s* loop,
MultiIsolatePlatform* platform = nullptr,
ArrayBufferAllocator* allocator = nullptr);
// TODO(addaleax): Merge with the function definition above.
NODE_EXTERN IsolateData* CreateIsolateData(
v8::Isolate* isolate,
struct uv_loop_s* loop,
MultiIsolatePlatform* platform,
ArrayBufferAllocator* allocator,
const EmbedderSnapshotData* snapshot_data);
ArrayBufferAllocator* allocator = nullptr,
const EmbedderSnapshotData* snapshot_data = nullptr);
NODE_EXTERN void FreeIsolateData(IsolateData* isolate_data);

struct ThreadId {
Expand Down

0 comments on commit e8bddac

Please sign in to comment.