diff --git a/.eslintrc.yml b/.eslintrc.yml index 6edbd4129fd..8ae3e533366 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -108,7 +108,6 @@ globals: _isLeakSanitizerActive: true _isThreadSanitizerActive: true _isUndefinedBehaviorSanitizerActive: true - _isSpiderMonkeyDebugEnabled: true _optimizationsEnabled: true allocatePort: true allocatePorts: true diff --git a/etc/evergreen_yml_components/variants/rhel/test_dev.yml b/etc/evergreen_yml_components/variants/rhel/test_dev.yml index cc283ac476f..6b9cd795263 100644 --- a/etc/evergreen_yml_components/variants/rhel/test_dev.yml +++ b/etc/evergreen_yml_components/variants/rhel/test_dev.yml @@ -36,7 +36,6 @@ 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: @@ -55,7 +54,6 @@ 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 @@ -70,7 +68,6 @@ 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 diff --git a/etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml b/etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml index 763d9dbcf5e..07bd377526e 100644 --- a/etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml +++ b/etc/evergreen_yml_components/variants/rhel/test_dev_master_and_lts_branches_only.yml @@ -10,7 +10,6 @@ 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: @@ -29,7 +28,6 @@ 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 diff --git a/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml b/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml index 520b13b4dd5..bcd4ed6208f 100644 --- a/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml +++ b/etc/evergreen_yml_components/variants/rhel/test_dev_master_branch_only.yml @@ -62,7 +62,6 @@ 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: @@ -81,7 +80,6 @@ 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 @@ -96,7 +94,6 @@ 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 diff --git a/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml b/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml index 97c5baed3ec..16218935d6a 100644 --- a/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml +++ b/etc/evergreen_yml_components/variants/sanitizer/test_dev.yml @@ -31,60 +31,6 @@ 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: rhel80 - multiversion_edition: enterprise - repo_edition: enterprise - large_distro_name: rhel80-medium - core_analyzer_distro_name: rhel80-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-80-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: rhel80-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 @@ -580,34 +526,3 @@ buildvariants: - name: .serverless - name: unittest_shell_hang_analyzer_gen - name: .watchdog - - - name: &enterprise-rhel-80-64-bit-dynamic-spider-monkey-dbg enterprise-rhel-80-64-bit-dynamic-spider-monkey-dbg - display_name: "~ Shared Library Enterprise RHEL 8.0 SpiderMonkey Debug" - tags: [] - cron: "0 */4 * * *" # From the ${project_required_suggested_cron} parameter - run_on: - - rhel80-small - expansions: - <<: *enterprise-rhel-80-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=rhel80 - -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 - 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: - - rhel80-xlarge - - name: aggregation - - name: aggregation_mongos_passthrough - - name: concurrency_simultaneous_gen - - name: jsCore diff --git a/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml b/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml index f6a1f2f4120..5d5def5425f 100644 --- a/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml +++ b/etc/evergreen_yml_components/variants/sanitizer/test_dev_master_branch_only.yml @@ -21,7 +21,6 @@ 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: @@ -58,7 +57,6 @@ 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 @@ -73,7 +71,6 @@ 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 diff --git a/evergreen/resmoke_tests_execute.sh b/evergreen/resmoke_tests_execute.sh index fd0483cca9d..31fd7ab0146 100644 --- a/evergreen/resmoke_tests_execute.sh +++ b/evergreen/resmoke_tests_execute.sh @@ -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} ${mozjs_options}" + resmoke_env_options="${gcov_environment} ${lang_environment} ${san_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 diff --git a/jstests/aggregation/query_limits_test.js b/jstests/aggregation/query_limits_test.js index 4aeb4351f12..30a97cd4db6 100644 --- a/jstests/aggregation/query_limits_test.js +++ b/jstests/aggregation/query_limits_test.js @@ -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() || _isSpiderMonkeyDebugEnabled()) { + _isUndefinedBehaviorSanitizerActive()) { jsTestLog("Returning early because debug is on, opt is off, or a sanitizer is enabled."); return; } diff --git a/src/mongo/scripting/mozjs/base.h b/src/mongo/scripting/mozjs/base.h index 9e400167356..e773be798d3 100644 --- a/src/mongo/scripting/mozjs/base.h +++ b/src/mongo/scripting/mozjs/base.h @@ -65,7 +65,6 @@ 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, diff --git a/src/mongo/scripting/mozjs/bindata.h b/src/mongo/scripting/mozjs/bindata.h index 726b390f40e..98c336ddc3e 100644 --- a/src/mongo/scripting/mozjs/bindata.h +++ b/src/mongo/scripting/mozjs/bindata.h @@ -66,8 +66,7 @@ struct BinDataInfo : public BaseInfo { static const JSFunctionSpec freeFunctions[4]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(BinDataSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(BinDataSlotCount); }; } // namespace mozjs diff --git a/src/mongo/scripting/mozjs/bson.h b/src/mongo/scripting/mozjs/bson.h index e75e1a269be..234f20884d7 100644 --- a/src/mongo/scripting/mozjs/bson.h +++ b/src/mongo/scripting/mozjs/bson.h @@ -73,8 +73,7 @@ struct BSONInfo : public BaseInfo { JS::ObjectOpResult& result); static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(BSONInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(BSONInfoSlotCount); static const InstallType installType = InstallType::Private; static void postInstall(JSContext* cx, JS::HandleObject global, JS::HandleObject proto); diff --git a/src/mongo/scripting/mozjs/cursor.h b/src/mongo/scripting/mozjs/cursor.h index fcd7c5a7033..92cca7f7e40 100644 --- a/src/mongo/scripting/mozjs/cursor.h +++ b/src/mongo/scripting/mozjs/cursor.h @@ -69,8 +69,7 @@ struct CursorInfo : public BaseInfo { static const JSFunctionSpec methods[9]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(CursorInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(CursorInfoSlotCount); static const InstallType installType = InstallType::Private; /** diff --git a/src/mongo/scripting/mozjs/cursor_handle.h b/src/mongo/scripting/mozjs/cursor_handle.h index 0b4861181ea..e50e3f5b7d5 100644 --- a/src/mongo/scripting/mozjs/cursor_handle.h +++ b/src/mongo/scripting/mozjs/cursor_handle.h @@ -61,8 +61,7 @@ struct CursorHandleInfo : public BaseInfo { static const JSFunctionSpec methods[2]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(CursorHandleInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(CursorHandleInfoSlotCount); static const InstallType installType = InstallType::Private; /** diff --git a/src/mongo/scripting/mozjs/dbref.h b/src/mongo/scripting/mozjs/dbref.h index 3dc0a37f30f..b6e0dbd5c60 100644 --- a/src/mongo/scripting/mozjs/dbref.h +++ b/src/mongo/scripting/mozjs/dbref.h @@ -56,8 +56,7 @@ 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) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(DBRefInfoSlotCount); static void delProperty(JSContext* cx, JS::HandleObject obj, diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 53681f55890..39369402408 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -560,7 +560,7 @@ MozJSImplScope::MozJSImplScope(MozJSScriptEngine* engine, boost::optional j } MozJSImplScope::~MozJSImplScope() { - invariant(!_promiseResult.initialized()); + invariant(!_promiseResult.has_value()); currentJSScope = nullptr; for (auto&& x : _funcs) { @@ -712,8 +712,7 @@ 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); - invariant(!scope->_promiseResult.initialized()); - scope->_promiseResult.init(cx, args[0]); + scope->_promiseResult.emplace(cx, args[0]); args.rval().setUndefined(); return true; } @@ -764,9 +763,9 @@ bool MozJSImplScope::awaitPromise(JSContext* cx, return false; } - invariant(scope->_promiseResult.initialized()); - out.set(scope->_promiseResult); - scope->_promiseResult.reset(); + invariant(scope->_promiseResult.has_value()); + out.set(*scope->_promiseResult); + scope->_promiseResult = boost::none; return true; } @@ -1167,11 +1166,6 @@ 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. @@ -1216,8 +1210,6 @@ 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()) { diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h index cd5f0a7f852..114d0f09daf 100644 --- a/src/mongo/scripting/mozjs/implscope.h +++ b/src/mongo/scripting/mozjs/implscope.h @@ -449,6 +449,8 @@ private: struct MozRuntime { public: MozRuntime(const MozJSScriptEngine* engine, boost::optional jsHeapLimitMB); + + std::unique_ptr> _runtime; std::unique_ptr> _context; }; @@ -514,10 +516,7 @@ private: std::unique_ptr _moduleLoader; std::unique_ptr _environmentPreparer; - // _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; + boost::optional _promiseResult; WrapType _binDataProto; WrapType _bsonProto; diff --git a/src/mongo/scripting/mozjs/jsthread.h b/src/mongo/scripting/mozjs/jsthread.h index e0d759cd269..ddec39c842f 100644 --- a/src/mongo/scripting/mozjs/jsthread.h +++ b/src/mongo/scripting/mozjs/jsthread.h @@ -74,8 +74,7 @@ struct JSThreadInfo : public BaseInfo { static const JSFunctionSpec freeFunctions[3]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(JSThreadInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(JSThreadInfoSlotCount); static const InstallType installType = InstallType::Private; }; diff --git a/src/mongo/scripting/mozjs/module_loader.cpp b/src/mongo/scripting/mozjs/module_loader.cpp index 8cfea9df479..d211d67eef3 100644 --- a/src/mongo/scripting/mozjs/module_loader.cpp +++ b/src/mongo/scripting/mozjs/module_loader.cpp @@ -361,7 +361,7 @@ JSString* ModuleLoader::fetchSource(JSContext* cx, enum GlobalAppSlot { GlobalAppSlotModuleRegistry, GlobalAppSlotCount }; JSObject* ModuleLoader::getOrCreateModuleRegistry(JSContext* cx) { - JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx)); + JSObject* global = JS::CurrentGlobalOrNull(cx); if (!global) { return nullptr; } @@ -371,7 +371,7 @@ JSObject* ModuleLoader::getOrCreateModuleRegistry(JSContext* cx) { return &value.toObject(); } - JS::RootedObject registry(cx, JS::NewMapObject(cx)); + JSObject* registry = JS::NewMapObject(cx); if (!registry) { return nullptr; } diff --git a/src/mongo/scripting/mozjs/mongo.h b/src/mongo/scripting/mozjs/mongo.h index 1ad3c3bc77f..83591e767aa 100644 --- a/src/mongo/scripting/mozjs/mongo.h +++ b/src/mongo/scripting/mozjs/mongo.h @@ -112,8 +112,7 @@ struct MongoBase : public BaseInfo { static const JSFunctionSpec methods[31]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(MongoBaseSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(MongoBaseSlotCount); }; /** diff --git a/src/mongo/scripting/mozjs/nativefunction.h b/src/mongo/scripting/mozjs/nativefunction.h index bc1461a6e4b..3ba89ad61b6 100644 --- a/src/mongo/scripting/mozjs/nativefunction.h +++ b/src/mongo/scripting/mozjs/nativefunction.h @@ -62,8 +62,7 @@ struct NativeFunctionInfo : public BaseInfo { static const char* const inheritFrom; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(NativeFunctionInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NativeFunctionInfoSlotCount); static const InstallType installType = InstallType::Private; struct Functions { diff --git a/src/mongo/scripting/mozjs/numberdecimal.h b/src/mongo/scripting/mozjs/numberdecimal.h index 31947b05161..94a14039613 100644 --- a/src/mongo/scripting/mozjs/numberdecimal.h +++ b/src/mongo/scripting/mozjs/numberdecimal.h @@ -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) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NumberDecimalInfoSlotCount); + static Decimal128 ToNumberDecimal(JSContext* cx, JS::HandleObject object); static Decimal128 ToNumberDecimal(JSContext* cx, JS::HandleValue value); diff --git a/src/mongo/scripting/mozjs/numberint.h b/src/mongo/scripting/mozjs/numberint.h index 8a5c0d139a0..2ac72aaff06 100644 --- a/src/mongo/scripting/mozjs/numberint.h +++ b/src/mongo/scripting/mozjs/numberint.h @@ -61,8 +61,7 @@ struct NumberIntInfo : public BaseInfo { static const JSFunctionSpec methods[5]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(NumberIntInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NumberIntInfoSlotCount); static int ToNumberInt(JSContext* cx, JS::HandleObject object); static int ToNumberInt(JSContext* cx, JS::HandleValue value); diff --git a/src/mongo/scripting/mozjs/numberlong.h b/src/mongo/scripting/mozjs/numberlong.h index 7d6a6aa89cc..89d9cbce1fa 100644 --- a/src/mongo/scripting/mozjs/numberlong.h +++ b/src/mongo/scripting/mozjs/numberlong.h @@ -77,8 +77,7 @@ struct NumberLongInfo : public BaseInfo { static const JSFunctionSpec methods[6]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(NumberLongInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(NumberLongInfoSlotCount); static void postInstall(JSContext* cx, JS::HandleObject global, JS::HandleObject proto); diff --git a/src/mongo/scripting/mozjs/oid.h b/src/mongo/scripting/mozjs/oid.h index 72189a2a915..74651617bc1 100644 --- a/src/mongo/scripting/mozjs/oid.h +++ b/src/mongo/scripting/mozjs/oid.h @@ -60,8 +60,8 @@ struct OIDInfo : public BaseInfo { static const JSFunctionSpec methods[3]; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(OIDInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(OIDInfoSlotCount); + static const char* const className; static void postInstall(JSContext* cx, JS::HandleObject global, JS::HandleObject proto); diff --git a/src/mongo/scripting/mozjs/session.h b/src/mongo/scripting/mozjs/session.h index 0f3d5a19b54..d5cff762b47 100644 --- a/src/mongo/scripting/mozjs/session.h +++ b/src/mongo/scripting/mozjs/session.h @@ -67,8 +67,7 @@ struct SessionInfo : public BaseInfo { static const JSFunctionSpec methods[8]; static const char* const className; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(SessionInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(SessionInfoSlotCount); static const InstallType installType = InstallType::Private; static void make(JSContext* cx, diff --git a/src/mongo/scripting/mozjs/status.h b/src/mongo/scripting/mozjs/status.h index cf117e39098..0163a3ef25d 100644 --- a/src/mongo/scripting/mozjs/status.h +++ b/src/mongo/scripting/mozjs/status.h @@ -65,8 +65,7 @@ struct MongoStatusInfo : public BaseInfo { static const char* const className; static const char* const inheritFrom; - static const unsigned classFlags = - JSCLASS_HAS_RESERVED_SLOTS(MongoStatusInfoSlotCount) | BaseInfo::finalizeFlag; + static const unsigned classFlags = JSCLASS_HAS_RESERVED_SLOTS(MongoStatusInfoSlotCount); static const InstallType installType = InstallType::Private; static Status toStatus(JSContext* cx, JS::HandleObject object); diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index ccedf85437e..083b8652346 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -402,21 +402,6 @@ 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 diff --git a/src/third_party/SConscript b/src/third_party/SConscript index bd9ece96bbf..defef8bf334 100644 --- a/src/third_party/SConscript +++ b/src/third_party/SConscript @@ -78,7 +78,6 @@ def injectMozJS(thisEnv): thisEnv.Prepend(CPPDEFINES=[ 'DEBUG', 'JS_DEBUG', - 'JS_GC_ZEAL' ]) diff --git a/src/third_party/mozjs/SConscript b/src/third_party/mozjs/SConscript index 6ebd467c4bd..abbdef7e835 100644 --- a/src/third_party/mozjs/SConscript +++ b/src/third_party/mozjs/SConscript @@ -147,9 +147,6 @@ 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"]) diff --git a/src/third_party/mozjs/extract/js/src/util/Utility.cpp b/src/third_party/mozjs/extract/js/src/util/Utility.cpp index 2ba975bbec0..4fcacaba2e5 100644 --- a/src/third_party/mozjs/extract/js/src/util/Utility.cpp +++ b/src/third_party/mozjs/extract/js/src/util/Utility.cpp @@ -100,9 +100,6 @@ 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; @@ -124,7 +121,6 @@ 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 diff --git a/src/third_party/mozjs/extract/js/src/vm/JSObject.cpp b/src/third_party/mozjs/extract/js/src/vm/JSObject.cpp index 2b43c1f4269..292971cf3e4 100644 --- a/src/third_party/mozjs/extract/js/src/vm/JSObject.cpp +++ b/src/third_party/mozjs/extract/js/src/vm/JSObject.cpp @@ -3583,8 +3583,6 @@ 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_) { @@ -3597,7 +3595,6 @@ void js::AssertJSClassInvariants(const JSClass* clasp) { MOZ_ASSERT(!clasp->getOpsGetOwnPropertyDescriptor()); MOZ_ASSERT(!clasp->getOpsDeleteProperty()); } -#endif } /* static */ diff --git a/src/third_party/mozjs/get-sources.sh b/src/third_party/mozjs/get-sources.sh index ca1b4e6f870..b42e1398d76 100755 --- a/src/third_party/mozjs/get-sources.sh +++ b/src/third_party/mozjs/get-sources.sh @@ -9,7 +9,7 @@ set -vx NAME=spidermonkey LIB_GIT_BRANCH=spidermonkey-esr115.7-cpp-only -LIB_GIT_REVISION=8067826deecd3e89bdd85c80364ce5ce824c1f32 +LIB_GIT_REVISION=bb6edb4fcd43607c87de81df8c58db11a663634a LIB_GIT_REPO=git@github.com:mongodb-forks/spidermonkey.git DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/mozjs