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

Side by Side Diff: src/isolate.cc

Issue 6670119: VM initialization refactoring. (Closed)
Patch Set: Created 9 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
OLDNEW
1 // Copyright 2006-2010 the V8 project authors. All rights reserved. 1 // Copyright 2006-2010 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 : state_(UNINITIALIZED), 407 : state_(UNINITIALIZED),
408 entry_stack_(NULL), 408 entry_stack_(NULL),
409 stack_trace_nesting_level_(0), 409 stack_trace_nesting_level_(0),
410 incomplete_message_(NULL), 410 incomplete_message_(NULL),
411 preallocated_memory_thread_(NULL), 411 preallocated_memory_thread_(NULL),
412 preallocated_message_space_(NULL), 412 preallocated_message_space_(NULL),
413 bootstrapper_(NULL), 413 bootstrapper_(NULL),
414 runtime_profiler_(NULL), 414 runtime_profiler_(NULL),
415 compilation_cache_(NULL), 415 compilation_cache_(NULL),
416 counters_(new Counters()), 416 counters_(new Counters()),
417 cpu_features_(NULL),
418 code_range_(NULL), 417 code_range_(NULL),
419 break_access_(OS::CreateMutex()), 418 break_access_(OS::CreateMutex()),
420 logger_(new Logger()), 419 logger_(new Logger()),
421 stats_table_(new StatsTable()), 420 stats_table_(new StatsTable()),
422 stub_cache_(NULL), 421 stub_cache_(NULL),
423 deoptimizer_data_(NULL), 422 deoptimizer_data_(NULL),
424 capture_stack_trace_for_uncaught_exceptions_(false), 423 capture_stack_trace_for_uncaught_exceptions_(false),
425 stack_trace_for_uncaught_exceptions_frame_limit_(0), 424 stack_trace_for_uncaught_exceptions_frame_limit_(0),
426 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), 425 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
427 transcendental_cache_(NULL), 426 transcendental_cache_(NULL),
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 delete stub_cache_; 585 delete stub_cache_;
587 stub_cache_ = NULL; 586 stub_cache_ = NULL;
588 delete stats_table_; 587 delete stats_table_;
589 stats_table_ = NULL; 588 stats_table_ = NULL;
590 589
591 delete logger_; 590 delete logger_;
592 logger_ = NULL; 591 logger_ = NULL;
593 592
594 delete counters_; 593 delete counters_;
595 counters_ = NULL; 594 counters_ = NULL;
596 delete cpu_features_;
597 cpu_features_ = NULL;
598 595
599 delete handle_scope_implementer_; 596 delete handle_scope_implementer_;
600 handle_scope_implementer_ = NULL; 597 handle_scope_implementer_ = NULL;
601 delete break_access_; 598 delete break_access_;
602 break_access_ = NULL; 599 break_access_ = NULL;
603 600
604 delete compilation_cache_; 601 delete compilation_cache_;
605 compilation_cache_ = NULL; 602 compilation_cache_ = NULL;
606 delete bootstrapper_; 603 delete bootstrapper_;
607 bootstrapper_ = NULL; 604 bootstrapper_ = NULL;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 compilation_cache_ = new CompilationCache(this); 670 compilation_cache_ = new CompilationCache(this);
674 transcendental_cache_ = new TranscendentalCache(); 671 transcendental_cache_ = new TranscendentalCache();
675 keyed_lookup_cache_ = new KeyedLookupCache(); 672 keyed_lookup_cache_ = new KeyedLookupCache();
676 context_slot_cache_ = new ContextSlotCache(); 673 context_slot_cache_ = new ContextSlotCache();
677 descriptor_lookup_cache_ = new DescriptorLookupCache(); 674 descriptor_lookup_cache_ = new DescriptorLookupCache();
678 scanner_constants_ = new ScannerConstants(); 675 scanner_constants_ = new ScannerConstants();
679 pc_to_code_cache_ = new PcToCodeCache(this); 676 pc_to_code_cache_ = new PcToCodeCache(this);
680 write_input_buffer_ = new StringInputBuffer(); 677 write_input_buffer_ = new StringInputBuffer();
681 global_handles_ = new GlobalHandles(this); 678 global_handles_ = new GlobalHandles(this);
682 bootstrapper_ = new Bootstrapper(); 679 bootstrapper_ = new Bootstrapper();
683 cpu_features_ = new CpuFeatures();
684 handle_scope_implementer_ = new HandleScopeImplementer(); 680 handle_scope_implementer_ = new HandleScopeImplementer();
685 stub_cache_ = new StubCache(this); 681 stub_cache_ = new StubCache(this);
686 ast_sentinels_ = new AstSentinels(); 682 ast_sentinels_ = new AstSentinels();
687 regexp_stack_ = new RegExpStack(); 683 regexp_stack_ = new RegExpStack();
688 regexp_stack_->isolate_ = this; 684 regexp_stack_->isolate_ = this;
689 685
690 #ifdef ENABLE_LOGGING_AND_PROFILING 686 #ifdef ENABLE_LOGGING_AND_PROFILING
691 producer_heap_profile_ = new ProducerHeapProfile(); 687 producer_heap_profile_ = new ProducerHeapProfile();
692 producer_heap_profile_->isolate_ = this; 688 producer_heap_profile_->isolate_ = this;
693 #endif 689 #endif
(...skipping 24 matching lines...) Expand all
718 #endif 714 #endif
719 715
720 if (state_ == UNINITIALIZED && !PreInit()) return false; 716 if (state_ == UNINITIALIZED && !PreInit()) return false;
721 717
722 // Enable logging before setting up the heap 718 // Enable logging before setting up the heap
723 logger_->Setup(); 719 logger_->Setup();
724 720
725 CpuProfiler::Setup(); 721 CpuProfiler::Setup();
726 HeapProfiler::Setup(); 722 HeapProfiler::Setup();
727 723
728 // Setup the platform OS support.
729 OS::Setup();
730
731 // Initialize other runtime facilities 724 // Initialize other runtime facilities
732 #if defined(USE_SIMULATOR) 725 #if defined(USE_SIMULATOR)
733 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) 726 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
734 Simulator::Initialize(); 727 Simulator::Initialize();
735 #endif 728 #endif
736 #endif 729 #endif
737 730
738 { // NOLINT 731 { // NOLINT
739 // Ensure that the thread has a valid stack guard. The v8::Locker object 732 // Ensure that the thread has a valid stack guard. The v8::Locker object
740 // will ensure this too, but we don't have to use lockers if we are only 733 // will ensure this too, but we don't have to use lockers if we are only
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 // If we are deserializing, read the state into the now-empty heap. 772 // If we are deserializing, read the state into the now-empty heap.
780 if (des != NULL) { 773 if (des != NULL) {
781 des->Deserialize(); 774 des->Deserialize();
782 stub_cache_->Clear(); 775 stub_cache_->Clear();
783 } 776 }
784 777
785 // Deserializing may put strange things in the root array's copy of the 778 // Deserializing may put strange things in the root array's copy of the
786 // stack guard. 779 // stack guard.
787 heap_.SetStackLimits(); 780 heap_.SetStackLimits();
788 781
789 // Setup the CPU support. Must be done after heap setup and after
790 // any deserialization because we have to have the initial heap
791 // objects in place for creating the code object used for probing.
792 CPU::Setup();
793
794 deoptimizer_data_ = new DeoptimizerData; 782 deoptimizer_data_ = new DeoptimizerData;
795 runtime_profiler_ = new RuntimeProfiler(this); 783 runtime_profiler_ = new RuntimeProfiler(this);
796 runtime_profiler_->Setup(); 784 runtime_profiler_->Setup();
797 785
798 // If we are deserializing, log non-function code objects and compiled 786 // If we are deserializing, log non-function code objects and compiled
799 // functions found in the snapshot. 787 // functions found in the snapshot.
800 if (des != NULL && FLAG_log_code) { 788 if (des != NULL && FLAG_log_code) {
801 HandleScope scope; 789 HandleScope scope;
802 LOG(this, LogCodeObjects()); 790 LOG(this, LogCodeObjects());
803 LOG(this, LogCompiledFunctions()); 791 LOG(this, LogCompiledFunctions());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 874
887 #ifdef DEBUG 875 #ifdef DEBUG
888 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 876 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
889 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 877 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
890 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 878 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
891 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 879 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
892 #undef ISOLATE_FIELD_OFFSET 880 #undef ISOLATE_FIELD_OFFSET
893 #endif 881 #endif
894 882
895 } } // namespace v8::internal 883 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698