Skip to content

Commit 15527d3

Browse files
joyeecheungkiyomizumia
authored andcommittedNov 15, 2018
src: remove pushValueToArray and SetupProcessObject
The usage of NODE_PUSH_VAL_TO_ARRAY_MAX and push_values_to_array_function has all been removed in favor of the new Array::New API that takes a C++ array. Remove the unused code. PR-URL: nodejs#24264 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 11604c7 commit 15527d3

File tree

3 files changed

+1
-20
lines changed

3 files changed

+1
-20
lines changed
 

‎lib/internal/bootstrap/node.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// avoid retaining a reference to the bootstrap
1818
// object.
1919
{ _setupTraceCategoryState,
20-
_setupProcessObject, _setupNextTick,
20+
_setupNextTick,
2121
_setupPromises, _chdir, _cpuUsage,
2222
_hrtime, _hrtimeBigInt,
2323
_memoryUsage, _rawDebug,
@@ -376,13 +376,6 @@
376376
const origProcProto = Object.getPrototypeOf(process);
377377
Object.setPrototypeOf(origProcProto, EventEmitter.prototype);
378378
EventEmitter.call(process);
379-
380-
_setupProcessObject(pushValueToArray);
381-
382-
function pushValueToArray() {
383-
for (var i = 0; i < arguments.length; i++)
384-
this.push(arguments[i]);
385-
}
386379
}
387380

388381
function setupGlobalVariables() {

‎src/bootstrapper.cc

-7
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ using v8::PromiseRejectMessage;
2626
using v8::String;
2727
using v8::Value;
2828

29-
void SetupProcessObject(const FunctionCallbackInfo<Value>& args) {
30-
Environment* env = Environment::GetCurrent(args);
31-
CHECK(args[0]->IsFunction());
32-
env->set_push_values_to_array_function(args[0].As<Function>());
33-
}
34-
3529
void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
3630
args.GetIsolate()->RunMicrotasks();
3731
}
@@ -142,7 +136,6 @@ void SetupPromises(const FunctionCallbackInfo<Value>& args) {
142136
void SetupBootstrapObject(Environment* env,
143137
Local<Object> bootstrapper) {
144138
BOOTSTRAP_METHOD(_setupTraceCategoryState, SetupTraceCategoryState);
145-
BOOTSTRAP_METHOD(_setupProcessObject, SetupProcessObject);
146139
BOOTSTRAP_METHOD(_setupNextTick, SetupNextTick);
147140
BOOTSTRAP_METHOD(_setupPromises, SetupPromises);
148141
BOOTSTRAP_METHOD(_chdir, Chdir);

‎src/env.h

-5
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ struct PackageConfig {
8282
};
8383
} // namespace loader
8484

85-
// The number of items passed to push_values_to_array_function has diminishing
86-
// returns around 8. This should be used at all call sites using said function.
87-
constexpr size_t NODE_PUSH_VAL_TO_ARRAY_MAX = 8;
88-
8985
// Stat fields buffers contain twice the number of entries in an uv_stat_t
9086
// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
9187
constexpr size_t kFsStatsFieldsNumber = 14;
@@ -353,7 +349,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
353349
V(process_object, v8::Object) \
354350
V(promise_handler_function, v8::Function) \
355351
V(promise_wrap_template, v8::ObjectTemplate) \
356-
V(push_values_to_array_function, v8::Function) \
357352
V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \
358353
V(script_context_constructor_template, v8::FunctionTemplate) \
359354
V(script_data_constructor_function, v8::Function) \

0 commit comments

Comments
 (0)
Please sign in to comment.