From f8ed673308b1d504390bb4bce7643b0de455cd74 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 9 Nov 2018 12:25:22 +0800 Subject: [PATCH] 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 Reviewed-By: Daniel Bevenius Reviewed-By: Refael Ackermann --- lib/internal/bootstrap/node.js | 9 +-------- src/bootstrapper.cc | 7 ------- src/env.h | 7 ------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index a0cf67b9ead671..85bfc688b391c0 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -17,7 +17,7 @@ // avoid retaining a reference to the bootstrap // object. { _setupTraceCategoryState, - _setupProcessObject, _setupNextTick, + _setupNextTick, _setupPromises, _chdir, _cpuUsage, _hrtime, _hrtimeBigInt, _memoryUsage, _rawDebug, @@ -376,13 +376,6 @@ const origProcProto = Object.getPrototypeOf(process); Object.setPrototypeOf(origProcProto, EventEmitter.prototype); EventEmitter.call(process); - - _setupProcessObject(pushValueToArray); - - function pushValueToArray() { - for (var i = 0; i < arguments.length; i++) - this.push(arguments[i]); - } } function setupGlobalVariables() { diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index d6a8d3854ad6ff..c40b855b9939ca 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -26,12 +26,6 @@ using v8::PromiseRejectMessage; using v8::String; using v8::Value; -void SetupProcessObject(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - CHECK(args[0]->IsFunction()); - env->set_push_values_to_array_function(args[0].As()); -} - void RunMicrotasks(const FunctionCallbackInfo& args) { args.GetIsolate()->RunMicrotasks(); } @@ -142,7 +136,6 @@ void SetupPromises(const FunctionCallbackInfo& args) { void SetupBootstrapObject(Environment* env, Local bootstrapper) { BOOTSTRAP_METHOD(_setupTraceCategoryState, SetupTraceCategoryState); - BOOTSTRAP_METHOD(_setupProcessObject, SetupProcessObject); BOOTSTRAP_METHOD(_setupNextTick, SetupNextTick); BOOTSTRAP_METHOD(_setupPromises, SetupPromises); BOOTSTRAP_METHOD(_chdir, Chdir); diff --git a/src/env.h b/src/env.h index dec0b9d4c00994..791eda4fd9dc53 100644 --- a/src/env.h +++ b/src/env.h @@ -82,12 +82,6 @@ struct PackageConfig { }; } // 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. -#ifndef NODE_PUSH_VAL_TO_ARRAY_MAX -#define NODE_PUSH_VAL_TO_ARRAY_MAX 8 -#endif - // PER_ISOLATE_* macros: We have a lot of per-isolate properties // and adding and maintaining their getters and setters by hand would be // difficult so let's make the preprocessor generate them for us. @@ -350,7 +344,6 @@ struct PackageConfig { V(process_object, v8::Object) \ V(promise_handler_function, v8::Function) \ V(promise_wrap_template, v8::ObjectTemplate) \ - V(push_values_to_array_function, v8::Function) \ V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \ V(script_context_constructor_template, v8::FunctionTemplate) \ V(script_data_constructor_function, v8::Function) \