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 6866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6877 if (fits_into_int32_t) { | 6877 if (fits_into_int32_t) { |
6878 return Integer::New(isolate, static_cast<int32_t>(value)); | 6878 return Integer::New(isolate, static_cast<int32_t>(value)); |
6879 } | 6879 } |
6880 ENTER_V8(internal_isolate); | 6880 ENTER_V8(internal_isolate); |
6881 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6881 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
6882 return Utils::IntegerToLocal(result); | 6882 return Utils::IntegerToLocal(result); |
6883 } | 6883 } |
6884 | 6884 |
6885 | 6885 |
6886 void Isolate::CollectAllGarbage(const char* gc_reason) { | 6886 void Isolate::CollectAllGarbage(const char* gc_reason) { |
6887 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( | 6887 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); |
6888 i::Heap::kNoGCFlags, gc_reason, v8::kGCCallbackFlagForced); | 6888 if (heap->incremental_marking()->IsStopped()) { |
| 6889 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced, |
| 6890 gc_reason); |
| 6891 } |
| 6892 // TODO(mlippautz): Compute the time slice for incremental marking based on |
| 6893 // memory pressure. |
| 6894 double deadline = heap->MonotonicallyIncreasingTimeInMs() + |
| 6895 i::FLAG_external_allocation_limit_incremental_time; |
| 6896 heap->AdvanceIncrementalMarking(0, deadline, |
| 6897 i::IncrementalMarking::StepActions( |
| 6898 i::IncrementalMarking::GC_VIA_STACK_GUARD, |
| 6899 i::IncrementalMarking::FORCE_MARKING, |
| 6900 i::IncrementalMarking::FORCE_COMPLETION)); |
6889 } | 6901 } |
6890 | 6902 |
6891 | 6903 |
6892 HeapProfiler* Isolate::GetHeapProfiler() { | 6904 HeapProfiler* Isolate::GetHeapProfiler() { |
6893 i::HeapProfiler* heap_profiler = | 6905 i::HeapProfiler* heap_profiler = |
6894 reinterpret_cast<i::Isolate*>(this)->heap_profiler(); | 6906 reinterpret_cast<i::Isolate*>(this)->heap_profiler(); |
6895 return reinterpret_cast<HeapProfiler*>(heap_profiler); | 6907 return reinterpret_cast<HeapProfiler*>(heap_profiler); |
6896 } | 6908 } |
6897 | 6909 |
6898 | 6910 |
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8403 Address callback_address = | 8415 Address callback_address = |
8404 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8416 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8405 VMState<EXTERNAL> state(isolate); | 8417 VMState<EXTERNAL> state(isolate); |
8406 ExternalCallbackScope call_scope(isolate, callback_address); | 8418 ExternalCallbackScope call_scope(isolate, callback_address); |
8407 callback(info); | 8419 callback(info); |
8408 } | 8420 } |
8409 | 8421 |
8410 | 8422 |
8411 } // namespace internal | 8423 } // namespace internal |
8412 } // namespace v8 | 8424 } // namespace v8 |
OLD | NEW |