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

Side by Side Diff: src/isolate.cc

Issue 2335343007: Pool implementation for zone segments (Closed)
Patch Set: Fixed Regexp benchmark regression Created 4 years, 2 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 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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 } while (false) 1926 } while (false)
1927 #else 1927 #else
1928 #define TRACE_ISOLATE(tag) 1928 #define TRACE_ISOLATE(tag)
1929 #endif 1929 #endif
1930 1930
1931 class VerboseAccountingAllocator : public AccountingAllocator { 1931 class VerboseAccountingAllocator : public AccountingAllocator {
1932 public: 1932 public:
1933 VerboseAccountingAllocator(Heap* heap, size_t sample_bytes) 1933 VerboseAccountingAllocator(Heap* heap, size_t sample_bytes)
1934 : heap_(heap), last_memory_usage_(0), sample_bytes_(sample_bytes) {} 1934 : heap_(heap), last_memory_usage_(0), sample_bytes_(sample_bytes) {}
1935 1935
1936 v8::internal::Segment* AllocateSegment(size_t size) override { 1936 v8::internal::Segment* GetSegment(size_t size) override {
1937 v8::internal::Segment* memory = AccountingAllocator::AllocateSegment(size); 1937 v8::internal::Segment* memory = AccountingAllocator::GetSegment(size);
1938 if (memory) { 1938 if (memory) {
1939 size_t current = GetCurrentMemoryUsage(); 1939 size_t current = GetCurrentMemoryUsage();
1940 if (last_memory_usage_.Value() + sample_bytes_ < current) { 1940 if (last_memory_usage_.Value() + sample_bytes_ < current) {
1941 PrintJSON(current); 1941 PrintJSON(current);
1942 last_memory_usage_.SetValue(current); 1942 last_memory_usage_.SetValue(current);
1943 } 1943 }
1944 } 1944 }
1945 return memory; 1945 return memory;
1946 } 1946 }
1947 1947
1948 void FreeSegment(v8::internal::Segment* memory) override { 1948 void ReturnSegment(v8::internal::Segment* memory) override {
1949 AccountingAllocator::FreeSegment(memory); 1949 AccountingAllocator::ReturnSegment(memory);
1950 size_t current = GetCurrentMemoryUsage(); 1950 size_t current = GetCurrentMemoryUsage();
1951 if (current + sample_bytes_ < last_memory_usage_.Value()) { 1951 if (current + sample_bytes_ < last_memory_usage_.Value()) {
1952 PrintJSON(current); 1952 PrintJSON(current);
1953 last_memory_usage_.SetValue(current); 1953 last_memory_usage_.SetValue(current);
1954 } 1954 }
1955 } 1955 }
1956 1956
1957 private: 1957 private:
1958 void PrintJSON(size_t sample) { 1958 void PrintJSON(size_t sample) {
1959 // Note: Neither isolate, nor heap is locked, so be careful with accesses 1959 // Note: Neither isolate, nor heap is locked, so be careful with accesses
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 stack_trace_for_uncaught_exceptions_frame_limit_(0), 1995 stack_trace_for_uncaught_exceptions_frame_limit_(0),
1996 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), 1996 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
1997 keyed_lookup_cache_(NULL), 1997 keyed_lookup_cache_(NULL),
1998 context_slot_cache_(NULL), 1998 context_slot_cache_(NULL),
1999 descriptor_lookup_cache_(NULL), 1999 descriptor_lookup_cache_(NULL),
2000 handle_scope_implementer_(NULL), 2000 handle_scope_implementer_(NULL),
2001 unicode_cache_(NULL), 2001 unicode_cache_(NULL),
2002 allocator_(FLAG_trace_gc_object_stats 2002 allocator_(FLAG_trace_gc_object_stats
2003 ? new VerboseAccountingAllocator(&heap_, 256 * KB) 2003 ? new VerboseAccountingAllocator(&heap_, 256 * KB)
2004 : new AccountingAllocator()), 2004 : new AccountingAllocator()),
2005 runtime_zone_(new Zone(allocator_)),
2006 inner_pointer_to_code_cache_(NULL), 2005 inner_pointer_to_code_cache_(NULL),
2007 global_handles_(NULL), 2006 global_handles_(NULL),
2008 eternal_handles_(NULL), 2007 eternal_handles_(NULL),
2009 thread_manager_(NULL), 2008 thread_manager_(NULL),
2010 has_installed_extensions_(false), 2009 has_installed_extensions_(false),
2011 regexp_stack_(NULL), 2010 regexp_stack_(NULL),
2012 date_cache_(NULL), 2011 date_cache_(NULL),
2013 call_descriptor_data_(NULL), 2012 call_descriptor_data_(NULL),
2014 // TODO(bmeurer) Initialized lazily because it depends on flags; can 2013 // TODO(bmeurer) Initialized lazily because it depends on flags; can
2015 // be fixed once the default isolate cleanup is done. 2014 // be fixed once the default isolate cleanup is done.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 void Isolate::SetIsolateThreadLocals(Isolate* isolate, 2189 void Isolate::SetIsolateThreadLocals(Isolate* isolate,
2191 PerIsolateThreadData* data) { 2190 PerIsolateThreadData* data) {
2192 base::Thread::SetThreadLocal(isolate_key_, isolate); 2191 base::Thread::SetThreadLocal(isolate_key_, isolate);
2193 base::Thread::SetThreadLocal(per_isolate_thread_data_key_, data); 2192 base::Thread::SetThreadLocal(per_isolate_thread_data_key_, data);
2194 } 2193 }
2195 2194
2196 2195
2197 Isolate::~Isolate() { 2196 Isolate::~Isolate() {
2198 TRACE_ISOLATE(destructor); 2197 TRACE_ISOLATE(destructor);
2199 2198
2200 // Has to be called while counters_ are still alive
2201 runtime_zone_->DeleteKeptSegment();
2202
2203 // The entry stack must be empty when we get here. 2199 // The entry stack must be empty when we get here.
2204 DCHECK(entry_stack_ == NULL || entry_stack_->previous_item == NULL); 2200 DCHECK(entry_stack_ == NULL || entry_stack_->previous_item == NULL);
2205 2201
2206 delete entry_stack_; 2202 delete entry_stack_;
2207 entry_stack_ = NULL; 2203 entry_stack_ = NULL;
2208 2204
2209 delete unicode_cache_; 2205 delete unicode_cache_;
2210 unicode_cache_ = NULL; 2206 unicode_cache_ = NULL;
2211 2207
2212 delete date_cache_; 2208 delete date_cache_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 2265
2270 delete random_number_generator_; 2266 delete random_number_generator_;
2271 random_number_generator_ = NULL; 2267 random_number_generator_ = NULL;
2272 2268
2273 delete debug_; 2269 delete debug_;
2274 debug_ = NULL; 2270 debug_ = NULL;
2275 2271
2276 delete cancelable_task_manager_; 2272 delete cancelable_task_manager_;
2277 cancelable_task_manager_ = nullptr; 2273 cancelable_task_manager_ = nullptr;
2278 2274
2279 delete runtime_zone_;
2280 runtime_zone_ = nullptr;
2281
2282 delete allocator_; 2275 delete allocator_;
2283 allocator_ = nullptr; 2276 allocator_ = nullptr;
2284 2277
2285 #if USE_SIMULATOR 2278 #if USE_SIMULATOR
2286 Simulator::TearDown(simulator_i_cache_, simulator_redirection_); 2279 Simulator::TearDown(simulator_i_cache_, simulator_redirection_);
2287 simulator_i_cache_ = nullptr; 2280 simulator_i_cache_ = nullptr;
2288 simulator_redirection_ = nullptr; 2281 simulator_redirection_ = nullptr;
2289 #endif 2282 #endif
2290 } 2283 }
2291 2284
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 // Then check whether this scope intercepts. 3310 // Then check whether this scope intercepts.
3318 if ((flag & intercept_mask_)) { 3311 if ((flag & intercept_mask_)) {
3319 intercepted_flags_ |= flag; 3312 intercepted_flags_ |= flag;
3320 return true; 3313 return true;
3321 } 3314 }
3322 return false; 3315 return false;
3323 } 3316 }
3324 3317
3325 } // namespace internal 3318 } // namespace internal
3326 } // namespace v8 3319 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/list.h » ('j') | src/runtime/runtime-regexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698