Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1c6f86

Browse filesBrowse files
Aditi-1400aduh95
authored andcommitted
src: update std::vector<v8::Local<T>> to use v8::LocalVector<T>
According to V8's public API documentation, local handles (i.e., objects of type v8::Local<T>) "should never be allocated on the heap". This replaces the usage of heap-allocated data structures containing instances of `v8::Local`, specifically the `std::vector<v8::Local<v8::String>>` with recently introduced `v8::LocalVector<T>`. This is first of the series of commits to replace all `std::vector<v8::Local<T>>` to use `v8::LocalVector<T>`. PR-URL: #57578 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b5cd0eb commit d1c6f86
Copy full SHA for d1c6f86

File tree

Expand file treeCollapse file tree

2 files changed

+6
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-5
lines changed

‎src/node_builtins.cc

Copy file name to clipboardExpand all lines: src/node_builtins.cc
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using v8::FunctionCallbackInfo;
1717
using v8::IntegrityLevel;
1818
using v8::Isolate;
1919
using v8::Local;
20+
using v8::LocalVector;
2021
using v8::MaybeLocal;
2122
using v8::Name;
2223
using v8::None;
@@ -268,7 +269,7 @@ void BuiltinLoader::AddExternalizedBuiltin(const char* id,
268269
MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
269270
Local<Context> context,
270271
const char* id,
271-
std::vector<Local<String>>* parameters,
272+
LocalVector<String>* parameters,
272273
Realm* optional_realm) {
273274
Isolate* isolate = context->GetIsolate();
274275
EscapableHandleScope scope(isolate);
@@ -392,8 +393,8 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) {
392393
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context,
393394
const char* id,
394395
Realm* optional_realm) {
395-
std::vector<Local<String>> parameters;
396396
Isolate* isolate = context->GetIsolate();
397+
LocalVector<String> parameters(isolate);
397398
// Detects parameters of the scripts based on module ids.
398399
// internal/bootstrap/realm: process, getLinkedBinding,
399400
// getInternalBinding, primordials
@@ -507,7 +508,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
507508
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
508509
Local<Context> context,
509510
const char* id,
510-
std::vector<Local<String>>* parameters,
511+
LocalVector<String>* parameters,
511512
Realm* optional_realm) {
512513
return LookupAndCompileInternal(context, id, parameters, optional_realm);
513514
}

‎src/node_builtins.h

Copy file name to clipboardExpand all lines: src/node_builtins.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
100100
v8::MaybeLocal<v8::Function> LookupAndCompile(
101101
v8::Local<v8::Context> context,
102102
const char* id,
103-
std::vector<v8::Local<v8::String>>* parameters,
103+
v8::LocalVector<v8::String>* parameters,
104104
Realm* optional_realm);
105105

106106
v8::MaybeLocal<v8::Value> CompileAndCall(v8::Local<v8::Context> context,
@@ -156,7 +156,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
156156
v8::MaybeLocal<v8::Function> LookupAndCompileInternal(
157157
v8::Local<v8::Context> context,
158158
const char* id,
159-
std::vector<v8::Local<v8::String>>* parameters,
159+
v8::LocalVector<v8::String>* parameters,
160160
Realm* optional_realm);
161161
void SaveCodeCache(const char* id, v8::Local<v8::Function> fn);
162162

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.