Revert of d8 workers: make sure Shell::Quit is only called once (patchset #5 id:80001...
authorbinji <binji@chromium.org>
Tue, 14 Jul 2015 18:13:46 +0000 (11:13 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 14 Jul 2015 18:14:01 +0000 (18:14 +0000)
Reason for revert:
Breaks webkit_unit_tests. See http://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Win/builds/853/steps/webkit_unit_tests/logs/stdio

Original issue's description:
> d8 workers: make sure Shell::Quit is only called once
>
> When running with isolates, Quit can be called simultaneously by two threads.
> If this happens, then both threads try to clean up the Workers, which could
> crash.
>
> BUG=v8:4279
> R=jarin@chromium.org
> R=machenbach@chromium.org
> LOG=n
>
> Committed: https://crrev.com/76184292b392d107609f21662a949b58bb1e258c
> Cr-Commit-Position: refs/heads/master@{#29654}

TBR=jarin@chromium.org,machenbach@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4279

Review URL: https://codereview.chromium.org/1235083004

Cr-Commit-Position: refs/heads/master@{#29656}

src/d8.cc
src/d8.h
test/mjsunit/mjsunit.status

index d882e45..2b1832a 100644 (file)
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -216,7 +216,6 @@ Persistent<Context> Shell::evaluation_context_;
 ArrayBuffer::Allocator* Shell::array_buffer_allocator;
 ShellOptions Shell::options;
 const char* Shell::kPrompt = "d8> ";
-base::OnceType Shell::quit_once_ = V8_ONCE_INIT;
 
 #ifndef V8_SHARED
 bool CounterMap::Match(void* key1, void* key2) {
@@ -810,22 +809,16 @@ void Shell::WorkerTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
 #endif  // !V8_SHARED
 
 
-void Shell::QuitOnce(v8::FunctionCallbackInfo<v8::Value>* args) {
-  int exit_code = (*args)[0]->Int32Value();
+void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
+  int exit_code = args[0]->Int32Value();
 #ifndef V8_SHARED
   CleanupWorkers();
 #endif  // !V8_SHARED
-  OnExit(args->GetIsolate());
+  OnExit(args.GetIsolate());
   exit(exit_code);
 }
 
 
-void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  base::CallOnce(&quit_once_, &QuitOnce,
-                 const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args));
-}
-
-
 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
   args.GetReturnValue().Set(
       String::NewFromUtf8(args.GetIsolate(), V8::GetVersion()));
index f126dd2..6c632c9 100644 (file)
--- a/src/d8.h
+++ b/src/d8.h
@@ -15,9 +15,6 @@
 #include "src/base/compiler-specific.h"
 #endif  // !V8_SHARED
 
-#include "src/base/once.h"
-
-
 namespace v8 {
 
 
@@ -414,7 +411,6 @@ class Shell : public i::AllStatic {
 
   static void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
   static void Write(const v8::FunctionCallbackInfo<v8::Value>& args);
-  static void QuitOnce(v8::FunctionCallbackInfo<v8::Value>* args);
   static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args);
   static void Version(const v8::FunctionCallbackInfo<v8::Value>& args);
   static void Read(const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -472,7 +468,6 @@ class Shell : public i::AllStatic {
 
  private:
   static Persistent<Context> evaluation_context_;
-  static base::OnceType quit_once_;
 #ifndef V8_SHARED
   static Persistent<Context> utility_context_;
   static CounterMap* counter_map_;
index 0b25f4c..864cd3e 100644 (file)
   # BUG(chromium:508074). Remove this once the issue is fixed.
   'harmony/arrow-rest-params': [PASS, NO_VARIANTS],
   'harmony/rest-params': [PASS, ['no_snap == True', NO_VARIANTS]],
+
+  # BUG(v8:4279).
+  'regress/regress-4279': [PASS, ['isolates', SKIP]],
 }],  # ALWAYS
 
 ['novfp3 == True', {