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

Side by Side Diff: src/isolate.cc

Issue 24568003: Allocate optimizing compiler thread only when necessary. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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') | no next file » | 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 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 // FLAG_force_memory_constrained in Isolate::Init; move to here when 1796 // FLAG_force_memory_constrained in Isolate::Init; move to here when
1797 // isolate cleanup is done 1797 // isolate cleanup is done
1798 is_memory_constrained_(false), 1798 is_memory_constrained_(false),
1799 has_fatal_error_(false), 1799 has_fatal_error_(false),
1800 use_crankshaft_(true), 1800 use_crankshaft_(true),
1801 initialized_from_snapshot_(false), 1801 initialized_from_snapshot_(false),
1802 cpu_profiler_(NULL), 1802 cpu_profiler_(NULL),
1803 heap_profiler_(NULL), 1803 heap_profiler_(NULL),
1804 function_entry_hook_(NULL), 1804 function_entry_hook_(NULL),
1805 deferred_handles_head_(NULL), 1805 deferred_handles_head_(NULL),
1806 optimizing_compiler_thread_(this), 1806 optimizing_compiler_thread_(NULL),
1807 marking_thread_(NULL), 1807 marking_thread_(NULL),
1808 sweeper_thread_(NULL), 1808 sweeper_thread_(NULL),
1809 stress_deopt_count_(0) { 1809 stress_deopt_count_(0) {
1810 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); 1810 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1);
1811 TRACE_ISOLATE(constructor); 1811 TRACE_ISOLATE(constructor);
1812 1812
1813 memset(isolate_addresses_, 0, 1813 memset(isolate_addresses_, 0,
1814 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); 1814 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1));
1815 1815
1816 heap_.isolate_ = this; 1816 heap_.isolate_ = this;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 1891
1892 1892
1893 void Isolate::Deinit() { 1893 void Isolate::Deinit() {
1894 if (state_ == INITIALIZED) { 1894 if (state_ == INITIALIZED) {
1895 TRACE_ISOLATE(deinit); 1895 TRACE_ISOLATE(deinit);
1896 1896
1897 #ifdef ENABLE_DEBUGGER_SUPPORT 1897 #ifdef ENABLE_DEBUGGER_SUPPORT
1898 debugger()->UnloadDebugger(); 1898 debugger()->UnloadDebugger();
1899 #endif 1899 #endif
1900 1900
1901 if (FLAG_concurrent_recompilation) optimizing_compiler_thread_.Stop(); 1901 if (FLAG_concurrent_recompilation) {
1902 optimizing_compiler_thread_->Stop();
1903 delete optimizing_compiler_thread_;
1904 }
1902 1905
1903 if (FLAG_sweeper_threads > 0) { 1906 if (FLAG_sweeper_threads > 0) {
1904 for (int i = 0; i < FLAG_sweeper_threads; i++) { 1907 for (int i = 0; i < FLAG_sweeper_threads; i++) {
1905 sweeper_thread_[i]->Stop(); 1908 sweeper_thread_[i]->Stop();
1906 delete sweeper_thread_[i]; 1909 delete sweeper_thread_[i];
1907 } 1910 }
1908 delete[] sweeper_thread_; 1911 delete[] sweeper_thread_;
1909 } 1912 }
1910 1913
1911 if (FLAG_marking_threads > 0) { 1914 if (FLAG_marking_threads > 0) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 2236
2234 // SetUp the object heap. 2237 // SetUp the object heap.
2235 ASSERT(!heap_.HasBeenSetUp()); 2238 ASSERT(!heap_.HasBeenSetUp());
2236 if (!heap_.SetUp()) { 2239 if (!heap_.SetUp()) {
2237 V8::FatalProcessOutOfMemory("heap setup"); 2240 V8::FatalProcessOutOfMemory("heap setup");
2238 return false; 2241 return false;
2239 } 2242 }
2240 2243
2241 deoptimizer_data_ = new DeoptimizerData(memory_allocator_); 2244 deoptimizer_data_ = new DeoptimizerData(memory_allocator_);
2242 2245
2246 if (FLAG_concurrent_recompilation) {
2247 optimizing_compiler_thread_ = new OptimizingCompilerThread(this);
2248 optimizing_compiler_thread_->Start();
2249 }
2250
2243 const bool create_heap_objects = (des == NULL); 2251 const bool create_heap_objects = (des == NULL);
2244 if (create_heap_objects && !heap_.CreateHeapObjects()) { 2252 if (create_heap_objects && !heap_.CreateHeapObjects()) {
2245 V8::FatalProcessOutOfMemory("heap object creation"); 2253 V8::FatalProcessOutOfMemory("heap object creation");
2246 return false; 2254 return false;
2247 } 2255 }
2248 2256
2249 if (create_heap_objects) { 2257 if (create_heap_objects) {
2250 // Terminate the cache array with the sentinel so we can iterate. 2258 // Terminate the cache array with the sentinel so we can iterate.
2251 PushToPartialSnapshotCache(heap_.undefined_value()); 2259 PushToPartialSnapshotCache(heap_.undefined_value());
2252 } 2260 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 DONT_TRACK_ALLOCATION_SITE, 0); 2347 DONT_TRACK_ALLOCATION_SITE, 0);
2340 stub.InitializeInterfaceDescriptor( 2348 stub.InitializeInterfaceDescriptor(
2341 this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray)); 2349 this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray));
2342 CompareNilICStub::InitializeForIsolate(this); 2350 CompareNilICStub::InitializeForIsolate(this);
2343 ToBooleanStub::InitializeForIsolate(this); 2351 ToBooleanStub::InitializeForIsolate(this);
2344 ArrayConstructorStubBase::InstallDescriptors(this); 2352 ArrayConstructorStubBase::InstallDescriptors(this);
2345 InternalArrayConstructorStubBase::InstallDescriptors(this); 2353 InternalArrayConstructorStubBase::InstallDescriptors(this);
2346 FastNewClosureStub::InstallDescriptors(this); 2354 FastNewClosureStub::InstallDescriptors(this);
2347 } 2355 }
2348 2356
2349 if (FLAG_concurrent_recompilation) optimizing_compiler_thread_.Start();
2350
2351 if (FLAG_marking_threads > 0) { 2357 if (FLAG_marking_threads > 0) {
2352 marking_thread_ = new MarkingThread*[FLAG_marking_threads]; 2358 marking_thread_ = new MarkingThread*[FLAG_marking_threads];
2353 for (int i = 0; i < FLAG_marking_threads; i++) { 2359 for (int i = 0; i < FLAG_marking_threads; i++) {
2354 marking_thread_[i] = new MarkingThread(this); 2360 marking_thread_[i] = new MarkingThread(this);
2355 marking_thread_[i]->Start(); 2361 marking_thread_[i]->Start();
2356 } 2362 }
2357 } 2363 }
2358 2364
2359 if (FLAG_sweeper_threads > 0) { 2365 if (FLAG_sweeper_threads > 0) {
2360 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; 2366 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads];
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 2548
2543 #ifdef DEBUG 2549 #ifdef DEBUG
2544 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2550 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2545 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2551 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2546 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2552 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2547 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2553 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2548 #undef ISOLATE_FIELD_OFFSET 2554 #undef ISOLATE_FIELD_OFFSET
2549 #endif 2555 #endif
2550 2556
2551 } } // namespace v8::internal 2557 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698