Revert "Simplify v8/Isolate teardown."
This reverts commit r20876, it broke non-snapshot tests. TBR=bmeurer@chromium.org git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20879 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
206dbe87e7
commit
eeb1d7020e
@ -328,7 +328,6 @@ bool RunCppCycle(v8::Handle<v8::Script> script,
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
v8::V8::InitializeICU();
|
||||
v8::V8::Initialize();
|
||||
int result = RunMain(argc, argv);
|
||||
v8::V8::Dispose();
|
||||
return result;
|
||||
|
@ -644,7 +644,6 @@ void PrintMap(map<string, string>* m) {
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
v8::V8::InitializeICU();
|
||||
v8::V8::Initialize();
|
||||
map<string, string> options;
|
||||
string file;
|
||||
ParseOptions(argc, argv, options, &file);
|
||||
|
@ -67,7 +67,6 @@ static bool run_shell;
|
||||
|
||||
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);
|
||||
|
@ -4996,6 +4996,12 @@ void v8::V8::SetArrayBufferAllocator(
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1678,7 +1678,6 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
||||
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";
|
||||
@ -1693,7 +1692,7 @@ int Shell::Main(int argc, char* argv[]) {
|
||||
v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
|
||||
}
|
||||
int result = 0;
|
||||
Isolate* isolate = Isolate::New();
|
||||
Isolate* isolate = Isolate::GetCurrent();
|
||||
#ifndef V8_SHARED
|
||||
v8::ResourceConstraints constraints;
|
||||
constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory(),
|
||||
@ -1704,7 +1703,6 @@ int Shell::Main(int argc, char* argv[]) {
|
||||
DumbLineEditor dumb_line_editor(isolate);
|
||||
{
|
||||
Initialize(isolate);
|
||||
Isolate::Scope isolate_scope(isolate);
|
||||
#ifdef ENABLE_VTUNE_JIT_INTERFACE
|
||||
vTune::InitializeVtuneForV8();
|
||||
#endif
|
||||
@ -1767,7 +1765,6 @@ int Shell::Main(int argc, char* argv[]) {
|
||||
RunShell(isolate);
|
||||
}
|
||||
}
|
||||
isolate->Dispose();
|
||||
V8::Dispose();
|
||||
|
||||
OnExit();
|
||||
|
@ -1551,7 +1551,9 @@ void Isolate::TearDown() {
|
||||
serialize_partial_snapshot_cache_ = NULL;
|
||||
}
|
||||
|
||||
delete this;
|
||||
if (!IsDefaultIsolate()) {
|
||||
delete this;
|
||||
}
|
||||
|
||||
// Restore the previous current isolate.
|
||||
SetIsolateThreadLocals(saved_isolate, saved_data);
|
||||
|
@ -271,8 +271,6 @@ void DumpException(Handle<Message> message) {
|
||||
|
||||
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.
|
||||
@ -412,7 +410,6 @@ int main(int argc, char** argv) {
|
||||
ser.CurrentAllocationAddress(i::CELL_SPACE),
|
||||
ser.CurrentAllocationAddress(i::PROPERTY_CELL_SPACE));
|
||||
isolate->Exit();
|
||||
i::Serializer::TearDown();
|
||||
isolate->Dispose();
|
||||
V8::Dispose();
|
||||
return 0;
|
||||
|
@ -785,6 +785,9 @@ void Serializer::InitializeOncePerProcess() {
|
||||
|
||||
|
||||
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_) {
|
||||
|
11
src/v8.cc
11
src/v8.cc
@ -77,6 +77,16 @@ bool V8::Initialize(Deserializer* des) {
|
||||
|
||||
|
||||
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();
|
||||
@ -88,6 +98,7 @@ void V8::TearDown() {
|
||||
call_completed_callbacks_ = NULL;
|
||||
|
||||
Sampler::TearDown();
|
||||
Serializer::TearDown();
|
||||
|
||||
#ifdef V8_USE_DEFAULT_PLATFORM
|
||||
DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
|
||||
|
@ -138,7 +138,6 @@ static void SuggestTestHarness(int tests) {
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
v8::V8::InitializeICU();
|
||||
v8::V8::Initialize();
|
||||
i::Isolate::SetCrashIfDefaultIsolateInitialized();
|
||||
|
||||
v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
|
||||
|
@ -22313,7 +22313,6 @@ TEST(EventLogging) {
|
||||
|
||||
TEST(Promises) {
|
||||
i::FLAG_harmony_promises = true;
|
||||
i::FlagList::EnforceFlagImplications();
|
||||
|
||||
LocalContext context;
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
|
@ -37,7 +37,6 @@ class HarmonyIsolate {
|
||||
public:
|
||||
HarmonyIsolate() {
|
||||
i::FLAG_harmony_promises = true;
|
||||
i::FlagList::EnforceFlagImplications();
|
||||
isolate_ = Isolate::New();
|
||||
isolate_->Enter();
|
||||
}
|
||||
|
@ -182,7 +182,6 @@ TimeDelta ProcessFile(
|
||||
|
||||
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;
|
||||
|
@ -107,7 +107,6 @@ std::pair<TimeDelta, TimeDelta> RunBaselineParser(
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user