diff options
author | 2022-02-22 15:51:41 -0800 | |
---|---|---|
committer | 2022-02-22 15:51:41 -0800 | |
commit | 27be64cf12b8a2096ebb464106d6cfa992c289cf (patch) | |
tree | b74a53be64bceafb62749a496a88d24e8c2f0e8c /src/javascript/jsc/bindings/ZigSourceProvider.h | |
parent | 4dd647290825040b69742993955e7d2dcfea65ba (diff) | |
download | bun-27be64cf12b8a2096ebb464106d6cfa992c289cf.tar.gz bun-27be64cf12b8a2096ebb464106d6cfa992c289cf.tar.zst bun-27be64cf12b8a2096ebb464106d6cfa992c289cf.zip |
Make format consistent with WebKit
Diffstat (limited to 'src/javascript/jsc/bindings/ZigSourceProvider.h')
-rw-r--r-- | src/javascript/jsc/bindings/ZigSourceProvider.h | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/src/javascript/jsc/bindings/ZigSourceProvider.h b/src/javascript/jsc/bindings/ZigSourceProvider.h index 24ae82af8..3a1a73b8f 100644 --- a/src/javascript/jsc/bindings/ZigSourceProvider.h +++ b/src/javascript/jsc/bindings/ZigSourceProvider.h @@ -22,60 +22,66 @@ class SourceProvider; namespace Zig { class SourceProvider final : public JSC::SourceProvider { - WTF_MAKE_FAST_ALLOCATED; - using Base = JSC::SourceProvider; - using BytecodeCacheGenerator = JSC::BytecodeCacheGenerator; - using UnlinkedFunctionExecutable = JSC::UnlinkedFunctionExecutable; - using CachedBytecode = JSC::CachedBytecode; - using UnlinkedFunctionCodeBlock = JSC::UnlinkedFunctionCodeBlock; - using SourceCode = JSC::SourceCode; - using CodeSpecializationKind = JSC::CodeSpecializationKind; - using SourceOrigin = JSC::SourceOrigin; + WTF_MAKE_FAST_ALLOCATED; + using Base = JSC::SourceProvider; + using BytecodeCacheGenerator = JSC::BytecodeCacheGenerator; + using UnlinkedFunctionExecutable = JSC::UnlinkedFunctionExecutable; + using CachedBytecode = JSC::CachedBytecode; + using UnlinkedFunctionCodeBlock = JSC::UnlinkedFunctionCodeBlock; + using SourceCode = JSC::SourceCode; + using CodeSpecializationKind = JSC::CodeSpecializationKind; + using SourceOrigin = JSC::SourceOrigin; - public: - static Ref<SourceProvider> create(ResolvedSource resolvedSource); - ~SourceProvider() { - freeSourceCode(); +public: + static Ref<SourceProvider> create(ResolvedSource resolvedSource); + ~SourceProvider() + { + freeSourceCode(); - commitCachedBytecode(); - } + commitCachedBytecode(); + } - unsigned hash() const { return m_hash; }; - StringView source() const { return StringView(m_source.get()); } - RefPtr<JSC::CachedBytecode> cachedBytecode() { - if (m_resolvedSource.bytecodecache_fd == 0) { return nullptr; } + unsigned hash() const { return m_hash; }; + StringView source() const { return StringView(m_source.get()); } + RefPtr<JSC::CachedBytecode> cachedBytecode() + { + if (m_resolvedSource.bytecodecache_fd == 0) { + return nullptr; + } - return m_cachedBytecode; - }; + return m_cachedBytecode; + }; - void updateCache(const UnlinkedFunctionExecutable *executable, const SourceCode &, - CodeSpecializationKind kind, const UnlinkedFunctionCodeBlock *codeBlock); - void cacheBytecode(const BytecodeCacheGenerator &generator); - void commitCachedBytecode(); - bool isBytecodeCacheEnabled() const; - void readOrGenerateByteCodeCache(JSC::VM &vm, const JSC::SourceCode &sourceCode); - ResolvedSource m_resolvedSource; - int readCache(JSC::VM &vm, const JSC::SourceCode &sourceCode); - void freeSourceCode(); + void updateCache(const UnlinkedFunctionExecutable* executable, const SourceCode&, + CodeSpecializationKind kind, const UnlinkedFunctionCodeBlock* codeBlock); + void cacheBytecode(const BytecodeCacheGenerator& generator); + void commitCachedBytecode(); + bool isBytecodeCacheEnabled() const; + void readOrGenerateByteCodeCache(JSC::VM& vm, const JSC::SourceCode& sourceCode); + ResolvedSource m_resolvedSource; + int readCache(JSC::VM& vm, const JSC::SourceCode& sourceCode); + void freeSourceCode(); - private: - SourceProvider(ResolvedSource resolvedSource, WTF::StringImpl *sourceImpl, - const SourceOrigin &sourceOrigin, WTF::String &&sourceURL, - const TextPosition &startPosition, JSC::SourceProviderSourceType sourceType) - : Base(sourceOrigin, WTFMove(sourceURL), startPosition, sourceType), m_source(*sourceImpl) { +private: + SourceProvider(ResolvedSource resolvedSource, WTF::StringImpl* sourceImpl, + const SourceOrigin& sourceOrigin, WTF::String&& sourceURL, + const TextPosition& startPosition, JSC::SourceProviderSourceType sourceType) + : Base(sourceOrigin, WTFMove(sourceURL), startPosition, sourceType) + , m_source(*sourceImpl) + { - m_resolvedSource = resolvedSource; + m_resolvedSource = resolvedSource; - m_hash = resolvedSource.hash; - getHash(); - } + m_hash = resolvedSource.hash; + getHash(); + } - unsigned m_hash; - unsigned getHash(); - RefPtr<JSC::CachedBytecode> m_cachedBytecode; - Ref<WTF::StringImpl> m_source; - bool did_free_source_code = false; - // JSC::SourceCodeKey key; + unsigned m_hash; + unsigned getHash(); + RefPtr<JSC::CachedBytecode> m_cachedBytecode; + Ref<WTF::StringImpl> m_source; + bool did_free_source_code = false; + // JSC::SourceCodeKey key; }; } // namespace Zig
\ No newline at end of file |