diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-01-29 23:16:33 +0000 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-01-29 23:16:33 +0000 |
commit | 254fff93270089e8ac33be3f7e079aa8bfc3f7bc (patch) | |
tree | ef7f69b2cacc081a16b4da1b58c327f29ae0b8b4 /src/third_party/mozjs-60/mongo_sources | |
parent | a3d232b697dfc7c8833fc1855abbc190fe0d5970 (diff) | |
download | mongo-254fff93270089e8ac33be3f7e079aa8bfc3f7bc.tar.gz |
Revert "SERVER-29286 import and use mozjs-60"
This reverts commit a3d232b697dfc7c8833fc1855abbc190fe0d5970.
Diffstat (limited to 'src/third_party/mozjs-60/mongo_sources')
8 files changed, 0 insertions, 637 deletions
diff --git a/src/third_party/mozjs-60/mongo_sources/freeOpToJSContext.cpp b/src/third_party/mozjs-60/mongo_sources/freeOpToJSContext.cpp deleted file mode 100644 index 227c7c4ff2e..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/freeOpToJSContext.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "jsapi.h" -#include "gc/FreeOp.h" -#include "vm/Runtime.h" -#include "vm/JSContext.h" - -#include "mongo/scripting/mozjs/freeOpToJSContext.h" - -namespace mongo { -namespace mozjs { - -JSContext* freeOpToJSContext(js::FreeOp* fop) { - return fop->runtime()->activeContextFromOwnThread(); -} - -} // namespace mozjs -} // namespace mongo diff --git a/src/third_party/mozjs-60/mongo_sources/jscustomallocator.h b/src/third_party/mozjs-60/mongo_sources/jscustomallocator.h deleted file mode 100644 index a74e1f39385..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/jscustomallocator.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2015 MongoDB Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the GNU Affero General Public License in all respects - * for all of the code used other than as permitted herein. If you modify - * file(s) with this exception, you may extend this exception to your - * version of the file(s), but you are not obligated to do so. If you do not - * wish to do so, delete this exception statement from your version. If you - * delete this exception statement from all source files in the program, - * then also delete it in the license file. - */ - -#pragma once - -#include <cstdlib> -#include <cstring> - -#include <jstypes.h> - -#include "jscustomallocator_oom.h" - -namespace mongo { -namespace sm { -JS_PUBLIC_API(size_t) get_total_bytes(); -JS_PUBLIC_API(void) reset(size_t max_bytes); -JS_PUBLIC_API(size_t) get_max_bytes(); -} // namespace sm -} // namespace mongo - -#ifdef DEBUG -extern JS_PUBLIC_DATA(uint32_t) OOM_maxAllocations; -extern JS_PUBLIC_DATA(uint32_t) OOM_counter; -#endif - -JS_PUBLIC_API(void*) js_malloc(size_t bytes); -JS_PUBLIC_API(void*) js_calloc(size_t bytes); -JS_PUBLIC_API(void*) js_calloc(size_t nmemb, size_t size); -JS_PUBLIC_API(void) js_free(void* p); -JS_PUBLIC_API(void*) js_realloc(void* p, size_t bytes); - -// js_strdup was only partially removed from the custom allocator api. -// The custom allocator still needs to declare it, but can't define it because -// a it's defined elsewhere -JS_PUBLIC_API(char*) js_strdup(const char* s); - -#define JS_OOM_POSSIBLY_FAIL() do {} while(0) -#define JS_OOM_POSSIBLY_FAIL_BOOL() do {} while(0) -#define JS_STACK_OOM_POSSIBLY_FAIL() do {} while(0) -#define JS_STACK_OOM_POSSIBLY_FAIL_REPORT() do {} while(0) -#define JS_INTERRUPT_POSSIBLY_FAIL() do {} while(0) - -namespace js { - -extern void InitMallocAllocator(); -extern void ShutDownMallocAllocator(); - -} /* namespace js */ diff --git a/src/third_party/mozjs-60/mongo_sources/jscustomallocator_oom.h b/src/third_party/mozjs-60/mongo_sources/jscustomallocator_oom.h deleted file mode 100644 index 950920d7d1d..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/jscustomallocator_oom.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * 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/. */ - -/** - * Defines, Enums, Functions, and Types extract from include/js/Utility.h - * to support MongoDB's jscustomallocator.h - */ - -#pragma once - -#include <cstdlib> - -namespace js { - -enum ThreadType { - THREAD_TYPE_NONE = 0, // 0 - THREAD_TYPE_COOPERATING, // 1 - THREAD_TYPE_WASM, // 2 - THREAD_TYPE_ION, // 3 - THREAD_TYPE_PARSE, // 4 - THREAD_TYPE_COMPRESS, // 5 - THREAD_TYPE_GCHELPER, // 6 - THREAD_TYPE_GCPARALLEL, // 7 - THREAD_TYPE_PROMISE_TASK, // 8 - THREAD_TYPE_ION_FREE, // 9 - THREAD_TYPE_WASM_TIER2, // 10 - THREAD_TYPE_WORKER, // 11 - THREAD_TYPE_MAX // Used to check shell function arguments -}; - -namespace oom { - -# if defined(DEBUG) || defined(JS_OOM_BREAKPOINT) -extern bool InitThreadType(void); -extern void SetThreadType(ThreadType); -extern uint32_t GetThreadType(void); -# else -inline bool InitThreadType(void) { return true; } -inline void SetThreadType(ThreadType t) {}; -inline uint32_t GetThreadType(void) { return 0; } -# endif -} /* namespace oom */ -} /* namespace js */ - -# if defined(DEBUG) || defined(JS_OOM_BREAKPOINT) - -/* - * In order to test OOM conditions, when the testing function - * oomAfterAllocations COUNT is passed, we fail continuously after the NUM'th - * allocation from now. - */ -extern JS_PUBLIC_DATA(uint32_t) OOM_maxAllocations; /* set in builtin/TestingFunctions.cpp */ -extern JS_PUBLIC_DATA(uint32_t) OOM_counter; /* data race, who cares. */ -extern JS_PUBLIC_DATA(bool) OOM_failAlways; - -#ifdef JS_OOM_BREAKPOINT -static MOZ_NEVER_INLINE void js_failedAllocBreakpoint() { asm(""); } -#define JS_OOM_CALL_BP_FUNC() js_failedAllocBreakpoint() -#else -#define JS_OOM_CALL_BP_FUNC() do {} while(0) -#endif - -namespace js { -namespace oom { - -extern JS_PUBLIC_DATA(uint32_t) targetThread; - -static inline bool -IsThreadSimulatingOOM() -{ - return false; -} - -static inline bool -IsSimulatedOOMAllocation() -{ - return false; -} - -static inline bool -ShouldFailWithOOM() -{ - return false; -} - -# else - -namespace js { -namespace oom { -static inline bool IsSimulatedOOMAllocation() { return false; } -static inline bool ShouldFailWithOOM() { return false; } - -# endif /* DEBUG || JS_OOM_BREAKPOINT */ - -} /* namespace oom */ -} /* namespace js */ - -# define JS_OOM_POSSIBLY_FAIL() do {} while(0) -# define JS_OOM_POSSIBLY_FAIL_BOOL() do {} while(0) - -namespace js { - -/* Disable OOM testing in sections which are not OOM safe. */ -struct MOZ_RAII AutoEnterOOMUnsafeRegion -{ - MOZ_NORETURN MOZ_COLD void crash(const char* reason); - MOZ_NORETURN MOZ_COLD void crash(size_t size, const char* reason); - - using AnnotateOOMAllocationSizeCallback = void(*)(size_t); - static AnnotateOOMAllocationSizeCallback annotateOOMSizeCallback; - -#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT) - AutoEnterOOMUnsafeRegion() - : oomEnabled_(oom::IsThreadSimulatingOOM() && OOM_maxAllocations != UINT32_MAX), - oomAfter_(0) - { - if (oomEnabled_) { - oomAfter_ = int64_t(OOM_maxAllocations) - OOM_counter; - OOM_maxAllocations = UINT32_MAX; - } - } - - ~AutoEnterOOMUnsafeRegion() { - if (oomEnabled_) { - MOZ_ASSERT(OOM_maxAllocations == UINT32_MAX); - int64_t maxAllocations = OOM_counter + oomAfter_; - MOZ_ASSERT(maxAllocations >= 0 && maxAllocations < UINT32_MAX, - "alloc count + oom limit exceeds range, your oom limit is probably too large"); - OOM_maxAllocations = uint32_t(maxAllocations); - } - } - - private: - bool oomEnabled_; - int64_t oomAfter_; -#endif - -}; -} /* namespace js */ diff --git a/src/third_party/mozjs-60/mongo_sources/mongo/scripting/mozjs/freeOpToJSContext.h b/src/third_party/mozjs-60/mongo_sources/mongo/scripting/mozjs/freeOpToJSContext.h deleted file mode 100644 index e0df8c62c95..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/mongo/scripting/mozjs/freeOpToJSContext.h +++ /dev/null @@ -1,41 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include "jsapi.h" - -namespace mongo { -namespace mozjs { - -JSContext* freeOpToJSContext(js::FreeOp* fop); - -} // namespace mozjs -} // namespace mongo diff --git a/src/third_party/mozjs-60/mongo_sources/mongo/scripting/mozjs/mongoErrorReportToString.h b/src/third_party/mozjs-60/mongo_sources/mongo/scripting/mozjs/mongoErrorReportToString.h deleted file mode 100644 index 901115b1a25..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/mongo/scripting/mozjs/mongoErrorReportToString.h +++ /dev/null @@ -1,32 +0,0 @@ - -/** - * Copyright (C) 2019-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -JSString* -mongoErrorReportToString(JSContext* cx, JSErrorReport* reportp); diff --git a/src/third_party/mozjs-60/mongo_sources/mongoErrorReportToString.cpp b/src/third_party/mozjs-60/mongo_sources/mongoErrorReportToString.cpp deleted file mode 100644 index d269a3852d7..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/mongoErrorReportToString.cpp +++ /dev/null @@ -1,101 +0,0 @@ - -/** - * Copyright (C) 2019-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "jsexn.h" - -#include "mozilla/Sprintf.h" - -#include <string.h> - -#include "jsapi.h" -#include "jsnum.h" -#include "jstypes.h" -#include "jsutil.h" - -#include "gc/FreeOp.h" -#include "gc/Marking.h" -#include "js/CharacterEncoding.h" -#include "js/Wrapper.h" -#include "util/StringBuffer.h" -#include "vm/ErrorObject.h" -#include "vm/GlobalObject.h" -#include "vm/JSContext.h" -#include "vm/JSFunction.h" -#include "vm/JSObject.h" -#include "vm/JSScript.h" -#include "vm/SavedStacks.h" -#include "vm/SelfHosting.h" -#include "vm/StringType.h" - -#include "vm/ErrorObject-inl.h" -#include "vm/JSObject-inl.h" -#include "vm/SavedStacks-inl.h" - -#include "mongo/scripting/mozjs/mongoErrorReportToString.h" - -using namespace js; -using namespace js::gc; - -JSString* -mongoErrorReportToString(JSContext* cx, JSErrorReport* reportp) -{ - /* - * We do NOT want to use GetErrorTypeName() here because it will not do the - * "right thing" for JSEXN_INTERNALERR. That is, the caller of this API - * expects that "InternalError: " will be prepended but GetErrorTypeName - * goes out of its way to avoid this. - */ - JSExnType type = static_cast<JSExnType>(reportp->exnType); - RootedString str(cx); - if (type != JSEXN_WARN && type != JSEXN_NOTE) - str = ClassName(GetExceptionProtoKey(type), cx); - - /* - * If "str" is null at this point, that means we just want to use - * message without prefixing it with anything. - */ - if (str) { - RootedString separator(cx, JS_NewUCStringCopyN(cx, u": ", 2)); - if (!separator) - return nullptr; - str = ConcatStrings<CanGC>(cx, str, separator); - if (!str) - return nullptr; - } - - RootedString message(cx, reportp->newMessageString(cx)); - if (!message) - return nullptr; - - if (!str) - return message; - - return ConcatStrings<CanGC>(cx, str, message); -} diff --git a/src/third_party/mozjs-60/mongo_sources/vm/PosixNSPR.cpp b/src/third_party/mozjs-60/mongo_sources/vm/PosixNSPR.cpp deleted file mode 100644 index 2abfcfe2afe..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/vm/PosixNSPR.cpp +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This file is purposefully empty. We use it to satisfy the unity headers that - * mozilla's configure generates. It's fine that it's empty because we supply - * all the symbols we need in src/mongo/scripting/mozjs/PosixNSPR.cpp - */ diff --git a/src/third_party/mozjs-60/mongo_sources/vm/PosixNSPR.h b/src/third_party/mozjs-60/mongo_sources/vm/PosixNSPR.h deleted file mode 100644 index f2efe8effdf..00000000000 --- a/src/third_party/mozjs-60/mongo_sources/vm/PosixNSPR.h +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * 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/. */ - -#ifndef vm_PosixNSPR_h -#define vm_PosixNSPR_h - -#include <stdint.h> -#include "jspubtd.h" - -namespace nspr { -class Thread; -class Lock; -class CondVar; -}; - -typedef nspr::Thread PRThread; -typedef nspr::Lock PRLock; -typedef nspr::CondVar PRCondVar; - -namespace mongo { -namespace mozjs { -void PR_BindThread(PRThread* thread); -PRThread* PR_CreateFakeThread(); -void PR_DestroyFakeThread(PRThread* thread); -} // namespace mozjs -} // namespace mongo - -enum PRThreadType { - PR_USER_THREAD, - PR_SYSTEM_THREAD -}; - -enum PRThreadPriority -{ - PR_PRIORITY_FIRST = 0, - PR_PRIORITY_LOW = 0, - PR_PRIORITY_NORMAL = 1, - PR_PRIORITY_HIGH = 2, - PR_PRIORITY_URGENT = 3, - PR_PRIORITY_LAST = 3 -}; - -enum PRThreadScope { - PR_LOCAL_THREAD, - PR_GLOBAL_THREAD, - PR_GLOBAL_BOUND_THREAD -}; - -enum PRThreadState { - PR_JOINABLE_THREAD, - PR_UNJOINABLE_THREAD -}; - -PRThread* -PR_CreateThread(PRThreadType type, - void (*start)(void* arg), - void* arg, - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, - uint32_t stackSize); - -typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus; - -PRStatus -PR_JoinThread(PRThread* thread); - -PRThread* -PR_GetCurrentThread(); - -PRStatus -PR_SetCurrentThreadName(const char* name); - -typedef void (*PRThreadPrivateDTOR)(void* priv); - -PRStatus -PR_NewThreadPrivateIndex(unsigned* newIndex, PRThreadPrivateDTOR destructor); - -PRStatus -PR_SetThreadPrivate(unsigned index, void* priv); - -void* -PR_GetThreadPrivate(unsigned index); - -struct PRCallOnceType { - int initialized; - int32_t inProgress; - PRStatus status; -}; - -typedef PRStatus (*PRCallOnceFN)(); - -PRStatus -PR_CallOnce(PRCallOnceType* once, PRCallOnceFN func); - -typedef PRStatus (*PRCallOnceWithArgFN)(void*); - -PRStatus -PR_CallOnceWithArg(PRCallOnceType* once, PRCallOnceWithArgFN func, void* arg); - -PRLock* -PR_NewLock(); - -void -PR_DestroyLock(PRLock* lock); - -void -PR_Lock(PRLock* lock); - -PRStatus -PR_Unlock(PRLock* lock); - -PRCondVar* -PR_NewCondVar(PRLock* lock); - -void -PR_DestroyCondVar(PRCondVar* cvar); - -PRStatus -PR_NotifyCondVar(PRCondVar* cvar); - -PRStatus -PR_NotifyAllCondVar(PRCondVar* cvar); - -#define PR_INTERVAL_MIN 1000UL -#define PR_INTERVAL_MAX 100000UL - -#define PR_INTERVAL_NO_WAIT 0UL -#define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL - -uint32_t -PR_MillisecondsToInterval(uint32_t milli); - -uint32_t -PR_MicrosecondsToInterval(uint32_t micro); - -uint32_t -PR_TicksPerSecond(); - -PRStatus -PR_WaitCondVar(PRCondVar* cvar, uint32_t timeout); - -int32_t -PR_FileDesc2NativeHandle(PRFileDesc* fd); - -enum PRFileType -{ - PR_FILE_FILE = 1, - PR_FILE_DIRECTORY = 2, - PR_FILE_OTHER = 3 -}; - -struct PRFileInfo -{ - PRFileType type; - int32_t size; - int64_t creationTime; - int64_t modifyTime; -}; - -PRStatus -PR_GetOpenFileInfo(PRFileDesc *fd, PRFileInfo *info); - -enum PRSeekWhence -{ - PR_SEEK_SET = 0, - PR_SEEK_CUR = 1, - PR_SEEK_END = 2 -}; - -int32_t -PR_Seek(PRFileDesc *fd, int32_t offset, PRSeekWhence whence); - -enum PRFileMapProtect -{ - PR_PROT_READONLY, - PR_PROT_READWRITE, - PR_PROT_WRITECOPY -}; - -struct PRFileMap; - -PRFileMap* -PR_CreateFileMap(PRFileDesc *fd, int64_t size, PRFileMapProtect prot); - -void* -PR_MemMap(PRFileMap *fmap, int64_t offset, uint32_t len); - -PRStatus -PR_MemUnmap(void *addr, uint32_t len); - -PRStatus -PR_CloseFileMap(PRFileMap *fmap); - -#endif /* vm_PosixNSPR_h */ |