diff options
author | Matt A. Tobin <email@mattatobin.com> | 2022-05-29 00:47:25 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2022-05-29 00:47:25 -0500 |
commit | f11b40c3ab4a5a766b0b71ab1e9a6199b23bbfeb (patch) | |
tree | 7b10fdf57c04235448662d0256ef76fa48a1d076 /js/src/vm/SavedStacks.h | |
parent | 5310bcfbad6c8687d0bdbe5e49fb73858dcc1631 (diff) | |
download | aura-central-f11b40c3ab4a5a766b0b71ab1e9a6199b23bbfeb.tar.gz |
[JS:Engine] Remove the use of tagged shape pointers
Diffstat (limited to 'js/src/vm/SavedStacks.h')
-rw-r--r-- | js/src/vm/SavedStacks.h | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/js/src/vm/SavedStacks.h b/js/src/vm/SavedStacks.h index c6bda2831..3ea6c4087 100644 --- a/js/src/vm/SavedStacks.h +++ b/js/src/vm/SavedStacks.h @@ -265,24 +265,6 @@ class SavedStacks { uint32_t column; }; - template <typename Outer> - struct LocationValueOperations { - JSAtom* source() const { return loc().source; } - size_t line() const { return loc().line; } - uint32_t column() const { return loc().column; } - private: - const LocationValue& loc() const { return static_cast<const Outer*>(this)->get(); } - }; - - template <typename Outer> - struct MutableLocationValueOperations : public LocationValueOperations<Outer> { - void setSource(JSAtom* v) { loc().source = v; } - void setLine(size_t v) { loc().line = v; } - void setColumn(uint32_t v) { loc().column = v; } - private: - LocationValue& loc() { return static_cast<Outer*>(this)->get(); } - }; - private: struct PCLocationHasher : public DefaultHasher<PCKey> { using ScriptPtrHasher = DefaultHasher<JSScript*>; @@ -313,15 +295,32 @@ class SavedStacks { MutableHandle<LocationValue> locationp); }; -template <> -class RootedBase<SavedStacks::LocationValue> - : public SavedStacks::MutableLocationValueOperations<JS::Rooted<SavedStacks::LocationValue>> -{}; +template <typename Wrapper> +struct WrappedPtrOperations<SavedStacks::LocationValue, Wrapper> +{ + JSAtom* source() const { return loc().source; } + size_t line() const { return loc().line; } + uint32_t column() const { return loc().column; } + + private: + const SavedStacks::LocationValue& loc() const { + return static_cast<const Wrapper*>(this)->get(); + } +}; + +template <typename Wrapper> +struct MutableWrappedPtrOperations<SavedStacks::LocationValue, Wrapper> + : public WrappedPtrOperations<SavedStacks::LocationValue, Wrapper> +{ + void setSource(JSAtom* v) { loc().source = v; } + void setLine(size_t v) { loc().line = v; } + void setColumn(uint32_t v) { loc().column = v; } -template <> -class MutableHandleBase<SavedStacks::LocationValue> - : public SavedStacks::MutableLocationValueOperations<JS::MutableHandle<SavedStacks::LocationValue>> -{}; + private: + SavedStacks::LocationValue& loc() { + return static_cast<Wrapper*>(this)->get(); + } +}; UTF8CharsZ BuildUTF8StackString(JSContext* cx, HandleObject stack); |