static void handleExec(CmdLineParamDef * param, const wchar_t * value) { UNREFERENCED_PARAMETER(param); if (params.hasExecutableSpecified()) { fatalError("Executable file already specified", 3); } params.setExecutable(std::wstring(value)); }
static void handleArgs(CmdLineParamDef * param, const wchar_t * value) { UNREFERENCED_PARAMETER(param); if (params.hasExecutableSpecified()) { fatalError("Executable file already specified", 3); } params.setExecutable(value); argsFound = true; }
void nonParamHandler(const wchar_t * value) { if (params.exename.empty()) { params.setExecutable(std::wstring(value)); return; } if (!argsFound) { fatalError("Use --args to provide inferior arguments", 3); } params.addArg(std::wstring(value)); }
UnlinkedCodeBlock::UnlinkedCodeBlock(VM* vm, Structure* structure, CodeType codeType, const ExecutableInfo& info) : Base(*vm, structure) , m_numVars(0) , m_numCalleeRegisters(0) , m_numParameters(0) , m_vm(vm) , m_globalObjectRegister(VirtualRegister()) , m_needsFullScopeChain(info.needsActivation()) , m_usesEval(info.usesEval()) , m_isNumericCompareFunction(false) , m_isStrictMode(info.isStrictMode()) , m_isConstructor(info.isConstructor()) , m_hasCapturedVariables(false) , m_isBuiltinFunction(info.isBuiltinFunction()) , m_constructorKind(static_cast<unsigned>(info.constructorKind())) , m_firstLine(0) , m_lineCount(0) , m_endColumn(UINT_MAX) , m_features(0) , m_codeType(codeType) , m_arrayProfileCount(0) , m_arrayAllocationProfileCount(0) , m_objectAllocationProfileCount(0) , m_valueProfileCount(0) , m_llintCallLinkInfoCount(0) #if ENABLE(BYTECODE_COMMENTS) , m_bytecodeCommentIterator(0) #endif { ASSERT(m_constructorKind == static_cast<unsigned>(info.constructorKind())); }
void parseCommandLine(int argc, wchar_t *argv[]) { for (int i = 1; i < argc; i++) { wchar_t * v = argv[i]; if (v[0] == '-') { const wchar_t * value = v; CmdLineParamDef * param = findParam(value); if (!param) { fatalError(std::wstring(L"Unknown command line parameter ") + v, 1); } if (param->paramType != NO_PARAMS) { if (!value[0]) { if (i == argc - 1) { fatalError(std::wstring(L"Value not specified for parameter ") + v, 1); } i++; value = argv[i]; } } else { if (value[0]) { fatalError(std::wstring(L"Value not allowed for parameter ") + v, 1); } } if (param->handler) { param->handler(param, value); } else { defParamHandler(param, value); } } else { nonParamHandler(v); } } // handle logging if (!params.logFile.empty()) { CRLog::log_level level = CRLog::LL_INFO; if (params.logLevel == L"FATAL") level = CRLog::LL_FATAL; else if (params.logLevel == L"ERROR") level = CRLog::LL_ERROR; else if (params.logLevel == L"DEBUG") level = CRLog::LL_DEBUG; else if (params.logLevel == L"TRACE") level = CRLog::LL_TRACE; CRLog::setFileLogger(toUtf8(params.logFile).c_str(), true); CRLog::setLogLevel(level); } params.dumpParams(); }
UnlinkedCodeBlock::UnlinkedCodeBlock(VM* vm, Structure* structure, CodeType codeType, const ExecutableInfo& info, DebuggerMode debuggerMode) : Base(*vm, structure) , m_numVars(0) , m_numCalleeLocals(0) , m_numParameters(0) , m_globalObjectRegister(VirtualRegister()) , m_usesEval(info.usesEval()) , m_isStrictMode(info.isStrictMode()) , m_isConstructor(info.isConstructor()) , m_hasCapturedVariables(false) , m_isBuiltinFunction(info.isBuiltinFunction()) , m_constructorKind(static_cast<unsigned>(info.constructorKind())) , m_superBinding(static_cast<unsigned>(info.superBinding())) , m_derivedContextType(static_cast<unsigned>(info.derivedContextType())) , m_evalContextType(static_cast<unsigned>(info.evalContextType())) , m_isArrowFunctionContext(info.isArrowFunctionContext()) , m_isClassContext(info.isClassContext()) , m_wasCompiledWithDebuggingOpcodes(debuggerMode == DebuggerMode::DebuggerOn || Options::forceDebuggerBytecodeGeneration()) , m_firstLine(0) , m_lineCount(0) , m_endColumn(UINT_MAX) , m_parseMode(info.parseMode()) , m_features(0) , m_codeType(codeType) , m_arrayProfileCount(0) , m_arrayAllocationProfileCount(0) , m_objectAllocationProfileCount(0) , m_valueProfileCount(0) , m_llintCallLinkInfoCount(0) { for (auto& constantRegisterIndex : m_linkTimeConstants) constantRegisterIndex = 0; ASSERT(m_constructorKind == static_cast<unsigned>(info.constructorKind())); }
static void handleNx(CmdLineParamDef * param, const wchar_t * value) { UNREFERENCED_PARAMETER(param); UNREFERENCED_PARAMETER(value); params.setDir(value); }