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: https://github.com/nodejs/node/pull/24264
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
Joyee Cheung 2018-11-09 12:25:22 +08:00
parent 51cea618e2
commit 5877836a33
No known key found for this signature in database
GPG Key ID: 92B78A53C8303B8D
3 changed files with 1 additions and 20 deletions

View File

@ -17,7 +17,7 @@
// avoid retaining a reference to the bootstrap // avoid retaining a reference to the bootstrap
// object. // object.
{ _setupTraceCategoryState, { _setupTraceCategoryState,
_setupProcessObject, _setupNextTick, _setupNextTick,
_setupPromises, _chdir, _cpuUsage, _setupPromises, _chdir, _cpuUsage,
_hrtime, _hrtimeBigInt, _hrtime, _hrtimeBigInt,
_memoryUsage, _rawDebug, _memoryUsage, _rawDebug,
@ -376,13 +376,6 @@
const origProcProto = Object.getPrototypeOf(process); const origProcProto = Object.getPrototypeOf(process);
Object.setPrototypeOf(origProcProto, EventEmitter.prototype); Object.setPrototypeOf(origProcProto, EventEmitter.prototype);
EventEmitter.call(process); EventEmitter.call(process);
_setupProcessObject(pushValueToArray);
function pushValueToArray() {
for (var i = 0; i < arguments.length; i++)
this.push(arguments[i]);
}
} }
function setupGlobalVariables() { function setupGlobalVariables() {

View File

@ -26,12 +26,6 @@ using v8::PromiseRejectMessage;
using v8::String; using v8::String;
using v8::Value; using v8::Value;
void SetupProcessObject(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK(args[0]->IsFunction());
env->set_push_values_to_array_function(args[0].As<Function>());
}
void RunMicrotasks(const FunctionCallbackInfo<Value>& args) { void RunMicrotasks(const FunctionCallbackInfo<Value>& args) {
args.GetIsolate()->RunMicrotasks(); args.GetIsolate()->RunMicrotasks();
} }
@ -142,7 +136,6 @@ void SetupPromises(const FunctionCallbackInfo<Value>& args) {
void SetupBootstrapObject(Environment* env, void SetupBootstrapObject(Environment* env,
Local<Object> bootstrapper) { Local<Object> bootstrapper) {
BOOTSTRAP_METHOD(_setupTraceCategoryState, SetupTraceCategoryState); BOOTSTRAP_METHOD(_setupTraceCategoryState, SetupTraceCategoryState);
BOOTSTRAP_METHOD(_setupProcessObject, SetupProcessObject);
BOOTSTRAP_METHOD(_setupNextTick, SetupNextTick); BOOTSTRAP_METHOD(_setupNextTick, SetupNextTick);
BOOTSTRAP_METHOD(_setupPromises, SetupPromises); BOOTSTRAP_METHOD(_setupPromises, SetupPromises);
BOOTSTRAP_METHOD(_chdir, Chdir); BOOTSTRAP_METHOD(_chdir, Chdir);

View File

@ -82,10 +82,6 @@ struct PackageConfig {
}; };
} // namespace loader } // namespace loader
// The number of items passed to push_values_to_array_function has diminishing
// returns around 8. This should be used at all call sites using said function.
constexpr size_t NODE_PUSH_VAL_TO_ARRAY_MAX = 8;
// Stat fields buffers contain twice the number of entries in an uv_stat_t // Stat fields buffers contain twice the number of entries in an uv_stat_t
// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances. // because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
constexpr size_t kFsStatsFieldsNumber = 14; constexpr size_t kFsStatsFieldsNumber = 14;
@ -353,7 +349,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
V(process_object, v8::Object) \ V(process_object, v8::Object) \
V(promise_handler_function, v8::Function) \ V(promise_handler_function, v8::Function) \
V(promise_wrap_template, v8::ObjectTemplate) \ V(promise_wrap_template, v8::ObjectTemplate) \
V(push_values_to_array_function, v8::Function) \
V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \ V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \
V(script_context_constructor_template, v8::FunctionTemplate) \ V(script_context_constructor_template, v8::FunctionTemplate) \
V(script_data_constructor_function, v8::Function) \ V(script_data_constructor_function, v8::Function) \