0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-21 20:49:10 +01:00

SERVER-91111: Enable spider-monkey-dbg build (#24813)

GitOrigin-RevId: d04fcbceb37c43435234c8ac0c6dd599bd4cb794
This commit is contained in:
Santiago Roche 2024-07-17 12:07:16 -04:00 committed by MongoDB Bot
parent 57ed2feaec
commit 758b931e8a
32 changed files with 175 additions and 29 deletions

View File

@ -108,6 +108,7 @@ globals:
_isLeakSanitizerActive: true
_isThreadSanitizerActive: true
_isUndefinedBehaviorSanitizerActive: true
_isSpiderMonkeyDebugEnabled: true
_optimizationsEnabled: true
allocatePort: true
allocatePorts: true

View File

@ -36,6 +36,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_dynamic_compile_variant_dependency
depends_on:
@ -54,6 +55,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_generic_expansions
multiversion_platform: rhel8
@ -68,6 +70,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &enterprise-rhel-8-64-bit-dynamic-expansions
<<: *linux_x86_generic_expansions

View File

@ -10,6 +10,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_dynamic_compile_variant_dependency
depends_on:
@ -28,6 +29,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_generic_expansions
multiversion_platform: rhel8

View File

@ -62,6 +62,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_dynamic_compile_variant_dependency
depends_on:
@ -80,6 +81,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_generic_expansions
multiversion_platform: rhel8
@ -94,6 +96,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &enterprise-rhel-8-64-bit-dynamic-expansions
<<: *linux_x86_generic_expansions

View File

@ -31,6 +31,60 @@ variables:
scons_cache_mode: all
has_packages: false
# THIS HAS COPIES IN:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_dynamic_compile_variant_dependency
depends_on:
- name: archive_dist_test_debug
variant: &linux_x86_dynamic_compile_variant_name linux-x86-dynamic-compile
- name: version_gen
variant: generate-tasks-for-version
# This is added because of EVG-18211.
# Without this we are adding extra dependencies on evergreen and it is causing strain
omit_generated_tasks: true
# - name: generate_buildid_to_debug_symbols_mapping
# variant: linux-x86-dynamic-compile
# THIS HAS COPIES IN:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_generic_expansions
multiversion_platform: rhel8
multiversion_edition: enterprise
repo_edition: enterprise
large_distro_name: rhel8.8-medium
core_analyzer_distro_name: rhel8.8-xlarge
num_scons_link_jobs_available: 0.99
compile_variant: *linux_x86_dynamic_compile_variant_name
# THIS HAS COPIES IN:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &enterprise-rhel-8-64-bit-dynamic-expansions
<<: *linux_x86_generic_expansions
scons_cache_scope: shared
scons_cache_mode: all
has_packages: false
jstestfuzz_num_generated_files: 40
jstestfuzz_concurrent_num_files: 10
target_resmoke_time: 10
max_sub_suites: 5
idle_timeout_factor: 1.5
exec_timeout_factor: 1.5
large_distro_name: rhel8.8-medium
# THIS HAS COPIES IN
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# - etc/evergreen_yml_components/variants/wiredtiger/test_dev_master_branch_only.yml
@ -526,3 +580,35 @@ buildvariants:
- name: .serverless
- name: unittest_shell_hang_analyzer_gen
- name: .watchdog
- name: &enterprise-rhel-8-64-bit-dynamic-spider-monkey-dbg enterprise-rhel-8-64-bit-dynamic-spider-monkey-dbg
display_name: "~ Shared Library Enterprise RHEL 8 SpiderMonkey Debug"
tags: []
cron: "0 */4 * * *" # From the ${project_required_suggested_cron} parameter
run_on:
- rhel8.8-small
expansions:
<<: *enterprise-rhel-8-64-bit-dynamic-expansions
# JS_GC_ZEAL modes can be found at https://github.com/mongodb/mongo/blob/r8.0.0-rc9/src/third_party/mozjs/extract/js/src/gc/GC.cpp#L563-L612.
# These modes correspond to collecting the nursery (GenerationalGC) every 50 allocations.
mozjs_options: JS_GC_ZEAL='7,50'
compile_flags: >-
--ssl
MONGO_DISTMOD=rhel88
-j$(grep -c ^processor /proc/cpuinfo)
--variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars
--link-model=dynamic
--use-diagnostic-latches=on
--spider-monkey-dbg=on
compile_variant: enterprise-rhel-8-64-bit-dynamic-spider-monkey-dbg
exec_timeout_secs: 32400 # 9 hour timeout
timeout_secs: 18000 # 5 hour idle timeout
depends_on: []
tasks:
- name: compile_test_parallel_core_stream_TG
distros:
- rhel8.8-xlarge
- name: aggregation
- name: aggregation_mongos_passthrough
- name: concurrency_simultaneous_gen
- name: jsCore

View File

@ -21,6 +21,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_dynamic_compile_variant_dependency
depends_on:
@ -57,6 +58,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &linux_x86_generic_expansions
multiversion_platform: rhel8
@ -71,6 +73,7 @@ variables:
# - etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/rhel/test_dev.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml
# - etc/evergreen_yml_components/variants/sanitizer/test_dev.yml
# ANY MODIFICATIONS HERE SHOULD ALSO BE MADE IN THOSE FILES
- &enterprise-rhel-8-64-bit-dynamic-expansions
<<: *linux_x86_generic_expansions

View File

@ -125,7 +125,7 @@ if [[ ${disable_unit_tests} = "false" && ! -f ${skip_tests} ]]; then
suite_name=${suite}
fi
resmoke_env_options="${gcov_environment} ${lang_environment} ${san_options}"
resmoke_env_options="${gcov_environment} ${lang_environment} ${san_options} ${mozjs_options}"
echo $resmoke_env_options > resmoke_env_options.txt
# The "resmoke_wrapper" expansion is used by the 'burn_in_tests' task to wrap the resmoke.py

View File

@ -24,7 +24,7 @@ import {checkCascadesOptimizerEnabled} from "jstests/libs/optimizer_utils.js";
const debugBuild = db.adminCommand("buildInfo").debug;
if (debugBuild || !_optimizationsEnabled() || _isAddressSanitizerActive() ||
_isLeakSanitizerActive() || _isThreadSanitizerActive() ||
_isUndefinedBehaviorSanitizerActive()) {
_isUndefinedBehaviorSanitizerActive() || _isSpiderMonkeyDebugEnabled()) {
jsTestLog("Returning early because debug is on, opt is off, or a sanitizer is enabled.");
return;
}

View File

@ -65,6 +65,7 @@ struct BaseInfo {
static const JSFunctionSpec* freeFunctions;
static const JSFunctionSpec* methods;
static const unsigned classFlags = 0;
static constexpr uint32_t finalizeFlag = JSCLASS_FOREGROUND_FINALIZE;
static void addProperty(JSContext* cx,
JS::HandleObject obj,
JS::HandleId id,

View File

@ -66,7 +66,8 @@ struct BinDataInfo : public BaseInfo {
static const JSFunctionSpec freeFunctions[4];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(BinDataSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(BinDataSlotCount) | BaseInfo::finalizeFlag;
};
} // namespace mozjs

View File

@ -73,7 +73,8 @@ struct BSONInfo : public BaseInfo {
JS::ObjectOpResult& result);
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(BSONInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(BSONInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
static void postInstall(JSContext* cx, JS::HandleObject global, JS::HandleObject proto);

View File

@ -69,7 +69,8 @@ struct CursorInfo : public BaseInfo {
static const JSFunctionSpec methods[9];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(CursorInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(CursorInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
/**

View File

@ -61,7 +61,8 @@ struct CursorHandleInfo : public BaseInfo {
static const JSFunctionSpec methods[2];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(CursorHandleInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(CursorHandleInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
/**

View File

@ -56,7 +56,8 @@ struct DBRefInfo : public BaseInfo {
static void construct(JSContext* cx, JS::CallArgs args);
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(DBRefInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(DBRefInfoSlotCount) | BaseInfo::finalizeFlag;
static void delProperty(JSContext* cx,
JS::HandleObject obj,

View File

@ -560,7 +560,7 @@ MozJSImplScope::MozJSImplScope(MozJSScriptEngine* engine, boost::optional<int> j
}
MozJSImplScope::~MozJSImplScope() {
invariant(!_promiseResult.has_value());
invariant(!_promiseResult.initialized());
currentJSScope = nullptr;
for (auto&& x : _funcs) {
@ -712,7 +712,8 @@ void MozJSImplScope::_MozJSCreateFunction(StringData raw, JS::MutableHandleValue
bool MozJSImplScope::onSyncPromiseResolved(JSContext* cx, unsigned argc, JS::Value* vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
auto scope = getScope(cx);
scope->_promiseResult.emplace(cx, args[0]);
invariant(!scope->_promiseResult.initialized());
scope->_promiseResult.init(cx, args[0]);
args.rval().setUndefined();
return true;
}
@ -763,9 +764,9 @@ bool MozJSImplScope::awaitPromise(JSContext* cx,
return false;
}
invariant(scope->_promiseResult.has_value());
out.set(*scope->_promiseResult);
scope->_promiseResult = boost::none;
invariant(scope->_promiseResult.initialized());
out.set(scope->_promiseResult);
scope->_promiseResult.reset();
return true;
}
@ -1166,6 +1167,11 @@ bool MozJSImplScope::_checkErrorState(bool success, bool reportError, bool asser
if (_status.isOK()) {
JS::RootedValue excn(_context);
if (JS_GetPendingException(_context, &excn)) {
// The pending JS exception needs to be cleared before we call ValueWriter below to
// print the exception. ValueWriter::toStringData() may call back into the Interpret,
// which asserts that we don't have an exception pending in DEBUG builds.
JS_ClearPendingException(_context);
if (excn.isObject()) {
str::stream ss;
// Exceptions originating from C++ should not get the "uncaught exception: " prefix.
@ -1210,6 +1216,8 @@ bool MozJSImplScope::_checkErrorState(bool success, bool reportError, bool asser
_status = Status(ErrorCodes::UnknownError, "Unknown Failure from JSInterpreter");
}
}
// We always unconditionally clear any pending exception, as this method _checkErrorState is
// expected to report and clear the errors before returning.
JS_ClearPendingException(_context);
if (auto extraInfo = _status.extraInfo<JSExceptionInfo>()) {

View File

@ -449,8 +449,6 @@ private:
struct MozRuntime {
public:
MozRuntime(const MozJSScriptEngine* engine, boost::optional<int> jsHeapLimitMB);
std::unique_ptr<JSRuntime, std::function<void(JSRuntime*)>> _runtime;
std::unique_ptr<JSContext, std::function<void(JSContext*)>> _context;
};
@ -516,7 +514,10 @@ private:
std::unique_ptr<ModuleLoader> _moduleLoader;
std::unique_ptr<EnvironmentPreparer> _environmentPreparer;
boost::optional<JS::RootedValue> _promiseResult;
// _promiseResult must be a persistentRootedValue (instead of a simple RootedValue). Using a
// simple RootedValue here affects the stack cleanup conditions in the promise's execution
// context.
JS::PersistentRootedValue _promiseResult;
WrapType<BinDataInfo> _binDataProto;
WrapType<BSONInfo> _bsonProto;

View File

@ -74,7 +74,8 @@ struct JSThreadInfo : public BaseInfo {
static const JSFunctionSpec freeFunctions[3];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(JSThreadInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(JSThreadInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
};

View File

@ -361,7 +361,7 @@ JSString* ModuleLoader::fetchSource(JSContext* cx,
enum GlobalAppSlot { GlobalAppSlotModuleRegistry, GlobalAppSlotCount };
JSObject* ModuleLoader::getOrCreateModuleRegistry(JSContext* cx) {
JSObject* global = JS::CurrentGlobalOrNull(cx);
JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
if (!global) {
return nullptr;
}
@ -371,7 +371,7 @@ JSObject* ModuleLoader::getOrCreateModuleRegistry(JSContext* cx) {
return &value.toObject();
}
JSObject* registry = JS::NewMapObject(cx);
JS::RootedObject registry(cx, JS::NewMapObject(cx));
if (!registry) {
return nullptr;
}

View File

@ -112,7 +112,8 @@ struct MongoBase : public BaseInfo {
static const JSFunctionSpec methods[31];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(MongoBaseSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(MongoBaseSlotCount) | BaseInfo::finalizeFlag;
};
/**

View File

@ -62,7 +62,8 @@ struct NativeFunctionInfo : public BaseInfo {
static const char* const inheritFrom;
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NativeFunctionInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(NativeFunctionInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
struct Functions {

View File

@ -61,8 +61,8 @@ struct NumberDecimalInfo : public BaseInfo {
static const JSFunctionSpec methods[3];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NumberDecimalInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(NumberDecimalInfoSlotCount) | BaseInfo::finalizeFlag;
static Decimal128 ToNumberDecimal(JSContext* cx, JS::HandleObject object);
static Decimal128 ToNumberDecimal(JSContext* cx, JS::HandleValue value);

View File

@ -61,7 +61,8 @@ struct NumberIntInfo : public BaseInfo {
static const JSFunctionSpec methods[5];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NumberIntInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(NumberIntInfoSlotCount) | BaseInfo::finalizeFlag;
static int ToNumberInt(JSContext* cx, JS::HandleObject object);
static int ToNumberInt(JSContext* cx, JS::HandleValue value);

View File

@ -77,7 +77,8 @@ struct NumberLongInfo : public BaseInfo {
static const JSFunctionSpec methods[6];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NumberLongInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(NumberLongInfoSlotCount) | BaseInfo::finalizeFlag;
static void postInstall(JSContext* cx, JS::HandleObject global, JS::HandleObject proto);

View File

@ -60,8 +60,8 @@ struct OIDInfo : public BaseInfo {
static const JSFunctionSpec methods[3];
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(OIDInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(OIDInfoSlotCount) | BaseInfo::finalizeFlag;
static const char* const className;
static void postInstall(JSContext* cx, JS::HandleObject global, JS::HandleObject proto);

View File

@ -67,7 +67,8 @@ struct SessionInfo : public BaseInfo {
static const JSFunctionSpec methods[8];
static const char* const className;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(SessionInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(SessionInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
static void make(JSContext* cx,

View File

@ -65,7 +65,8 @@ struct MongoStatusInfo : public BaseInfo {
static const char* const className;
static const char* const inheritFrom;
static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(MongoStatusInfoSlotCount);
static const unsigned classFlags =
JSCLASS_HAS_RESERVED_SLOTS(MongoStatusInfoSlotCount) | BaseInfo::finalizeFlag;
static const InstallType installType = InstallType::Private;
static Status toStatus(JSContext* cx, JS::HandleObject object);

View File

@ -402,6 +402,21 @@ function _isUndefinedBehaviorSanitizerActive() {
return __sanitizeMatch("undefined");
}
// Enabling a custom JS_GC_ZEAL value for spidermonkey is a two step process:
// 1) JS_GC_ZEAL preprocessor directive needs to be defined at compilation (spider-monkey-dbg=on).
// 2) A valid JS_GC_ZEAL value needs to be provided as an environment variable at runtime.
// In order to detect whether we are running with JS_GC_ZEAL enabled, ideally we'd like to check for
// the CPPDEFINE for JS_GC_ZEAL. Unfortunately, this CPPDEFINE only applies to libmozjs, and is not
// exposed in the BuildInfo response. Instead, we rely on detecting a non-empty environment variable
// for JS_GC_ZEAL. We could have restricted the RegExp to match a valid input for JS_GC_ZEAL
// For example: RegExp(/^\w+(;\w+)*(,\d+)?$/), but SpiderMonkey performs the validation for us.
// As long as a non-whitespace JS_GC_ZEAL value has been detected, we report it as being enabled.
function _isSpiderMonkeyDebugEnabled() {
const jsGcZeal = _getEnv("JS_GC_ZEAL");
let regex = RegExp(/^\S+$/);
return regex.test(jsGcZeal);
}
jsTestName = function() {
if (TestData) {
// If we are using the jsTestName as a database name and performing tenant prefixing

View File

@ -78,6 +78,7 @@ def injectMozJS(thisEnv):
thisEnv.Prepend(CPPDEFINES=[
'DEBUG',
'JS_DEBUG',
'JS_GC_ZEAL'
])

View File

@ -147,6 +147,9 @@ sources = [
"extract/js/src/wasm/WasmCode-platform.cpp",
]
if get_option('spider-monkey-dbg') == "on":
sources.extend(["extract/js/src/util/Utility.cpp"])
if env['TARGET_ARCH'] == 'x86_64' and not env.TargetOSIs('windows'):
env.Append(CCFLAGS=['-mavx2'])
sources.extend(["extract/mozglue/misc/SIMD_avx2.cpp", "extract/mozglue/misc/SSE.cpp"])

View File

@ -100,6 +100,9 @@ bool js::gExtraPoisoningEnabled = false;
# endif
#endif
// MONGODB MODIFICATION: We don't want to compile the below code when running in mongo embedding.
// Instead, we would like to rely on our own JS custom allocator implementation in mongo_sources.
#ifndef JS_USE_CUSTOM_ALLOCATOR
JS_PUBLIC_DATA arena_id_t js::MallocArena;
JS_PUBLIC_DATA arena_id_t js::ArrayBufferContentsArena;
JS_PUBLIC_DATA arena_id_t js::StringBufferArena;
@ -121,6 +124,7 @@ void js::ShutDownMallocAllocator() {
// moz_dispose_arena(MallocArena);
// moz_dispose_arena(ArrayBufferContentsArena);
}
#endif
extern void js::AssertJSStringBufferInCorrectArena(const void* ptr) {
// `jemalloc_ptr_info()` only exists if MOZ_MEMORY is defined, and it only

View File

@ -3583,6 +3583,8 @@ void js::AssertJSClassInvariants(const JSClass* clasp) {
//
// Environment objects unfortunately use these hooks, but environment objects
// are not exposed directly to script so they're generally less of an issue.
// MONGODB MODIFICATION: Disable the below MOZ_ASSERT calls when JIT is disabled, as these appear to be JIT specific checks.
#ifndef JS_CODEGEN_NONE
if (clasp->isNativeObject() && clasp != &WithEnvironmentObject::class_ &&
clasp != &ModuleEnvironmentObject::class_ &&
clasp != &RuntimeLexicalErrorObject::class_) {
@ -3595,6 +3597,7 @@ void js::AssertJSClassInvariants(const JSClass* clasp) {
MOZ_ASSERT(!clasp->getOpsGetOwnPropertyDescriptor());
MOZ_ASSERT(!clasp->getOpsDeleteProperty());
}
#endif
}
/* static */

View File

@ -9,7 +9,7 @@ set -vx
NAME=spidermonkey
LIB_GIT_BRANCH=spidermonkey-esr115.7-cpp-only
LIB_GIT_REVISION=bb6edb4fcd43607c87de81df8c58db11a663634a
LIB_GIT_REVISION=8067826deecd3e89bdd85c80364ce5ce824c1f32
LIB_GIT_REPO=git@github.com:mongodb-forks/spidermonkey.git
DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/mozjs