Bug 1553001 - Move module APIs out of jsapi.{cpp,h} into js/public/Modules.h and js/src/vm/Modules.cpp for better isolation of module-related APIs. r=arai

Differential Revision: https://phabricator.services.mozilla.com/D31917

--HG--
rename : js/src/jsapi.h => js/public/Modules.h
rename : js/src/jsapi.cpp => js/src/vm/Modules.cpp
extra : moz-landing-system : lando
This commit is contained in:
Jeff Walden 2019-05-21 00:57:38 +00:00
parent c4361da40f
commit 1e8a4f44fd
12 changed files with 331 additions and 246 deletions

View File

@ -15,6 +15,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/CompilationAndEvaluation.h"
#include "js/Modules.h" // JS::CompileModule, JS::GetModuleScript, JS::Module{Instantiate,Evaluate}
#include "js/OffThreadScriptCompilation.h"
#include "js/SourceText.h"
#include "nsIScriptContext.h"

View File

@ -9,6 +9,7 @@
#include "mozilla/HoldDropJSObjects.h"
#include "jsfriendapi.h"
#include "js/Modules.h" // JS::{Get,Set}ModulePrivate
#include "ScriptLoader.h"
namespace mozilla {

View File

@ -16,6 +16,7 @@
#include "jsfriendapi.h"
#include "js/CompilationAndEvaluation.h"
#include "js/MemoryFunctions.h"
#include "js/Modules.h" // JS::CompileModule, JS::FinishDynamicModuleImport, JS::{G,S}etModuleResolveHook, JS::Get{ModulePrivate,ModuleScript,RequestedModule{s,Specifier,SourcePos}}, JS::SetModule{DynamicImport,Metadata}Hook
#include "js/OffThreadScriptCompilation.h"
#include "js/Realm.h"
#include "js/SourceText.h"

162
js/public/Modules.h Normal file
View File

@ -0,0 +1,162 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* JavaScript module (as in, the syntactic construct) operations. */
#ifndef js_Modules_h
#define js_Modules_h
#include <stdint.h> // uint32_t
#include "jstypes.h" // JS_PUBLIC_API
#include "js/CompileOptions.h" // JS::ReadOnlyCompileOptions
#include "js/RootingAPI.h" // JS::{Mutable,}Handle
#include "js/Value.h" // JS::Value
struct JSContext;
class JSObject;
struct JSRuntime;
class JSString;
namespace JS {
template <typename UnitT>
class SourceText;
} // namespace JS
namespace JS {
using ModuleResolveHook = JSObject* (*)(JSContext*, Handle<Value>,
Handle<JSString*>);
/**
* Get the HostResolveImportedModule hook for the runtime.
*/
extern JS_PUBLIC_API ModuleResolveHook GetModuleResolveHook(JSRuntime* rt);
/**
* Set the HostResolveImportedModule hook for the runtime to the given function.
*/
extern JS_PUBLIC_API void SetModuleResolveHook(JSRuntime* rt,
ModuleResolveHook func);
using ModuleMetadataHook = bool (*)(JSContext*, Handle<Value>,
Handle<JSObject*>);
/**
* Get the hook for populating the import.meta metadata object.
*/
extern JS_PUBLIC_API ModuleMetadataHook GetModuleMetadataHook(JSRuntime* rt);
/**
* Set the hook for populating the import.meta metadata object to the given
* function.
*/
extern JS_PUBLIC_API void SetModuleMetadataHook(JSRuntime* rt,
ModuleMetadataHook func);
using ModuleDynamicImportHook = bool (*)(JSContext* cx,
Handle<Value> referencingPrivate,
Handle<JSString*> specifier,
Handle<JSObject*> promise);
/**
* Get the HostImportModuleDynamically hook for the runtime.
*/
extern JS_PUBLIC_API ModuleDynamicImportHook
GetModuleDynamicImportHook(JSRuntime* rt);
/**
* Set the HostImportModuleDynamically hook for the runtime to the given
* function.
*
* If this hook is not set (or set to nullptr) then the JS engine will throw an
* exception if dynamic module import is attempted.
*/
extern JS_PUBLIC_API void SetModuleDynamicImportHook(
JSRuntime* rt, ModuleDynamicImportHook func);
extern JS_PUBLIC_API bool FinishDynamicModuleImport(
JSContext* cx, Handle<Value> referencingPrivate,
Handle<JSString*> specifier, Handle<JSObject*> promise);
/**
* Parse the given source buffer as a module in the scope of the current global
* of cx and return a source text module record.
*/
extern JS_PUBLIC_API bool CompileModule(JSContext* cx,
const ReadOnlyCompileOptions& options,
SourceText<char16_t>& srcBuf,
MutableHandle<JSObject*> moduleRecord);
/**
* Set a private value associated with a source text module record.
*/
extern JS_PUBLIC_API void SetModulePrivate(JSObject* module,
const Value& value);
/**
* Get the private value associated with a source text module record.
*/
extern JS_PUBLIC_API Value GetModulePrivate(JSObject* module);
/*
* Perform the ModuleInstantiate operation on the given source text module
* record.
*
* This transitively resolves all module dependencies (calling the
* HostResolveImportedModule hook) and initializes the environment record for
* the module.
*/
extern JS_PUBLIC_API bool ModuleInstantiate(JSContext* cx,
Handle<JSObject*> moduleRecord);
/*
* Perform the ModuleEvaluate operation on the given source text module record.
*
* This does nothing if this module has already been evaluated. Otherwise, it
* transitively evaluates all dependences of this module and then evaluates this
* module.
*
* ModuleInstantiate must have completed prior to calling this.
*/
extern JS_PUBLIC_API bool ModuleEvaluate(JSContext* cx,
Handle<JSObject*> moduleRecord);
/*
* Get a list of the module specifiers used by a source text module
* record to request importation of modules.
*
* The result is a JavaScript array of object values. To extract the individual
* values use only JS_GetArrayLength and JS_GetElement with indices 0 to length
* - 1.
*
* The element values are objects with the following properties:
* - moduleSpecifier: the module specifier string
* - lineNumber: the line number of the import in the source text
* - columnNumber: the column number of the import in the source text
*
* These property values can be extracted with GetRequestedModuleSpecifier() and
* GetRequestedModuleSourcePos()
*/
extern JS_PUBLIC_API JSObject* GetRequestedModules(
JSContext* cx, Handle<JSObject*> moduleRecord);
extern JS_PUBLIC_API JSString* GetRequestedModuleSpecifier(
JSContext* cx, Handle<Value> requestedModuleObject);
extern JS_PUBLIC_API void GetRequestedModuleSourcePos(
JSContext* cx, Handle<Value> requestedModuleObject, uint32_t* lineNumber,
uint32_t* columnNumber);
/*
* Get the top-level script for a module which has not yet been executed.
*/
extern JS_PUBLIC_API JSScript* GetModuleScript(Handle<JSObject*> moduleRecord);
} // namespace JS
#endif // js_Modules_h

View File

@ -16,6 +16,7 @@
#include "gc/FreeOp.h"
#include "gc/Policy.h"
#include "gc/Tracer.h"
#include "js/Modules.h" // JS::GetModulePrivate, JS::ModuleDynamicImportHook
#include "js/PropertySpec.h"
#include "vm/AsyncFunction.h"
#include "vm/AsyncIteration.h"

View File

@ -3689,74 +3689,6 @@ JS_PUBLIC_API JSString* JS_DecompileFunction(JSContext* cx,
return FunctionToString(cx, fun, /* isToSource = */ false);
}
JS_PUBLIC_API JS::ModuleResolveHook JS::GetModuleResolveHook(JSRuntime* rt) {
AssertHeapIsIdle();
return rt->moduleResolveHook;
}
JS_PUBLIC_API void JS::SetModuleResolveHook(JSRuntime* rt,
JS::ModuleResolveHook func) {
AssertHeapIsIdle();
rt->moduleResolveHook = func;
}
JS_PUBLIC_API JS::ModuleMetadataHook JS::GetModuleMetadataHook(JSRuntime* rt) {
AssertHeapIsIdle();
return rt->moduleMetadataHook;
}
JS_PUBLIC_API void JS::SetModuleMetadataHook(JSRuntime* rt,
JS::ModuleMetadataHook func) {
AssertHeapIsIdle();
rt->moduleMetadataHook = func;
}
JS_PUBLIC_API JS::ModuleDynamicImportHook JS::GetModuleDynamicImportHook(
JSRuntime* rt) {
AssertHeapIsIdle();
return rt->moduleDynamicImportHook;
}
JS_PUBLIC_API void JS::SetModuleDynamicImportHook(
JSRuntime* rt, JS::ModuleDynamicImportHook func) {
AssertHeapIsIdle();
rt->moduleDynamicImportHook = func;
}
JS_PUBLIC_API bool JS::FinishDynamicModuleImport(JSContext* cx,
HandleValue referencingPrivate,
HandleString specifier,
HandleObject promise) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(referencingPrivate, promise);
return js::FinishDynamicModuleImport(cx, referencingPrivate, specifier,
promise);
}
JS_PUBLIC_API bool JS::CompileModule(JSContext* cx,
const ReadOnlyCompileOptions& options,
SourceText<char16_t>& srcBuf,
JS::MutableHandleObject module) {
MOZ_ASSERT(!cx->zone()->isAtomsZone());
AssertHeapIsIdle();
CHECK_THREAD(cx);
module.set(frontend::CompileModule(cx, options, srcBuf));
return !!module;
}
JS_PUBLIC_API void JS::SetModulePrivate(JSObject* module,
const JS::Value& value) {
JSRuntime* rt = module->zone()->runtimeFromMainThread();
module->as<ModuleObject>().scriptSourceObject()->setPrivate(rt, value);
}
JS_PUBLIC_API JS::Value JS::GetModulePrivate(JSObject* module) {
return module->as<ModuleObject>().scriptSourceObject()->canonicalPrivate();
}
JS_PUBLIC_API void JS::SetScriptPrivate(JSScript* script,
const JS::Value& value) {
JSRuntime* rt = script->zone()->runtimeFromMainThread();
@ -3787,58 +3719,6 @@ JS_PUBLIC_API void JS::SetScriptPrivateReferenceHooks(
rt->scriptPrivateReleaseHook = releaseHook;
}
JS_PUBLIC_API bool JS::ModuleInstantiate(JSContext* cx,
JS::HandleObject moduleArg) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->releaseCheck(moduleArg);
return ModuleObject::Instantiate(cx, moduleArg.as<ModuleObject>());
}
JS_PUBLIC_API bool JS::ModuleEvaluate(JSContext* cx,
JS::HandleObject moduleArg) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->releaseCheck(moduleArg);
return ModuleObject::Evaluate(cx, moduleArg.as<ModuleObject>());
}
JS_PUBLIC_API JSObject* JS::GetRequestedModules(JSContext* cx,
JS::HandleObject moduleArg) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(moduleArg);
return &moduleArg->as<ModuleObject>().requestedModules();
}
JS_PUBLIC_API JSString* JS::GetRequestedModuleSpecifier(JSContext* cx,
JS::HandleValue value) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(value);
JSObject* obj = &value.toObject();
return obj->as<RequestedModuleObject>().moduleSpecifier();
}
JS_PUBLIC_API void JS::GetRequestedModuleSourcePos(JSContext* cx,
JS::HandleValue value,
uint32_t* lineNumber,
uint32_t* columnNumber) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(value);
MOZ_ASSERT(lineNumber);
MOZ_ASSERT(columnNumber);
auto& requested = value.toObject().as<RequestedModuleObject>();
*lineNumber = requested.lineNumber();
*columnNumber = requested.columnNumber();
}
JS_PUBLIC_API JSScript* JS::GetModuleScript(JS::HandleObject moduleRecord) {
AssertHeapIsIdle();
return moduleRecord->as<ModuleObject>().script();
}
JS_PUBLIC_API JSObject* JS_New(JSContext* cx, HandleObject ctor,
const JS::HandleValueArray& inputArgs) {
AssertHeapIsIdle();

View File

@ -1905,78 +1905,6 @@ extern JS_PUBLIC_API JSString* JS_DecompileFunction(
namespace JS {
using ModuleResolveHook = JSObject* (*)(JSContext*, HandleValue, HandleString);
/**
* Get the HostResolveImportedModule hook for the runtime.
*/
extern JS_PUBLIC_API ModuleResolveHook GetModuleResolveHook(JSRuntime* rt);
/**
* Set the HostResolveImportedModule hook for the runtime to the given function.
*/
extern JS_PUBLIC_API void SetModuleResolveHook(JSRuntime* rt,
ModuleResolveHook func);
using ModuleMetadataHook = bool (*)(JSContext*, HandleValue, HandleObject);
/**
* Get the hook for populating the import.meta metadata object.
*/
extern JS_PUBLIC_API ModuleMetadataHook GetModuleMetadataHook(JSRuntime* rt);
/**
* Set the hook for populating the import.meta metadata object to the given
* function.
*/
extern JS_PUBLIC_API void SetModuleMetadataHook(JSRuntime* rt,
ModuleMetadataHook func);
using ModuleDynamicImportHook = bool (*)(JSContext* cx,
HandleValue referencingPrivate,
HandleString specifier,
HandleObject promise);
/**
* Get the HostImportModuleDynamically hook for the runtime.
*/
extern JS_PUBLIC_API ModuleDynamicImportHook
GetModuleDynamicImportHook(JSRuntime* rt);
/**
* Set the HostImportModuleDynamically hook for the runtime to the given
* function.
*
* If this hook is not set (or set to nullptr) then the JS engine will throw an
* exception if dynamic module import is attempted.
*/
extern JS_PUBLIC_API void SetModuleDynamicImportHook(
JSRuntime* rt, ModuleDynamicImportHook func);
extern JS_PUBLIC_API bool FinishDynamicModuleImport(
JSContext* cx, HandleValue referencingPrivate, HandleString specifier,
HandleObject promise);
/**
* Parse the given source buffer as a module in the scope of the current global
* of cx and return a source text module record.
*/
extern JS_PUBLIC_API bool CompileModule(JSContext* cx,
const ReadOnlyCompileOptions& options,
SourceText<char16_t>& srcBuf,
JS::MutableHandleObject moduleRecord);
/**
* Set a private value associated with a source text module record.
*/
extern JS_PUBLIC_API void SetModulePrivate(JSObject* module,
const JS::Value& value);
/**
* Get the private value associated with a source text module record.
*/
extern JS_PUBLIC_API JS::Value GetModulePrivate(JSObject* module);
/**
* Set a private value associated with a script. Note that this value is shared
* by all nested scripts compiled from a single source file.
@ -2010,60 +1938,6 @@ extern JS_PUBLIC_API void SetScriptPrivateReferenceHooks(
JSRuntime* rt, ScriptPrivateReferenceHook addRefHook,
ScriptPrivateReferenceHook releaseHook);
/*
* Perform the ModuleInstantiate operation on the given source text module
* record.
*
* This transitively resolves all module dependencies (calling the
* HostResolveImportedModule hook) and initializes the environment record for
* the module.
*/
extern JS_PUBLIC_API bool ModuleInstantiate(JSContext* cx,
JS::HandleObject moduleRecord);
/*
* Perform the ModuleEvaluate operation on the given source text module record.
*
* This does nothing if this module has already been evaluated. Otherwise, it
* transitively evaluates all dependences of this module and then evaluates this
* module.
*
* ModuleInstantiate must have completed prior to calling this.
*/
extern JS_PUBLIC_API bool ModuleEvaluate(JSContext* cx,
JS::HandleObject moduleRecord);
/*
* Get a list of the module specifiers used by a source text module
* record to request importation of modules.
*
* The result is a JavaScript array of object values. To extract the individual
* values use only JS_GetArrayLength and JS_GetElement with indices 0 to length
* - 1.
*
* The element values are objects with the following properties:
* - moduleSpecifier: the module specifier string
* - lineNumber: the line number of the import in the source text
* - columnNumber: the column number of the import in the source text
*
* These property values can be extracted with GetRequestedModuleSpecifier() and
* GetRequestedModuleSourcePos()
*/
extern JS_PUBLIC_API JSObject* GetRequestedModules(
JSContext* cx, JS::HandleObject moduleRecord);
extern JS_PUBLIC_API JSString* GetRequestedModuleSpecifier(
JSContext* cx, JS::HandleValue requestedModuleObject);
extern JS_PUBLIC_API void GetRequestedModuleSourcePos(
JSContext* cx, JS::HandleValue requestedModuleObject, uint32_t* lineNumber,
uint32_t* columnNumber);
/*
* Get the top-level script for a module which has not yet been executed.
*/
extern JS_PUBLIC_API JSScript* GetModuleScript(JS::HandleObject moduleRecord);
} /* namespace JS */
#if defined(JS_BUILD_BINAST)

View File

@ -146,6 +146,7 @@ EXPORTS.js += [
'../public/LocaleSensitive.h',
'../public/MemoryFunctions.h',
'../public/MemoryMetrics.h',
'../public/Modules.h',
'../public/OffThreadScriptCompilation.h',
'../public/Principals.h',
'../public/Printf.h',
@ -304,6 +305,7 @@ UNIFIED_SOURCES += [
'vm/JSScript.cpp',
'vm/List.cpp',
'vm/MemoryMetrics.cpp',
'vm/Modules.cpp',
'vm/NativeObject.cpp',
'vm/ObjectGroup.cpp',
'vm/OffThreadScriptCompilation.cpp',

View File

@ -98,6 +98,7 @@
#include "js/Initialization.h"
#include "js/JSON.h"
#include "js/MemoryFunctions.h"
#include "js/Modules.h" // JS::GetModulePrivate, JS::SetModule{DynamicImport,Metadata,Resolve}Hook, JS::SetModulePrivate
#include "js/Printf.h"
#include "js/PropertySpec.h"
#include "js/Realm.h"

160
js/src/vm/Modules.cpp Normal file
View File

@ -0,0 +1,160 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* JavaScript modules (as in, the syntactic construct) implementation. */
#include "js/Modules.h"
#include "mozilla/Assertions.h" // MOZ_ASSERT
#include <stdint.h> // uint32_t
#include "jsapi.h" // js::AssertHeapIsIdle
#include "jstypes.h" // JS_PUBLIC_API
#include "builtin/ModuleObject.h" // js::FinishDynamicModuleImport, js::{,Requested}ModuleObject
#include "frontend/BytecodeCompiler.h" // js::frontend::CompileModule
#include "js/RootingAPI.h" // JS::MutableHandle
#include "js/Value.h" // JS::Value
#include "vm/JSContext.h" // CHECK_THREAD, JSContext
#include "vm/JSObject.h" // JSObject
#include "vm/Runtime.h" // JSRuntime
#include "vm/JSContext-inl.h" // JSContext::{c,releaseC}heck
using js::AssertHeapIsIdle;
using js::ModuleObject;
using js::RequestedModuleObject;
JS_PUBLIC_API JS::ModuleResolveHook JS::GetModuleResolveHook(JSRuntime* rt) {
AssertHeapIsIdle();
return rt->moduleResolveHook;
}
JS_PUBLIC_API void JS::SetModuleResolveHook(JSRuntime* rt,
ModuleResolveHook func) {
AssertHeapIsIdle();
rt->moduleResolveHook = func;
}
JS_PUBLIC_API JS::ModuleMetadataHook JS::GetModuleMetadataHook(JSRuntime* rt) {
AssertHeapIsIdle();
return rt->moduleMetadataHook;
}
JS_PUBLIC_API void JS::SetModuleMetadataHook(JSRuntime* rt,
ModuleMetadataHook func) {
AssertHeapIsIdle();
rt->moduleMetadataHook = func;
}
JS_PUBLIC_API JS::ModuleDynamicImportHook JS::GetModuleDynamicImportHook(
JSRuntime* rt) {
AssertHeapIsIdle();
return rt->moduleDynamicImportHook;
}
JS_PUBLIC_API void JS::SetModuleDynamicImportHook(
JSRuntime* rt, ModuleDynamicImportHook func) {
AssertHeapIsIdle();
rt->moduleDynamicImportHook = func;
}
JS_PUBLIC_API bool JS::FinishDynamicModuleImport(
JSContext* cx, Handle<Value> referencingPrivate,
Handle<JSString*> specifier, Handle<JSObject*> promise) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(referencingPrivate, promise);
return js::FinishDynamicModuleImport(cx, referencingPrivate, specifier,
promise);
}
JS_PUBLIC_API bool JS::CompileModule(JSContext* cx,
const ReadOnlyCompileOptions& options,
SourceText<char16_t>& srcBuf,
MutableHandle<JSObject*> module) {
MOZ_ASSERT(!cx->zone()->isAtomsZone());
AssertHeapIsIdle();
CHECK_THREAD(cx);
module.set(js::frontend::CompileModule(cx, options, srcBuf));
return !!module;
}
JS_PUBLIC_API void JS::SetModulePrivate(JSObject* module, const Value& value) {
JSRuntime* rt = module->zone()->runtimeFromMainThread();
module->as<ModuleObject>().scriptSourceObject()->setPrivate(rt, value);
}
JS_PUBLIC_API JS::Value JS::GetModulePrivate(JSObject* module) {
return module->as<ModuleObject>().scriptSourceObject()->canonicalPrivate();
}
JS_PUBLIC_API bool JS::ModuleInstantiate(JSContext* cx,
Handle<JSObject*> moduleArg) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->releaseCheck(moduleArg);
return ModuleObject::Instantiate(cx, moduleArg.as<ModuleObject>());
}
JS_PUBLIC_API bool JS::ModuleEvaluate(JSContext* cx,
Handle<JSObject*> moduleArg) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->releaseCheck(moduleArg);
return ModuleObject::Evaluate(cx, moduleArg.as<ModuleObject>());
}
JS_PUBLIC_API JSObject* JS::GetRequestedModules(JSContext* cx,
Handle<JSObject*> moduleArg) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(moduleArg);
return &moduleArg->as<ModuleObject>().requestedModules();
}
JS_PUBLIC_API JSString* JS::GetRequestedModuleSpecifier(JSContext* cx,
Handle<Value> value) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(value);
JSObject* obj = &value.toObject();
return obj->as<RequestedModuleObject>().moduleSpecifier();
}
JS_PUBLIC_API void JS::GetRequestedModuleSourcePos(JSContext* cx,
JS::HandleValue value,
uint32_t* lineNumber,
uint32_t* columnNumber) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(value);
MOZ_ASSERT(lineNumber);
MOZ_ASSERT(columnNumber);
auto& requested = value.toObject().as<RequestedModuleObject>();
*lineNumber = requested.lineNumber();
*columnNumber = requested.columnNumber();
}
JS_PUBLIC_API JSScript* JS::GetModuleScript(JS::HandleObject moduleRecord) {
AssertHeapIsIdle();
return moduleRecord->as<ModuleObject>().script();
}

View File

@ -34,6 +34,7 @@
#include "js/experimental/SourceHook.h" // js::SourceHook
#include "js/GCVector.h"
#include "js/HashTable.h"
#include "js/Modules.h" // JS::Module{DynamicImport,Metadata,Resolve}Hook
#ifdef DEBUG
# include "js/Proxy.h" // For AutoEnterPolicy
#endif

View File

@ -44,6 +44,7 @@
#include "js/CharacterEncoding.h"
#include "js/CompilationAndEvaluation.h"
#include "js/Date.h"
#include "js/Modules.h" // JS::GetModulePrivate
#include "js/PropertySpec.h"
#include "js/SourceText.h" // JS::SourceText
#include "js/StableStringChars.h"