OLD | NEW |
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 6862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6873 | 6873 |
6874 void Isolate::CollectAllGarbage(const char* gc_reason) { | 6874 void Isolate::CollectAllGarbage(const char* gc_reason) { |
6875 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); | 6875 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); |
6876 if (heap->incremental_marking()->IsStopped()) { | 6876 if (heap->incremental_marking()->IsStopped()) { |
6877 if (heap->incremental_marking()->CanBeActivated()) { | 6877 if (heap->incremental_marking()->CanBeActivated()) { |
6878 heap->StartIncrementalMarking( | 6878 heap->StartIncrementalMarking( |
6879 i::Heap::kNoGCFlags, | 6879 i::Heap::kNoGCFlags, |
6880 kGCCallbackFlagSynchronousPhantomCallbackProcessing, gc_reason); | 6880 kGCCallbackFlagSynchronousPhantomCallbackProcessing, gc_reason); |
6881 } else { | 6881 } else { |
6882 heap->CollectAllGarbage( | 6882 heap->CollectAllGarbage( |
6883 i::Heap::kNoGCFlags, gc_reason, | 6883 gc_reason, i::Heap::kNoGCFlags, |
6884 kGCCallbackFlagSynchronousPhantomCallbackProcessing); | 6884 kGCCallbackFlagSynchronousPhantomCallbackProcessing); |
6885 } | 6885 } |
6886 } else { | 6886 } else { |
6887 // Incremental marking is turned on an has already been started. | 6887 // Incremental marking is turned on an has already been started. |
6888 | 6888 |
6889 // TODO(mlippautz): Compute the time slice for incremental marking based on | 6889 // TODO(mlippautz): Compute the time slice for incremental marking based on |
6890 // memory pressure. | 6890 // memory pressure. |
6891 double deadline = heap->MonotonicallyIncreasingTimeInMs() + | 6891 double deadline = heap->MonotonicallyIncreasingTimeInMs() + |
6892 i::FLAG_external_allocation_limit_incremental_time; | 6892 i::FLAG_external_allocation_limit_incremental_time; |
6893 heap->AdvanceIncrementalMarking( | 6893 heap->AdvanceIncrementalMarking( |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7064 void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { | 7064 void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { |
7065 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7065 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7066 isolate->RequestInterrupt(callback, data); | 7066 isolate->RequestInterrupt(callback, data); |
7067 } | 7067 } |
7068 | 7068 |
7069 | 7069 |
7070 void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) { | 7070 void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) { |
7071 CHECK(i::FLAG_expose_gc); | 7071 CHECK(i::FLAG_expose_gc); |
7072 if (type == kMinorGarbageCollection) { | 7072 if (type == kMinorGarbageCollection) { |
7073 reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage( | 7073 reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage( |
7074 i::NEW_SPACE, "Isolate::RequestGarbageCollection", | 7074 i::NEW_SPACE, "Isolate::RequestGarbageCollection", i::Heap::kNoGCFlags, |
7075 kGCCallbackFlagForced); | 7075 kGCCallbackFlagForced); |
7076 } else { | 7076 } else { |
7077 DCHECK_EQ(kFullGarbageCollection, type); | 7077 DCHECK_EQ(kFullGarbageCollection, type); |
7078 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( | 7078 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( |
7079 i::Heap::kAbortIncrementalMarkingMask, | 7079 "Isolate::RequestGarbageCollection", |
7080 "Isolate::RequestGarbageCollection", kGCCallbackFlagForced); | 7080 i::Heap::kAbortIncrementalMarkingMask, kGCCallbackFlagForced); |
7081 } | 7081 } |
7082 } | 7082 } |
7083 | 7083 |
7084 | 7084 |
7085 Isolate* Isolate::GetCurrent() { | 7085 Isolate* Isolate::GetCurrent() { |
7086 i::Isolate* isolate = i::Isolate::Current(); | 7086 i::Isolate* isolate = i::Isolate::Current(); |
7087 return reinterpret_cast<Isolate*>(isolate); | 7087 return reinterpret_cast<Isolate*>(isolate); |
7088 } | 7088 } |
7089 | 7089 |
7090 | 7090 |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8408 Address callback_address = | 8408 Address callback_address = |
8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8410 VMState<EXTERNAL> state(isolate); | 8410 VMState<EXTERNAL> state(isolate); |
8411 ExternalCallbackScope call_scope(isolate, callback_address); | 8411 ExternalCallbackScope call_scope(isolate, callback_address); |
8412 callback(info); | 8412 callback(info); |
8413 } | 8413 } |
8414 | 8414 |
8415 | 8415 |
8416 } // namespace internal | 8416 } // namespace internal |
8417 } // namespace v8 | 8417 } // namespace v8 |
OLD | NEW |