From b9fee3a322d70e6cfc06f75d22a9237f10e98699 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Thu, 4 Aug 2016 11:27:24 -0500 Subject: [PATCH] Bug 1292190 - Baldr: fix include dependencies (r=bbouvier) MozReview-Commit-ID: BAte5sedqaS --HG-- extra : rebase_source : 182416a9af4551fd2caca589f2e154be1ec288fc --- js/src/asmjs/WasmInstance.h | 2 +- js/src/asmjs/WasmJS.h | 35 ++++------------------------------- js/src/asmjs/WasmTable.cpp | 2 ++ js/src/asmjs/WasmTypes.h | 30 ++++++++++++++++++++++++++++++ js/src/builtin/SIMD.h | 15 +++------------ js/src/builtin/TypedObject.h | 10 ++++++++++ js/src/jit/JitCompartment.h | 2 +- 7 files changed, 51 insertions(+), 45 deletions(-) diff --git a/js/src/asmjs/WasmInstance.h b/js/src/asmjs/WasmInstance.h index 3592867e3d32..8372a5cc7878 100644 --- a/js/src/asmjs/WasmInstance.h +++ b/js/src/asmjs/WasmInstance.h @@ -66,7 +66,7 @@ class Instance public: Instance(JSContext* cx, - Handle object, + HandleWasmInstanceObject object, UniqueCode code, HandleWasmMemoryObject memory, SharedTableVector&& tables, diff --git a/js/src/asmjs/WasmJS.h b/js/src/asmjs/WasmJS.h index 1f7c55ef2c6b..ce10939ef1e4 100644 --- a/js/src/asmjs/WasmJS.h +++ b/js/src/asmjs/WasmJS.h @@ -19,25 +19,16 @@ #ifndef wasm_js_h #define wasm_js_h +#include "asmjs/WasmTypes.h" #include "gc/Policy.h" -#include "js/UniquePtr.h" #include "vm/NativeObject.h" namespace js { class TypedArrayObject; -class WasmInstanceObject; namespace wasm { -// This is a widespread header, so keep out core wasm impl definitions. - -class Module; -class Instance; -class Table; - -typedef UniquePtr UniqueInstance; - // Return whether WebAssembly can be compiled on this platform. // This must be checked and must be true to call any of the top-level wasm // eval/compile methods. @@ -54,7 +45,7 @@ IsI64Implemented(); MOZ_MUST_USE bool Eval(JSContext* cx, Handle code, HandleObject importObj, - MutableHandle instanceObj); + MutableHandleWasmInstanceObject instanceObj); // The field name of the export object on the instance object. @@ -117,10 +108,6 @@ class WasmModuleObject : public NativeObject wasm::Module& module() const; }; -typedef Rooted RootedWasmModuleObject; -typedef Handle HandleWasmModuleObject; -typedef MutableHandle MutableHandleWasmModuleObject; - // The class of WebAssembly.Instance. Each WasmInstanceObject owns a // wasm::Instance. These objects are used both as content-facing JS objects and // as internal implementation details of asm.js. @@ -152,20 +139,15 @@ class WasmInstanceObject : public NativeObject static bool construct(JSContext*, unsigned, Value*); static WasmInstanceObject* create(JSContext* cx, HandleObject proto); - void init(wasm::UniqueInstance instance); + void init(UniquePtr instance); wasm::Instance& instance() const; static bool getExportedFunction(JSContext* cx, - Handle instanceObj, + HandleWasmInstanceObject instanceObj, uint32_t funcIndex, MutableHandleFunction fun); }; -typedef GCVector WasmInstanceObjectVector; -typedef Rooted RootedWasmInstanceObject; -typedef Handle HandleWasmInstanceObject; -typedef MutableHandle MutableHandleWasmInstanceObject; - // The class of WebAssembly.Memory. A WasmMemoryObject references an ArrayBuffer // or SharedArrayBuffer object which owns the actual memory. @@ -186,11 +168,6 @@ class WasmMemoryObject : public NativeObject ArrayBufferObjectMaybeShared& buffer() const; }; -typedef GCPtr GCPtrWasmMemoryObject; -typedef Rooted RootedWasmMemoryObject; -typedef Handle HandleWasmMemoryObject; -typedef MutableHandle MutableHandleWasmMemoryObject; - // The class of WebAssembly.Table. A WasmTableObject holds a refcount on a // wasm::Table, allowing a Table to be shared between multiple Instances // (eventually between multiple threads). @@ -234,10 +211,6 @@ class WasmTableObject : public NativeObject bool setInstance(JSContext* cx, uint32_t index, HandleWasmInstanceObject instanceObj); }; -typedef Rooted RootedWasmTableObject; -typedef Handle HandleWasmTableObject; -typedef MutableHandle MutableHandleWasmTableObject; - } // namespace js #endif // wasm_js_h diff --git a/js/src/asmjs/WasmTable.cpp b/js/src/asmjs/WasmTable.cpp index c1b6af1585a9..2a967257c4c8 100644 --- a/js/src/asmjs/WasmTable.cpp +++ b/js/src/asmjs/WasmTable.cpp @@ -18,6 +18,8 @@ #include "asmjs/WasmTable.h" +#include "jscntxt.h" + using namespace js; using namespace js::wasm; diff --git a/js/src/asmjs/WasmTypes.h b/js/src/asmjs/WasmTypes.h index 157cb68ff671..958bacdbfda9 100644 --- a/js/src/asmjs/WasmTypes.h +++ b/js/src/asmjs/WasmTypes.h @@ -34,12 +34,37 @@ #include "js/UniquePtr.h" #include "js/Utility.h" #include "js/Vector.h" +#include "vm/MallocProvider.h" namespace js { class PropertyName; namespace jit { struct BaselineScript; } +// This is a widespread header, so lets keep out the core wasm impl types. + +class WasmMemoryObject; +typedef GCPtr GCPtrWasmMemoryObject; +typedef Rooted RootedWasmMemoryObject; +typedef Handle HandleWasmMemoryObject; +typedef MutableHandle MutableHandleWasmMemoryObject; + +class WasmModuleObject; +typedef Rooted RootedWasmModuleObject; +typedef Handle HandleWasmModuleObject; +typedef MutableHandle MutableHandleWasmModuleObject; + +class WasmInstanceObject; +typedef GCVector WasmInstanceObjectVector; +typedef Rooted RootedWasmInstanceObject; +typedef Handle HandleWasmInstanceObject; +typedef MutableHandle MutableHandleWasmInstanceObject; + +class WasmTableObject; +typedef Rooted RootedWasmTableObject; +typedef Handle HandleWasmTableObject; +typedef MutableHandle MutableHandleWasmTableObject; + namespace wasm { using mozilla::DebugOnly; @@ -56,6 +81,11 @@ using mozilla::Some; typedef Vector Uint32Vector; +class Memory; +class Module; +class Instance; +class Table; + // To call Vector::podResizeToFit, a type must specialize mozilla::IsPod // which is pretty verbose to do within js::wasm, so factor that process out // into a macro. diff --git a/js/src/builtin/SIMD.h b/js/src/builtin/SIMD.h index 4e545bc89747..393e7df7408e 100644 --- a/js/src/builtin/SIMD.h +++ b/js/src/builtin/SIMD.h @@ -8,11 +8,11 @@ #define builtin_SIMD_h #include "jsapi.h" -#include "jsobj.h" +#include "NamespaceImports.h" -#include "builtin/TypedObject.h" +#include "builtin/TypedObjectConstants.h" +#include "jit/IonTypes.h" #include "js/Conversions.h" -#include "vm/GlobalObject.h" /* * JS SIMD functions. @@ -945,15 +945,6 @@ enum class SimdOperation { Last = Fn_fromFloat64x2Bits }; -class SimdObject : public JSObject -{ - public: - static const Class class_; - static MOZ_MUST_USE bool toString(JSContext* cx, unsigned int argc, Value* vp); - static MOZ_MUST_USE bool resolve(JSContext* cx, JS::HandleObject obj, JS::HandleId, - bool* resolved); -}; - // These classes implement the concept containing the following constraints: // - requires typename Elem: this is the scalar lane type, stored in each lane // of the SIMD vector. diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index ca9209176c29..e9a3fd63c218 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -724,6 +724,16 @@ class InlineOpaqueTypedObject : public InlineTypedObject static const Class class_; }; +// Class for the global SIMD object. +class SimdObject : public JSObject +{ + public: + static const Class class_; + static MOZ_MUST_USE bool toString(JSContext* cx, unsigned int argc, Value* vp); + static MOZ_MUST_USE bool resolve(JSContext* cx, JS::HandleObject obj, JS::HandleId, + bool* resolved); +}; + /* * Usage: NewOpaqueTypedObject(typeObj) * diff --git a/js/src/jit/JitCompartment.h b/js/src/jit/JitCompartment.h index 5f2c2bbf25f5..5a6bad1ab0a4 100644 --- a/js/src/jit/JitCompartment.h +++ b/js/src/jit/JitCompartment.h @@ -11,7 +11,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/MemoryReporting.h" -#include "builtin/SIMD.h" +#include "builtin/TypedObject.h" #include "jit/CompileInfo.h" #include "jit/ICStubSpace.h" #include "jit/IonCode.h"