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

Side by Side Diff: src/isolate.cc

Issue 7129002: Fix bug 1433: clear the global thread table when an isolate is disposed. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 #ifdef V8_TARGET_ARCH_ARM 1300 #ifdef V8_TARGET_ARCH_ARM
1301 thread_local_top()->simulator_ = Simulator::current(this); 1301 thread_local_top()->simulator_ = Simulator::current(this);
1302 #elif V8_TARGET_ARCH_MIPS 1302 #elif V8_TARGET_ARCH_MIPS
1303 thread_local_top()->simulator_ = Simulator::current(this); 1303 thread_local_top()->simulator_ = Simulator::current(this);
1304 #endif 1304 #endif
1305 #endif 1305 #endif
1306 #ifdef ENABLE_LOGGING_AND_PROFILING 1306 #ifdef ENABLE_LOGGING_AND_PROFILING
1307 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { 1307 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) {
1308 RuntimeProfiler::IsolateEnteredJS(this); 1308 RuntimeProfiler::IsolateEnteredJS(this);
1309 } 1309 }
1310 ASSERT(context() == NULL || context()->IsContext());
1310 #endif 1311 #endif
1311 return from + sizeof(ThreadLocalTop); 1312 return from + sizeof(ThreadLocalTop);
1312 } 1313 }
1313 1314
1314 1315
1315 Isolate::ThreadDataTable::ThreadDataTable() 1316 Isolate::ThreadDataTable::ThreadDataTable()
1316 : list_(NULL) { 1317 : list_(NULL) {
1317 } 1318 }
1318 1319
1319 1320
(...skipping 23 matching lines...) Expand all
1343 1344
1344 void Isolate::ThreadDataTable::Remove(Isolate* isolate, 1345 void Isolate::ThreadDataTable::Remove(Isolate* isolate,
1345 ThreadId thread_id) { 1346 ThreadId thread_id) {
1346 PerIsolateThreadData* data = Lookup(isolate, thread_id); 1347 PerIsolateThreadData* data = Lookup(isolate, thread_id);
1347 if (data != NULL) { 1348 if (data != NULL) {
1348 Remove(data); 1349 Remove(data);
1349 } 1350 }
1350 } 1351 }
1351 1352
1352 1353
1354 void Isolate::ThreadDataTable::RemoveAllThreads(Isolate* isolate) {
1355 PerIsolateThreadData* data = list_;
1356 while (data != NULL) {
1357 PerIsolateThreadData* next = data->next_;
1358 if (data->isolate() == isolate) Remove(data);
1359 data = next;
1360 }
1361 }
1362
1363
1353 #ifdef DEBUG 1364 #ifdef DEBUG
1354 #define TRACE_ISOLATE(tag) \ 1365 #define TRACE_ISOLATE(tag) \
1355 do { \ 1366 do { \
1356 if (FLAG_trace_isolates) { \ 1367 if (FLAG_trace_isolates) { \
1357 PrintF("Isolate %p " #tag "\n", reinterpret_cast<void*>(this)); \ 1368 PrintF("Isolate %p " #tag "\n", reinterpret_cast<void*>(this)); \
1358 } \ 1369 } \
1359 } while (false) 1370 } while (false)
1360 #else 1371 #else
1361 #define TRACE_ISOLATE(tag) 1372 #define TRACE_ISOLATE(tag)
1362 #endif 1373 #endif
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 // Temporarily set this isolate as current so that various parts of 1468 // Temporarily set this isolate as current so that various parts of
1458 // the isolate can access it in their destructors without having a 1469 // the isolate can access it in their destructors without having a
1459 // direct pointer. We don't use Enter/Exit here to avoid 1470 // direct pointer. We don't use Enter/Exit here to avoid
1460 // initializing the thread data. 1471 // initializing the thread data.
1461 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData(); 1472 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData();
1462 Isolate* saved_isolate = UncheckedCurrent(); 1473 Isolate* saved_isolate = UncheckedCurrent();
1463 SetIsolateThreadLocals(this, NULL); 1474 SetIsolateThreadLocals(this, NULL);
1464 1475
1465 Deinit(); 1476 Deinit();
1466 1477
1478 { ScopedLock lock(process_wide_mutex_);
1479 thread_data_table_->RemoveAllThreads(this);
1480 }
1481
1467 if (!IsDefaultIsolate()) { 1482 if (!IsDefaultIsolate()) {
1468 delete this; 1483 delete this;
1469 } 1484 }
1470 1485
1471 // Restore the previous current isolate. 1486 // Restore the previous current isolate.
1472 SetIsolateThreadLocals(saved_isolate, saved_data); 1487 SetIsolateThreadLocals(saved_isolate, saved_data);
1473 } 1488 }
1474 1489
1475 1490
1476 void Isolate::Deinit() { 1491 void Isolate::Deinit() {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 1877
1863 #ifdef DEBUG 1878 #ifdef DEBUG
1864 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 1879 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
1865 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 1880 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
1866 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 1881 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
1867 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 1882 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
1868 #undef ISOLATE_FIELD_OFFSET 1883 #undef ISOLATE_FIELD_OFFSET
1869 #endif 1884 #endif
1870 1885
1871 } } // namespace v8::internal 1886 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-lockers.cc » ('j') | test/cctest/test-lockers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698