From 6ded16be15dd865a9b21ea304d5273c8be299c87 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Mon, 10 May 2010 14:33:55 +0100 Subject: Update V8 to r4588 We're using WebKit r58033, as used by http://src.chromium.org/svn/releases/5.0.387.0/DEPS This requires http://v8.googlecode.com/svn/trunk@4465 but this version has a crashing bug for ARM. Instead we use http://v8.googlecode.com/svn/trunk@4588, which is used by http://src.chromium.org/svn/releases/6.0.399.0/DEPS Note that a trivial bug fix was required in arm/codegen-arm.cc. This is guarded with ANDROID. See http://code.google.com/p/v8/issues/detail?id=703 Change-Id: I459647a8286c4f8c7405f0c5581ecbf051a6f1e8 --- samples/lineprocessor.cc | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'samples') diff --git a/samples/lineprocessor.cc b/samples/lineprocessor.cc index 61517d36..1606a8f9 100644 --- a/samples/lineprocessor.cc +++ b/samples/lineprocessor.cc @@ -25,8 +25,20 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This controls whether this sample is compiled with debugger support. +// You may trace its usages in source text to see what parts of program +// are responsible for debugging support. +// Note that V8 itself should be compiled with enabled debugger support +// to have it all working. +#define SUPPORT_DEBUGGING + #include + +#ifdef SUPPORT_DEBUGGING #include +#endif + #include #include #include @@ -103,8 +115,9 @@ v8::Handle ReadLine(const v8::Arguments& args); bool RunCppCycle(v8::Handle script, v8::Local context, bool report_exceptions); -v8::Persistent debug_message_context; +#ifdef SUPPORT_DEBUGGING +v8::Persistent debug_message_context; void DispatchDebugMessages() { // We are in some random thread. We should already have v8::Locker acquired @@ -122,6 +135,7 @@ void DispatchDebugMessages() { v8::Debug::ProcessDebugMessages(); } +#endif int RunMain(int argc, char* argv[]) { @@ -132,9 +146,12 @@ int RunMain(int argc, char* argv[]) { v8::Handle script_name(NULL); int script_param_counter = 0; +#ifdef SUPPORT_DEBUGGING int port_number = -1; bool wait_for_connection = false; bool support_callback = false; +#endif + MainCycleType cycle_type = CycleInCpp; for (int i = 1; i < argc; i++) { @@ -143,17 +160,19 @@ int RunMain(int argc, char* argv[]) { // Ignore any -f flags for compatibility with the other stand- // alone JavaScript engines. continue; - } else if (strcmp(str, "--callback") == 0) { - support_callback = true; - } else if (strcmp(str, "--wait-for-connection") == 0) { - wait_for_connection = true; } else if (strcmp(str, "--main-cycle-in-cpp") == 0) { cycle_type = CycleInCpp; } else if (strcmp(str, "--main-cycle-in-js") == 0) { cycle_type = CycleInJs; +#ifdef SUPPORT_DEBUGGING + } else if (strcmp(str, "--callback") == 0) { + support_callback = true; + } else if (strcmp(str, "--wait-for-connection") == 0) { + wait_for_connection = true; } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { port_number = atoi(argv[i + 1]); // NOLINT i++; +#endif } else if (strncmp(str, "--", 2) == 0) { printf("Warning: unknown flag %s.\nTry --help for options\n", str); } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { @@ -197,12 +216,12 @@ int RunMain(int argc, char* argv[]) { // Create a new execution environment containing the built-in // functions v8::Handle context = v8::Context::New(NULL, global); - debug_message_context = v8::Persistent::New(context); - - // Enter the newly created execution environment. v8::Context::Scope context_scope(context); +#ifdef SUPPORT_DEBUGGING + debug_message_context = v8::Persistent::New(context); + v8::Locker locker; if (support_callback) { @@ -210,10 +229,9 @@ int RunMain(int argc, char* argv[]) { } if (port_number != -1) { - const char* auto_break_param = "--debugger_auto_break"; - v8::V8::SetFlagsFromString(auto_break_param, strlen(auto_break_param)); v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); } +#endif bool report_exceptions = true; @@ -254,7 +272,9 @@ int RunMain(int argc, char* argv[]) { bool RunCppCycle(v8::Handle script, v8::Local context, bool report_exceptions) { +#ifdef SUPPORT_DEBUGGING v8::Locker lock; +#endif v8::Handle fun_name = v8::String::New("ProcessLine"); v8::Handle process_val = @@ -407,7 +427,9 @@ v8::Handle ReadLine() { char* res; { +#ifdef SUPPORT_DEBUGGING v8::Unlocker unlocker; +#endif res = fgets(buffer, kBufferSize, stdin); } if (res == NULL) { -- cgit v1.2.3