diff options
author | isaacs <i@izs.me> | 2012-09-18 15:20:38 -0700 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-09-21 01:52:24 +0200 |
commit | 3411a03dd114d635800cc50749d2351cd734eb2a (patch) | |
tree | 0ba1e52ab2236286894b33400302181ece91b63a /deps/v8/samples | |
parent | cc1b09d6b7c3cc6b8729804cbf644634ba5d0815 (diff) | |
download | android-node-v8-3411a03dd114d635800cc50749d2351cd734eb2a.tar.gz android-node-v8-3411a03dd114d635800cc50749d2351cd734eb2a.tar.bz2 android-node-v8-3411a03dd114d635800cc50749d2351cd734eb2a.zip |
V8: Upgrade to 3.13.7.1
Diffstat (limited to 'deps/v8/samples')
-rw-r--r-- | deps/v8/samples/lineprocessor.cc | 38 | ||||
-rw-r--r-- | deps/v8/samples/process.cc | 14 | ||||
-rw-r--r-- | deps/v8/samples/shell.cc | 2 |
3 files changed, 23 insertions, 31 deletions
diff --git a/deps/v8/samples/lineprocessor.cc b/deps/v8/samples/lineprocessor.cc index 7a84a2a0ff..26e787f2b7 100644 --- a/deps/v8/samples/lineprocessor.cc +++ b/deps/v8/samples/lineprocessor.cc @@ -25,19 +25,11 @@ // (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 <v8.h> -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT #include <v8-debug.h> -#endif +#endif // ENABLE_DEBUGGER_SUPPORT #include <fcntl.h> #include <string.h> @@ -116,7 +108,7 @@ bool RunCppCycle(v8::Handle<v8::Script> script, v8::Local<v8::Context> context, bool report_exceptions); -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT v8::Persistent<v8::Context> debug_message_context; void DispatchDebugMessages() { @@ -135,7 +127,7 @@ void DispatchDebugMessages() { v8::Debug::ProcessDebugMessages(); } -#endif +#endif // ENABLE_DEBUGGER_SUPPORT int RunMain(int argc, char* argv[]) { @@ -146,11 +138,11 @@ int RunMain(int argc, char* argv[]) { v8::Handle<v8::Value> script_name(NULL); int script_param_counter = 0; -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT int port_number = -1; bool wait_for_connection = false; bool support_callback = false; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT MainCycleType cycle_type = CycleInCpp; @@ -164,7 +156,7 @@ int RunMain(int argc, char* argv[]) { cycle_type = CycleInCpp; } else if (strcmp(str, "--main-cycle-in-js") == 0) { cycle_type = CycleInJs; -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT } else if (strcmp(str, "--callback") == 0) { support_callback = true; } else if (strcmp(str, "--wait-for-connection") == 0) { @@ -172,7 +164,7 @@ int RunMain(int argc, char* argv[]) { } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { port_number = atoi(argv[i + 1]); // NOLINT i++; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT } 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) { @@ -219,7 +211,7 @@ int RunMain(int argc, char* argv[]) { // Enter the newly created execution environment. v8::Context::Scope context_scope(context); -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT debug_message_context = v8::Persistent<v8::Context>::New(context); v8::Locker locker; @@ -231,7 +223,7 @@ int RunMain(int argc, char* argv[]) { if (port_number != -1) { v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); } -#endif +#endif // ENABLE_DEBUGGER_SUPPORT bool report_exceptions = true; @@ -272,9 +264,9 @@ int RunMain(int argc, char* argv[]) { bool RunCppCycle(v8::Handle<v8::Script> script, v8::Local<v8::Context> context, bool report_exceptions) { -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT v8::Locker lock; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT v8::Handle<v8::String> fun_name = v8::String::New("ProcessLine"); v8::Handle<v8::Value> process_val = @@ -347,7 +339,7 @@ v8::Handle<v8::String> ReadFile(const char* name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast<int>(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); @@ -427,9 +419,9 @@ v8::Handle<v8::String> ReadLine() { char* res; { -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT v8::Unlocker unlocker; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT res = fgets(buffer, kBufferSize, stdin); } if (res == NULL) { diff --git a/deps/v8/samples/process.cc b/deps/v8/samples/process.cc index c0cee4c28e..ae6a5500cd 100644 --- a/deps/v8/samples/process.cc +++ b/deps/v8/samples/process.cc @@ -1,4 +1,4 @@ -// Copyright 2008 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -351,7 +351,7 @@ Handle<Value> JsHttpRequestProcessor::MapGet(Local<String> name, // Otherwise fetch the value and wrap it in a JavaScript string const string& value = (*iter).second; - return String::New(value.c_str(), value.length()); + return String::New(value.c_str(), static_cast<int>(value.length())); } @@ -443,7 +443,7 @@ Handle<Value> JsHttpRequestProcessor::GetPath(Local<String> name, const string& path = request->Path(); // Wrap the result in a JavaScript string and return it. - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast<int>(path.length())); } @@ -451,7 +451,7 @@ Handle<Value> JsHttpRequestProcessor::GetReferrer(Local<String> name, const AccessorInfo& info) { HttpRequest* request = UnwrapRequest(info.Holder()); const string& path = request->Referrer(); - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast<int>(path.length())); } @@ -459,7 +459,7 @@ Handle<Value> JsHttpRequestProcessor::GetHost(Local<String> name, const AccessorInfo& info) { HttpRequest* request = UnwrapRequest(info.Holder()); const string& path = request->Host(); - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast<int>(path.length())); } @@ -467,7 +467,7 @@ Handle<Value> JsHttpRequestProcessor::GetUserAgent(Local<String> name, const AccessorInfo& info) { HttpRequest* request = UnwrapRequest(info.Holder()); const string& path = request->UserAgent(); - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast<int>(path.length())); } @@ -557,7 +557,7 @@ Handle<String> ReadFile(const string& name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast<int>(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); diff --git a/deps/v8/samples/shell.cc b/deps/v8/samples/shell.cc index db0cc1a930..821ef75a76 100644 --- a/deps/v8/samples/shell.cc +++ b/deps/v8/samples/shell.cc @@ -205,7 +205,7 @@ v8::Handle<v8::String> ReadFile(const char* name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast<int>(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); |