Ignore:
Timestamp:
Feb 28, 2017, 10:50:00 AM (8 years ago)
Author:
[email protected]
Message:

Add ability to configure JSC options from a file
https://bugs.webkit.org/show_bug.cgi?id=168914

Reviewed by Filip Pizlo.

Added the ability to set options and DataLog file location via a configuration file.
Source/JavaScriptCore:

The configuration file is specified with the --configFile option to JSC or the
JSC_configFile environment variable.

The file format allows for options conditionally dependent on various attributes.
Currently those attributes are the process name, parent process name and build
type (Release or Debug). In this patch, the parent process type is not set.
That will be set up in WebKit code with a follow up patch.

Here is an example config file:

logFile = "/tmp/jscLog.%pid.txt"

jscOptions {

dumpOptions = 2

}

build == "Debug" {

jscOptions {

useConcurrentJIT = false
dumpDisassembly = true

}

}

build == "Release" && processName == "jsc" {

jscOptions {

asyncDisassembly = true

}

}

Eliminated the prior options file code.

(jscmain):

  • runtime/ConfigFile.cpp: Added.

(JSC::ConfigFileScanner::ConfigFileScanner):
(JSC::ConfigFileScanner::start):
(JSC::ConfigFileScanner::lineNumber):
(JSC::ConfigFileScanner::currentBuffer):
(JSC::ConfigFileScanner::atFileEnd):
(JSC::ConfigFileScanner::tryConsume):
(JSC::ConfigFileScanner::tryConsumeString):
(JSC::ConfigFileScanner::tryConsumeUpto):
(JSC::ConfigFileScanner::fillBufferIfNeeded):
(JSC::ConfigFileScanner::fillBuffer):
(JSC::ConfigFile::ConfigFile):
(JSC::ConfigFile::setProcessName):
(JSC::ConfigFile::setParentProcessName):
(JSC::ConfigFile::parse):

  • runtime/ConfigFile.h: Added.
  • runtime/Options.cpp:

(JSC::Options::initialize):
(JSC::Options::setOptions):

  • runtime/Options.h:

Source/WTF:

The pathname can include the printf style "%pid", which will be replaced with the
current process id.

  • wtf/DataLog.cpp:

(WTF::initializeLogFileOnce):
(WTF::setDataFile):

  • wtf/DataLog.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r213088 r213151  
    3030#include "CodeBlock.h"
    3131#include "Completion.h"
     32#include "ConfigFile.h"
    3233#include "DOMJITGetterSetter.h"
    3334#include "DOMJITPatchpoint.h"
     
    37633764    CommandLine options(argc, argv);
    37643765
     3766    if (Options::configFile()) {
     3767        ConfigFile configFile(Options::configFile());
     3768        configFile.setProcessName("jsc");
     3769        configFile.parse();
     3770    }
     3771
    37653772    // Initialize JSC before getting VM.
    37663773    WTF::initializeMainThread();
Note: See TracChangeset for help on using the changeset viewer.