CodeBlockHash::CodeBlockHash(const SourceCode& sourceCode, CodeSpecializationKind kind) : m_hash(0) { SHA1 sha1; sha1.addBytes(sourceCode.toString().utf8()); Vector<uint8_t, 20> digest; sha1.computeHash(digest); m_hash += digest[0] | (digest[1] << 8) | (digest[2] << 16) | (digest[3] << 24); m_hash ^= static_cast<unsigned>(kind); }
bool FunctionOverrides::initializeOverrideFor(const SourceCode& origCode, FunctionOverrides::OverrideInfo& result) { ASSERT(Options::functionOverrides()); FunctionOverrides& overrides = FunctionOverrides::overrides(); auto it = overrides.m_entries.find(origCode.toString()); if (it == overrides.m_entries.end()) return false; initializeOverrideInfo(origCode, it->value, result); return true; }
void evaluateModule(ExecState* exec, const SourceCode& source, NakedPtr<Exception>& returnedException) { JSLockHolder lock(exec); RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); RELEASE_ASSERT(!exec->vm().isCollectorBusy()); CodeProfiling profile(source); JSGlobalObject* globalObject = exec->vmEntryGlobalObject(); // Generate the unique key for the source-provided module. PrivateName privateName(PrivateName::Description, "EntryPointModule"); Symbol* key = Symbol::create(exec->vm(), *privateName.uid()); ModuleLoaderObject* moduleLoader = globalObject->moduleLoader(); // Insert the given source code to the ModuleLoader registry as the fetched registry entry. moduleLoader->provide(exec, key, ModuleLoaderObject::Status::Fetch, source.toString()); if (exec->hadException()) { returnedException = exec->exception(); exec->clearException(); return; } // FIXME: Now, we don't implement the linking phase yet. // So here, we just call requestInstantiateAll to only perform the module loading. // At last, it should be replaced with requestReady. // https://bugs.webkit.org/show_bug.cgi?id=148172 moduleLoader->requestInstantiateAll(exec, key); // FIXME: We should also handle the asynchronous Syntax Errors that will be delivered by the rejected promise. // https://bugs.webkit.org/show_bug.cgi?id=148173 if (exec->hadException()) { returnedException = exec->exception(); exec->clearException(); return; } }
CodeCache::CodeBlockKey CodeCache::makeCodeBlockKey(const SourceCode& source, CodeCache::CodeType type, JSParserStrictness strictness) { return std::make_pair(source.toString(), (type << 1) | strictness); }
CodeCache::GlobalFunctionKey CodeCache::makeGlobalFunctionKey(const SourceCode& source, const String& name) { return GlobalFunctionKey(source.toString(), name); }