#include "headers.h" #include "root.h" #pragma once namespace JSC { class Structure; class Identifier; class SourceCodeKey; class SourceProvider; } // namespace JSC #include "JavaScriptCore/CachedBytecode.h" #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/JSTypeInfo.h" #include "ZigConsoleClient.h" // #include "JavaScriptCore/SourceCodeKey.h" #include "JavaScriptCore/SourceProvider.h" #include "JavaScriptCore/Structure.h" 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; public: static Ref create(ResolvedSource resolvedSource); ~SourceProvider() { freeSourceCode(); commitCachedBytecode(); } unsigned hash() const { return m_hash; }; StringView source() const { return StringView(m_source.get()); } RefPtr cachedBytecode() { // if (m_resolvedSource.bytecodecache_fd == 0) { return nullptr; // } // 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(); 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_hash = resolvedSource.hash; getHash(); } unsigned m_hash; unsigned getHash(); RefPtr m_cachedBytecode; Ref m_source; bool did_free_source_code = false; // JSC::SourceCodeKey key; }; } // namespace Zig Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2022-04-18[timer] Remove timer.zig and use system_timer.zig (#149)Gravatar wangao 6-33/+7
2022-04-18[build] Fix Dockerfile COPY slash (#147)Gravatar wangao 2-5/+5
2022-04-18not sure yetGravatar Jarred Sumner 4-92/+107
2022-04-18fix wasm build take 2 (one more thing is broken)Gravatar Jarred Sumner 15-195/+641
2022-04-18Fix wasm buildGravatar Jarred Sumner 6-13/+58
2022-04-18[node] Add more fs constants (#144)Gravatar wangao 4-137/+201
2022-04-16Move some code around + delete dead codeGravatar Jarred Sumner 4-2113/+1889
2022-04-16[JS Parser] Support explicit removingGravatar Jarred Sumner 10-88/+480
2022-04-16Workaround C ABI bugGravatar Jarred Sumner 1-9/+12
2022-04-16[JS Parser] API for removing & replacing exportsGravatar Jarred Sumner 2-85/+495
2022-04-15Update README.mdGravatar Jarred Sumner 1-29/+0