WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-72962-20111212123117.patch (text/plain), 7.54 KB, created by
Andy Wingo
on 2011-12-12 03:31:19 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Wingo
Created:
2011-12-12 03:31:19 PST
Size:
7.54 KB
patch
obsolete
>Subversion Revision: 102564 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 438a041cd1e2165c04cbfd3b5cf2d04a3adcb750..554fa4e2bf2b3d0852ae2139bcde5b855aa28ec4 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,27 @@ >+2011-11-22 Andy Wingo <wingo@igalia.com> >+ >+ Add --dump-bytecode to the runtime options >+ https://bugs.webkit.org/show_bug.cgi?id=72962 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bytecompiler/BytecodeGenerator.cpp: >+ (JSC::BytecodeGenerator::dumpsGeneratedCode): >+ (JSC::BytecodeGenerator::generate): Look at Options::dumpBytecode >+ rather than our own static member. >+ * bytecompiler/BytecodeGenerator.h: Remove setDumpsGeneratedCode. >+ >+ * jsc.cpp: >+ (CommandLine::CommandLine): >+ (runWithScripts): >+ (printUsageStatement): >+ (parseArguments): >+ (jscmain): Remove -d option, as --dump-bytecode is handled by the >+ options interface now. >+ >+ * runtime/Options.h: Add --dump-bytecode. Declare the >+ dumpBytecode variable as `static const' if debugging is disabled. >+ > 2011-11-29 Andy Wingo <wingo@igalia.com> > > Allow JSC heuristics to be set on the command-line >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >index 14a13832f725db49f5d0afafe4722ca8fd597e28..4d0be434b8e0b2c2f5496f459a2fa000762a20cd 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >@@ -116,23 +116,10 @@ namespace JSC { > expected by the callee. > */ > >-#ifndef NDEBUG >-static bool s_dumpsGeneratedCode = false; >-#endif >- >-void BytecodeGenerator::setDumpsGeneratedCode(bool dumpsGeneratedCode) >-{ >-#ifndef NDEBUG >- s_dumpsGeneratedCode = dumpsGeneratedCode; >-#else >- UNUSED_PARAM(dumpsGeneratedCode); >-#endif >-} >- > bool BytecodeGenerator::dumpsGeneratedCode() > { > #ifndef NDEBUG >- return s_dumpsGeneratedCode; >+ return Options::dumpBytecode; > #else > return false; > #endif >@@ -149,7 +136,7 @@ JSObject* BytecodeGenerator::generate() > m_codeBlock->setInstructionCount(m_codeBlock->instructions().size()); > > #ifndef NDEBUG >- if (s_dumpsGeneratedCode) >+ if (dumpsGeneratedCode()) > m_codeBlock->dump(m_scopeChain->globalObject->globalExec()); > #endif > >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >index 3ff5f2343f02635154f488647adbff992289dc21..7cd254a6d9971685e3b49c1e1ad31fa7f4dd54bc 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >@@ -91,7 +91,6 @@ namespace JSC { > typedef DeclarationStacks::VarStack VarStack; > typedef DeclarationStacks::FunctionStack FunctionStack; > >- JS_EXPORT_PRIVATE static void setDumpsGeneratedCode(bool dumpsGeneratedCode); > static bool dumpsGeneratedCode(); > > BytecodeGenerator(ProgramNode*, ScopeChainNode*, SymbolTable*, ProgramCodeBlock*, CompilationKind); >diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp >index 3ea48273996ff1850f87bd27ef1f546c2cd40689..8403b13485d649d2a16f5212abb412a8752133a0 100644 >--- a/Source/JavaScriptCore/jsc.cpp >+++ b/Source/JavaScriptCore/jsc.cpp >@@ -105,12 +105,10 @@ struct Script { > struct CommandLine { > CommandLine() > : interactive(false) >- , dump(false) > { > } > > bool interactive; >- bool dump; > Vector<Script> scripts; > Vector<UString> arguments; > }; >@@ -430,15 +428,12 @@ static void cleanupGlobalData(JSGlobalData* globalData) > globalData->deref(); > } > >-static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts, bool dump) >+static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts) > { > UString script; > UString fileName; > Vector<char> scriptBuffer; > >- if (dump) >- BytecodeGenerator::setDumpsGeneratedCode(true); >- > JSGlobalData& globalData = globalObject->globalData(); > > #if ENABLE(SAMPLING_FLAGS) >@@ -462,12 +457,16 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr > JSValue evaluationException; > JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script, fileName), JSValue(), &evaluationException); > success = success && !evaluationException; >- if (dump) { >+#ifndef NDEBUG >+ if (Options::dumpBytecode) { > if (evaluationException) > printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec()).utf8().data()); > else > printf("End: %s\n", returnValue.toString(globalObject->globalExec()).utf8().data()); > } >+#else >+ (void)returnValue; >+#endif > > globalData.stopSampling(); > globalObject->globalExec()->clearException(); >@@ -548,7 +547,6 @@ static NO_RETURN void printDebugUsageStatement(JSGlobalData* globalData) > static NO_RETURN void printUsageStatement(JSGlobalData* globalData, bool help = false) > { > fprintf(stderr, "Usage: jsc [options] [files] [-- arguments]\n"); >- fprintf(stderr, " -d Dumps bytecode (debug builds only)\n"); > fprintf(stderr, " -e Evaluate argument as script code\n"); > fprintf(stderr, " -f Specifies a source file (deprecated)\n"); > fprintf(stderr, " -h|--help Prints this help message\n"); >@@ -601,10 +599,6 @@ static void parseArguments(int argc, char** argv, CommandLine& options, JSGlobal > options.interactive = true; > continue; > } >- if (!strcmp(arg, "-d")) { >- options.dump = true; >- continue; >- } > if (!strcmp(arg, "-s")) { > #if HAVE(SIGNAL_H) > signal(SIGILL, _exit); >@@ -640,7 +634,7 @@ int jscmain(int argc, char** argv, JSGlobalData* globalData) > parseArguments(argc, argv, options, globalData); > > GlobalObject* globalObject = GlobalObject::create(*globalData, GlobalObject::createStructure(*globalData, jsNull()), options.arguments); >- bool success = runWithScripts(globalObject, options.scripts, options.dump); >+ bool success = runWithScripts(globalObject, options.scripts); > if (options.interactive && success) > runInteractive(globalObject); > >diff --git a/Source/JavaScriptCore/runtime/Options.h b/Source/JavaScriptCore/runtime/Options.h >index 327a56747de69bdb795957d73b11af9bf33d1c61..e7584be037a2070a3b6aed074d44aa8a6c329214 100644 >--- a/Source/JavaScriptCore/runtime/Options.h >+++ b/Source/JavaScriptCore/runtime/Options.h >@@ -30,6 +30,21 @@ > > namespace JSC { namespace Options { > >+#define FOR_EACH_DEBUGGING_OPTION(m) \ >+ m(bool, dumpBytecode, false, \ >+ "dump-bytecode") >+ >+#ifndef NDEBUG >+#define FOR_EACH_ENABLED_DEBUGGING_OPTION(m) \ >+ FOR_EACH_DEBUGGING_OPTION(m) >+#else >+#define FOR_EACH_ENABLED_DEBUGGING_OPTION(m) /* noop */ >+#define DECLARE_CONST(type, name, default, optname) \ >+ static const type name = default; >+FOR_EACH_DEBUGGING_OPTION(DECLARE_CONST) >+#undef DECLARE_CONST >+#endif >+ > // maximumInliningDepth is the maximum depth of inline stack, so 1 = no > // inlining, 2 = one level, etc > >@@ -111,7 +126,8 @@ namespace JSC { namespace Options { > "opaque-root-merge-threshold") > > #define FOR_EACH_OPTION(m) \ >- FOR_EACH_HEURISTIC(m) >+ FOR_EACH_HEURISTIC(m) \ >+ FOR_EACH_ENABLED_DEBUGGING_OPTION(m) > > #define DECLARE(type, cname, default_val, optname) extern type cname; > FOR_EACH_OPTION(DECLARE)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ggaren
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 72962
:
116235
|
116990
|
117153
|
118763
| 118764