OLD | NEW |
---|---|
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 Loading... | |
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 17 matching lines...) Expand all Loading... | |
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 |
1730 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop(); | 1731 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop(); |
1731 | 1732 |
1733 if (FLAG_concurrent_sweeping || FLAG_parallel_sweeping) { | |
Michael Starzinger
2013/01/24 17:15:54
Move this above the stopping of the optimizing com
Hannes Payer (out of office)
2013/01/25 10:46:49
Done.
| |
1734 for (int i = 0; i < FLAG_sweeper_threads; i++) { | |
1735 sweeper_thread_[i]->Stop(); | |
1736 } | |
1737 | |
1738 for (int i = 0; i < FLAG_sweeper_threads; i++) { | |
1739 delete sweeper_thread_[i]; | |
1740 } | |
1741 delete[] sweeper_thread_; | |
1742 } | |
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) { |
1740 v8::Locker locker; | 1752 v8::Locker locker; |
1741 v8::Locker::StopPreemption(); | 1753 v8::Locker::StopPreemption(); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) { | |
Michael Starzinger
2013/01/24 17:15:54
Just set it to one if it's smaller than one.
Hannes Payer (out of office)
2013/01/25 10:46:49
Done.
| |
2107 V8::SetFatalError(); | |
2108 return false; | |
2109 } | |
2110 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; | |
2111 for (int i = 0; i < FLAG_sweeper_threads; i++) { | |
2112 sweeper_thread_[i] = new SweeperThread(this); | |
2113 sweeper_thread_[i]->Start(); | |
2114 } | |
2115 } | |
2092 return true; | 2116 return true; |
2093 } | 2117 } |
2094 | 2118 |
2095 | 2119 |
2096 // Initialized lazily to allow early | 2120 // Initialized lazily to allow early |
2097 // v8::V8::SetAddHistogramSampleFunction calls. | 2121 // v8::V8::SetAddHistogramSampleFunction calls. |
2098 StatsTable* Isolate::stats_table() { | 2122 StatsTable* Isolate::stats_table() { |
2099 if (stats_table_ == NULL) { | 2123 if (stats_table_ == NULL) { |
2100 stats_table_ = new StatsTable; | 2124 stats_table_ = new StatsTable; |
2101 } | 2125 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2210 | 2234 |
2211 #ifdef DEBUG | 2235 #ifdef DEBUG |
2212 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2236 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2213 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2237 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2214 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2238 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2215 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2239 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2216 #undef ISOLATE_FIELD_OFFSET | 2240 #undef ISOLATE_FIELD_OFFSET |
2217 #endif | 2241 #endif |
2218 | 2242 |
2219 } } // namespace v8::internal | 2243 } } // namespace v8::internal |
OLD | NEW |