summaryrefslogtreecommitdiff
path: root/deps/v8/samples
diff options
context:
space:
mode:
authorMichaƫl Zasso <mic.besace@gmail.com>2015-10-06 08:42:38 +0200
committerAli Ijaz Sheikh <ofrobots@google.com>2015-10-14 11:20:34 -0700
commitd8011d1683fe0d977de2bea1147f5213d4490c5a (patch)
tree54967df8dc1732e59eef39e5c5b39fe99ad88977 /deps/v8/samples
parentd1a2e5357ef0357cec9b516fa9ac78cc38a984aa (diff)
downloadandroid-node-v8-d8011d1683fe0d977de2bea1147f5213d4490c5a.tar.gz
android-node-v8-d8011d1683fe0d977de2bea1147f5213d4490c5a.tar.bz2
android-node-v8-d8011d1683fe0d977de2bea1147f5213d4490c5a.zip
deps: upgrade V8 to 4.6.85.23
PR-URL: https://github.com/nodejs/node/pull/3351 Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/samples')
-rw-r--r--deps/v8/samples/process.cc12
-rw-r--r--deps/v8/samples/shell.cc24
2 files changed, 23 insertions, 13 deletions
diff --git a/deps/v8/samples/process.cc b/deps/v8/samples/process.cc
index 6f7a47f1b0..cfbd054c16 100644
--- a/deps/v8/samples/process.cc
+++ b/deps/v8/samples/process.cc
@@ -666,11 +666,13 @@ StringHttpRequest kSampleRequests[kSampleSize] = {
};
-bool ProcessEntries(HttpRequestProcessor* processor, int count,
- StringHttpRequest* reqs) {
+bool ProcessEntries(v8::Platform* platform, HttpRequestProcessor* processor,
+ int count, StringHttpRequest* reqs) {
for (int i = 0; i < count; i++) {
- if (!processor->Process(&reqs[i]))
- return false;
+ bool result = processor->Process(&reqs[i]);
+ while (v8::platform::PumpMessageLoop(platform, Isolate::GetCurrent()))
+ continue;
+ if (!result) return false;
}
return true;
}
@@ -714,7 +716,7 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Error initializing processor.\n");
return 1;
}
- if (!ProcessEntries(&processor, kSampleSize, kSampleRequests))
+ if (!ProcessEntries(platform, &processor, kSampleSize, kSampleRequests))
return 1;
PrintMap(&output);
}
diff --git a/deps/v8/samples/shell.cc b/deps/v8/samples/shell.cc
index bd621c5465..ad22285084 100644
--- a/deps/v8/samples/shell.cc
+++ b/deps/v8/samples/shell.cc
@@ -45,8 +45,9 @@
v8::Local<v8::Context> CreateShellContext(v8::Isolate* isolate);
-void RunShell(v8::Local<v8::Context> context);
-int RunMain(v8::Isolate* isolate, int argc, char* argv[]);
+void RunShell(v8::Local<v8::Context> context, v8::Platform* platform);
+int RunMain(v8::Isolate* isolate, v8::Platform* platform, int argc,
+ char* argv[]);
bool ExecuteString(v8::Isolate* isolate, v8::Local<v8::String> source,
v8::Local<v8::Value> name, bool print_result,
bool report_exceptions);
@@ -95,8 +96,8 @@ int main(int argc, char* argv[]) {
return 1;
}
v8::Context::Scope context_scope(context);
- result = RunMain(isolate, argc, argv);
- if (run_shell) RunShell(context);
+ result = RunMain(isolate, platform, argc, argv);
+ if (run_shell) RunShell(context, platform);
}
isolate->Dispose();
v8::V8::Dispose();
@@ -270,7 +271,8 @@ v8::MaybeLocal<v8::String> ReadFile(v8::Isolate* isolate, const char* name) {
// Process remaining command line arguments and execute files
-int RunMain(v8::Isolate* isolate, int argc, char* argv[]) {
+int RunMain(v8::Isolate* isolate, v8::Platform* platform, int argc,
+ char* argv[]) {
for (int i = 1; i < argc; i++) {
const char* str = argv[i];
if (strcmp(str, "--shell") == 0) {
@@ -293,7 +295,9 @@ int RunMain(v8::Isolate* isolate, int argc, char* argv[]) {
.ToLocal(&source)) {
return 1;
}
- if (!ExecuteString(isolate, source, file_name, false, true)) return 1;
+ bool success = ExecuteString(isolate, source, file_name, false, true);
+ while (v8::platform::PumpMessageLoop(platform, isolate)) continue;
+ if (!success) return 1;
} else {
// Use all other arguments as names of files to load and run.
v8::Local<v8::String> file_name =
@@ -304,7 +308,9 @@ int RunMain(v8::Isolate* isolate, int argc, char* argv[]) {
fprintf(stderr, "Error reading '%s'\n", str);
continue;
}
- if (!ExecuteString(isolate, source, file_name, false, true)) return 1;
+ bool success = ExecuteString(isolate, source, file_name, false, true);
+ while (v8::platform::PumpMessageLoop(platform, isolate)) continue;
+ if (!success) return 1;
}
}
return 0;
@@ -312,7 +318,7 @@ int RunMain(v8::Isolate* isolate, int argc, char* argv[]) {
// The read-eval-execute loop of the shell.
-void RunShell(v8::Local<v8::Context> context) {
+void RunShell(v8::Local<v8::Context> context, v8::Platform* platform) {
fprintf(stderr, "V8 version %s [sample shell]\n", v8::V8::GetVersion());
static const int kBufferSize = 256;
// Enter the execution environment before evaluating any code.
@@ -331,6 +337,8 @@ void RunShell(v8::Local<v8::Context> context) {
v8::String::NewFromUtf8(context->GetIsolate(), str,
v8::NewStringType::kNormal).ToLocalChecked(),
name, true, true);
+ while (v8::platform::PumpMessageLoop(platform, context->GetIsolate()))
+ continue;
}
fprintf(stderr, "\n");
}