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

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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "log.h" 42 #include "log.h"
43 #include "messages.h" 43 #include "messages.h"
44 #include "platform.h" 44 #include "platform.h"
45 #include "regexp-stack.h" 45 #include "regexp-stack.h"
46 #include "runtime-profiler.h" 46 #include "runtime-profiler.h"
47 #include "scopeinfo.h" 47 #include "scopeinfo.h"
48 #include "serialize.h" 48 #include "serialize.h"
49 #include "simulator.h" 49 #include "simulator.h"
50 #include "spaces.h" 50 #include "spaces.h"
51 #include "stub-cache.h" 51 #include "stub-cache.h"
52 #include "sweeper-thread.h"
52 #include "version.h" 53 #include "version.h"
53 #include "vm-state-inl.h" 54 #include "vm-state-inl.h"
54 55
55 56
56 namespace v8 { 57 namespace v8 {
57 namespace internal { 58 namespace internal {
58 59
59 Atomic32 ThreadId::highest_thread_id_ = 0; 60 Atomic32 ThreadId::highest_thread_id_ = 0;
60 61
61 int ThreadId::AllocateThreadId() { 62 int ThreadId::AllocateThreadId() {
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 name##_ = (initial_value); 1686 name##_ = (initial_value);
1686 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) 1687 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE)
1687 #undef ISOLATE_INIT_EXECUTE 1688 #undef ISOLATE_INIT_EXECUTE
1688 1689
1689 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ 1690 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \
1690 memset(name##_, 0, sizeof(type) * length); 1691 memset(name##_, 0, sizeof(type) * length);
1691 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) 1692 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE)
1692 #undef ISOLATE_INIT_ARRAY_EXECUTE 1693 #undef ISOLATE_INIT_ARRAY_EXECUTE
1693 } 1694 }
1694 1695
1696
1695 void Isolate::TearDown() { 1697 void Isolate::TearDown() {
1696 TRACE_ISOLATE(tear_down); 1698 TRACE_ISOLATE(tear_down);
1697 1699
1698 // Temporarily set this isolate as current so that various parts of 1700 // Temporarily set this isolate as current so that various parts of
1699 // the isolate can access it in their destructors without having a 1701 // the isolate can access it in their destructors without having a
1700 // direct pointer. We don't use Enter/Exit here to avoid 1702 // direct pointer. We don't use Enter/Exit here to avoid
1701 // initializing the thread data. 1703 // initializing the thread data.
1702 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData(); 1704 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData();
1703 Isolate* saved_isolate = UncheckedCurrent(); 1705 Isolate* saved_isolate = UncheckedCurrent();
1704 SetIsolateThreadLocals(this, NULL); 1706 SetIsolateThreadLocals(this, NULL);
(...skipping 15 matching lines...) Expand all
1720 1722
1721 // Restore the previous current isolate. 1723 // Restore the previous current isolate.
1722 SetIsolateThreadLocals(saved_isolate, saved_data); 1724 SetIsolateThreadLocals(saved_isolate, saved_data);
1723 } 1725 }
1724 1726
1725 1727
1726 void Isolate::Deinit() { 1728 void Isolate::Deinit() {
1727 if (state_ == INITIALIZED) { 1729 if (state_ == INITIALIZED) {
1728 TRACE_ISOLATE(deinit); 1730 TRACE_ISOLATE(deinit);
1729 1731
1732 if (FLAG_concurrent_sweeping || FLAG_parallel_sweeping) {
1733 for (int i = 0; i < FLAG_sweeper_threads; i++) {
1734 sweeper_thread_[i]->Stop();
1735 }
1736
1737 for (int i = 0; i < FLAG_sweeper_threads; i++) {
Michael Starzinger 2013/01/30 11:01:19 Can we merge the two for-loops, I think that's eas
Hannes Payer (out of office) 2013/01/30 12:07:32 Done.
1738 delete sweeper_thread_[i];
1739 }
1740 delete[] sweeper_thread_;
1741 }
1742
1730 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop(); 1743 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop();
1731 1744
1732 if (FLAG_hydrogen_stats) HStatistics::Instance()->Print(); 1745 if (FLAG_hydrogen_stats) HStatistics::Instance()->Print();
1733 1746
1734 // We must stop the logger before we tear down other components. 1747 // We must stop the logger before we tear down other components.
1735 logger_->EnsureTickerStopped(); 1748 logger_->EnsureTickerStopped();
1736 1749
1737 delete deoptimizer_data_; 1750 delete deoptimizer_data_;
1738 deoptimizer_data_ = NULL; 1751 deoptimizer_data_ = NULL;
1739 if (FLAG_preemption) { 1752 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 2095 // 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 2096 // deopt entry table that might have been referred to by optimized code in
2084 // the snapshot. 2097 // the snapshot.
2085 HandleScope scope(this); 2098 HandleScope scope(this);
2086 Deoptimizer::EnsureCodeForDeoptimizationEntry( 2099 Deoptimizer::EnsureCodeForDeoptimizationEntry(
2087 Deoptimizer::LAZY, 2100 Deoptimizer::LAZY,
2088 kDeoptTableSerializeEntryCount - 1); 2101 kDeoptTableSerializeEntryCount - 1);
2089 } 2102 }
2090 2103
2091 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Start(); 2104 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Start();
2105
2106 if (FLAG_parallel_sweeping || FLAG_concurrent_sweeping) {
2107 if (FLAG_sweeper_threads < 1) {
2108 FLAG_sweeper_threads = 1;
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
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
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/mark-compact.h » ('j') | src/mark-compact.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698