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 946073003: Remove reinvented wheel for partial snapshot cache. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/serialize.h » ('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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 Isolate* saved_isolate = UncheckedCurrent(); 1750 Isolate* saved_isolate = UncheckedCurrent();
1751 SetIsolateThreadLocals(this, NULL); 1751 SetIsolateThreadLocals(this, NULL);
1752 1752
1753 Deinit(); 1753 Deinit();
1754 1754
1755 { 1755 {
1756 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); 1756 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer());
1757 thread_data_table_->RemoveAllThreads(this); 1757 thread_data_table_->RemoveAllThreads(this);
1758 } 1758 }
1759 1759
1760 if (serialize_partial_snapshot_cache_ != NULL) {
1761 delete[] serialize_partial_snapshot_cache_;
1762 serialize_partial_snapshot_cache_ = NULL;
1763 }
1764
1765 delete this; 1760 delete this;
1766 1761
1767 // Restore the previous current isolate. 1762 // Restore the previous current isolate.
1768 SetIsolateThreadLocals(saved_isolate, saved_data); 1763 SetIsolateThreadLocals(saved_isolate, saved_data);
1769 } 1764 }
1770 1765
1771 1766
1772 void Isolate::GlobalTearDown() { 1767 void Isolate::GlobalTearDown() {
1773 delete thread_data_table_; 1768 delete thread_data_table_;
1774 thread_data_table_ = NULL; 1769 thread_data_table_ = NULL;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 heap_.TearDown(); 1813 heap_.TearDown();
1819 logger_->TearDown(); 1814 logger_->TearDown();
1820 1815
1821 delete heap_profiler_; 1816 delete heap_profiler_;
1822 heap_profiler_ = NULL; 1817 heap_profiler_ = NULL;
1823 delete cpu_profiler_; 1818 delete cpu_profiler_;
1824 cpu_profiler_ = NULL; 1819 cpu_profiler_ = NULL;
1825 } 1820 }
1826 1821
1827 1822
1828 void Isolate::PushToPartialSnapshotCache(Object* obj) {
1829 int length = serialize_partial_snapshot_cache_length();
1830 int capacity = serialize_partial_snapshot_cache_capacity();
1831
1832 if (length >= capacity) {
1833 int new_capacity = static_cast<int>((capacity + 10) * 1.2);
1834 Object** new_array = new Object*[new_capacity];
1835 for (int i = 0; i < length; i++) {
1836 new_array[i] = serialize_partial_snapshot_cache()[i];
1837 }
1838 if (capacity != 0) delete[] serialize_partial_snapshot_cache();
1839 set_serialize_partial_snapshot_cache(new_array);
1840 set_serialize_partial_snapshot_cache_capacity(new_capacity);
1841 }
1842
1843 serialize_partial_snapshot_cache()[length] = obj;
1844 set_serialize_partial_snapshot_cache_length(length + 1);
1845 }
1846
1847
1848 void Isolate::SetIsolateThreadLocals(Isolate* isolate, 1823 void Isolate::SetIsolateThreadLocals(Isolate* isolate,
1849 PerIsolateThreadData* data) { 1824 PerIsolateThreadData* data) {
1850 base::Thread::SetThreadLocal(isolate_key_, isolate); 1825 base::Thread::SetThreadLocal(isolate_key_, isolate);
1851 base::Thread::SetThreadLocal(per_isolate_thread_data_key_, data); 1826 base::Thread::SetThreadLocal(per_isolate_thread_data_key_, data);
1852 } 1827 }
1853 1828
1854 1829
1855 Isolate::~Isolate() { 1830 Isolate::~Isolate() {
1856 TRACE_ISOLATE(destructor); 1831 TRACE_ISOLATE(destructor);
1857 1832
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 deoptimizer_data_ = new DeoptimizerData(memory_allocator_); 2056 deoptimizer_data_ = new DeoptimizerData(memory_allocator_);
2082 2057
2083 const bool create_heap_objects = (des == NULL); 2058 const bool create_heap_objects = (des == NULL);
2084 if (create_heap_objects && !heap_.CreateHeapObjects()) { 2059 if (create_heap_objects && !heap_.CreateHeapObjects()) {
2085 V8::FatalProcessOutOfMemory("heap object creation"); 2060 V8::FatalProcessOutOfMemory("heap object creation");
2086 return false; 2061 return false;
2087 } 2062 }
2088 2063
2089 if (create_heap_objects) { 2064 if (create_heap_objects) {
2090 // Terminate the cache array with the sentinel so we can iterate. 2065 // Terminate the cache array with the sentinel so we can iterate.
2091 PushToPartialSnapshotCache(heap_.undefined_value()); 2066 partial_snapshot_cache_.Add(heap_.undefined_value());
2092 } 2067 }
2093 2068
2094 InitializeThreadLocal(); 2069 InitializeThreadLocal();
2095 2070
2096 bootstrapper_->Initialize(create_heap_objects); 2071 bootstrapper_->Initialize(create_heap_objects);
2097 builtins_.SetUp(this, create_heap_objects); 2072 builtins_.SetUp(this, create_heap_objects);
2098 2073
2099 if (FLAG_log_internal_timer_events) { 2074 if (FLAG_log_internal_timer_events) {
2100 set_event_logger(Logger::DefaultEventLoggerSentinel); 2075 set_event_logger(Logger::DefaultEventLoggerSentinel);
2101 } 2076 }
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 if (prev_ && prev_->Intercept(flag)) return true; 2610 if (prev_ && prev_->Intercept(flag)) return true;
2636 // Then check whether this scope intercepts. 2611 // Then check whether this scope intercepts.
2637 if ((flag & intercept_mask_)) { 2612 if ((flag & intercept_mask_)) {
2638 intercepted_flags_ |= flag; 2613 intercepted_flags_ |= flag;
2639 return true; 2614 return true;
2640 } 2615 }
2641 return false; 2616 return false;
2642 } 2617 }
2643 2618
2644 } } // namespace v8::internal 2619 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698