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

Side by Side Diff: src/isolate.cc

Issue 256653004: Always include debugger support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Makefile Created 6 years, 8 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 // 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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 bool should_report_exception = 1045 bool should_report_exception =
1046 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); 1046 ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
1047 bool report_exception = catchable_by_javascript && should_report_exception; 1047 bool report_exception = catchable_by_javascript && should_report_exception;
1048 bool try_catch_needs_message = 1048 bool try_catch_needs_message =
1049 can_be_caught_externally && try_catch_handler()->capture_message_ && 1049 can_be_caught_externally && try_catch_handler()->capture_message_ &&
1050 !thread_local_top()->rethrowing_message_; 1050 !thread_local_top()->rethrowing_message_;
1051 bool bootstrapping = bootstrapper()->IsActive(); 1051 bool bootstrapping = bootstrapper()->IsActive();
1052 1052
1053 thread_local_top()->rethrowing_message_ = false; 1053 thread_local_top()->rethrowing_message_ = false;
1054 1054
1055 #ifdef ENABLE_DEBUGGER_SUPPORT
1056 // Notify debugger of exception. 1055 // Notify debugger of exception.
1057 if (catchable_by_javascript) { 1056 if (catchable_by_javascript) {
1058 debugger_->OnException( 1057 debugger_->OnException(
1059 exception_handle, report_exception, factory()->undefined_value()); 1058 exception_handle, report_exception, factory()->undefined_value());
1060 } 1059 }
1061 #endif
1062 1060
1063 // Generate the message if required. 1061 // Generate the message if required.
1064 if (report_exception || try_catch_needs_message) { 1062 if (report_exception || try_catch_needs_message) {
1065 MessageLocation potential_computed_location; 1063 MessageLocation potential_computed_location;
1066 if (location == NULL) { 1064 if (location == NULL) {
1067 // If no location was specified we use a computed one instead. 1065 // If no location was specified we use a computed one instead.
1068 ComputeLocation(&potential_computed_location); 1066 ComputeLocation(&potential_computed_location);
1069 location = &potential_computed_location; 1067 location = &potential_computed_location;
1070 } 1068 }
1071 // It's not safe to try to make message objects or collect stack traces 1069 // It's not safe to try to make message objects or collect stack traces
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 } 1318 }
1321 1319
1322 1320
1323 Handle<Context> Isolate::global_context() { 1321 Handle<Context> Isolate::global_context() {
1324 return Handle<Context>(context()->global_object()->global_context()); 1322 return Handle<Context>(context()->global_object()->global_context());
1325 } 1323 }
1326 1324
1327 1325
1328 Handle<Context> Isolate::GetCallingNativeContext() { 1326 Handle<Context> Isolate::GetCallingNativeContext() {
1329 JavaScriptFrameIterator it(this); 1327 JavaScriptFrameIterator it(this);
1330 #ifdef ENABLE_DEBUGGER_SUPPORT
1331 if (debug_->InDebugger()) { 1328 if (debug_->InDebugger()) {
1332 while (!it.done()) { 1329 while (!it.done()) {
1333 JavaScriptFrame* frame = it.frame(); 1330 JavaScriptFrame* frame = it.frame();
1334 Context* context = Context::cast(frame->context()); 1331 Context* context = Context::cast(frame->context());
1335 if (context->native_context() == *debug_->debug_context()) { 1332 if (context->native_context() == *debug_->debug_context()) {
1336 it.Advance(); 1333 it.Advance();
1337 } else { 1334 } else {
1338 break; 1335 break;
1339 } 1336 }
1340 } 1337 }
1341 } 1338 }
1342 #endif // ENABLE_DEBUGGER_SUPPORT
1343 if (it.done()) return Handle<Context>::null(); 1339 if (it.done()) return Handle<Context>::null();
1344 JavaScriptFrame* frame = it.frame(); 1340 JavaScriptFrame* frame = it.frame();
1345 Context* context = Context::cast(frame->context()); 1341 Context* context = Context::cast(frame->context());
1346 return Handle<Context>(context->native_context()); 1342 return Handle<Context>(context->native_context());
1347 } 1343 }
1348 1344
1349 1345
1350 char* Isolate::ArchiveThread(char* to) { 1346 char* Isolate::ArchiveThread(char* to) {
1351 OS::MemCopy(to, reinterpret_cast<char*>(thread_local_top()), 1347 OS::MemCopy(to, reinterpret_cast<char*>(thread_local_top()),
1352 sizeof(ThreadLocalTop)); 1348 sizeof(ThreadLocalTop));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 // ThreadManager is initialized early to support locking an isolate 1500 // ThreadManager is initialized early to support locking an isolate
1505 // before it is entered. 1501 // before it is entered.
1506 thread_manager_ = new ThreadManager(); 1502 thread_manager_ = new ThreadManager();
1507 thread_manager_->isolate_ = this; 1503 thread_manager_->isolate_ = this;
1508 1504
1509 #ifdef DEBUG 1505 #ifdef DEBUG
1510 // heap_histograms_ initializes itself. 1506 // heap_histograms_ initializes itself.
1511 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); 1507 memset(&js_spill_information_, 0, sizeof(js_spill_information_));
1512 #endif 1508 #endif
1513 1509
1514 #ifdef ENABLE_DEBUGGER_SUPPORT
1515 debug_ = NULL; 1510 debug_ = NULL;
1516 debugger_ = NULL; 1511 debugger_ = NULL;
1517 #endif
1518 1512
1519 handle_scope_data_.Initialize(); 1513 handle_scope_data_.Initialize();
1520 1514
1521 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \ 1515 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \
1522 name##_ = (initial_value); 1516 name##_ = (initial_value);
1523 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) 1517 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE)
1524 #undef ISOLATE_INIT_EXECUTE 1518 #undef ISOLATE_INIT_EXECUTE
1525 1519
1526 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ 1520 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \
1527 memset(name##_, 0, sizeof(type) * length); 1521 memset(name##_, 0, sizeof(type) * length);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 1557
1564 void Isolate::GlobalTearDown() { 1558 void Isolate::GlobalTearDown() {
1565 delete thread_data_table_; 1559 delete thread_data_table_;
1566 } 1560 }
1567 1561
1568 1562
1569 void Isolate::Deinit() { 1563 void Isolate::Deinit() {
1570 if (state_ == INITIALIZED) { 1564 if (state_ == INITIALIZED) {
1571 TRACE_ISOLATE(deinit); 1565 TRACE_ISOLATE(deinit);
1572 1566
1573 #ifdef ENABLE_DEBUGGER_SUPPORT
1574 debugger()->UnloadDebugger(); 1567 debugger()->UnloadDebugger();
1575 #endif
1576 1568
1577 if (concurrent_recompilation_enabled()) { 1569 if (concurrent_recompilation_enabled()) {
1578 optimizing_compiler_thread_->Stop(); 1570 optimizing_compiler_thread_->Stop();
1579 delete optimizing_compiler_thread_; 1571 delete optimizing_compiler_thread_;
1580 optimizing_compiler_thread_ = NULL; 1572 optimizing_compiler_thread_ = NULL;
1581 } 1573 }
1582 1574
1583 for (int i = 0; i < num_sweeper_threads_; i++) { 1575 for (int i = 0; i < num_sweeper_threads_; i++) {
1584 sweeper_thread_[i]->Stop(); 1576 sweeper_thread_[i]->Stop();
1585 delete sweeper_thread_[i]; 1577 delete sweeper_thread_[i];
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 1725
1734 delete string_stream_debug_object_cache_; 1726 delete string_stream_debug_object_cache_;
1735 string_stream_debug_object_cache_ = NULL; 1727 string_stream_debug_object_cache_ = NULL;
1736 1728
1737 delete external_reference_table_; 1729 delete external_reference_table_;
1738 external_reference_table_ = NULL; 1730 external_reference_table_ = NULL;
1739 1731
1740 delete random_number_generator_; 1732 delete random_number_generator_;
1741 random_number_generator_ = NULL; 1733 random_number_generator_ = NULL;
1742 1734
1743 #ifdef ENABLE_DEBUGGER_SUPPORT
1744 delete debugger_; 1735 delete debugger_;
1745 debugger_ = NULL; 1736 debugger_ = NULL;
1746 delete debug_; 1737 delete debug_;
1747 debug_ = NULL; 1738 debug_ = NULL;
1748 #endif
1749 } 1739 }
1750 1740
1751 1741
1752 void Isolate::InitializeThreadLocal() { 1742 void Isolate::InitializeThreadLocal() {
1753 thread_local_top_.isolate_ = this; 1743 thread_local_top_.isolate_ = this;
1754 thread_local_top_.Initialize(); 1744 thread_local_top_.Initialize();
1755 } 1745 }
1756 1746
1757 1747
1758 void Isolate::PropagatePendingExceptionToExternalTryCatch() { 1748 void Isolate::PropagatePendingExceptionToExternalTryCatch() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 if (logger_ == NULL) { 1782 if (logger_ == NULL) {
1793 logger_ = new Logger(this); 1783 logger_ = new Logger(this);
1794 } 1784 }
1795 if (counters_ == NULL) { 1785 if (counters_ == NULL) {
1796 counters_ = new Counters(this); 1786 counters_ = new Counters(this);
1797 } 1787 }
1798 } 1788 }
1799 1789
1800 1790
1801 void Isolate::InitializeDebugger() { 1791 void Isolate::InitializeDebugger() {
1802 #ifdef ENABLE_DEBUGGER_SUPPORT
1803 LockGuard<RecursiveMutex> lock_guard(debugger_access()); 1792 LockGuard<RecursiveMutex> lock_guard(debugger_access());
1804 if (NoBarrier_Load(&debugger_initialized_)) return; 1793 if (NoBarrier_Load(&debugger_initialized_)) return;
1805 InitializeLoggingAndCounters(); 1794 InitializeLoggingAndCounters();
1806 debug_ = new Debug(this); 1795 debug_ = new Debug(this);
1807 debugger_ = new Debugger(this); 1796 debugger_ = new Debugger(this);
1808 Release_Store(&debugger_initialized_, true); 1797 Release_Store(&debugger_initialized_, true);
1809 #endif
1810 } 1798 }
1811 1799
1812 1800
1813 bool Isolate::Init(Deserializer* des) { 1801 bool Isolate::Init(Deserializer* des) {
1814 ASSERT(state_ != INITIALIZED); 1802 ASSERT(state_ != INITIALIZED);
1815 TRACE_ISOLATE(init); 1803 TRACE_ISOLATE(init);
1816 1804
1817 stress_deopt_count_ = FLAG_deopt_every_n_times; 1805 stress_deopt_count_ = FLAG_deopt_every_n_times;
1818 1806
1819 has_fatal_error_ = false; 1807 has_fatal_error_ = false;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 } 1932 }
1945 1933
1946 if (num_sweeper_threads_ > 0) { 1934 if (num_sweeper_threads_ > 0) {
1947 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_]; 1935 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_];
1948 for (int i = 0; i < num_sweeper_threads_; i++) { 1936 for (int i = 0; i < num_sweeper_threads_; i++) {
1949 sweeper_thread_[i] = new SweeperThread(this); 1937 sweeper_thread_[i] = new SweeperThread(this);
1950 sweeper_thread_[i]->Start(); 1938 sweeper_thread_[i]->Start();
1951 } 1939 }
1952 } 1940 }
1953 1941
1954 #ifdef ENABLE_DEBUGGER_SUPPORT
1955 debug_->SetUp(create_heap_objects); 1942 debug_->SetUp(create_heap_objects);
1956 #endif
1957 1943
1958 // If we are deserializing, read the state into the now-empty heap. 1944 // If we are deserializing, read the state into the now-empty heap.
1959 if (!create_heap_objects) { 1945 if (!create_heap_objects) {
1960 des->Deserialize(this); 1946 des->Deserialize(this);
1961 } 1947 }
1962 stub_cache_->Initialize(); 1948 stub_cache_->Initialize();
1963 1949
1964 // Finish initialization of ThreadLocal after deserialization is done. 1950 // Finish initialization of ThreadLocal after deserialization is done.
1965 clear_pending_exception(); 1951 clear_pending_exception();
1966 clear_pending_message(); 1952 clear_pending_message();
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); 2237 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
2252 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); 2238 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
2253 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); 2239 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert();
2254 } 2240 }
2255 } 2241 }
2256 return Handle<JSObject>::cast(factory()->symbol_registry()); 2242 return Handle<JSObject>::cast(factory()->symbol_registry());
2257 } 2243 }
2258 2244
2259 2245
2260 } } // namespace v8::internal 2246 } } // 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