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
This commit is contained in:
parent
f5864d08af
commit
3dd74076d1
24
SConstruct
24
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):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
5
src/v8.h
5
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"
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -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";
|
||||
|
@ -8,7 +8,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="$(ProjectDir)\..\..\src;$(IntDir)\DerivedSources"
|
||||
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;ENABLE_LOGGING_AND_PROFILING"
|
||||
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;ENABLE_LOGGING_AND_PROFILING;ENABLE_DEBUGGER_SUPPORT"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="0"
|
||||
RuntimeTypeInfo="false"
|
||||
|
Loading…
Reference in New Issue
Block a user