Changeset 194606 in webkit
- Timestamp:
- Jan 5, 2016 2:04:59 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r194604 r194606 1 2015-12-24 Mark Lam <mark.lam@apple.com> 2 3 Re-landing: Add validation of JSC options to catch typos. 4 https://bugs.webkit.org/show_bug.cgi?id=152549 5 6 Reviewed by Benjamin Poulain. 7 8 1. If a JSC_xxx option is found and xxx is not a valid option, we will now log 9 an error message. 10 2. If a --xxx jsc option is specified, but xxx is not a valid option, we will 11 now log an error message. 12 3. Added JSC_validateOptions, which if set to true will cause the VM to crash if 13 an invalid option was seen during options parsing. 14 15 In this version for re-landing, I removed the change where I disallowed -- options 16 after the script name. Apparently, we have some test harnesses that do append the 17 -- options after the script name. 18 19 * jsc.cpp: 20 (CommandLine::parseArguments): 21 * runtime/Options.cpp: 22 (JSC::Options::initialize): 23 * runtime/Options.h: 24 1 25 2016-01-05 Filip Pizlo <fpizlo@apple.com> 2 26 -
trunk/Source/JavaScriptCore/jsc.cpp
r194599 r194606 1890 1890 bool needToExit = false; 1891 1891 1892 bool hasBadJSCOptions = false; 1892 1893 for (; i < argc; ++i) { 1893 1894 const char* arg = argv[i]; … … 1954 1955 1955 1956 // See if the -- option is a JSC VM option. 1956 if (strstr(arg, "--") == arg && JSC::Options::setOption(&arg[2])) { 1957 // The arg was recognized as a VM option and has been parsed. 1958 continue; // Just continue with the next arg. 1957 if (strstr(arg, "--") == arg) { 1958 if (!JSC::Options::setOption(&arg[2])) { 1959 hasBadJSCOptions = true; 1960 dataLog("ERROR: invalid option: ", arg, "\n"); 1961 } 1962 continue; 1959 1963 } 1960 1964 … … 1963 1967 m_scripts.append(Script(true, argv[i])); 1964 1968 } 1969 1970 if (hasBadJSCOptions && JSC::Options::validateOptions()) 1971 CRASH(); 1965 1972 1966 1973 if (m_scripts.isEmpty()) -
trunk/Source/JavaScriptCore/runtime/Options.cpp
r194599 r194606 40 40 #include <wtf/text/StringBuilder.h> 41 41 42 #if PLATFORM(COCOA) 43 #include <crt_externs.h> 44 #endif 45 42 46 #if OS(WINDOWS) 43 47 #include "MacroAssemblerX86.h" … … 377 381 // The evn var should be the name of the option prefixed with 378 382 // "JSC_". 383 #if PLATFORM(COCOA) 384 bool hasBadOptions = false; 385 for (char** envp = *_NSGetEnviron(); *envp; envp++) { 386 const char* env = *envp; 387 if (!strncmp("JSC_", env, 4)) { 388 if (!Options::setOption(&env[4])) { 389 dataLog("ERROR: invalid option: ", *envp, "\n"); 390 hasBadOptions = true; 391 } 392 } 393 } 394 if (hasBadOptions && Options::validateOptions()) 395 CRASH(); 396 #else // PLATFORM(COCOA) 379 397 #define FOR_EACH_OPTION(type_, name_, defaultValue_, description_) \ 380 398 overrideOptionWithHeuristic(name_(), "JSC_" #name_); 381 399 JSC_OPTIONS(FOR_EACH_OPTION) 382 400 #undef FOR_EACH_OPTION 401 #endif // PLATFORM(COCOA) 383 402 384 403 #define FOR_EACH_OPTION(aliasedName_, unaliasedName_, equivalence_) \ -
trunk/Source/JavaScriptCore/runtime/Options.h
r194599 r194606 103 103 104 104 #define JSC_OPTIONS(v) \ 105 v(bool, validateOptions, false, "crashes if mis-typed JSC options were passed to the VM") \ 105 106 v(unsigned, dumpOptions, 0, "dumps JSC options (0 = None, 1 = Overridden only, 2 = All, 3 = Verbose)") \ 106 107 \
Note: See TracChangeset
for help on using the changeset viewer.