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

Side by Side Diff: src/isolate.cc

Issue 265593004: Always initialize the debugger eagerly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/isolate-inl.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "v8.h" 7 #include "v8.h"
8 8
9 #include "ast.h" 9 #include "ast.h"
10 #include "bootstrapper.h" 10 #include "bootstrapper.h"
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 : embedder_data_(), 1415 : embedder_data_(),
1416 state_(UNINITIALIZED), 1416 state_(UNINITIALIZED),
1417 entry_stack_(NULL), 1417 entry_stack_(NULL),
1418 stack_trace_nesting_level_(0), 1418 stack_trace_nesting_level_(0),
1419 incomplete_message_(NULL), 1419 incomplete_message_(NULL),
1420 bootstrapper_(NULL), 1420 bootstrapper_(NULL),
1421 runtime_profiler_(NULL), 1421 runtime_profiler_(NULL),
1422 compilation_cache_(NULL), 1422 compilation_cache_(NULL),
1423 counters_(NULL), 1423 counters_(NULL),
1424 code_range_(NULL), 1424 code_range_(NULL),
1425 debugger_initialized_(false),
1426 logger_(NULL), 1425 logger_(NULL),
1427 stats_table_(NULL), 1426 stats_table_(NULL),
1428 stub_cache_(NULL), 1427 stub_cache_(NULL),
1429 deoptimizer_data_(NULL), 1428 deoptimizer_data_(NULL),
1430 materialized_object_store_(NULL), 1429 materialized_object_store_(NULL),
1431 capture_stack_trace_for_uncaught_exceptions_(false), 1430 capture_stack_trace_for_uncaught_exceptions_(false),
1432 stack_trace_for_uncaught_exceptions_frame_limit_(0), 1431 stack_trace_for_uncaught_exceptions_frame_limit_(0),
1433 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), 1432 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
1434 memory_allocator_(NULL), 1433 memory_allocator_(NULL),
1435 keyed_lookup_cache_(NULL), 1434 keyed_lookup_cache_(NULL),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 // ThreadManager is initialized early to support locking an isolate 1475 // ThreadManager is initialized early to support locking an isolate
1477 // before it is entered. 1476 // before it is entered.
1478 thread_manager_ = new ThreadManager(); 1477 thread_manager_ = new ThreadManager();
1479 thread_manager_->isolate_ = this; 1478 thread_manager_->isolate_ = this;
1480 1479
1481 #ifdef DEBUG 1480 #ifdef DEBUG
1482 // heap_histograms_ initializes itself. 1481 // heap_histograms_ initializes itself.
1483 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); 1482 memset(&js_spill_information_, 0, sizeof(js_spill_information_));
1484 #endif 1483 #endif
1485 1484
1486 debug_ = NULL;
1487 debugger_ = NULL;
1488
1489 handle_scope_data_.Initialize(); 1485 handle_scope_data_.Initialize();
1490 1486
1491 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \ 1487 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \
1492 name##_ = (initial_value); 1488 name##_ = (initial_value);
1493 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) 1489 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE)
1494 #undef ISOLATE_INIT_EXECUTE 1490 #undef ISOLATE_INIT_EXECUTE
1495 1491
1496 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ 1492 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \
1497 memset(name##_, 0, sizeof(type) * length); 1493 memset(name##_, 0, sizeof(type) * length);
1498 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) 1494 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE)
1499 #undef ISOLATE_INIT_ARRAY_EXECUTE 1495 #undef ISOLATE_INIT_ARRAY_EXECUTE
1496
1497 InitializeLoggingAndCounters();
1498 debug_ = new Debug(this);
1499 debugger_ = new Debugger(this);
1500 } 1500 }
1501 1501
1502 1502
1503 void Isolate::TearDown() { 1503 void Isolate::TearDown() {
1504 TRACE_ISOLATE(tear_down); 1504 TRACE_ISOLATE(tear_down);
1505 1505
1506 // Temporarily set this isolate as current so that various parts of 1506 // Temporarily set this isolate as current so that various parts of
1507 // the isolate can access it in their destructors without having a 1507 // the isolate can access it in their destructors without having a
1508 // direct pointer. We don't use Enter/Exit here to avoid 1508 // direct pointer. We don't use Enter/Exit here to avoid
1509 // initializing the thread data. 1509 // initializing the thread data.
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 void Isolate::InitializeLoggingAndCounters() { 1757 void Isolate::InitializeLoggingAndCounters() {
1758 if (logger_ == NULL) { 1758 if (logger_ == NULL) {
1759 logger_ = new Logger(this); 1759 logger_ = new Logger(this);
1760 } 1760 }
1761 if (counters_ == NULL) { 1761 if (counters_ == NULL) {
1762 counters_ = new Counters(this); 1762 counters_ = new Counters(this);
1763 } 1763 }
1764 } 1764 }
1765 1765
1766 1766
1767 void Isolate::InitializeDebugger() {
1768 LockGuard<RecursiveMutex> lock_guard(debugger_access());
1769 if (NoBarrier_Load(&debugger_initialized_)) return;
1770 InitializeLoggingAndCounters();
1771 debug_ = new Debug(this);
1772 debugger_ = new Debugger(this);
1773 Release_Store(&debugger_initialized_, true);
1774 }
1775
1776
1777 bool Isolate::Init(Deserializer* des) { 1767 bool Isolate::Init(Deserializer* des) {
1778 ASSERT(state_ != INITIALIZED); 1768 ASSERT(state_ != INITIALIZED);
1779 TRACE_ISOLATE(init); 1769 TRACE_ISOLATE(init);
1780 1770
1781 stress_deopt_count_ = FLAG_deopt_every_n_times; 1771 stress_deopt_count_ = FLAG_deopt_every_n_times;
1782 1772
1783 has_fatal_error_ = false; 1773 has_fatal_error_ = false;
1784 1774
1785 use_crankshaft_ = FLAG_crankshaft 1775 use_crankshaft_ = FLAG_crankshaft
1786 && !Serializer::enabled(this) 1776 && !Serializer::enabled(this)
1787 && CpuFeatures::SupportsCrankshaft(); 1777 && CpuFeatures::SupportsCrankshaft();
1788 1778
1789 if (function_entry_hook() != NULL) { 1779 if (function_entry_hook() != NULL) {
1790 // When function entry hooking is in effect, we have to create the code 1780 // When function entry hooking is in effect, we have to create the code
1791 // stubs from scratch to get entry hooks, rather than loading the previously 1781 // stubs from scratch to get entry hooks, rather than loading the previously
1792 // generated stubs from disk. 1782 // generated stubs from disk.
1793 // If this assert fires, the initialization path has regressed. 1783 // If this assert fires, the initialization path has regressed.
1794 ASSERT(des == NULL); 1784 ASSERT(des == NULL);
1795 } 1785 }
1796 1786
1797 // The initialization process does not handle memory exhaustion. 1787 // The initialization process does not handle memory exhaustion.
1798 DisallowAllocationFailure disallow_allocation_failure(this); 1788 DisallowAllocationFailure disallow_allocation_failure(this);
1799 1789
1800 InitializeLoggingAndCounters();
1801
1802 InitializeDebugger();
1803
1804 memory_allocator_ = new MemoryAllocator(this); 1790 memory_allocator_ = new MemoryAllocator(this);
1805 code_range_ = new CodeRange(this); 1791 code_range_ = new CodeRange(this);
1806 1792
1807 // Safe after setting Heap::isolate_, and initializing StackGuard 1793 // Safe after setting Heap::isolate_, and initializing StackGuard
1808 heap_.SetStackLimits(); 1794 heap_.SetStackLimits();
1809 1795
1810 #define ASSIGN_ELEMENT(CamelName, hacker_name) \ 1796 #define ASSIGN_ELEMENT(CamelName, hacker_name) \
1811 isolate_addresses_[Isolate::k##CamelName##Address] = \ 1797 isolate_addresses_[Isolate::k##CamelName##Address] = \
1812 reinterpret_cast<Address>(hacker_name##_address()); 1798 reinterpret_cast<Address>(hacker_name##_address());
1813 FOR_EACH_ISOLATE_ADDRESS_NAME(ASSIGN_ELEMENT) 1799 FOR_EACH_ISOLATE_ADDRESS_NAME(ASSIGN_ELEMENT)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 } 1894 }
1909 1895
1910 if (num_sweeper_threads_ > 0) { 1896 if (num_sweeper_threads_ > 0) {
1911 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_]; 1897 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_];
1912 for (int i = 0; i < num_sweeper_threads_; i++) { 1898 for (int i = 0; i < num_sweeper_threads_; i++) {
1913 sweeper_thread_[i] = new SweeperThread(this); 1899 sweeper_thread_[i] = new SweeperThread(this);
1914 sweeper_thread_[i]->Start(); 1900 sweeper_thread_[i]->Start();
1915 } 1901 }
1916 } 1902 }
1917 1903
1918 debug_->SetUp(create_heap_objects);
1919
1920 // If we are deserializing, read the state into the now-empty heap. 1904 // If we are deserializing, read the state into the now-empty heap.
1921 if (!create_heap_objects) { 1905 if (!create_heap_objects) {
1922 des->Deserialize(this); 1906 des->Deserialize(this);
1923 } 1907 }
1924 stub_cache_->Initialize(); 1908 stub_cache_->Initialize();
1925 1909
1926 // Finish initialization of ThreadLocal after deserialization is done. 1910 // Finish initialization of ThreadLocal after deserialization is done.
1927 clear_pending_exception(); 1911 clear_pending_exception();
1928 clear_pending_message(); 1912 clear_pending_message();
1929 clear_scheduled_exception(); 1913 clear_scheduled_exception();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 handle_scope_implementer()->IncrementCallDepth(); 2230 handle_scope_implementer()->IncrementCallDepth();
2247 if (run_microtasks) Execution::RunMicrotasks(this); 2231 if (run_microtasks) Execution::RunMicrotasks(this);
2248 for (int i = 0; i < call_completed_callbacks_.length(); i++) { 2232 for (int i = 0; i < call_completed_callbacks_.length(); i++) {
2249 call_completed_callbacks_.at(i)(); 2233 call_completed_callbacks_.at(i)();
2250 } 2234 }
2251 handle_scope_implementer()->DecrementCallDepth(); 2235 handle_scope_implementer()->DecrementCallDepth();
2252 } 2236 }
2253 2237
2254 2238
2255 } } // namespace v8::internal 2239 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/isolate-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698