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

Side by Side Diff: src/heap/heap.cc

Issue 1344823002: Version 4.6.85.17 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
Patch Set: Created 5 years, 3 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/api.cc ('k') | no next file » | 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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 1840
1841 1841
1842 void Heap::RegisterNewArrayBuffer(bool in_new_space, void* data, 1842 void Heap::RegisterNewArrayBuffer(bool in_new_space, void* data,
1843 size_t length) { 1843 size_t length) {
1844 if (!data) return; 1844 if (!data) return;
1845 RegisterNewArrayBufferHelper(live_array_buffers_, data, length); 1845 RegisterNewArrayBufferHelper(live_array_buffers_, data, length);
1846 if (in_new_space) { 1846 if (in_new_space) {
1847 RegisterNewArrayBufferHelper(live_array_buffers_for_scavenge_, data, 1847 RegisterNewArrayBufferHelper(live_array_buffers_for_scavenge_, data,
1848 length); 1848 length);
1849 } 1849 }
1850
1851 // We may go over the limit of externally allocated memory here. We call the
1852 // api function to trigger a GC in this case.
1850 reinterpret_cast<v8::Isolate*>(isolate_) 1853 reinterpret_cast<v8::Isolate*>(isolate_)
1851 ->AdjustAmountOfExternalAllocatedMemory(length); 1854 ->AdjustAmountOfExternalAllocatedMemory(length);
1852 } 1855 }
1853 1856
1854 1857
1855 void Heap::UnregisterArrayBuffer(bool in_new_space, void* data) { 1858 void Heap::UnregisterArrayBuffer(bool in_new_space, void* data) {
1856 if (!data) return; 1859 if (!data) return;
1857 UnregisterArrayBufferHelper(live_array_buffers_, 1860 UnregisterArrayBufferHelper(live_array_buffers_,
1858 not_yet_discovered_array_buffers_, data); 1861 not_yet_discovered_array_buffers_, data);
1859 if (in_new_space) { 1862 if (in_new_space) {
(...skipping 22 matching lines...) Expand all
1882 } 1885 }
1883 } else { 1886 } else {
1884 for (auto& buffer : not_yet_discovered_array_buffers_) { 1887 for (auto& buffer : not_yet_discovered_array_buffers_) {
1885 // Scavenge can't happend during evacuation, so we only need to update 1888 // Scavenge can't happend during evacuation, so we only need to update
1886 // live_array_buffers_for_scavenge_. 1889 // live_array_buffers_for_scavenge_.
1887 // not_yet_discovered_array_buffers_for_scanvenge_ will be reset before 1890 // not_yet_discovered_array_buffers_for_scanvenge_ will be reset before
1888 // the next scavenge run in PrepareArrayBufferDiscoveryInNewSpace. 1891 // the next scavenge run in PrepareArrayBufferDiscoveryInNewSpace.
1889 live_array_buffers_for_scavenge_.erase(buffer.first); 1892 live_array_buffers_for_scavenge_.erase(buffer.first);
1890 } 1893 }
1891 } 1894 }
1892 size_t freed_memory = FreeDeadArrayBuffersHelper( 1895
1896 // Do not call through the api as this code is triggered while doing a GC.
1897 amount_of_external_allocated_memory_ -= FreeDeadArrayBuffersHelper(
1893 isolate_, 1898 isolate_,
1894 from_scavenge ? live_array_buffers_for_scavenge_ : live_array_buffers_, 1899 from_scavenge ? live_array_buffers_for_scavenge_ : live_array_buffers_,
1895 from_scavenge ? not_yet_discovered_array_buffers_for_scavenge_ 1900 from_scavenge ? not_yet_discovered_array_buffers_for_scavenge_
1896 : not_yet_discovered_array_buffers_); 1901 : not_yet_discovered_array_buffers_);
1897 if (freed_memory) {
1898 reinterpret_cast<v8::Isolate*>(isolate_)
1899 ->AdjustAmountOfExternalAllocatedMemory(
1900 -static_cast<int64_t>(freed_memory));
1901 }
1902 } 1902 }
1903 1903
1904 1904
1905 void Heap::TearDownArrayBuffers() { 1905 void Heap::TearDownArrayBuffers() {
1906 TearDownArrayBuffersHelper(isolate_, live_array_buffers_, 1906 TearDownArrayBuffersHelper(isolate_, live_array_buffers_,
1907 not_yet_discovered_array_buffers_); 1907 not_yet_discovered_array_buffers_);
1908 } 1908 }
1909 1909
1910 1910
1911 void Heap::PrepareArrayBufferDiscoveryInNewSpace() { 1911 void Heap::PrepareArrayBufferDiscoveryInNewSpace() {
(...skipping 4977 matching lines...) Expand 10 before | Expand all | Expand 10 after
6889 *object_type = "CODE_TYPE"; \ 6889 *object_type = "CODE_TYPE"; \
6890 *object_sub_type = "CODE_AGE/" #name; \ 6890 *object_sub_type = "CODE_AGE/" #name; \
6891 return true; 6891 return true;
6892 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6892 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6893 #undef COMPARE_AND_RETURN_NAME 6893 #undef COMPARE_AND_RETURN_NAME
6894 } 6894 }
6895 return false; 6895 return false;
6896 } 6896 }
6897 } // namespace internal 6897 } // namespace internal
6898 } // namespace v8 6898 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698