OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 js_entry_sp_ = NULL; | 91 js_entry_sp_ = NULL; |
92 external_callback_ = NULL; | 92 external_callback_ = NULL; |
93 current_vm_state_ = EXTERNAL; | 93 current_vm_state_ = EXTERNAL; |
94 try_catch_handler_address_ = NULL; | 94 try_catch_handler_address_ = NULL; |
95 context_ = NULL; | 95 context_ = NULL; |
96 thread_id_ = ThreadId::Invalid(); | 96 thread_id_ = ThreadId::Invalid(); |
97 external_caught_exception_ = false; | 97 external_caught_exception_ = false; |
98 failed_access_check_callback_ = NULL; | 98 failed_access_check_callback_ = NULL; |
99 save_context_ = NULL; | 99 save_context_ = NULL; |
100 catcher_ = NULL; | 100 catcher_ = NULL; |
| 101 |
| 102 // These members are re-initialized later after deserialization |
| 103 // is complete. |
| 104 pending_exception_ = NULL; |
| 105 has_pending_message_ = false; |
| 106 pending_message_obj_ = NULL; |
| 107 pending_message_script_ = NULL; |
| 108 scheduled_exception_ = NULL; |
101 } | 109 } |
102 | 110 |
103 | 111 |
104 void ThreadLocalTop::Initialize() { | 112 void ThreadLocalTop::Initialize() { |
105 InitializeInternal(); | 113 InitializeInternal(); |
106 #ifdef USE_SIMULATOR | 114 #ifdef USE_SIMULATOR |
107 #ifdef V8_TARGET_ARCH_ARM | 115 #ifdef V8_TARGET_ARCH_ARM |
108 simulator_ = Simulator::current(isolate_); | 116 simulator_ = Simulator::current(isolate_); |
109 #elif V8_TARGET_ARCH_MIPS | 117 #elif V8_TARGET_ARCH_MIPS |
110 simulator_ = Simulator::current(isolate_); | 118 simulator_ = Simulator::current(isolate_); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 } | 1285 } |
1278 | 1286 |
1279 | 1287 |
1280 char* Isolate::ArchiveThread(char* to) { | 1288 char* Isolate::ArchiveThread(char* to) { |
1281 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 1289 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
1282 RuntimeProfiler::IsolateExitedJS(this); | 1290 RuntimeProfiler::IsolateExitedJS(this); |
1283 } | 1291 } |
1284 memcpy(to, reinterpret_cast<char*>(thread_local_top()), | 1292 memcpy(to, reinterpret_cast<char*>(thread_local_top()), |
1285 sizeof(ThreadLocalTop)); | 1293 sizeof(ThreadLocalTop)); |
1286 InitializeThreadLocal(); | 1294 InitializeThreadLocal(); |
| 1295 clear_pending_exception(); |
| 1296 clear_pending_message(); |
| 1297 clear_scheduled_exception(); |
1287 return to + sizeof(ThreadLocalTop); | 1298 return to + sizeof(ThreadLocalTop); |
1288 } | 1299 } |
1289 | 1300 |
1290 | 1301 |
1291 char* Isolate::RestoreThread(char* from) { | 1302 char* Isolate::RestoreThread(char* from) { |
1292 memcpy(reinterpret_cast<char*>(thread_local_top()), from, | 1303 memcpy(reinterpret_cast<char*>(thread_local_top()), from, |
1293 sizeof(ThreadLocalTop)); | 1304 sizeof(ThreadLocalTop)); |
1294 // This might be just paranoia, but it seems to be needed in case a | 1305 // This might be just paranoia, but it seems to be needed in case a |
1295 // thread_local_top_ is restored on a separate OS thread. | 1306 // thread_local_top_ is restored on a separate OS thread. |
1296 #ifdef USE_SIMULATOR | 1307 #ifdef USE_SIMULATOR |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 debugger_ = NULL; | 1615 debugger_ = NULL; |
1605 delete debug_; | 1616 delete debug_; |
1606 debug_ = NULL; | 1617 debug_ = NULL; |
1607 #endif | 1618 #endif |
1608 } | 1619 } |
1609 | 1620 |
1610 | 1621 |
1611 void Isolate::InitializeThreadLocal() { | 1622 void Isolate::InitializeThreadLocal() { |
1612 thread_local_top_.isolate_ = this; | 1623 thread_local_top_.isolate_ = this; |
1613 thread_local_top_.Initialize(); | 1624 thread_local_top_.Initialize(); |
1614 clear_pending_exception(); | |
1615 clear_pending_message(); | |
1616 clear_scheduled_exception(); | |
1617 } | 1625 } |
1618 | 1626 |
1619 | 1627 |
1620 void Isolate::PropagatePendingExceptionToExternalTryCatch() { | 1628 void Isolate::PropagatePendingExceptionToExternalTryCatch() { |
1621 ASSERT(has_pending_exception()); | 1629 ASSERT(has_pending_exception()); |
1622 | 1630 |
1623 bool external_caught = IsExternallyCaught(); | 1631 bool external_caught = IsExternallyCaught(); |
1624 thread_local_top_.external_caught_exception_ = external_caught; | 1632 thread_local_top_.external_caught_exception_ = external_caught; |
1625 | 1633 |
1626 if (!external_caught) return; | 1634 if (!external_caught) return; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 debug_->Setup(create_heap_objects); | 1772 debug_->Setup(create_heap_objects); |
1765 #endif | 1773 #endif |
1766 stub_cache_->Initialize(create_heap_objects); | 1774 stub_cache_->Initialize(create_heap_objects); |
1767 | 1775 |
1768 // If we are deserializing, read the state into the now-empty heap. | 1776 // If we are deserializing, read the state into the now-empty heap. |
1769 if (des != NULL) { | 1777 if (des != NULL) { |
1770 des->Deserialize(); | 1778 des->Deserialize(); |
1771 stub_cache_->Initialize(true); | 1779 stub_cache_->Initialize(true); |
1772 } | 1780 } |
1773 | 1781 |
| 1782 // Finish initialization of ThreadLocal after deserialization is done. |
| 1783 clear_pending_exception(); |
| 1784 clear_pending_message(); |
| 1785 clear_scheduled_exception(); |
| 1786 |
1774 // Deserializing may put strange things in the root array's copy of the | 1787 // Deserializing may put strange things in the root array's copy of the |
1775 // stack guard. | 1788 // stack guard. |
1776 heap_.SetStackLimits(); | 1789 heap_.SetStackLimits(); |
1777 | 1790 |
1778 deoptimizer_data_ = new DeoptimizerData; | 1791 deoptimizer_data_ = new DeoptimizerData; |
1779 runtime_profiler_ = new RuntimeProfiler(this); | 1792 runtime_profiler_ = new RuntimeProfiler(this); |
1780 runtime_profiler_->Setup(); | 1793 runtime_profiler_->Setup(); |
1781 | 1794 |
1782 // If we are deserializing, log non-function code objects and compiled | 1795 // If we are deserializing, log non-function code objects and compiled |
1783 // functions found in the snapshot. | 1796 // functions found in the snapshot. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 | 1886 |
1874 #ifdef DEBUG | 1887 #ifdef DEBUG |
1875 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1888 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
1876 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 1889 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
1877 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1890 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
1878 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1891 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
1879 #undef ISOLATE_FIELD_OFFSET | 1892 #undef ISOLATE_FIELD_OFFSET |
1880 #endif | 1893 #endif |
1881 | 1894 |
1882 } } // namespace v8::internal | 1895 } } // namespace v8::internal |
OLD | NEW |