Revision: 16563
Author:   [email protected]
Date:     Thu Sep  5 18:53:39 2013 UTC
Log:      Remove obsolete global V8::has_been_fooed flags.

[email protected]
BUG=v8:2744
TEST=cctest/test-api/InitializeAndDispose

Review URL: https://codereview.chromium.org/23453030
http://code.google.com/p/v8/source/detail?r=16563

Modified:
 /branches/bleeding_edge/src/v8.cc
 /branches/bleeding_edge/src/v8.h
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/src/v8.cc   Thu Sep  5 11:27:22 2013 UTC
+++ /branches/bleeding_edge/src/v8.cc   Thu Sep  5 18:53:39 2013 UTC
@@ -50,8 +50,6 @@

 V8_DECLARE_ONCE(init_once);

-bool V8::has_been_set_up_ = false;
-bool V8::has_been_disposed_ = false;
 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;

@@ -81,9 +79,6 @@
   if (isolate->IsDead()) return false;
   if (isolate->IsInitialized()) return true;

-  has_been_set_up_ = true;
-  has_been_disposed_ = false;
-
   return isolate->Init(des);
 }

@@ -91,8 +86,7 @@
 void V8::TearDown() {
   Isolate* isolate = Isolate::Current();
   ASSERT(isolate->IsDefaultIsolate());
-
-  if (!has_been_set_up_ || has_been_disposed_) return;
+  if (!isolate->IsInitialized()) return;

   // The isolate has to be torn down before clearing the LOperand
   // caches so that the optimizing compiler thread (if running)
@@ -106,8 +100,6 @@
   RegisteredExtension::UnregisterAll();
   Isolate::GlobalTearDown();

-  has_been_disposed_ = true;
-
   delete call_completed_callbacks_;
   call_completed_callbacks_ = NULL;

=======================================
--- /branches/bleeding_edge/src/v8.h    Wed Sep  4 13:37:39 2013 UTC
+++ /branches/bleeding_edge/src/v8.h    Thu Sep  5 18:53:39 2013 UTC
@@ -122,11 +122,6 @@
   static void InitializeOncePerProcessImpl();
   static void InitializeOncePerProcess();

-  // True if V8 has ever been run
-  static bool has_been_set_up_;
-  // True if engine has been shut down
-  // (reset if engine is restarted)
-  static bool has_been_disposed_;
   // List of callbacks when a Call completes.
   static List<CallCompletedCallback>* call_completed_callbacks_;
   // Allocator for external array buffers.
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Thu Sep 5 11:18:52 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Thu Sep 5 18:53:39 2013 UTC
@@ -164,6 +164,24 @@
   }
   args.GetReturnValue().Set(result);
 }
+
+
+// Tests that call v8::V8::Dispose() cannot be threaded.
+TEST(InitializeAndDisposeOnce) {
+  CHECK(v8::V8::Initialize());
+  CHECK(v8::V8::Dispose());
+}
+
+
+// Tests that call v8::V8::Dispose() cannot be threaded.
+TEST(InitializeAndDisposeMultiple) {
+  for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
+  for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
+  for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
+  // TODO(mstarzinger): This should fail gracefully instead of asserting.
+  // for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
+  for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
+}


 THREADED_TEST(Handles) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to