Don't allocate new "require" and "resolve" strings in CJS modules (#7162)

* Don't allocate new `"require"` and `"resolve"` strings in every CommonJS module

* Use builtinNames more

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2023-11-17 00:10:27 +01:00
committed by GitHub
parent d1ec8f86f3
commit d9a0fd4f59
7 changed files with 95 additions and 12 deletions

View File

@@ -2,10 +2,10 @@
#include "CommonJSModuleRecord.h"
#include "ImportMetaObject.h"
#include <JavaScriptCore/JSBoundFunction.h>
#include <JavaScriptCore/ObjectConstructor.h>
#include "_NativeModule.h"
#include "isBuiltinModule.h"
#include <JavaScriptCore/JSBoundFunction.h>
#include <JavaScriptCore/ObjectConstructor.h>
using namespace Zig;
using namespace JSC;
@@ -189,7 +189,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNodeModuleCreateRequire,
vm, globalObject, val)));
}
extern "C" JSC::EncodedJSValue Resolver__nodeModulePathsForJS(JSGlobalObject *,
CallFrame *);
CallFrame *);
JSC_DEFINE_HOST_FUNCTION(jsFunctionFindSourceMap,
(JSGlobalObject * globalObject,