mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: add v8::Local specialization for MaybeStackBuffer
Long-term itch. Per v8 rules, we're not supposed to be heap allocating v8::Local's; instead we're supposed to be using v8::LocalVector. Create a specialization of MaybeStackBuffer that uses either a stack array of v8::Locals or v8::LocalVector with some additional utility improvements. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65159 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
1 parent
825fcfe4d5
commit
613be79cf4
15 files changed
+161
-49
No files matched your search
+3
-2
@@ -206,7 +206,7 @@ static MaybeLocal<Array> DirentListToArray(Environment* env,
|
||||
uv_dirent_t* ents,
|
||||
int num,
|
||||
enum encoding encoding) {
|
||||
MaybeStackBuffer<Local<Value>, 64> entries(num * 2);
|
||||
MaybeStackBuffer<Value, 64> entries(env->isolate(), num * 2);
|
||||
|
||||
// Return an array of all read filenames.
|
||||
int j = 0;
|
||||
@@ -222,7 +222,8 @@ static MaybeLocal<Array> DirentListToArray(Environment* env,
|
||||
entries[j++] = Integer::New(env->isolate(), ents[i].type);
|
||||
}
|
||||
|
||||
return Array::New(env->isolate(), entries.out(), j);
|
||||
CHECK_EQ(j, num * 2);
|
||||
return entries.ToArray();
|
||||
}
|
||||
|
||||
static void AfterDirRead(uv_fs_t* req) {
|
||||
|
||||
Reference in new issue
Block a user