From 3921ce61cc453de33e43c85e03915e175e29231f Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Thu, 30 Aug 2018 20:10:21 +0100 Subject: [PATCH] Bug 1486782 - Remove unnecessary includes of gc/Zone.h r=sfink --- js/src/ctypes/CTypes.cpp | 1 - js/src/frontend/BinToken.cpp | 2 +- js/src/frontend/BinTokenReaderBase.cpp | 1 - js/src/frontend/BinTokenReaderMultipart.cpp | 1 - js/src/frontend/BinTokenReaderTester.cpp | 1 - js/src/frontend/TokenStream.h | 4 +- js/src/gc/GCInternals.h | 3 +- js/src/gc/WeakMap-inl.h | 1 - js/src/jsapi-tests/testBinASTReader.cpp | 1 - .../jsapi-tests/testBinTokenReaderTester.cpp | 1 - js/src/jsapi-tests/testGCUniqueId.cpp | 1 - js/src/jsapi-tests/testGCWeakRef.cpp | 1 - js/src/jsapi-tests/testIsInsideNursery.cpp | 1 - js/src/jsfriendapi.cpp | 2 +- js/src/shell/js.cpp | 3 +- js/src/vm/Compartment.cpp | 2 +- js/src/vm/Compartment.h | 7 ++-- js/src/vm/GlobalObject.h | 2 +- js/src/vm/ObjectGroup.cpp | 1 - js/src/vm/Realm.h | 1 - js/src/vm/RegExpConstants.h | 42 +++++++++++++++++++ js/src/vm/RegExpShared.h | 28 +------------ js/src/vm/UnboxedObject.h | 7 ++-- 23 files changed, 59 insertions(+), 55 deletions(-) create mode 100644 js/src/vm/RegExpConstants.h diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 9623f055bcfc..a5b528850c5c 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -38,7 +38,6 @@ #include "ctypes/Library.h" #include "gc/FreeOp.h" #include "gc/Policy.h" -#include "gc/Zone.h" #include "jit/AtomicOperations.h" #include "js/AutoByteString.h" #include "js/StableStringChars.h" diff --git a/js/src/frontend/BinToken.cpp b/js/src/frontend/BinToken.cpp index c5c243621e33..601f34173b80 100644 --- a/js/src/frontend/BinToken.cpp +++ b/js/src/frontend/BinToken.cpp @@ -12,8 +12,8 @@ #include "frontend/BinSourceRuntimeSupport.h" #include "frontend/TokenStream.h" -#include "gc/Zone.h" #include "js/Result.h" +#include "vm/Runtime.h" namespace js { namespace frontend { diff --git a/js/src/frontend/BinTokenReaderBase.cpp b/js/src/frontend/BinTokenReaderBase.cpp index 9e951a11094e..d56e593977fb 100644 --- a/js/src/frontend/BinTokenReaderBase.cpp +++ b/js/src/frontend/BinTokenReaderBase.cpp @@ -7,7 +7,6 @@ #include "frontend/BinTokenReaderBase.h" #include "frontend/BinSource-macros.h" -#include "gc/Zone.h" #include "js/Result.h" namespace js { diff --git a/js/src/frontend/BinTokenReaderMultipart.cpp b/js/src/frontend/BinTokenReaderMultipart.cpp index 116333667387..ae361a36970a 100644 --- a/js/src/frontend/BinTokenReaderMultipart.cpp +++ b/js/src/frontend/BinTokenReaderMultipart.cpp @@ -16,7 +16,6 @@ #include "frontend/BinSource-macros.h" #include "frontend/BinSourceRuntimeSupport.h" -#include "gc/Zone.h" #include "js/Result.h" namespace js { diff --git a/js/src/frontend/BinTokenReaderTester.cpp b/js/src/frontend/BinTokenReaderTester.cpp index c71aedf73a6d..ac0bb7641fb0 100644 --- a/js/src/frontend/BinTokenReaderTester.cpp +++ b/js/src/frontend/BinTokenReaderTester.cpp @@ -13,7 +13,6 @@ #include "mozilla/PodOperations.h" #include "frontend/BinSource-macros.h" -#include "gc/Zone.h" #include "js/Result.h" namespace js { diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h index 8e837140887b..796bf0225231 100644 --- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -210,7 +210,9 @@ #include "util/Text.h" #include "util/Unicode.h" #include "vm/ErrorReporting.h" -#include "vm/RegExpShared.h" +#include "vm/JSAtom.h" +#include "vm/RegExpConstants.h" +#include "vm/StringType.h" struct JSContext; struct KeywordInfo; diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index d02153ec6c3f..89280e6386b4 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -16,7 +16,6 @@ #include "gc/GC.h" #include "gc/RelocationOverlay.h" -#include "gc/Zone.h" #include "vm/HelperThreads.h" #include "vm/Runtime.h" @@ -321,7 +320,7 @@ IsOOMReason(JS::gcreason::Reason reason) } TenuredCell* -AllocateCellInGC(Zone* zone, AllocKind thingKind); +AllocateCellInGC(JS::Zone* zone, AllocKind thingKind); } /* namespace gc */ } /* namespace js */ diff --git a/js/src/gc/WeakMap-inl.h b/js/src/gc/WeakMap-inl.h index 10affa40b699..1061c8cf51b7 100644 --- a/js/src/gc/WeakMap-inl.h +++ b/js/src/gc/WeakMap-inl.h @@ -9,7 +9,6 @@ #include "gc/WeakMap.h" -#include "gc/Zone.h" #include "vm/JSContext.h" namespace js { diff --git a/js/src/jsapi-tests/testBinASTReader.cpp b/js/src/jsapi-tests/testBinASTReader.cpp index ced2401bc753..64749d4870f1 100644 --- a/js/src/jsapi-tests/testBinASTReader.cpp +++ b/js/src/jsapi-tests/testBinASTReader.cpp @@ -27,7 +27,6 @@ #include "frontend/FullParseHandler.h" #include "frontend/ParseContext.h" #include "frontend/Parser.h" -#include "gc/Zone.h" #include "js/Vector.h" #include "jsapi-tests/tests.h" diff --git a/js/src/jsapi-tests/testBinTokenReaderTester.cpp b/js/src/jsapi-tests/testBinTokenReaderTester.cpp index f0683728fe7d..c2695ad1709d 100644 --- a/js/src/jsapi-tests/testBinTokenReaderTester.cpp +++ b/js/src/jsapi-tests/testBinTokenReaderTester.cpp @@ -18,7 +18,6 @@ #include "mozilla/Maybe.h" #include "frontend/BinTokenReaderTester.h" -#include "gc/Zone.h" #include "js/Vector.h" diff --git a/js/src/jsapi-tests/testGCUniqueId.cpp b/js/src/jsapi-tests/testGCUniqueId.cpp index 945c4c7a6bc1..2706218d3d82 100644 --- a/js/src/jsapi-tests/testGCUniqueId.cpp +++ b/js/src/jsapi-tests/testGCUniqueId.cpp @@ -6,7 +6,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "gc/GCInternals.h" -#include "gc/Zone.h" #include "js/GCVector.h" #include "jsapi-tests/tests.h" diff --git a/js/src/jsapi-tests/testGCWeakRef.cpp b/js/src/jsapi-tests/testGCWeakRef.cpp index f51e7febc766..585db57a9770 100644 --- a/js/src/jsapi-tests/testGCWeakRef.cpp +++ b/js/src/jsapi-tests/testGCWeakRef.cpp @@ -6,7 +6,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "gc/Barrier.h" -#include "gc/Zone.h" #include "js/RootingAPI.h" #include "jsapi-tests/tests.h" diff --git a/js/src/jsapi-tests/testIsInsideNursery.cpp b/js/src/jsapi-tests/testIsInsideNursery.cpp index 618b3c4d1637..d942fc21b481 100644 --- a/js/src/jsapi-tests/testIsInsideNursery.cpp +++ b/js/src/jsapi-tests/testIsInsideNursery.cpp @@ -5,7 +5,6 @@ * 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/. */ -#include "gc/Zone.h" #include "jsapi-tests/tests.h" #include "vm/JSContext-inl.h" diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 88a3d67711b3..af0491ba789e 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -219,7 +219,7 @@ JS_ScriptHasMutedErrors(JSScript* script) } JS_FRIEND_API(bool) -JS_WrapPropertyDescriptor(JSContext* cx, JS::MutableHandle desc) +JS_WrapPropertyDescriptor(JSContext* cx, JS::MutableHandle desc) { return cx->compartment()->wrap(cx, desc); } diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 70ddf5fe4d59..06d2373723e8 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -71,7 +71,6 @@ #endif // defined(JS_BUILD_BINAST) #include "frontend/Parser.h" #include "gc/PublicIterators.h" -#include "gc/Zone.h" #include "jit/arm/Simulator-arm.h" #include "jit/InlinableNatives.h" #include "jit/Ion.h" @@ -4310,7 +4309,7 @@ EnsureModuleLoaderScriptObjectMap(JSContext* cx) if (priv->moduleLoaderScriptObjectMap) return priv->moduleLoaderScriptObjectMap.get(); - Zone* zone = cx->zone(); + JS::Zone* zone = cx->zone(); auto* map = cx->new_(zone); if (!map) return nullptr; diff --git a/js/src/vm/Compartment.cpp b/js/src/vm/Compartment.cpp index a6db4c09e062..35b789593913 100644 --- a/js/src/vm/Compartment.cpp +++ b/js/src/vm/Compartment.cpp @@ -348,7 +348,7 @@ Compartment::rewrap(JSContext* cx, MutableHandleObject obj, HandleObject existin } bool -Compartment::wrap(JSContext* cx, MutableHandle desc) +Compartment::wrap(JSContext* cx, MutableHandle desc) { if (!wrap(cx, desc.object())) return false; diff --git a/js/src/vm/Compartment.h b/js/src/vm/Compartment.h index eb8838d1a571..8dd5cb3f7f54 100644 --- a/js/src/vm/Compartment.h +++ b/js/src/vm/Compartment.h @@ -17,13 +17,14 @@ #include "gc/Barrier.h" #include "gc/NurseryAwareHashMap.h" -#include "gc/Zone.h" #include "js/UniquePtr.h" +#include "vm/JSObject.h" +#include "vm/JSScript.h" namespace js { namespace gc { -template class ComponentFinder; +struct ZoneComponentFinder; } // namespace gc class CrossCompartmentKey @@ -446,7 +447,7 @@ class JS::Compartment MOZ_MUST_USE bool wrap(JSContext* cx, js::MutableHandle bi); #endif MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandleObject obj); - MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle desc); + MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle desc); MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle> vec); MOZ_MUST_USE bool rewrap(JSContext* cx, JS::MutableHandleObject obj, JS::HandleObject existing); diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h index 2c0bdffb965e..9c22478d91ca 100644 --- a/js/src/vm/GlobalObject.h +++ b/js/src/vm/GlobalObject.h @@ -17,7 +17,6 @@ #include "vm/ErrorObject.h" #include "vm/JSFunction.h" #include "vm/Realm.h" -#include "vm/RegExpStatics.h" #include "vm/Runtime.h" namespace js { @@ -25,6 +24,7 @@ namespace js { class Debugger; class TypedObjectModuleObject; class LexicalEnvironmentObject; +class RegExpStatics; /* * Global object slots are reserved as follows: diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index 4bac9ba3b711..717d419ceab5 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -16,7 +16,6 @@ #include "gc/HashUtil.h" #include "gc/Policy.h" #include "gc/StoreBuffer.h" -#include "gc/Zone.h" #include "js/CharacterEncoding.h" #include "js/UniquePtr.h" #include "vm/ArrayObject.h" diff --git a/js/src/vm/Realm.h b/js/src/vm/Realm.h index f94b66b13592..53f5236065f8 100644 --- a/js/src/vm/Realm.h +++ b/js/src/vm/Realm.h @@ -20,7 +20,6 @@ #include "builtin/Array.h" #include "gc/Barrier.h" -#include "gc/Zone.h" #include "js/UniquePtr.h" #include "vm/ArrayBufferObject.h" #include "vm/Compartment.h" diff --git a/js/src/vm/RegExpConstants.h b/js/src/vm/RegExpConstants.h new file mode 100644 index 000000000000..983983eadbe2 --- /dev/null +++ b/js/src/vm/RegExpConstants.h @@ -0,0 +1,42 @@ +/* -*- 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_RegExpConstants_h +#define vm_RegExpConstants_h + +#include "builtin/SelfHostingDefines.h" + +namespace js { + +enum RegExpFlag : uint8_t +{ + IgnoreCaseFlag = 0x01, + GlobalFlag = 0x02, + MultilineFlag = 0x04, + StickyFlag = 0x08, + UnicodeFlag = 0x10, + + NoFlags = 0x00, + AllFlags = 0x1f +}; + +static_assert(IgnoreCaseFlag == REGEXP_IGNORECASE_FLAG && + GlobalFlag == REGEXP_GLOBAL_FLAG && + MultilineFlag == REGEXP_MULTILINE_FLAG && + StickyFlag == REGEXP_STICKY_FLAG && + UnicodeFlag == REGEXP_UNICODE_FLAG, + "Flag values should be in sync with self-hosted JS"); + +enum RegExpRunStatus +{ + RegExpRunStatus_Error, + RegExpRunStatus_Success, + RegExpRunStatus_Success_NotFound +}; + +} /* namespace js */ + +#endif /* vm_RegExpConstants_h */ diff --git a/js/src/vm/RegExpShared.h b/js/src/vm/RegExpShared.h index 6f935a670cfe..289c6fe83eb5 100644 --- a/js/src/vm/RegExpShared.h +++ b/js/src/vm/RegExpShared.h @@ -15,7 +15,6 @@ #include "mozilla/Assertions.h" #include "mozilla/MemoryReporting.h" -#include "builtin/SelfHostingDefines.h" #include "gc/Barrier.h" #include "gc/Heap.h" #include "gc/Marking.h" @@ -25,6 +24,7 @@ #include "js/Vector.h" #include "vm/ArrayObject.h" #include "vm/JSAtom.h" +#include "vm/RegExpConstants.h" namespace js { @@ -38,32 +38,6 @@ using RootedRegExpShared = JS::Rooted; using HandleRegExpShared = JS::Handle; using MutableHandleRegExpShared = JS::MutableHandle; -enum RegExpFlag : uint8_t -{ - IgnoreCaseFlag = 0x01, - GlobalFlag = 0x02, - MultilineFlag = 0x04, - StickyFlag = 0x08, - UnicodeFlag = 0x10, - - NoFlags = 0x00, - AllFlags = 0x1f -}; - -static_assert(IgnoreCaseFlag == REGEXP_IGNORECASE_FLAG && - GlobalFlag == REGEXP_GLOBAL_FLAG && - MultilineFlag == REGEXP_MULTILINE_FLAG && - StickyFlag == REGEXP_STICKY_FLAG && - UnicodeFlag == REGEXP_UNICODE_FLAG, - "Flag values should be in sync with self-hosted JS"); - -enum RegExpRunStatus -{ - RegExpRunStatus_Error, - RegExpRunStatus_Success, - RegExpRunStatus_Success_NotFound -}; - /* * A RegExpShared is the compiled representation of a regexp. A RegExpShared is * potentially pointed to by multiple RegExpObjects. Additionally, C++ code may diff --git a/js/src/vm/UnboxedObject.h b/js/src/vm/UnboxedObject.h index 8dc911596952..dd1ffe5776ed 100644 --- a/js/src/vm/UnboxedObject.h +++ b/js/src/vm/UnboxedObject.h @@ -8,7 +8,6 @@ #define vm_UnboxedObject_h #include "gc/DeletePolicy.h" -#include "gc/Zone.h" #include "vm/JSObject.h" #include "vm/Runtime.h" #include "vm/TypeInference.h" @@ -59,7 +58,7 @@ class UnboxedLayout : public mozilla::LinkedListElement typedef Vector PropertyVector; private: - Zone* zone_; + JS::Zone* zone_; // If objects in this group have ever been converted to native objects, // these store the corresponding native group and initial shape for such @@ -99,13 +98,13 @@ class UnboxedLayout : public mozilla::LinkedListElement GCPtrJitCode constructorCode_; public: - explicit UnboxedLayout(Zone* zone) + explicit UnboxedLayout(JS::Zone* zone) : zone_(zone), nativeGroup_(nullptr), nativeShape_(nullptr), allocationScript_(nullptr), allocationPc_(nullptr), replacementGroup_(nullptr), size_(0), newScript_(nullptr), traceList_(nullptr), constructorCode_(nullptr) {} - Zone* zone() const { return zone_; } + JS::Zone* zone() const { return zone_; } bool initProperties(const PropertyVector& properties, size_t size) { size_ = size;