| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Make sure we access the buffer after the wait to remove all possibility | 185 // Make sure we access the buffer after the wait to remove all possibility |
| 186 // of it being optimized away. | 186 // of it being optimized away. |
| 187 OS::StrNCpy(local_buffer, "PreallocatedMemoryThread shutting down.\n", | 187 OS::StrNCpy(local_buffer, "PreallocatedMemoryThread shutting down.\n", |
| 188 local_buffer.length()); | 188 local_buffer.length()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 | 191 |
| 192 private: | 192 private: |
| 193 explicit PreallocatedMemoryThread(Isolate* isolate) | 193 PreallocatedMemoryThread() |
| 194 : Thread(isolate, "v8:PreallocMem"), | 194 : Thread("v8:PreallocMem"), |
| 195 keep_running_(true), | 195 keep_running_(true), |
| 196 wait_for_ever_semaphore_(OS::CreateSemaphore(0)), | 196 wait_for_ever_semaphore_(OS::CreateSemaphore(0)), |
| 197 data_ready_semaphore_(OS::CreateSemaphore(0)), | 197 data_ready_semaphore_(OS::CreateSemaphore(0)), |
| 198 data_(NULL), | 198 data_(NULL), |
| 199 length_(0) { | 199 length_(0) { |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Used to make sure that the thread keeps looping even for spurious wakeups. | 202 // Used to make sure that the thread keeps looping even for spurious wakeups. |
| 203 bool keep_running_; | 203 bool keep_running_; |
| 204 | 204 |
| 205 // This semaphore is used by the PreallocatedMemoryThread to wait for ever. | 205 // This semaphore is used by the PreallocatedMemoryThread to wait for ever. |
| 206 Semaphore* wait_for_ever_semaphore_; | 206 Semaphore* wait_for_ever_semaphore_; |
| 207 // Semaphore to signal that the data has been initialized. | 207 // Semaphore to signal that the data has been initialized. |
| 208 Semaphore* data_ready_semaphore_; | 208 Semaphore* data_ready_semaphore_; |
| 209 | 209 |
| 210 // Location and size of the preallocated memory block. | 210 // Location and size of the preallocated memory block. |
| 211 char* data_; | 211 char* data_; |
| 212 unsigned length_; | 212 unsigned length_; |
| 213 | 213 |
| 214 friend class Isolate; | 214 friend class Isolate; |
| 215 | 215 |
| 216 DISALLOW_COPY_AND_ASSIGN(PreallocatedMemoryThread); | 216 DISALLOW_COPY_AND_ASSIGN(PreallocatedMemoryThread); |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 | 219 |
| 220 void Isolate::PreallocatedMemoryThreadStart() { | 220 void Isolate::PreallocatedMemoryThreadStart() { |
| 221 if (preallocated_memory_thread_ != NULL) return; | 221 if (preallocated_memory_thread_ != NULL) return; |
| 222 preallocated_memory_thread_ = new PreallocatedMemoryThread(this); | 222 preallocated_memory_thread_ = new PreallocatedMemoryThread(); |
| 223 preallocated_memory_thread_->Start(); | 223 preallocated_memory_thread_->Start(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 | 226 |
| 227 void Isolate::PreallocatedMemoryThreadStop() { | 227 void Isolate::PreallocatedMemoryThreadStop() { |
| 228 if (preallocated_memory_thread_ == NULL) return; | 228 if (preallocated_memory_thread_ == NULL) return; |
| 229 preallocated_memory_thread_->StopThread(); | 229 preallocated_memory_thread_->StopThread(); |
| 230 // Done with the thread entirely. | 230 // Done with the thread entirely. |
| 231 delete preallocated_memory_thread_; | 231 delete preallocated_memory_thread_; |
| 232 preallocated_memory_thread_ = NULL; | 232 preallocated_memory_thread_ = NULL; |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 } | 1272 } |
| 1273 #endif // ENABLE_DEBUGGER_SUPPORT | 1273 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1274 if (it.done()) return Handle<Context>::null(); | 1274 if (it.done()) return Handle<Context>::null(); |
| 1275 JavaScriptFrame* frame = it.frame(); | 1275 JavaScriptFrame* frame = it.frame(); |
| 1276 Context* context = Context::cast(frame->context()); | 1276 Context* context = Context::cast(frame->context()); |
| 1277 return Handle<Context>(context->global_context()); | 1277 return Handle<Context>(context->global_context()); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 | 1280 |
| 1281 char* Isolate::ArchiveThread(char* to) { | 1281 char* Isolate::ArchiveThread(char* to) { |
| 1282 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 1282 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 1283 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
| 1283 RuntimeProfiler::IsolateExitedJS(this); | 1284 RuntimeProfiler::IsolateExitedJS(this); |
| 1284 } | 1285 } |
| 1286 #endif |
| 1285 memcpy(to, reinterpret_cast<char*>(thread_local_top()), | 1287 memcpy(to, reinterpret_cast<char*>(thread_local_top()), |
| 1286 sizeof(ThreadLocalTop)); | 1288 sizeof(ThreadLocalTop)); |
| 1287 InitializeThreadLocal(); | 1289 InitializeThreadLocal(); |
| 1288 return to + sizeof(ThreadLocalTop); | 1290 return to + sizeof(ThreadLocalTop); |
| 1289 } | 1291 } |
| 1290 | 1292 |
| 1291 | 1293 |
| 1292 char* Isolate::RestoreThread(char* from) { | 1294 char* Isolate::RestoreThread(char* from) { |
| 1293 memcpy(reinterpret_cast<char*>(thread_local_top()), from, | 1295 memcpy(reinterpret_cast<char*>(thread_local_top()), from, |
| 1294 sizeof(ThreadLocalTop)); | 1296 sizeof(ThreadLocalTop)); |
| 1295 // This might be just paranoia, but it seems to be needed in case a | 1297 // This might be just paranoia, but it seems to be needed in case a |
| 1296 // thread_local_top_ is restored on a separate OS thread. | 1298 // thread_local_top_ is restored on a separate OS thread. |
| 1297 #ifdef USE_SIMULATOR | 1299 #ifdef USE_SIMULATOR |
| 1298 #ifdef V8_TARGET_ARCH_ARM | 1300 #ifdef V8_TARGET_ARCH_ARM |
| 1299 thread_local_top()->simulator_ = Simulator::current(this); | 1301 thread_local_top()->simulator_ = Simulator::current(this); |
| 1300 #elif V8_TARGET_ARCH_MIPS | 1302 #elif V8_TARGET_ARCH_MIPS |
| 1301 thread_local_top()->simulator_ = Simulator::current(this); | 1303 thread_local_top()->simulator_ = Simulator::current(this); |
| 1302 #endif | 1304 #endif |
| 1303 #endif | 1305 #endif |
| 1306 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 1304 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 1307 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
| 1305 RuntimeProfiler::IsolateEnteredJS(this); | 1308 RuntimeProfiler::IsolateEnteredJS(this); |
| 1306 } | 1309 } |
| 1310 ASSERT(context() == NULL || context()->IsContext()); |
| 1311 #endif |
| 1307 return from + sizeof(ThreadLocalTop); | 1312 return from + sizeof(ThreadLocalTop); |
| 1308 } | 1313 } |
| 1309 | 1314 |
| 1310 | 1315 |
| 1311 Isolate::ThreadDataTable::ThreadDataTable() | 1316 Isolate::ThreadDataTable::ThreadDataTable() |
| 1312 : list_(NULL) { | 1317 : list_(NULL) { |
| 1313 } | 1318 } |
| 1314 | 1319 |
| 1315 | 1320 |
| 1316 Isolate::PerIsolateThreadData* | 1321 Isolate::PerIsolateThreadData* |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1339 | 1344 |
| 1340 void Isolate::ThreadDataTable::Remove(Isolate* isolate, | 1345 void Isolate::ThreadDataTable::Remove(Isolate* isolate, |
| 1341 ThreadId thread_id) { | 1346 ThreadId thread_id) { |
| 1342 PerIsolateThreadData* data = Lookup(isolate, thread_id); | 1347 PerIsolateThreadData* data = Lookup(isolate, thread_id); |
| 1343 if (data != NULL) { | 1348 if (data != NULL) { |
| 1344 Remove(data); | 1349 Remove(data); |
| 1345 } | 1350 } |
| 1346 } | 1351 } |
| 1347 | 1352 |
| 1348 | 1353 |
| 1354 void Isolate::ThreadDataTable::RemoveAllThreads(Isolate* isolate) { |
| 1355 PerIsolateThreadData* data = list_; |
| 1356 while (data != NULL) { |
| 1357 PerIsolateThreadData* next = data->next_; |
| 1358 if (data->isolate() == isolate) Remove(data); |
| 1359 data = next; |
| 1360 } |
| 1361 } |
| 1362 |
| 1363 |
| 1349 #ifdef DEBUG | 1364 #ifdef DEBUG |
| 1350 #define TRACE_ISOLATE(tag) \ | 1365 #define TRACE_ISOLATE(tag) \ |
| 1351 do { \ | 1366 do { \ |
| 1352 if (FLAG_trace_isolates) { \ | 1367 if (FLAG_trace_isolates) { \ |
| 1353 PrintF("Isolate %p " #tag "\n", reinterpret_cast<void*>(this)); \ | 1368 PrintF("Isolate %p " #tag "\n", reinterpret_cast<void*>(this)); \ |
| 1354 } \ | 1369 } \ |
| 1355 } while (false) | 1370 } while (false) |
| 1356 #else | 1371 #else |
| 1357 #define TRACE_ISOLATE(tag) | 1372 #define TRACE_ISOLATE(tag) |
| 1358 #endif | 1373 #endif |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1389 free_list_(0), | 1404 free_list_(0), |
| 1390 preallocated_storage_preallocated_(false), | 1405 preallocated_storage_preallocated_(false), |
| 1391 pc_to_code_cache_(NULL), | 1406 pc_to_code_cache_(NULL), |
| 1392 write_input_buffer_(NULL), | 1407 write_input_buffer_(NULL), |
| 1393 global_handles_(NULL), | 1408 global_handles_(NULL), |
| 1394 context_switcher_(NULL), | 1409 context_switcher_(NULL), |
| 1395 thread_manager_(NULL), | 1410 thread_manager_(NULL), |
| 1396 ast_sentinels_(NULL), | 1411 ast_sentinels_(NULL), |
| 1397 string_tracker_(NULL), | 1412 string_tracker_(NULL), |
| 1398 regexp_stack_(NULL), | 1413 regexp_stack_(NULL), |
| 1399 frame_element_constant_list_(0), | |
| 1400 result_constant_list_(0), | |
| 1401 embedder_data_(NULL) { | 1414 embedder_data_(NULL) { |
| 1402 TRACE_ISOLATE(constructor); | 1415 TRACE_ISOLATE(constructor); |
| 1403 | 1416 |
| 1404 memset(isolate_addresses_, 0, | 1417 memset(isolate_addresses_, 0, |
| 1405 sizeof(isolate_addresses_[0]) * (k_isolate_address_count + 1)); | 1418 sizeof(isolate_addresses_[0]) * (k_isolate_address_count + 1)); |
| 1406 | 1419 |
| 1407 heap_.isolate_ = this; | 1420 heap_.isolate_ = this; |
| 1408 zone_.isolate_ = this; | 1421 zone_.isolate_ = this; |
| 1409 stack_guard_.isolate_ = this; | 1422 stack_guard_.isolate_ = this; |
| 1410 | 1423 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1425 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); | 1438 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); |
| 1426 memset(code_kind_statistics_, 0, | 1439 memset(code_kind_statistics_, 0, |
| 1427 sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); | 1440 sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); |
| 1428 #endif | 1441 #endif |
| 1429 | 1442 |
| 1430 #ifdef ENABLE_DEBUGGER_SUPPORT | 1443 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1431 debug_ = NULL; | 1444 debug_ = NULL; |
| 1432 debugger_ = NULL; | 1445 debugger_ = NULL; |
| 1433 #endif | 1446 #endif |
| 1434 | 1447 |
| 1435 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1436 producer_heap_profile_ = NULL; | |
| 1437 #endif | |
| 1438 | |
| 1439 handle_scope_data_.Initialize(); | 1448 handle_scope_data_.Initialize(); |
| 1440 | 1449 |
| 1441 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \ | 1450 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \ |
| 1442 name##_ = (initial_value); | 1451 name##_ = (initial_value); |
| 1443 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) | 1452 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) |
| 1444 #undef ISOLATE_INIT_EXECUTE | 1453 #undef ISOLATE_INIT_EXECUTE |
| 1445 | 1454 |
| 1446 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ | 1455 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ |
| 1447 memset(name##_, 0, sizeof(type) * length); | 1456 memset(name##_, 0, sizeof(type) * length); |
| 1448 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) | 1457 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) |
| 1449 #undef ISOLATE_INIT_ARRAY_EXECUTE | 1458 #undef ISOLATE_INIT_ARRAY_EXECUTE |
| 1450 } | 1459 } |
| 1451 | 1460 |
| 1452 void Isolate::TearDown() { | 1461 void Isolate::TearDown() { |
| 1453 TRACE_ISOLATE(tear_down); | 1462 TRACE_ISOLATE(tear_down); |
| 1454 | 1463 |
| 1455 // Temporarily set this isolate as current so that various parts of | 1464 // Temporarily set this isolate as current so that various parts of |
| 1456 // the isolate can access it in their destructors without having a | 1465 // the isolate can access it in their destructors without having a |
| 1457 // direct pointer. We don't use Enter/Exit here to avoid | 1466 // direct pointer. We don't use Enter/Exit here to avoid |
| 1458 // initializing the thread data. | 1467 // initializing the thread data. |
| 1459 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData(); | 1468 PerIsolateThreadData* saved_data = CurrentPerIsolateThreadData(); |
| 1460 Isolate* saved_isolate = UncheckedCurrent(); | 1469 Isolate* saved_isolate = UncheckedCurrent(); |
| 1461 SetIsolateThreadLocals(this, NULL); | 1470 SetIsolateThreadLocals(this, NULL); |
| 1462 | 1471 |
| 1463 Deinit(); | 1472 Deinit(); |
| 1464 | 1473 |
| 1474 { ScopedLock lock(process_wide_mutex_); |
| 1475 thread_data_table_->RemoveAllThreads(this); |
| 1476 } |
| 1477 |
| 1465 if (!IsDefaultIsolate()) { | 1478 if (!IsDefaultIsolate()) { |
| 1466 delete this; | 1479 delete this; |
| 1467 } | 1480 } |
| 1468 | 1481 |
| 1469 // Restore the previous current isolate. | 1482 // Restore the previous current isolate. |
| 1470 SetIsolateThreadLocals(saved_isolate, saved_data); | 1483 SetIsolateThreadLocals(saved_isolate, saved_data); |
| 1471 } | 1484 } |
| 1472 | 1485 |
| 1473 | 1486 |
| 1474 void Isolate::Deinit() { | 1487 void Isolate::Deinit() { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 void Isolate::SetIsolateThreadLocals(Isolate* isolate, | 1526 void Isolate::SetIsolateThreadLocals(Isolate* isolate, |
| 1514 PerIsolateThreadData* data) { | 1527 PerIsolateThreadData* data) { |
| 1515 Thread::SetThreadLocal(isolate_key_, isolate); | 1528 Thread::SetThreadLocal(isolate_key_, isolate); |
| 1516 Thread::SetThreadLocal(per_isolate_thread_data_key_, data); | 1529 Thread::SetThreadLocal(per_isolate_thread_data_key_, data); |
| 1517 } | 1530 } |
| 1518 | 1531 |
| 1519 | 1532 |
| 1520 Isolate::~Isolate() { | 1533 Isolate::~Isolate() { |
| 1521 TRACE_ISOLATE(destructor); | 1534 TRACE_ISOLATE(destructor); |
| 1522 | 1535 |
| 1523 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1524 delete producer_heap_profile_; | |
| 1525 producer_heap_profile_ = NULL; | |
| 1526 #endif | |
| 1527 | |
| 1528 delete unicode_cache_; | 1536 delete unicode_cache_; |
| 1529 unicode_cache_ = NULL; | 1537 unicode_cache_ = NULL; |
| 1530 | 1538 |
| 1531 delete regexp_stack_; | 1539 delete regexp_stack_; |
| 1532 regexp_stack_ = NULL; | 1540 regexp_stack_ = NULL; |
| 1533 | 1541 |
| 1534 delete ast_sentinels_; | 1542 delete ast_sentinels_; |
| 1535 ast_sentinels_ = NULL; | 1543 ast_sentinels_ = NULL; |
| 1536 | 1544 |
| 1537 delete descriptor_lookup_cache_; | 1545 delete descriptor_lookup_cache_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 | 1601 |
| 1594 | 1602 |
| 1595 bool Isolate::PreInit() { | 1603 bool Isolate::PreInit() { |
| 1596 if (state_ != UNINITIALIZED) return true; | 1604 if (state_ != UNINITIALIZED) return true; |
| 1597 | 1605 |
| 1598 TRACE_ISOLATE(preinit); | 1606 TRACE_ISOLATE(preinit); |
| 1599 | 1607 |
| 1600 ASSERT(Isolate::Current() == this); | 1608 ASSERT(Isolate::Current() == this); |
| 1601 #ifdef ENABLE_DEBUGGER_SUPPORT | 1609 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1602 debug_ = new Debug(this); | 1610 debug_ = new Debug(this); |
| 1603 debugger_ = new Debugger(); | 1611 debugger_ = new Debugger(this); |
| 1604 debugger_->isolate_ = this; | |
| 1605 #endif | 1612 #endif |
| 1606 | 1613 |
| 1607 memory_allocator_ = new MemoryAllocator(); | 1614 memory_allocator_ = new MemoryAllocator(); |
| 1608 memory_allocator_->isolate_ = this; | 1615 memory_allocator_->isolate_ = this; |
| 1609 code_range_ = new CodeRange(); | 1616 code_range_ = new CodeRange(); |
| 1610 code_range_->isolate_ = this; | 1617 code_range_->isolate_ = this; |
| 1611 | 1618 |
| 1612 // Safe after setting Heap::isolate_, initializing StackGuard and | 1619 // Safe after setting Heap::isolate_, initializing StackGuard and |
| 1613 // ensuring that Isolate::Current() == this. | 1620 // ensuring that Isolate::Current() == this. |
| 1614 heap_.SetStackLimits(); | 1621 heap_.SetStackLimits(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1634 pc_to_code_cache_ = new PcToCodeCache(this); | 1641 pc_to_code_cache_ = new PcToCodeCache(this); |
| 1635 write_input_buffer_ = new StringInputBuffer(); | 1642 write_input_buffer_ = new StringInputBuffer(); |
| 1636 global_handles_ = new GlobalHandles(this); | 1643 global_handles_ = new GlobalHandles(this); |
| 1637 bootstrapper_ = new Bootstrapper(); | 1644 bootstrapper_ = new Bootstrapper(); |
| 1638 handle_scope_implementer_ = new HandleScopeImplementer(this); | 1645 handle_scope_implementer_ = new HandleScopeImplementer(this); |
| 1639 stub_cache_ = new StubCache(this); | 1646 stub_cache_ = new StubCache(this); |
| 1640 ast_sentinels_ = new AstSentinels(); | 1647 ast_sentinels_ = new AstSentinels(); |
| 1641 regexp_stack_ = new RegExpStack(); | 1648 regexp_stack_ = new RegExpStack(); |
| 1642 regexp_stack_->isolate_ = this; | 1649 regexp_stack_->isolate_ = this; |
| 1643 | 1650 |
| 1644 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1645 producer_heap_profile_ = new ProducerHeapProfile(); | |
| 1646 producer_heap_profile_->isolate_ = this; | |
| 1647 #endif | |
| 1648 | |
| 1649 state_ = PREINITIALIZED; | 1651 state_ = PREINITIALIZED; |
| 1650 return true; | 1652 return true; |
| 1651 } | 1653 } |
| 1652 | 1654 |
| 1653 | 1655 |
| 1654 void Isolate::InitializeThreadLocal() { | 1656 void Isolate::InitializeThreadLocal() { |
| 1655 thread_local_top_.isolate_ = this; | 1657 thread_local_top_.isolate_ = this; |
| 1656 thread_local_top_.Initialize(); | 1658 thread_local_top_.Initialize(); |
| 1657 clear_pending_exception(); | 1659 clear_pending_exception(); |
| 1658 clear_pending_message(); | 1660 clear_pending_message(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 stack_guard_.InitThread(lock); | 1730 stack_guard_.InitThread(lock); |
| 1729 } | 1731 } |
| 1730 | 1732 |
| 1731 // Setup the object heap | 1733 // Setup the object heap |
| 1732 ASSERT(!heap_.HasBeenSetup()); | 1734 ASSERT(!heap_.HasBeenSetup()); |
| 1733 if (!heap_.Setup(create_heap_objects)) { | 1735 if (!heap_.Setup(create_heap_objects)) { |
| 1734 V8::SetFatalError(); | 1736 V8::SetFatalError(); |
| 1735 return false; | 1737 return false; |
| 1736 } | 1738 } |
| 1737 | 1739 |
| 1740 InitializeThreadLocal(); |
| 1741 |
| 1738 bootstrapper_->Initialize(create_heap_objects); | 1742 bootstrapper_->Initialize(create_heap_objects); |
| 1739 builtins_.Setup(create_heap_objects); | 1743 builtins_.Setup(create_heap_objects); |
| 1740 | 1744 |
| 1741 InitializeThreadLocal(); | |
| 1742 | |
| 1743 // Only preallocate on the first initialization. | 1745 // Only preallocate on the first initialization. |
| 1744 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { | 1746 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { |
| 1745 // Start the thread which will set aside some memory. | 1747 // Start the thread which will set aside some memory. |
| 1746 PreallocatedMemoryThreadStart(); | 1748 PreallocatedMemoryThreadStart(); |
| 1747 preallocated_message_space_ = | 1749 preallocated_message_space_ = |
| 1748 new NoAllocationStringAllocator( | 1750 new NoAllocationStringAllocator( |
| 1749 preallocated_memory_thread_->data(), | 1751 preallocated_memory_thread_->data(), |
| 1750 preallocated_memory_thread_->length()); | 1752 preallocated_memory_thread_->length()); |
| 1751 PreallocatedStorageInit(preallocated_memory_thread_->length() / 4); | 1753 PreallocatedStorageInit(preallocated_memory_thread_->length() / 4); |
| 1752 } | 1754 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 PerIsolateThreadData* previous_thread_data = item->previous_thread_data; | 1854 PerIsolateThreadData* previous_thread_data = item->previous_thread_data; |
| 1853 Isolate* previous_isolate = item->previous_isolate; | 1855 Isolate* previous_isolate = item->previous_isolate; |
| 1854 | 1856 |
| 1855 delete item; | 1857 delete item; |
| 1856 | 1858 |
| 1857 // Reinit the current thread for the isolate it was running before this one. | 1859 // Reinit the current thread for the isolate it was running before this one. |
| 1858 SetIsolateThreadLocals(previous_isolate, previous_thread_data); | 1860 SetIsolateThreadLocals(previous_isolate, previous_thread_data); |
| 1859 } | 1861 } |
| 1860 | 1862 |
| 1861 | 1863 |
| 1862 void Isolate::ResetEagerOptimizingData() { | |
| 1863 compilation_cache_->ResetEagerOptimizingData(); | |
| 1864 } | |
| 1865 | |
| 1866 | |
| 1867 #ifdef DEBUG | 1864 #ifdef DEBUG |
| 1868 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1865 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1869 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 1866 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 1870 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1867 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1871 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1868 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1872 #undef ISOLATE_FIELD_OFFSET | 1869 #undef ISOLATE_FIELD_OFFSET |
| 1873 #endif | 1870 #endif |
| 1874 | 1871 |
| 1875 } } // namespace v8::internal | 1872 } } // namespace v8::internal |
| OLD | NEW |