michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef frontend_BytecodeCompiler_h michael@0: #define frontend_BytecodeCompiler_h michael@0: michael@0: #include "NamespaceImports.h" michael@0: michael@0: class JSLinearString; michael@0: michael@0: namespace js { michael@0: michael@0: class AutoNameVector; michael@0: class LazyScript; michael@0: class LifoAlloc; michael@0: struct SourceCompressionTask; michael@0: michael@0: namespace frontend { michael@0: michael@0: JSScript * michael@0: CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, michael@0: HandleObject scopeChain, HandleScript evalCaller, michael@0: const ReadOnlyCompileOptions &options, SourceBufferHolder &srcBuf, michael@0: JSString *source_ = nullptr, unsigned staticLevel = 0, michael@0: SourceCompressionTask *extraSct = nullptr); michael@0: michael@0: bool michael@0: CompileLazyFunction(JSContext *cx, Handle lazy, const jschar *chars, size_t length); michael@0: michael@0: bool michael@0: CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, michael@0: const ReadOnlyCompileOptions &options, michael@0: const AutoNameVector &formals, JS::SourceBufferHolder &srcBuf); michael@0: bool michael@0: CompileStarGeneratorBody(JSContext *cx, MutableHandleFunction fun, michael@0: const ReadOnlyCompileOptions &options, michael@0: const AutoNameVector &formals, JS::SourceBufferHolder &srcBuf); michael@0: michael@0: ScriptSourceObject * michael@0: CreateScriptSourceObject(ExclusiveContext *cx, const ReadOnlyCompileOptions &options); michael@0: michael@0: /* michael@0: * This should be called while still on the main thread if compilation will michael@0: * occur on a worker thread. michael@0: */ michael@0: void michael@0: MaybeCallSourceHandler(JSContext *cx, const ReadOnlyCompileOptions &options, michael@0: JS::SourceBufferHolder &srcBuf); michael@0: michael@0: /* michael@0: * True if str consists of an IdentifierStart character, followed by one or michael@0: * more IdentifierPart characters, i.e. it matches the IdentifierName production michael@0: * in the language spec. michael@0: * michael@0: * This returns true even if str is a keyword like "if". michael@0: * michael@0: * Defined in TokenStream.cpp. michael@0: */ michael@0: bool michael@0: IsIdentifier(JSLinearString *str); michael@0: michael@0: /* True if str is a keyword. Defined in TokenStream.cpp. */ michael@0: bool michael@0: IsKeyword(JSLinearString *str); michael@0: michael@0: /* GC marking. Defined in Parser.cpp. */ michael@0: void michael@0: MarkParser(JSTracer *trc, AutoGCRooter *parser); michael@0: michael@0: } /* namespace frontend */ michael@0: } /* namespace js */ michael@0: michael@0: #endif /* frontend_BytecodeCompiler_h */