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

Side by Side Diff: src/isolate.cc

Issue 1862653002: Move MemoryAllocator and CodeRange into Heap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « src/isolate.h ('k') | src/regexp/jsregexp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 1791
1792 Isolate::Isolate(bool enable_serializer) 1792 Isolate::Isolate(bool enable_serializer)
1793 : embedder_data_(), 1793 : embedder_data_(),
1794 entry_stack_(NULL), 1794 entry_stack_(NULL),
1795 stack_trace_nesting_level_(0), 1795 stack_trace_nesting_level_(0),
1796 incomplete_message_(NULL), 1796 incomplete_message_(NULL),
1797 bootstrapper_(NULL), 1797 bootstrapper_(NULL),
1798 runtime_profiler_(NULL), 1798 runtime_profiler_(NULL),
1799 compilation_cache_(NULL), 1799 compilation_cache_(NULL),
1800 counters_(NULL), 1800 counters_(NULL),
1801 code_range_(NULL),
1802 logger_(NULL), 1801 logger_(NULL),
1803 stats_table_(NULL), 1802 stats_table_(NULL),
1804 stub_cache_(NULL), 1803 stub_cache_(NULL),
1805 code_aging_helper_(NULL), 1804 code_aging_helper_(NULL),
1806 deoptimizer_data_(NULL), 1805 deoptimizer_data_(NULL),
1807 deoptimizer_lazy_throw_(false), 1806 deoptimizer_lazy_throw_(false),
1808 materialized_object_store_(NULL), 1807 materialized_object_store_(NULL),
1809 capture_stack_trace_for_uncaught_exceptions_(false), 1808 capture_stack_trace_for_uncaught_exceptions_(false),
1810 stack_trace_for_uncaught_exceptions_frame_limit_(0), 1809 stack_trace_for_uncaught_exceptions_frame_limit_(0),
1811 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), 1810 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
1812 memory_allocator_(NULL),
1813 keyed_lookup_cache_(NULL), 1811 keyed_lookup_cache_(NULL),
1814 context_slot_cache_(NULL), 1812 context_slot_cache_(NULL),
1815 descriptor_lookup_cache_(NULL), 1813 descriptor_lookup_cache_(NULL),
1816 handle_scope_implementer_(NULL), 1814 handle_scope_implementer_(NULL),
1817 unicode_cache_(NULL), 1815 unicode_cache_(NULL),
1818 runtime_zone_(&allocator_), 1816 runtime_zone_(&allocator_),
1819 interface_descriptor_zone_(&allocator_), 1817 interface_descriptor_zone_(&allocator_),
1820 inner_pointer_to_code_cache_(NULL), 1818 inner_pointer_to_code_cache_(NULL),
1821 global_handles_(NULL), 1819 global_handles_(NULL),
1822 eternal_handles_(NULL), 1820 eternal_handles_(NULL),
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 delete compilation_cache_; 2058 delete compilation_cache_;
2061 compilation_cache_ = NULL; 2059 compilation_cache_ = NULL;
2062 delete bootstrapper_; 2060 delete bootstrapper_;
2063 bootstrapper_ = NULL; 2061 bootstrapper_ = NULL;
2064 delete inner_pointer_to_code_cache_; 2062 delete inner_pointer_to_code_cache_;
2065 inner_pointer_to_code_cache_ = NULL; 2063 inner_pointer_to_code_cache_ = NULL;
2066 2064
2067 delete thread_manager_; 2065 delete thread_manager_;
2068 thread_manager_ = NULL; 2066 thread_manager_ = NULL;
2069 2067
2070 delete memory_allocator_;
2071 memory_allocator_ = NULL;
2072 delete code_range_;
2073 code_range_ = NULL;
2074 delete global_handles_; 2068 delete global_handles_;
2075 global_handles_ = NULL; 2069 global_handles_ = NULL;
2076 delete eternal_handles_; 2070 delete eternal_handles_;
2077 eternal_handles_ = NULL; 2071 eternal_handles_ = NULL;
2078 2072
2079 delete string_stream_debug_object_cache_; 2073 delete string_stream_debug_object_cache_;
2080 string_stream_debug_object_cache_ = NULL; 2074 string_stream_debug_object_cache_ = NULL;
2081 2075
2082 delete random_number_generator_; 2076 delete random_number_generator_;
2083 random_number_generator_ = NULL; 2077 random_number_generator_ = NULL;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 // When function entry hooking is in effect, we have to create the code 2151 // When function entry hooking is in effect, we have to create the code
2158 // stubs from scratch to get entry hooks, rather than loading the previously 2152 // stubs from scratch to get entry hooks, rather than loading the previously
2159 // generated stubs from disk. 2153 // generated stubs from disk.
2160 // If this assert fires, the initialization path has regressed. 2154 // If this assert fires, the initialization path has regressed.
2161 DCHECK(des == NULL); 2155 DCHECK(des == NULL);
2162 } 2156 }
2163 2157
2164 // The initialization process does not handle memory exhaustion. 2158 // The initialization process does not handle memory exhaustion.
2165 AlwaysAllocateScope always_allocate(this); 2159 AlwaysAllocateScope always_allocate(this);
2166 2160
2167 memory_allocator_ = new MemoryAllocator(this);
2168 code_range_ = new CodeRange(this);
2169
2170 // Safe after setting Heap::isolate_, and initializing StackGuard 2161 // Safe after setting Heap::isolate_, and initializing StackGuard
2171 heap_.SetStackLimits(); 2162 heap_.SetStackLimits();
2172 2163
2173 #define ASSIGN_ELEMENT(CamelName, hacker_name) \ 2164 #define ASSIGN_ELEMENT(CamelName, hacker_name) \
2174 isolate_addresses_[Isolate::k##CamelName##Address] = \ 2165 isolate_addresses_[Isolate::k##CamelName##Address] = \
2175 reinterpret_cast<Address>(hacker_name##_address()); 2166 reinterpret_cast<Address>(hacker_name##_address());
2176 FOR_EACH_ISOLATE_ADDRESS_NAME(ASSIGN_ELEMENT) 2167 FOR_EACH_ISOLATE_ADDRESS_NAME(ASSIGN_ELEMENT)
2177 #undef ASSIGN_ELEMENT 2168 #undef ASSIGN_ELEMENT
2178 2169
2179 compilation_cache_ = new CompilationCache(this); 2170 compilation_cache_ = new CompilationCache(this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 stack_guard_.InitThread(lock); 2209 stack_guard_.InitThread(lock);
2219 } 2210 }
2220 2211
2221 // SetUp the object heap. 2212 // SetUp the object heap.
2222 DCHECK(!heap_.HasBeenSetUp()); 2213 DCHECK(!heap_.HasBeenSetUp());
2223 if (!heap_.SetUp()) { 2214 if (!heap_.SetUp()) {
2224 V8::FatalProcessOutOfMemory("heap setup"); 2215 V8::FatalProcessOutOfMemory("heap setup");
2225 return false; 2216 return false;
2226 } 2217 }
2227 2218
2228 deoptimizer_data_ = new DeoptimizerData(memory_allocator_); 2219 deoptimizer_data_ = new DeoptimizerData(heap()->memory_allocator());
2229 2220
2230 const bool create_heap_objects = (des == NULL); 2221 const bool create_heap_objects = (des == NULL);
2231 if (create_heap_objects && !heap_.CreateHeapObjects()) { 2222 if (create_heap_objects && !heap_.CreateHeapObjects()) {
2232 V8::FatalProcessOutOfMemory("heap object creation"); 2223 V8::FatalProcessOutOfMemory("heap object creation");
2233 return false; 2224 return false;
2234 } 2225 }
2235 2226
2236 if (create_heap_objects) { 2227 if (create_heap_objects) {
2237 // Terminate the partial snapshot cache so we can iterate. 2228 // Terminate the partial snapshot cache so we can iterate.
2238 partial_snapshot_cache_.Add(heap_.undefined_value()); 2229 partial_snapshot_cache_.Add(heap_.undefined_value());
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 // Then check whether this scope intercepts. 2980 // Then check whether this scope intercepts.
2990 if ((flag & intercept_mask_)) { 2981 if ((flag & intercept_mask_)) {
2991 intercepted_flags_ |= flag; 2982 intercepted_flags_ |= flag;
2992 return true; 2983 return true;
2993 } 2984 }
2994 return false; 2985 return false;
2995 } 2986 }
2996 2987
2997 } // namespace internal 2988 } // namespace internal
2998 } // namespace v8 2989 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/regexp/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698