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

Side by Side Diff: src/api.cc

Issue 1374203002: [heap] No leakage of incremental-marking.h outside of heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « include/v8.h ('k') | src/heap/heap.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 "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 6800 matching lines...) Expand 10 before | Expand all | Expand 10 after
6811 bool fits_into_int32_t = (value & (1 << 31)) == 0; 6811 bool fits_into_int32_t = (value & (1 << 31)) == 0;
6812 if (fits_into_int32_t) { 6812 if (fits_into_int32_t) {
6813 return Integer::New(isolate, static_cast<int32_t>(value)); 6813 return Integer::New(isolate, static_cast<int32_t>(value));
6814 } 6814 }
6815 ENTER_V8(internal_isolate); 6815 ENTER_V8(internal_isolate);
6816 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); 6816 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
6817 return Utils::IntegerToLocal(result); 6817 return Utils::IntegerToLocal(result);
6818 } 6818 }
6819 6819
6820 6820
6821 void Isolate::CollectAllGarbage(const char* gc_reason) { 6821 void Isolate::ReportExternalAllocationLimitReached() {
6822 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); 6822 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
6823 DCHECK_EQ(heap->gc_state(), i::Heap::NOT_IN_GC); 6823 DCHECK_EQ(heap->gc_state(), i::Heap::NOT_IN_GC);
6824 if (heap->incremental_marking()->IsStopped()) { 6824 heap->ReportExternalMemoryPressure(
6825 if (heap->incremental_marking()->CanBeActivated()) { 6825 "external memory allocation limit reached.");
6826 heap->StartIncrementalMarking(
6827 i::Heap::kNoGCFlags,
6828 kGCCallbackFlagSynchronousPhantomCallbackProcessing, gc_reason);
6829 } else {
6830 heap->CollectAllGarbage(
6831 i::Heap::kNoGCFlags, gc_reason,
6832 kGCCallbackFlagSynchronousPhantomCallbackProcessing);
6833 }
6834 } else {
6835 // Incremental marking is turned on an has already been started.
6836
6837 // TODO(mlippautz): Compute the time slice for incremental marking based on
6838 // memory pressure.
6839 double deadline = heap->MonotonicallyIncreasingTimeInMs() +
6840 i::FLAG_external_allocation_limit_incremental_time;
6841 heap->AdvanceIncrementalMarking(
6842 0, deadline, i::IncrementalMarking::StepActions(
6843 i::IncrementalMarking::GC_VIA_STACK_GUARD,
6844 i::IncrementalMarking::FORCE_MARKING,
6845 i::IncrementalMarking::FORCE_COMPLETION));
6846 }
6847 } 6826 }
6848 6827
6849 6828
6850 HeapProfiler* Isolate::GetHeapProfiler() { 6829 HeapProfiler* Isolate::GetHeapProfiler() {
6851 i::HeapProfiler* heap_profiler = 6830 i::HeapProfiler* heap_profiler =
6852 reinterpret_cast<i::Isolate*>(this)->heap_profiler(); 6831 reinterpret_cast<i::Isolate*>(this)->heap_profiler();
6853 return reinterpret_cast<HeapProfiler*>(heap_profiler); 6832 return reinterpret_cast<HeapProfiler*>(heap_profiler);
6854 } 6833 }
6855 6834
6856 6835
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
8359 Address callback_address = 8338 Address callback_address =
8360 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8339 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8361 VMState<EXTERNAL> state(isolate); 8340 VMState<EXTERNAL> state(isolate);
8362 ExternalCallbackScope call_scope(isolate, callback_address); 8341 ExternalCallbackScope call_scope(isolate, callback_address);
8363 callback(info); 8342 callback(info);
8364 } 8343 }
8365 8344
8366 8345
8367 } // namespace internal 8346 } // namespace internal
8368 } // namespace v8 8347 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698