Revision: 20876
Author:   [email protected]
Date:     Tue Apr 22 09:24:56 2014 UTC
Log:      Simplify v8/Isolate teardown.

This implies that one better has a v8::V8::Initialize when v8::V8::Dispose is used.

BUG=359977
LOG=y
[email protected]

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

Modified:
 /branches/bleeding_edge/samples/lineprocessor.cc
 /branches/bleeding_edge/samples/process.cc
 /branches/bleeding_edge/samples/shell.cc
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/d8.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/mksnapshot.cc
 /branches/bleeding_edge/src/serialize.cc
 /branches/bleeding_edge/src/v8.cc
 /branches/bleeding_edge/test/cctest/cctest.cc
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-microtask-delivery.cc
 /branches/bleeding_edge/tools/lexer-shell.cc
 /branches/bleeding_edge/tools/parser-shell.cc

=======================================
--- /branches/bleeding_edge/samples/lineprocessor.cc Fri Mar 14 10:20:33 2014 UTC +++ /branches/bleeding_edge/samples/lineprocessor.cc Tue Apr 22 09:24:56 2014 UTC
@@ -328,6 +328,7 @@

 int main(int argc, char* argv[]) {
   v8::V8::InitializeICU();
+  v8::V8::Initialize();
   int result = RunMain(argc, argv);
   v8::V8::Dispose();
   return result;
=======================================
--- /branches/bleeding_edge/samples/process.cc  Wed Jan  8 06:53:31 2014 UTC
+++ /branches/bleeding_edge/samples/process.cc  Tue Apr 22 09:24:56 2014 UTC
@@ -644,6 +644,7 @@

 int main(int argc, char* argv[]) {
   v8::V8::InitializeICU();
+  v8::V8::Initialize();
   map<string, string> options;
   string file;
   ParseOptions(argc, argv, options, &file);
=======================================
--- /branches/bleeding_edge/samples/shell.cc    Fri Mar 14 10:20:33 2014 UTC
+++ /branches/bleeding_edge/samples/shell.cc    Tue Apr 22 09:24:56 2014 UTC
@@ -67,6 +67,7 @@

 int main(int argc, char* argv[]) {
   v8::V8::InitializeICU();
+  v8::V8::Initialize();
   v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
   v8::Isolate* isolate = v8::Isolate::GetCurrent();
   run_shell = (argc == 1);
=======================================
--- /branches/bleeding_edge/src/api.cc  Sat Apr 19 14:33:18 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Tue Apr 22 09:24:56 2014 UTC
@@ -4995,12 +4995,6 @@


 bool v8::V8::Dispose() {
-  i::Isolate* isolate = i::Isolate::Current();
-  if (!Utils::ApiCheck(isolate != NULL && isolate->IsDefaultIsolate(),
-                       "v8::V8::Dispose()",
- "Use v8::Isolate::Dispose() for non-default isolate.")) {
-    return false;
-  }
   i::V8::TearDown();
   return true;
 }
=======================================
--- /branches/bleeding_edge/src/d8.cc   Thu Apr 17 13:27:02 2014 UTC
+++ /branches/bleeding_edge/src/d8.cc   Tue Apr 22 09:24:56 2014 UTC
@@ -1678,6 +1678,7 @@
 int Shell::Main(int argc, char* argv[]) {
   if (!SetOptions(argc, argv)) return 1;
   v8::V8::InitializeICU(options.icu_data_file);
+  v8::V8::Initialize();
 #ifndef V8_SHARED
   i::FLAG_trace_hydrogen_file = "hydrogen.cfg";
   i::FLAG_redirect_code_traces_to = "code.asm";
@@ -1692,7 +1693,7 @@
     v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
   }
   int result = 0;
-  Isolate* isolate = Isolate::GetCurrent();
+  Isolate* isolate = Isolate::New();
 #ifndef V8_SHARED
   v8::ResourceConstraints constraints;
   constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory(),
@@ -1703,6 +1704,7 @@
   DumbLineEditor dumb_line_editor(isolate);
   {
     Initialize(isolate);
+    Isolate::Scope isolate_scope(isolate);
 #ifdef ENABLE_VTUNE_JIT_INTERFACE
     vTune::InitializeVtuneForV8();
 #endif
@@ -1765,6 +1767,7 @@
       RunShell(isolate);
     }
   }
+  isolate->Dispose();
   V8::Dispose();

   OnExit();
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Wed Apr 16 13:28:11 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Tue Apr 22 09:24:56 2014 UTC
@@ -1551,9 +1551,7 @@
     serialize_partial_snapshot_cache_ = NULL;
   }

-  if (!IsDefaultIsolate()) {
-    delete this;
-  }
+  delete this;

   // Restore the previous current isolate.
   SetIsolateThreadLocals(saved_isolate, saved_data);
=======================================
--- /branches/bleeding_edge/src/mksnapshot.cc   Thu Apr 17 14:45:06 2014 UTC
+++ /branches/bleeding_edge/src/mksnapshot.cc   Tue Apr 22 09:24:56 2014 UTC
@@ -271,6 +271,8 @@

 int main(int argc, char** argv) {
   V8::InitializeICU();
+  // TODO(svenpanne) We can't do this here currently, although we should!
+  // v8::V8::Initialize();
   i::Isolate::SetCrashIfDefaultIsolateInitialized();

   // By default, log code create information in the snapshot.
@@ -410,6 +412,7 @@
       ser.CurrentAllocationAddress(i::CELL_SPACE),
       ser.CurrentAllocationAddress(i::PROPERTY_CELL_SPACE));
   isolate->Exit();
+  i::Serializer::TearDown();
   isolate->Dispose();
   V8::Dispose();
   return 0;
=======================================
--- /branches/bleeding_edge/src/serialize.cc    Thu Apr 17 14:45:06 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc    Tue Apr 22 09:24:56 2014 UTC
@@ -785,9 +785,6 @@


 void Serializer::TearDown() {
- // TearDown is called by V8::TearDown() for the default isolate. It's safe
-  // to shut down the serializer by that point. Just to be safe, we restore
-  // serialization_state_ to uninitialized.
   ASSERT(NoBarrier_Load(&serialization_state_) !=
          SERIALIZER_STATE_UNINITIALIZED);
   if (code_address_map_) {
=======================================
--- /branches/bleeding_edge/src/v8.cc   Thu Apr 17 14:45:06 2014 UTC
+++ /branches/bleeding_edge/src/v8.cc   Tue Apr 22 09:24:56 2014 UTC
@@ -77,16 +77,6 @@


 void V8::TearDown() {
-  Isolate* isolate = Isolate::Current();
-  ASSERT(isolate->IsDefaultIsolate());
-  if (!isolate->IsInitialized()) return;
-
-  // The isolate has to be torn down before clearing the LOperand
-  // caches so that the optimizing compiler thread (if running)
-  // doesn't see an inconsistent view of the lithium instructions.
-  isolate->TearDown();
-  delete isolate;
-
   Bootstrapper::TearDownExtensions();
   ElementsAccessor::TearDown();
   LOperand::TearDownCaches();
@@ -98,7 +88,6 @@
   call_completed_callbacks_ = NULL;

   Sampler::TearDown();
-  Serializer::TearDown();

 #ifdef V8_USE_DEFAULT_PLATFORM
   DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.cc Fri Jan 31 07:29:25 2014 UTC +++ /branches/bleeding_edge/test/cctest/cctest.cc Tue Apr 22 09:24:56 2014 UTC
@@ -138,6 +138,7 @@

 int main(int argc, char* argv[]) {
   v8::V8::InitializeICU();
+  v8::V8::Initialize();
   i::Isolate::SetCrashIfDefaultIsolateInitialized();

   v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Thu Apr 17 11:27:45 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Tue Apr 22 09:24:56 2014 UTC
@@ -22313,6 +22313,7 @@

 TEST(Promises) {
   i::FLAG_harmony_promises = true;
+  i::FlagList::EnforceFlagImplications();

   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
=======================================
--- /branches/bleeding_edge/test/cctest/test-microtask-delivery.cc Mon Mar 31 12:40:32 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-microtask-delivery.cc Tue Apr 22 09:24:56 2014 UTC
@@ -37,6 +37,7 @@
  public:
   HarmonyIsolate() {
     i::FLAG_harmony_promises = true;
+    i::FlagList::EnforceFlagImplications();
     isolate_ = Isolate::New();
     isolate_->Enter();
   }
=======================================
--- /branches/bleeding_edge/tools/lexer-shell.cc Thu Apr 17 13:27:02 2014 UTC +++ /branches/bleeding_edge/tools/lexer-shell.cc Tue Apr 22 09:24:56 2014 UTC
@@ -182,6 +182,7 @@

 int main(int argc, char* argv[]) {
   v8::V8::InitializeICU();
+  v8::V8::Initialize();
   v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
   Encoding encoding = LATIN1;
   bool print_tokens = false;
=======================================
--- /branches/bleeding_edge/tools/parser-shell.cc Fri Apr 11 11:44:49 2014 UTC +++ /branches/bleeding_edge/tools/parser-shell.cc Tue Apr 22 09:24:56 2014 UTC
@@ -107,6 +107,7 @@

 int main(int argc, char* argv[]) {
   v8::V8::InitializeICU();
+  v8::V8::Initialize();
   v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
   Encoding encoding = LATIN1;
   std::vector<std::string> fnames;

--
--
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/d/optout.

Reply via email to