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

Side by Side Diff: src/isolate.cc

Issue 11782028: Parallel and concurrent sweeping. (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
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 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 name##_ = (initial_value); 1685 name##_ = (initial_value);
1686 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) 1686 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE)
1687 #undef ISOLATE_INIT_EXECUTE 1687 #undef ISOLATE_INIT_EXECUTE
1688 1688
1689 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ 1689 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \
1690 memset(name##_, 0, sizeof(type) * length); 1690 memset(name##_, 0, sizeof(type) * length);
1691 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) 1691 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE)
1692 #undef ISOLATE_INIT_ARRAY_EXECUTE 1692 #undef ISOLATE_INIT_ARRAY_EXECUTE
1693 } 1693 }
1694 1694
1695
1695 void Isolate::TearDown() { 1696 void Isolate::TearDown() {
1696 TRACE_ISOLATE(tear_down); 1697 TRACE_ISOLATE(tear_down);
1697 1698
1698 // Temporarily set this isolate as current so that various parts of 1699 // Temporarily set this isolate as current so that various parts of
1699 // the isolate can access it in their destructors without having a 1700 // the isolate can access it in their destructors without having a
1700 // direct pointer. We don't use Enter/Exit here to avoid 1701 // direct pointer. We don't use Enter/Exit here to avoid
1701 // initializing the thread data. 1702 // initializing the thread data.
1702 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData(); 1703 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData();
1703 Isolate* saved_isolate = UncheckedCurrent(); 1704 Isolate* saved_isolate = UncheckedCurrent();
1704 SetIsolateThreadLocals(this, NULL); 1705 SetIsolateThreadLocals(this, NULL);
(...skipping 15 matching lines...) Expand all
1720 1721
1721 // Restore the previous current isolate. 1722 // Restore the previous current isolate.
1722 SetIsolateThreadLocals(saved_isolate, saved_data); 1723 SetIsolateThreadLocals(saved_isolate, saved_data);
1723 } 1724 }
1724 1725
1725 1726
1726 void Isolate::Deinit() { 1727 void Isolate::Deinit() {
1727 if (state_ == INITIALIZED) { 1728 if (state_ == INITIALIZED) {
1728 TRACE_ISOLATE(deinit); 1729 TRACE_ISOLATE(deinit);
1729 1730
1731 if (FLAG_concurrent_sweeping || FLAG_parallel_sweeping) {
1732 for (int i = 0; i < FLAG_sweeper_threads; i++) {
1733 sweeper_thread_[i]->Stop();
1734 }
1735
1736 for (int i = 0; i < FLAG_sweeper_threads; i++) {
1737 delete sweeper_thread_[i];
1738 }
1739 delete[] sweeper_thread_;
1740 }
1741
1730 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop(); 1742 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop();
1731 1743
1732 if (FLAG_hydrogen_stats) HStatistics::Instance()->Print(); 1744 if (FLAG_hydrogen_stats) HStatistics::Instance()->Print();
1733 1745
1734 // We must stop the logger before we tear down other components. 1746 // We must stop the logger before we tear down other components.
1735 logger_->EnsureTickerStopped(); 1747 logger_->EnsureTickerStopped();
1736 1748
1737 delete deoptimizer_data_; 1749 delete deoptimizer_data_;
1738 deoptimizer_data_ = NULL; 1750 deoptimizer_data_ = NULL;
1739 if (FLAG_preemption) { 1751 if (FLAG_preemption) {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 // Now that the heap is consistent, it's OK to generate the code for the 2094 // Now that the heap is consistent, it's OK to generate the code for the
2083 // deopt entry table that might have been referred to by optimized code in 2095 // deopt entry table that might have been referred to by optimized code in
2084 // the snapshot. 2096 // the snapshot.
2085 HandleScope scope(this); 2097 HandleScope scope(this);
2086 Deoptimizer::EnsureCodeForDeoptimizationEntry( 2098 Deoptimizer::EnsureCodeForDeoptimizationEntry(
2087 Deoptimizer::LAZY, 2099 Deoptimizer::LAZY,
2088 kDeoptTableSerializeEntryCount - 1); 2100 kDeoptTableSerializeEntryCount - 1);
2089 } 2101 }
2090 2102
2091 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Start(); 2103 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Start();
2104
2105 if (FLAG_parallel_sweeping || FLAG_concurrent_sweeping) {
2106 if (FLAG_sweeper_threads < 1) {
2107 FLAG_sweeper_threads = 1;
2108 }
2109 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads];
2110 for (int i = 0; i < FLAG_sweeper_threads; i++) {
2111 sweeper_thread_[i] = new SweeperThread(this);
2112 sweeper_thread_[i]->Start();
2113 }
2114 }
2092 return true; 2115 return true;
2093 } 2116 }
2094 2117
2095 2118
2096 // Initialized lazily to allow early 2119 // Initialized lazily to allow early
2097 // v8::V8::SetAddHistogramSampleFunction calls. 2120 // v8::V8::SetAddHistogramSampleFunction calls.
2098 StatsTable* Isolate::stats_table() { 2121 StatsTable* Isolate::stats_table() {
2099 if (stats_table_ == NULL) { 2122 if (stats_table_ == NULL) {
2100 stats_table_ = new StatsTable; 2123 stats_table_ = new StatsTable;
2101 } 2124 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 2233
2211 #ifdef DEBUG 2234 #ifdef DEBUG
2212 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2235 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2213 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2236 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2214 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2237 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2215 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2238 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2216 #undef ISOLATE_FIELD_OFFSET 2239 #undef ISOLATE_FIELD_OFFSET
2217 #endif 2240 #endif
2218 2241
2219 } } // namespace v8::internal 2242 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698