| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 InitializeInternal(); | 78 InitializeInternal(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 void ThreadLocalTop::InitializeInternal() { | 82 void ThreadLocalTop::InitializeInternal() { |
| 83 c_entry_fp_ = 0; | 83 c_entry_fp_ = 0; |
| 84 handler_ = 0; | 84 handler_ = 0; |
| 85 #ifdef USE_SIMULATOR | 85 #ifdef USE_SIMULATOR |
| 86 simulator_ = NULL; | 86 simulator_ = NULL; |
| 87 #endif | 87 #endif |
| 88 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 89 js_entry_sp_ = NULL; | 88 js_entry_sp_ = NULL; |
| 90 external_callback_ = NULL; | 89 external_callback_ = NULL; |
| 91 #endif | |
| 92 #ifdef ENABLE_VMSTATE_TRACKING | |
| 93 current_vm_state_ = EXTERNAL; | 90 current_vm_state_ = EXTERNAL; |
| 94 #endif | |
| 95 try_catch_handler_address_ = NULL; | 91 try_catch_handler_address_ = NULL; |
| 96 context_ = NULL; | 92 context_ = NULL; |
| 97 thread_id_ = ThreadId::Invalid(); | 93 thread_id_ = ThreadId::Invalid(); |
| 98 external_caught_exception_ = false; | 94 external_caught_exception_ = false; |
| 99 failed_access_check_callback_ = NULL; | 95 failed_access_check_callback_ = NULL; |
| 100 save_context_ = NULL; | 96 save_context_ = NULL; |
| 101 catcher_ = NULL; | 97 catcher_ = NULL; |
| 102 } | 98 } |
| 103 | 99 |
| 104 | 100 |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 } | 1268 } |
| 1273 #endif // ENABLE_DEBUGGER_SUPPORT | 1269 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1274 if (it.done()) return Handle<Context>::null(); | 1270 if (it.done()) return Handle<Context>::null(); |
| 1275 JavaScriptFrame* frame = it.frame(); | 1271 JavaScriptFrame* frame = it.frame(); |
| 1276 Context* context = Context::cast(frame->context()); | 1272 Context* context = Context::cast(frame->context()); |
| 1277 return Handle<Context>(context->global_context()); | 1273 return Handle<Context>(context->global_context()); |
| 1278 } | 1274 } |
| 1279 | 1275 |
| 1280 | 1276 |
| 1281 char* Isolate::ArchiveThread(char* to) { | 1277 char* Isolate::ArchiveThread(char* to) { |
| 1282 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1283 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 1278 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
| 1284 RuntimeProfiler::IsolateExitedJS(this); | 1279 RuntimeProfiler::IsolateExitedJS(this); |
| 1285 } | 1280 } |
| 1286 #endif | |
| 1287 memcpy(to, reinterpret_cast<char*>(thread_local_top()), | 1281 memcpy(to, reinterpret_cast<char*>(thread_local_top()), |
| 1288 sizeof(ThreadLocalTop)); | 1282 sizeof(ThreadLocalTop)); |
| 1289 InitializeThreadLocal(); | 1283 InitializeThreadLocal(); |
| 1290 return to + sizeof(ThreadLocalTop); | 1284 return to + sizeof(ThreadLocalTop); |
| 1291 } | 1285 } |
| 1292 | 1286 |
| 1293 | 1287 |
| 1294 char* Isolate::RestoreThread(char* from) { | 1288 char* Isolate::RestoreThread(char* from) { |
| 1295 memcpy(reinterpret_cast<char*>(thread_local_top()), from, | 1289 memcpy(reinterpret_cast<char*>(thread_local_top()), from, |
| 1296 sizeof(ThreadLocalTop)); | 1290 sizeof(ThreadLocalTop)); |
| 1297 // This might be just paranoia, but it seems to be needed in case a | 1291 // This might be just paranoia, but it seems to be needed in case a |
| 1298 // thread_local_top_ is restored on a separate OS thread. | 1292 // thread_local_top_ is restored on a separate OS thread. |
| 1299 #ifdef USE_SIMULATOR | 1293 #ifdef USE_SIMULATOR |
| 1300 #ifdef V8_TARGET_ARCH_ARM | 1294 #ifdef V8_TARGET_ARCH_ARM |
| 1301 thread_local_top()->simulator_ = Simulator::current(this); | 1295 thread_local_top()->simulator_ = Simulator::current(this); |
| 1302 #elif V8_TARGET_ARCH_MIPS | 1296 #elif V8_TARGET_ARCH_MIPS |
| 1303 thread_local_top()->simulator_ = Simulator::current(this); | 1297 thread_local_top()->simulator_ = Simulator::current(this); |
| 1304 #endif | 1298 #endif |
| 1305 #endif | 1299 #endif |
| 1306 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1307 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 1300 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
| 1308 RuntimeProfiler::IsolateEnteredJS(this); | 1301 RuntimeProfiler::IsolateEnteredJS(this); |
| 1309 } | 1302 } |
| 1310 ASSERT(context() == NULL || context()->IsContext()); | 1303 ASSERT(context() == NULL || context()->IsContext()); |
| 1311 #endif | |
| 1312 return from + sizeof(ThreadLocalTop); | 1304 return from + sizeof(ThreadLocalTop); |
| 1313 } | 1305 } |
| 1314 | 1306 |
| 1315 | 1307 |
| 1316 Isolate::ThreadDataTable::ThreadDataTable() | 1308 Isolate::ThreadDataTable::ThreadDataTable() |
| 1317 : list_(NULL) { | 1309 : list_(NULL) { |
| 1318 } | 1310 } |
| 1319 | 1311 |
| 1320 | 1312 |
| 1321 Isolate::PerIsolateThreadData* | 1313 Isolate::PerIsolateThreadData* |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 // ensuring that Isolate::Current() == this. | 1612 // ensuring that Isolate::Current() == this. |
| 1621 heap_.SetStackLimits(); | 1613 heap_.SetStackLimits(); |
| 1622 | 1614 |
| 1623 #ifdef DEBUG | 1615 #ifdef DEBUG |
| 1624 DisallowAllocationFailure disallow_allocation_failure; | 1616 DisallowAllocationFailure disallow_allocation_failure; |
| 1625 #endif | 1617 #endif |
| 1626 | 1618 |
| 1627 #define C(name) isolate_addresses_[Isolate::k_##name] = \ | 1619 #define C(name) isolate_addresses_[Isolate::k_##name] = \ |
| 1628 reinterpret_cast<Address>(name()); | 1620 reinterpret_cast<Address>(name()); |
| 1629 ISOLATE_ADDRESS_LIST(C) | 1621 ISOLATE_ADDRESS_LIST(C) |
| 1630 ISOLATE_ADDRESS_LIST_PROF(C) | |
| 1631 #undef C | 1622 #undef C |
| 1632 | 1623 |
| 1633 string_tracker_ = new StringTracker(); | 1624 string_tracker_ = new StringTracker(); |
| 1634 string_tracker_->isolate_ = this; | 1625 string_tracker_->isolate_ = this; |
| 1635 compilation_cache_ = new CompilationCache(this); | 1626 compilation_cache_ = new CompilationCache(this); |
| 1636 transcendental_cache_ = new TranscendentalCache(); | 1627 transcendental_cache_ = new TranscendentalCache(); |
| 1637 keyed_lookup_cache_ = new KeyedLookupCache(); | 1628 keyed_lookup_cache_ = new KeyedLookupCache(); |
| 1638 context_slot_cache_ = new ContextSlotCache(); | 1629 context_slot_cache_ = new ContextSlotCache(); |
| 1639 descriptor_lookup_cache_ = new DescriptorLookupCache(); | 1630 descriptor_lookup_cache_ = new DescriptorLookupCache(); |
| 1640 unicode_cache_ = new UnicodeCache(); | 1631 unicode_cache_ = new UnicodeCache(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 | 1848 |
| 1858 #ifdef DEBUG | 1849 #ifdef DEBUG |
| 1859 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1850 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1860 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 1851 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 1861 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1852 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1862 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1853 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1863 #undef ISOLATE_FIELD_OFFSET | 1854 #undef ISOLATE_FIELD_OFFSET |
| 1864 #endif | 1855 #endif |
| 1865 | 1856 |
| 1866 } } // namespace v8::internal | 1857 } } // namespace v8::internal |
| OLD | NEW |