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
diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc
index 1e8102e..83a1e19 100644
--- a/test/cctest/test-thread-termination.cc
+++ b/test/cctest/test-thread-termination.cc
@@ -40,6 +40,7 @@
 
 
 v8::Handle<v8::Value> TerminateCurrentThread(const v8::Arguments& args) {
+  CHECK(!v8::V8::IsExecutionTerminating());
   v8::V8::TerminateExecution();
   return v8::Undefined();
 }
@@ -52,15 +53,19 @@
 
 
 v8::Handle<v8::Value> Loop(const v8::Arguments& args) {
+  CHECK(!v8::V8::IsExecutionTerminating());
   v8::Handle<v8::String> source =
       v8::String::New("try { doloop(); fail(); } catch(e) { fail(); }");
-  v8::Script::Compile(source)->Run();
+  v8::Handle<v8::Value> result = v8::Script::Compile(source)->Run();
+  CHECK(result.IsEmpty());
+  CHECK(v8::V8::IsExecutionTerminating());
   return v8::Undefined();
 }
 
 
 v8::Handle<v8::Value> DoLoop(const v8::Arguments& args) {
   v8::TryCatch try_catch;
+  CHECK(!v8::V8::IsExecutionTerminating());
   v8::Script::Compile(v8::String::New("function f() {"
                                       "  var term = true;"
                                       "  try {"
@@ -78,12 +83,14 @@
   CHECK(try_catch.Exception()->IsNull());
   CHECK(try_catch.Message().IsEmpty());
   CHECK(!try_catch.CanContinue());
+  CHECK(v8::V8::IsExecutionTerminating());
   return v8::Undefined();
 }
 
 
 v8::Handle<v8::Value> DoLoopNoCall(const v8::Arguments& args) {
   v8::TryCatch try_catch;
+  CHECK(!v8::V8::IsExecutionTerminating());
   v8::Script::Compile(v8::String::New("var term = true;"
                                       "while(true) {"
                                       "  if (term) terminate();"
@@ -93,6 +100,7 @@
   CHECK(try_catch.Exception()->IsNull());
   CHECK(try_catch.Message().IsEmpty());
   CHECK(!try_catch.CanContinue());
+  CHECK(v8::V8::IsExecutionTerminating());
   return v8::Undefined();
 }
 
@@ -118,11 +126,13 @@
       CreateGlobalTemplate(TerminateCurrentThread, DoLoop);
   v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
   v8::Context::Scope context_scope(context);
+  CHECK(!v8::V8::IsExecutionTerminating());
   // Run a loop that will be infinite if thread termination does not work.
   v8::Handle<v8::String> source =
       v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
   v8::Script::Compile(source)->Run();
   // Test that we can run the code again after thread termination.
+  CHECK(!v8::V8::IsExecutionTerminating());
   v8::Script::Compile(source)->Run();
   context.Dispose();
 }
@@ -136,10 +146,12 @@
       CreateGlobalTemplate(TerminateCurrentThread, DoLoopNoCall);
   v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
   v8::Context::Scope context_scope(context);
+  CHECK(!v8::V8::IsExecutionTerminating());
   // Run a loop that will be infinite if thread termination does not work.
   v8::Handle<v8::String> source =
       v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
   v8::Script::Compile(source)->Run();
+  CHECK(!v8::V8::IsExecutionTerminating());
   // Test that we can run the code again after thread termination.
   v8::Script::Compile(source)->Run();
   context.Dispose();
@@ -149,6 +161,7 @@
 class TerminatorThread : public v8::internal::Thread {
   void Run() {
     semaphore->Wait();
+    CHECK(!v8::V8::IsExecutionTerminating());
     v8::V8::TerminateExecution();
   }
 };
@@ -165,6 +178,7 @@
   v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(Signal, DoLoop);
   v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
   v8::Context::Scope context_scope(context);
+  CHECK(!v8::V8::IsExecutionTerminating());
   // Run a loop that will be infinite if thread termination does not work.
   v8::Handle<v8::String> source =
       v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
@@ -187,6 +201,7 @@
         CreateGlobalTemplate(Signal, DoLoop);
     v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
     v8::Context::Scope context_scope(context);
+    CHECK(!v8::V8::IsExecutionTerminating());
     // Run a loop that will be infinite if thread termination does not work.
     v8::Handle<v8::String> source =
         v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
@@ -235,6 +250,7 @@
 
 v8::Handle<v8::Value> TerminateOrReturnObject(const v8::Arguments& args) {
   if (++call_count == 10) {
+    CHECK(!v8::V8::IsExecutionTerminating());
     v8::V8::TerminateExecution();
     return v8::Undefined();
   }
@@ -246,6 +262,7 @@
 
 v8::Handle<v8::Value> LoopGetProperty(const v8::Arguments& args) {
   v8::TryCatch try_catch;
+  CHECK(!v8::V8::IsExecutionTerminating());
   v8::Script::Compile(v8::String::New("function f() {"
                                       "  try {"
                                       "    while(true) {"
@@ -261,6 +278,7 @@
   CHECK(try_catch.Exception()->IsNull());
   CHECK(try_catch.Message().IsEmpty());
   CHECK(!try_catch.CanContinue());
+  CHECK(v8::V8::IsExecutionTerminating());
   return v8::Undefined();
 }
 
@@ -278,12 +296,14 @@
 
   v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
   v8::Context::Scope context_scope(context);
+  CHECK(!v8::V8::IsExecutionTerminating());
   // Run a loop that will be infinite if thread termination does not work.
   v8::Handle<v8::String> source =
       v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
   call_count = 0;
   v8::Script::Compile(source)->Run();
   // Test that we can run the code again after thread termination.
+  CHECK(!v8::V8::IsExecutionTerminating());
   call_count = 0;
   v8::Script::Compile(source)->Run();
   context.Dispose();