Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/v8.cc

Issue 238353015: Simplify v8/Isolate teardown. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 platform->SetThreadPoolSize(isolate->max_available_threads()); 70 platform->SetThreadPoolSize(isolate->max_available_threads());
71 // We currently only start the threads early, if we know that we'll use them. 71 // We currently only start the threads early, if we know that we'll use them.
72 if (FLAG_job_based_sweeping) platform->EnsureInitialized(); 72 if (FLAG_job_based_sweeping) platform->EnsureInitialized();
73 #endif 73 #endif
74 74
75 return isolate->Init(des); 75 return isolate->Init(des);
76 } 76 }
77 77
78 78
79 void V8::TearDown() { 79 void V8::TearDown() {
80 Isolate* isolate = Isolate::Current();
81 ASSERT(isolate->IsDefaultIsolate());
82 if (!isolate->IsInitialized()) return;
83
84 // The isolate has to be torn down before clearing the LOperand
85 // caches so that the optimizing compiler thread (if running)
86 // doesn't see an inconsistent view of the lithium instructions.
87 isolate->TearDown();
88 delete isolate;
89
90 Bootstrapper::TearDownExtensions(); 80 Bootstrapper::TearDownExtensions();
91 ElementsAccessor::TearDown(); 81 ElementsAccessor::TearDown();
92 LOperand::TearDownCaches(); 82 LOperand::TearDownCaches();
93 ExternalReference::TearDownMathExpData(); 83 ExternalReference::TearDownMathExpData();
94 RegisteredExtension::UnregisterAll(); 84 RegisteredExtension::UnregisterAll();
95 Isolate::GlobalTearDown(); 85 Isolate::GlobalTearDown();
96 86
97 delete call_completed_callbacks_; 87 delete call_completed_callbacks_;
98 call_completed_callbacks_ = NULL; 88 call_completed_callbacks_ = NULL;
99 89
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 platform_ = NULL; 205 platform_ = NULL;
216 } 206 }
217 207
218 208
219 v8::Platform* V8::GetCurrentPlatform() { 209 v8::Platform* V8::GetCurrentPlatform() {
220 ASSERT(platform_); 210 ASSERT(platform_);
221 return platform_; 211 return platform_;
222 } 212 }
223 213
224 } } // namespace v8::internal 214 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698