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

Side by Side Diff: src/isolate.cc

Issue 12223089: Fixed a memory leak in v8 and another one in d8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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
« no previous file with comments | « src/isolate.h ('k') | src/v8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 ASSERT(context() == NULL || context()->IsContext()); 1541 ASSERT(context() == NULL || context()->IsContext());
1542 return from + sizeof(ThreadLocalTop); 1542 return from + sizeof(ThreadLocalTop);
1543 } 1543 }
1544 1544
1545 1545
1546 Isolate::ThreadDataTable::ThreadDataTable() 1546 Isolate::ThreadDataTable::ThreadDataTable()
1547 : list_(NULL) { 1547 : list_(NULL) {
1548 } 1548 }
1549 1549
1550 1550
1551 Isolate::ThreadDataTable::~ThreadDataTable() {
1552 // TODO(svenpanne) The assertion below would fire if an embedder does not
1553 // cleanly dispose all Isolates before disposing v8, so we are conservative
1554 // and leave it out for now.
1555 // ASSERT_EQ(NULL, list_);
1556 }
1557
1558
1551 Isolate::PerIsolateThreadData* 1559 Isolate::PerIsolateThreadData*
1552 Isolate::ThreadDataTable::Lookup(Isolate* isolate, 1560 Isolate::ThreadDataTable::Lookup(Isolate* isolate,
1553 ThreadId thread_id) { 1561 ThreadId thread_id) {
1554 for (PerIsolateThreadData* data = list_; data != NULL; data = data->next_) { 1562 for (PerIsolateThreadData* data = list_; data != NULL; data = data->next_) {
1555 if (data->Matches(isolate, thread_id)) return data; 1563 if (data->Matches(isolate, thread_id)) return data;
1556 } 1564 }
1557 return NULL; 1565 return NULL;
1558 } 1566 }
1559 1567
1560 1568
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 1736
1729 if (!IsDefaultIsolate()) { 1737 if (!IsDefaultIsolate()) {
1730 delete this; 1738 delete this;
1731 } 1739 }
1732 1740
1733 // Restore the previous current isolate. 1741 // Restore the previous current isolate.
1734 SetIsolateThreadLocals(saved_isolate, saved_data); 1742 SetIsolateThreadLocals(saved_isolate, saved_data);
1735 } 1743 }
1736 1744
1737 1745
1746 void Isolate::GlobalTearDown() {
1747 delete thread_data_table_;
1748 }
1749
1750
1738 void Isolate::Deinit() { 1751 void Isolate::Deinit() {
1739 if (state_ == INITIALIZED) { 1752 if (state_ == INITIALIZED) {
1740 TRACE_ISOLATE(deinit); 1753 TRACE_ISOLATE(deinit);
1741 1754
1742 if (FLAG_concurrent_sweeping || FLAG_parallel_sweeping) { 1755 if (FLAG_concurrent_sweeping || FLAG_parallel_sweeping) {
1743 for (int i = 0; i < FLAG_sweeper_threads; i++) { 1756 for (int i = 0; i < FLAG_sweeper_threads; i++) {
1744 sweeper_thread_[i]->Stop(); 1757 sweeper_thread_[i]->Stop();
1745 delete sweeper_thread_[i]; 1758 delete sweeper_thread_[i];
1746 } 1759 }
1747 delete[] sweeper_thread_; 1760 delete[] sweeper_thread_;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 2280
2268 #ifdef DEBUG 2281 #ifdef DEBUG
2269 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2282 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2270 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2283 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2271 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2284 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2272 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2285 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2273 #undef ISOLATE_FIELD_OFFSET 2286 #undef ISOLATE_FIELD_OFFSET
2274 #endif 2287 #endif
2275 2288
2276 } } // namespace v8::internal 2289 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698