| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 int ThreadId::GetCurrentThreadId() { | 64 int ThreadId::GetCurrentThreadId() { |
| 65 int thread_id = Thread::GetThreadLocalInt(Isolate::thread_id_key_); | 65 int thread_id = Thread::GetThreadLocalInt(Isolate::thread_id_key_); |
| 66 if (thread_id == 0) { | 66 if (thread_id == 0) { |
| 67 thread_id = AllocateThreadId(); | 67 thread_id = AllocateThreadId(); |
| 68 Thread::SetThreadLocalInt(Isolate::thread_id_key_, thread_id); | 68 Thread::SetThreadLocalInt(Isolate::thread_id_key_, thread_id); |
| 69 } | 69 } |
| 70 return thread_id; | 70 return thread_id; |
| 71 } | 71 } |
| 72 | 72 |
| 73 |
| 73 // Create a dummy thread that will wait forever on a semaphore. The only | 74 // Create a dummy thread that will wait forever on a semaphore. The only |
| 74 // purpose for this thread is to have some stack area to save essential data | 75 // purpose for this thread is to have some stack area to save essential data |
| 75 // into for use by a stacks only core dump (aka minidump). | 76 // into for use by a stacks only core dump (aka minidump). |
| 76 class PreallocatedMemoryThread: public Thread { | 77 class PreallocatedMemoryThread: public Thread { |
| 77 public: | 78 public: |
| 78 char* data() { | 79 char* data() { |
| 79 if (data_ready_semaphore_ != NULL) { | 80 if (data_ready_semaphore_ != NULL) { |
| 80 // Initial access is guarded until the data has been published. | 81 // Initial access is guarded until the data has been published. |
| 81 data_ready_semaphore_->Wait(); | 82 data_ready_semaphore_->Wait(); |
| 82 delete data_ready_semaphore_; | 83 delete data_ready_semaphore_; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (default_isolate_ == NULL) { | 317 if (default_isolate_ == NULL) { |
| 317 isolate_key_ = Thread::CreateThreadLocalKey(); | 318 isolate_key_ = Thread::CreateThreadLocalKey(); |
| 318 thread_id_key_ = Thread::CreateThreadLocalKey(); | 319 thread_id_key_ = Thread::CreateThreadLocalKey(); |
| 319 per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey(); | 320 per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey(); |
| 320 thread_data_table_ = new Isolate::ThreadDataTable(); | 321 thread_data_table_ = new Isolate::ThreadDataTable(); |
| 321 default_isolate_ = new Isolate(); | 322 default_isolate_ = new Isolate(); |
| 322 } | 323 } |
| 323 // Can't use SetIsolateThreadLocals(default_isolate_, NULL) here | 324 // Can't use SetIsolateThreadLocals(default_isolate_, NULL) here |
| 324 // becase a non-null thread data may be already set. | 325 // becase a non-null thread data may be already set. |
| 325 Thread::SetThreadLocal(isolate_key_, default_isolate_); | 326 Thread::SetThreadLocal(isolate_key_, default_isolate_); |
| 326 CHECK(default_isolate_->PreInit()); | |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 Debugger* Isolate::GetDefaultIsolateDebugger() { | 330 Debugger* Isolate::GetDefaultIsolateDebugger() { |
| 331 EnsureDefaultIsolate(); | 331 EnsureDefaultIsolate(); |
| 332 return default_isolate_->debugger(); | 332 return default_isolate_->debugger(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 StackGuard* Isolate::GetDefaultIsolateStackGuard() { | 336 StackGuard* Isolate::GetDefaultIsolateStackGuard() { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 Isolate::Isolate() | 410 Isolate::Isolate() |
| 411 : state_(UNINITIALIZED), | 411 : state_(UNINITIALIZED), |
| 412 entry_stack_(NULL), | 412 entry_stack_(NULL), |
| 413 stack_trace_nesting_level_(0), | 413 stack_trace_nesting_level_(0), |
| 414 incomplete_message_(NULL), | 414 incomplete_message_(NULL), |
| 415 preallocated_memory_thread_(NULL), | 415 preallocated_memory_thread_(NULL), |
| 416 preallocated_message_space_(NULL), | 416 preallocated_message_space_(NULL), |
| 417 bootstrapper_(NULL), | 417 bootstrapper_(NULL), |
| 418 runtime_profiler_(NULL), | 418 runtime_profiler_(NULL), |
| 419 compilation_cache_(NULL), | 419 compilation_cache_(NULL), |
| 420 counters_(new Counters()), | 420 counters_(NULL), |
| 421 code_range_(NULL), | 421 code_range_(NULL), |
| 422 // Must be initialized early to allow v8::SetResourceConstraints calls. |
| 422 break_access_(OS::CreateMutex()), | 423 break_access_(OS::CreateMutex()), |
| 423 logger_(new Logger()), | 424 debugger_initialized_(false), |
| 424 stats_table_(new StatsTable()), | 425 // Must be initialized early to allow v8::Debug calls. |
| 426 debugger_access_(OS::CreateMutex()), |
| 427 logger_(NULL), |
| 428 stats_table_(NULL), |
| 425 stub_cache_(NULL), | 429 stub_cache_(NULL), |
| 426 deoptimizer_data_(NULL), | 430 deoptimizer_data_(NULL), |
| 427 capture_stack_trace_for_uncaught_exceptions_(false), | 431 capture_stack_trace_for_uncaught_exceptions_(false), |
| 428 stack_trace_for_uncaught_exceptions_frame_limit_(0), | 432 stack_trace_for_uncaught_exceptions_frame_limit_(0), |
| 429 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), | 433 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), |
| 430 transcendental_cache_(NULL), | 434 transcendental_cache_(NULL), |
| 431 memory_allocator_(NULL), | 435 memory_allocator_(NULL), |
| 432 keyed_lookup_cache_(NULL), | 436 keyed_lookup_cache_(NULL), |
| 433 context_slot_cache_(NULL), | 437 context_slot_cache_(NULL), |
| 434 descriptor_lookup_cache_(NULL), | 438 descriptor_lookup_cache_(NULL), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 456 zone_.isolate_ = this; | 460 zone_.isolate_ = this; |
| 457 stack_guard_.isolate_ = this; | 461 stack_guard_.isolate_ = this; |
| 458 | 462 |
| 459 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ | 463 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ |
| 460 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) | 464 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) |
| 461 simulator_initialized_ = false; | 465 simulator_initialized_ = false; |
| 462 simulator_i_cache_ = NULL; | 466 simulator_i_cache_ = NULL; |
| 463 simulator_redirection_ = NULL; | 467 simulator_redirection_ = NULL; |
| 464 #endif | 468 #endif |
| 465 | 469 |
| 470 thread_manager_ = new ThreadManager(); |
| 471 thread_manager_->isolate_ = this; |
| 472 |
| 466 #ifdef DEBUG | 473 #ifdef DEBUG |
| 467 // heap_histograms_ initializes itself. | 474 // heap_histograms_ initializes itself. |
| 468 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); | 475 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); |
| 469 memset(code_kind_statistics_, 0, | 476 memset(code_kind_statistics_, 0, |
| 470 sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); | 477 sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); |
| 471 #endif | 478 #endif |
| 472 | 479 |
| 473 #ifdef ENABLE_DEBUGGER_SUPPORT | 480 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 474 debug_ = NULL; | 481 debug_ = NULL; |
| 475 debugger_ = NULL; | 482 debugger_ = NULL; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 CpuProfiler::TearDown(); | 548 CpuProfiler::TearDown(); |
| 542 if (runtime_profiler_ != NULL) { | 549 if (runtime_profiler_ != NULL) { |
| 543 runtime_profiler_->TearDown(); | 550 runtime_profiler_->TearDown(); |
| 544 delete runtime_profiler_; | 551 delete runtime_profiler_; |
| 545 runtime_profiler_ = NULL; | 552 runtime_profiler_ = NULL; |
| 546 } | 553 } |
| 547 heap_.TearDown(); | 554 heap_.TearDown(); |
| 548 logger_->TearDown(); | 555 logger_->TearDown(); |
| 549 | 556 |
| 550 // The default isolate is re-initializable due to legacy API. | 557 // The default isolate is re-initializable due to legacy API. |
| 551 state_ = PREINITIALIZED; | 558 state_ = UNINITIALIZED; |
| 552 } | 559 } |
| 553 } | 560 } |
| 554 | 561 |
| 555 | 562 |
| 556 void Isolate::SetIsolateThreadLocals(Isolate* isolate, | 563 void Isolate::SetIsolateThreadLocals(Isolate* isolate, |
| 557 PerIsolateThreadData* data) { | 564 PerIsolateThreadData* data) { |
| 558 Thread::SetThreadLocal(isolate_key_, isolate); | 565 Thread::SetThreadLocal(isolate_key_, isolate); |
| 559 Thread::SetThreadLocal(per_isolate_thread_data_key_, data); | 566 Thread::SetThreadLocal(per_isolate_thread_data_key_, data); |
| 560 } | 567 } |
| 561 | 568 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 635 |
| 629 #ifdef ENABLE_DEBUGGER_SUPPORT | 636 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 630 delete debugger_; | 637 delete debugger_; |
| 631 debugger_ = NULL; | 638 debugger_ = NULL; |
| 632 delete debug_; | 639 delete debug_; |
| 633 debug_ = NULL; | 640 debug_ = NULL; |
| 634 #endif | 641 #endif |
| 635 } | 642 } |
| 636 | 643 |
| 637 | 644 |
| 638 bool Isolate::PreInit() { | |
| 639 if (state_ != UNINITIALIZED) return true; | |
| 640 | |
| 641 TRACE_ISOLATE(preinit); | |
| 642 | |
| 643 ASSERT(Isolate::Current() == this); | |
| 644 | |
| 645 #ifdef ENABLE_DEBUGGER_SUPPORT | |
| 646 debug_ = new Debug(this); | |
| 647 debugger_ = new Debugger(); | |
| 648 debugger_->isolate_ = this; | |
| 649 #endif | |
| 650 | |
| 651 memory_allocator_ = new MemoryAllocator(); | |
| 652 memory_allocator_->isolate_ = this; | |
| 653 code_range_ = new CodeRange(); | |
| 654 code_range_->isolate_ = this; | |
| 655 | |
| 656 // Safe after setting Heap::isolate_, initializing StackGuard and | |
| 657 // ensuring that Isolate::Current() == this. | |
| 658 heap_.SetStackLimits(); | |
| 659 | |
| 660 #ifdef DEBUG | |
| 661 DisallowAllocationFailure disallow_allocation_failure; | |
| 662 #endif | |
| 663 | |
| 664 #define C(name) isolate_addresses_[Isolate::k_##name] = \ | |
| 665 reinterpret_cast<Address>(name()); | |
| 666 ISOLATE_ADDRESS_LIST(C) | |
| 667 ISOLATE_ADDRESS_LIST_PROF(C) | |
| 668 #undef C | |
| 669 | |
| 670 string_tracker_ = new StringTracker(); | |
| 671 string_tracker_->isolate_ = this; | |
| 672 thread_manager_ = new ThreadManager(); | |
| 673 thread_manager_->isolate_ = this; | |
| 674 compilation_cache_ = new CompilationCache(this); | |
| 675 transcendental_cache_ = new TranscendentalCache(); | |
| 676 keyed_lookup_cache_ = new KeyedLookupCache(); | |
| 677 context_slot_cache_ = new ContextSlotCache(); | |
| 678 descriptor_lookup_cache_ = new DescriptorLookupCache(); | |
| 679 unicode_cache_ = new UnicodeCache(); | |
| 680 pc_to_code_cache_ = new PcToCodeCache(this); | |
| 681 write_input_buffer_ = new StringInputBuffer(); | |
| 682 global_handles_ = new GlobalHandles(this); | |
| 683 bootstrapper_ = new Bootstrapper(); | |
| 684 handle_scope_implementer_ = new HandleScopeImplementer(); | |
| 685 stub_cache_ = new StubCache(this); | |
| 686 ast_sentinels_ = new AstSentinels(); | |
| 687 regexp_stack_ = new RegExpStack(); | |
| 688 regexp_stack_->isolate_ = this; | |
| 689 | |
| 690 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 691 producer_heap_profile_ = new ProducerHeapProfile(); | |
| 692 producer_heap_profile_->isolate_ = this; | |
| 693 #endif | |
| 694 | |
| 695 state_ = PREINITIALIZED; | |
| 696 return true; | |
| 697 } | |
| 698 | |
| 699 | |
| 700 void Isolate::InitializeThreadLocal() { | 645 void Isolate::InitializeThreadLocal() { |
| 701 thread_local_top_.Initialize(); | 646 thread_local_top_.Initialize(); |
| 702 clear_pending_exception(); | 647 clear_pending_exception(); |
| 703 clear_pending_message(); | 648 clear_pending_message(); |
| 704 clear_scheduled_exception(); | 649 clear_scheduled_exception(); |
| 705 } | 650 } |
| 706 | 651 |
| 707 | 652 |
| 708 void Isolate::PropagatePendingExceptionToExternalTryCatch() { | 653 void Isolate::PropagatePendingExceptionToExternalTryCatch() { |
| 709 ASSERT(has_pending_exception()); | 654 ASSERT(has_pending_exception()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 725 ASSERT(!pending_exception()->IsFailure()); | 670 ASSERT(!pending_exception()->IsFailure()); |
| 726 try_catch_handler()->can_continue_ = true; | 671 try_catch_handler()->can_continue_ = true; |
| 727 try_catch_handler()->exception_ = pending_exception(); | 672 try_catch_handler()->exception_ = pending_exception(); |
| 728 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { | 673 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { |
| 729 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; | 674 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; |
| 730 } | 675 } |
| 731 } | 676 } |
| 732 } | 677 } |
| 733 | 678 |
| 734 | 679 |
| 680 void Isolate::InitializeLoggingAndCounters() { |
| 681 if (logger_ == NULL) { |
| 682 logger_ = new Logger; |
| 683 } |
| 684 if (counters_ == NULL) { |
| 685 counters_ = new Counters; |
| 686 } |
| 687 } |
| 688 |
| 689 |
| 690 void Isolate::InitializeDebugger() { |
| 691 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 692 ScopedLock lock(debugger_access_); |
| 693 if (NoBarrier_Load(&debugger_initialized_)) return; |
| 694 InitializeLoggingAndCounters(); |
| 695 debug_ = new Debug(this); |
| 696 debugger_ = new Debugger(this); |
| 697 Release_Store(&debugger_initialized_, true); |
| 698 #endif |
| 699 } |
| 700 |
| 701 |
| 735 bool Isolate::Init(Deserializer* des) { | 702 bool Isolate::Init(Deserializer* des) { |
| 736 ASSERT(state_ != INITIALIZED); | 703 ASSERT(state_ != INITIALIZED); |
| 737 | 704 ASSERT(Isolate::Current() == this); |
| 738 TRACE_ISOLATE(init); | 705 TRACE_ISOLATE(init); |
| 739 | 706 |
| 740 bool create_heap_objects = des == NULL; | |
| 741 | |
| 742 #ifdef DEBUG | 707 #ifdef DEBUG |
| 743 // The initialization process does not handle memory exhaustion. | 708 // The initialization process does not handle memory exhaustion. |
| 744 DisallowAllocationFailure disallow_allocation_failure; | 709 DisallowAllocationFailure disallow_allocation_failure; |
| 745 #endif | 710 #endif |
| 746 | 711 |
| 747 if (state_ == UNINITIALIZED && !PreInit()) return false; | 712 InitializeLoggingAndCounters(); |
| 713 |
| 714 InitializeDebugger(); |
| 715 |
| 716 memory_allocator_ = new MemoryAllocator(this); |
| 717 code_range_ = new CodeRange(this); |
| 718 |
| 719 // Safe after setting Heap::isolate_, initializing StackGuard and |
| 720 // ensuring that Isolate::Current() == this. |
| 721 heap_.SetStackLimits(); |
| 722 |
| 723 #define C(name) isolate_addresses_[Isolate::k_##name] = \ |
| 724 reinterpret_cast<Address>(name()); |
| 725 ISOLATE_ADDRESS_LIST(C) |
| 726 ISOLATE_ADDRESS_LIST_PROF(C) |
| 727 #undef C |
| 728 |
| 729 string_tracker_ = new StringTracker(); |
| 730 string_tracker_->isolate_ = this; |
| 731 compilation_cache_ = new CompilationCache(this); |
| 732 transcendental_cache_ = new TranscendentalCache(); |
| 733 keyed_lookup_cache_ = new KeyedLookupCache(); |
| 734 context_slot_cache_ = new ContextSlotCache(); |
| 735 descriptor_lookup_cache_ = new DescriptorLookupCache(); |
| 736 unicode_cache_ = new UnicodeCache(); |
| 737 pc_to_code_cache_ = new PcToCodeCache(this); |
| 738 write_input_buffer_ = new StringInputBuffer(); |
| 739 global_handles_ = new GlobalHandles(this); |
| 740 bootstrapper_ = new Bootstrapper(); |
| 741 handle_scope_implementer_ = new HandleScopeImplementer(); |
| 742 stub_cache_ = new StubCache(this); |
| 743 ast_sentinels_ = new AstSentinels(); |
| 744 regexp_stack_ = new RegExpStack(); |
| 745 regexp_stack_->isolate_ = this; |
| 746 |
| 747 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 748 producer_heap_profile_ = new ProducerHeapProfile(); |
| 749 producer_heap_profile_->isolate_ = this; |
| 750 #endif |
| 748 | 751 |
| 749 // Enable logging before setting up the heap | 752 // Enable logging before setting up the heap |
| 750 logger_->Setup(); | 753 logger_->Setup(); |
| 751 | 754 |
| 752 CpuProfiler::Setup(); | 755 CpuProfiler::Setup(); |
| 753 HeapProfiler::Setup(); | 756 HeapProfiler::Setup(); |
| 754 | 757 |
| 755 // Initialize other runtime facilities | 758 // Initialize other runtime facilities |
| 756 #if defined(USE_SIMULATOR) | 759 #if defined(USE_SIMULATOR) |
| 757 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) | 760 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) |
| 758 Simulator::Initialize(); | 761 Simulator::Initialize(); |
| 759 #endif | 762 #endif |
| 760 #endif | 763 #endif |
| 761 | 764 |
| 762 { // NOLINT | 765 { // NOLINT |
| 763 // Ensure that the thread has a valid stack guard. The v8::Locker object | 766 // Ensure that the thread has a valid stack guard. The v8::Locker object |
| 764 // will ensure this too, but we don't have to use lockers if we are only | 767 // will ensure this too, but we don't have to use lockers if we are only |
| 765 // using one thread. | 768 // using one thread. |
| 766 ExecutionAccess lock(this); | 769 ExecutionAccess lock(this); |
| 767 stack_guard_.InitThread(lock); | 770 stack_guard_.InitThread(lock); |
| 768 } | 771 } |
| 769 | 772 |
| 770 // Setup the object heap | 773 // Setup the object heap. |
| 774 const bool create_heap_objects = (des == NULL); |
| 771 ASSERT(!heap_.HasBeenSetup()); | 775 ASSERT(!heap_.HasBeenSetup()); |
| 772 if (!heap_.Setup(create_heap_objects)) { | 776 if (!heap_.Setup(create_heap_objects)) { |
| 773 V8::SetFatalError(); | 777 V8::SetFatalError(); |
| 774 return false; | 778 return false; |
| 775 } | 779 } |
| 776 | 780 |
| 777 bootstrapper_->Initialize(create_heap_objects); | 781 bootstrapper_->Initialize(create_heap_objects); |
| 778 builtins_.Setup(create_heap_objects); | 782 builtins_.Setup(create_heap_objects); |
| 779 | 783 |
| 780 InitializeThreadLocal(); | 784 InitializeThreadLocal(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 HandleScope scope; | 824 HandleScope scope; |
| 821 LOG(this, LogCodeObjects()); | 825 LOG(this, LogCodeObjects()); |
| 822 LOG(this, LogCompiledFunctions()); | 826 LOG(this, LogCompiledFunctions()); |
| 823 } | 827 } |
| 824 | 828 |
| 825 state_ = INITIALIZED; | 829 state_ = INITIALIZED; |
| 826 return true; | 830 return true; |
| 827 } | 831 } |
| 828 | 832 |
| 829 | 833 |
| 834 // Initialized lazily to allow early |
| 835 // v8::V8::SetAddHistogramSampleFunction calls. |
| 836 StatsTable* Isolate::stats_table() { |
| 837 if (stats_table_ == NULL) { |
| 838 stats_table_ = new StatsTable; |
| 839 } |
| 840 return stats_table_; |
| 841 } |
| 842 |
| 843 |
| 830 void Isolate::Enter() { | 844 void Isolate::Enter() { |
| 831 Isolate* current_isolate = NULL; | 845 Isolate* current_isolate = NULL; |
| 832 PerIsolateThreadData* current_data = CurrentPerIsolateThreadData(); | 846 PerIsolateThreadData* current_data = CurrentPerIsolateThreadData(); |
| 833 if (current_data != NULL) { | 847 if (current_data != NULL) { |
| 834 current_isolate = current_data->isolate_; | 848 current_isolate = current_data->isolate_; |
| 835 ASSERT(current_isolate != NULL); | 849 ASSERT(current_isolate != NULL); |
| 836 if (current_isolate == this) { | 850 if (current_isolate == this) { |
| 837 ASSERT(Current() == this); | 851 ASSERT(Current() == this); |
| 838 ASSERT(entry_stack_ != NULL); | 852 ASSERT(entry_stack_ != NULL); |
| 839 ASSERT(entry_stack_->previous_thread_data == NULL || | 853 ASSERT(entry_stack_->previous_thread_data == NULL || |
| (...skipping 19 matching lines...) Expand all Loading... |
| 859 ASSERT(data != NULL); | 873 ASSERT(data != NULL); |
| 860 ASSERT(data->isolate_ == this); | 874 ASSERT(data->isolate_ == this); |
| 861 | 875 |
| 862 EntryStackItem* item = new EntryStackItem(current_data, | 876 EntryStackItem* item = new EntryStackItem(current_data, |
| 863 current_isolate, | 877 current_isolate, |
| 864 entry_stack_); | 878 entry_stack_); |
| 865 entry_stack_ = item; | 879 entry_stack_ = item; |
| 866 | 880 |
| 867 SetIsolateThreadLocals(this, data); | 881 SetIsolateThreadLocals(this, data); |
| 868 | 882 |
| 869 CHECK(PreInit()); | |
| 870 | |
| 871 // In case it's the first time some thread enters the isolate. | 883 // In case it's the first time some thread enters the isolate. |
| 872 set_thread_id(data->thread_id()); | 884 set_thread_id(data->thread_id()); |
| 873 } | 885 } |
| 874 | 886 |
| 875 | 887 |
| 876 void Isolate::Exit() { | 888 void Isolate::Exit() { |
| 877 ASSERT(entry_stack_ != NULL); | 889 ASSERT(entry_stack_ != NULL); |
| 878 ASSERT(entry_stack_->previous_thread_data == NULL || | 890 ASSERT(entry_stack_->previous_thread_data == NULL || |
| 879 entry_stack_->previous_thread_data->thread_id().Equals( | 891 entry_stack_->previous_thread_data->thread_id().Equals( |
| 880 ThreadId::Current())); | 892 ThreadId::Current())); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 905 | 917 |
| 906 #ifdef DEBUG | 918 #ifdef DEBUG |
| 907 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 919 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 908 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 920 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 909 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 921 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 910 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 922 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 911 #undef ISOLATE_FIELD_OFFSET | 923 #undef ISOLATE_FIELD_OFFSET |
| 912 #endif | 924 #endif |
| 913 | 925 |
| 914 } } // namespace v8::internal | 926 } } // namespace v8::internal |
| OLD | NEW |