From: sgjesse@chromium.org Date: Fri, 11 Sep 2009 12:26:15 +0000 (+0000) Subject: Control profiling/debugger support from build script. X-Git-Tag: upstream/4.7.83~23288 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3dd74076d1835a716344df46ad26af80f1685636;p=platform%2Fupstream%2Fv8.git Control profiling/debugger support from build script. The SCons build now has the options profilingsupport and debuggersupport for controlling the setting of the defines ENABLE_LOGGIGN_AND_PROFILING and ENABLE_DEBUGGER_SUPPORT. By default both are set to true. The changes to the XCode project have not been tested. Review URL: http://codereview.chromium.org/195061 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2875 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/SConstruct b/SConstruct index ddd0190..9055731 100644 --- a/SConstruct +++ b/SConstruct @@ -96,13 +96,18 @@ ANDROID_LINKFLAGS = ['-nostdlib', LIBRARY_FLAGS = { 'all': { - 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'], 'CPPPATH': [join(root_dir, 'src')], 'regexp:native': { 'CPPDEFINES': ['V8_NATIVE_REGEXP'] }, 'mode:debug': { 'CPPDEFINES': ['V8_ENABLE_CHECKS'] + }, + 'profilingsupport:on': { + 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'], + }, + 'debuggersupport:on': { + 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], } }, 'gcc': { @@ -114,7 +119,6 @@ LIBRARY_FLAGS = { 'CCFLAGS': ['-g', '-O0'], 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], 'os:android': { - 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], 'CCFLAGS': ['-mthumb'] } }, @@ -123,7 +127,7 @@ LIBRARY_FLAGS = { '-ffunction-sections'], 'os:android': { 'CCFLAGS': ['-mthumb', '-Os'], - 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG', 'ENABLE_DEBUGGER_SUPPORT'] + 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] } }, 'os:linux': { @@ -576,6 +580,16 @@ SIMPLE_OPTIONS = { 'default': 'static', 'help': 'the type of library to produce' }, + 'profilingsupport': { + 'values': ['on', 'off'], + 'default': 'on', + 'help': 'enable profiling of JavaScript code' + }, + 'debuggersupport': { + 'values': ['on', 'off'], + 'default': 'on', + 'help': 'enable debugging of JavaScript code' + }, 'soname': { 'values': ['on', 'off'], 'default': 'off', @@ -794,6 +808,10 @@ def PostprocessOptions(options): # Print a warning if arch has explicitly been set print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] options['arch'] = options['simulator'] + if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): + # Print a warning if profiling is enabled without profiling support + print "Warning: forcing profilingsupport on when prof is on" + options['profilingsupport'] = 'on' def ParseEnvOverrides(arg, imports): diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 79b3089..e1e3884 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -1170,7 +1170,6 @@ void MacroAssembler::Abort(const char* msg) { } -#ifdef ENABLE_DEBUGGER_SUPPORT CodePatcher::CodePatcher(byte* address, int size) : address_(address), size_(size), masm_(address, size + Assembler::kGap) { // Create a new macro assembler pointing to the address of the code to patch. @@ -1188,7 +1187,6 @@ CodePatcher::~CodePatcher() { ASSERT(masm_.pc_ == address_ + size_); ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); } -#endif // ENABLE_DEBUGGER_SUPPORT } } // namespace v8::internal diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index fa61183..60ede8a 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -338,7 +338,6 @@ class MacroAssembler: public Assembler { }; -#ifdef ENABLE_DEBUGGER_SUPPORT // The code patcher is used to patch (typically) small parts of code e.g. for // debugging and other types of instrumentation. When using the code patcher // the exact number of bytes specified must be emitted. Is not legal to emit @@ -357,7 +356,6 @@ class CodePatcher { int size_; // Number of bytes of the expected patch size. MacroAssembler masm_; // Macro assembler used to generate the code. }; -#endif // ENABLE_DEBUGGER_SUPPORT // ----------------------------------------------------------------------------- diff --git a/src/v8.h b/src/v8.h index 50be6df..7786d66 100644 --- a/src/v8.h +++ b/src/v8.h @@ -51,11 +51,6 @@ #error both DEBUG and NDEBUG are set #endif -// Enable debugger support by default, unless it is in ANDROID -#if !defined(ENABLE_DEBUGGER_SUPPORT) && !defined(ANDROID) -#define ENABLE_DEBUGGER_SUPPORT -#endif - // Basic includes #include "../include/v8.h" #include "globals.h" diff --git a/src/x64/cfg-x64.cc b/src/x64/cfg-x64.cc index 0b71d8e..b755f49 100644 --- a/src/x64/cfg-x64.cc +++ b/src/x64/cfg-x64.cc @@ -112,12 +112,14 @@ void ExitNode::Compile(MacroAssembler* masm) { __ pop(rbp); int count = CfgGlobals::current()->fun()->scope()->num_parameters(); __ ret((count + 1) * kPointerSize); +#ifdef ENABLE_DEBUGGER_SUPPORT // Add padding that will be overwritten by a debugger breakpoint. // "movq rsp, rbp; pop rbp" has length 4. "ret k" has length 3. const int kPadding = Debug::kX64JSReturnSequenceLength - 4 - 3; for (int i = 0; i < kPadding; ++i) { __ int3(); } +#endif } diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc index 170e9ee..83b08bb 100644 --- a/src/x64/codegen-x64.cc +++ b/src/x64/codegen-x64.cc @@ -509,6 +509,7 @@ void CodeGenerator::GenerateReturnSequence(Result* return_value) { // receiver. frame_->Exit(); masm_->ret((scope_->num_parameters() + 1) * kPointerSize); +#ifdef ENABLE_DEBUGGER_SUPPORT // Add padding that will be overwritten by a debugger breakpoint. // frame_->Exit() generates "movq rsp, rbp; pop rbp; ret k" // with length 7 (3 + 1 + 3). @@ -516,12 +517,13 @@ void CodeGenerator::GenerateReturnSequence(Result* return_value) { for (int i = 0; i < kPadding; ++i) { masm_->int3(); } - DeleteFrame(); - // Check that the size of the code used for returning matches what is // expected by the debugger. ASSERT_EQ(Debug::kX64JSReturnSequenceLength, masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); +#endif + DeleteFrame(); + } diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index ab087f5..d2ec126 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -2087,7 +2087,6 @@ void MacroAssembler::UndoAllocationInNewSpace(Register object) { } -#ifdef ENABLE_DEBUGGER_SUPPORT CodePatcher::CodePatcher(byte* address, int size) : address_(address), size_(size), masm_(address, size + Assembler::kGap) { // Create a new macro assembler pointing to the address of the code to patch. @@ -2105,7 +2104,6 @@ CodePatcher::~CodePatcher() { ASSERT(masm_.pc_ == address_ + size_); ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); } -#endif // ENABLE_DEBUGGER_SUPPORT } } // namespace v8::internal diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index 224504a..a080f1b 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -589,7 +589,6 @@ class MacroAssembler: public Assembler { }; -#ifdef ENABLE_DEBUGGER_SUPPORT // The code patcher is used to patch (typically) small parts of code e.g. for // debugging and other types of instrumentation. When using the code patcher // the exact number of bytes specified must be emitted. Is not legal to emit @@ -608,7 +607,6 @@ class CodePatcher { int size_; // Number of bytes of the expected patch size. MacroAssembler masm_; // Macro assembler used to generate the code. }; -#endif // ENABLE_DEBUGGER_SUPPORT // ----------------------------------------------------------------------------- diff --git a/tools/v8.xcodeproj/project.pbxproj b/tools/v8.xcodeproj/project.pbxproj index f9241f9..79ece72 100644 --- a/tools/v8.xcodeproj/project.pbxproj +++ b/tools/v8.xcodeproj/project.pbxproj @@ -1489,6 +1489,7 @@ V8_TARGET_ARCH_IA32, V8_NATIVE_REGEXP, ENABLE_LOGGING_AND_PROFILING, + ENABLE_DEBUGGER_SUPPORT, ); HEADER_SEARCH_PATHS = ../src; PRODUCT_NAME = v8; @@ -1537,6 +1538,7 @@ V8_TARGET_ARCH_ARM, ENABLE_DISASSEMBLER, ENABLE_LOGGING_AND_PROFILING, + ENABLE_DEBUGGER_SUPPORT, ); HEADER_SEARCH_PATHS = ../src; PRODUCT_NAME = "v8-arm"; diff --git a/tools/visual_studio/common.vsprops b/tools/visual_studio/common.vsprops index 238dd97..213a081 100644 --- a/tools/visual_studio/common.vsprops +++ b/tools/visual_studio/common.vsprops @@ -8,7 +8,7 @@