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

Side by Side Diff: src/api.cc

Issue 1287323002: [api] Do not force external GCs when only trying to synchronously process phantom callbacks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
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 6864 matching lines...) Expand 10 before | Expand all | Expand 10 after
6875 ENTER_V8(internal_isolate); 6875 ENTER_V8(internal_isolate);
6876 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); 6876 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
6877 return Utils::IntegerToLocal(result); 6877 return Utils::IntegerToLocal(result);
6878 } 6878 }
6879 6879
6880 6880
6881 void Isolate::CollectAllGarbage(const char* gc_reason) { 6881 void Isolate::CollectAllGarbage(const char* gc_reason) {
6882 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap(); 6882 i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
6883 if (heap->incremental_marking()->IsStopped()) { 6883 if (heap->incremental_marking()->IsStopped()) {
6884 if (heap->incremental_marking()->CanBeActivated()) { 6884 if (heap->incremental_marking()->CanBeActivated()) {
6885 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced, 6885 heap->StartIncrementalMarking(
6886 gc_reason); 6886 i::Heap::kNoGCFlags,
6887 kGCCallbackFlagSynchronousPhantomCallbackProcessing, gc_reason);
6887 } else { 6888 } else {
6888 heap->CollectAllGarbage(i::Heap::kNoGCFlags, gc_reason, 6889 heap->CollectAllGarbage(
6889 kGCCallbackFlagForced); 6890 i::Heap::kNoGCFlags, gc_reason,
6891 kGCCallbackFlagSynchronousPhantomCallbackProcessing);
6890 } 6892 }
6891 } else { 6893 } else {
6892 // Incremental marking is turned on an has already been started. 6894 // Incremental marking is turned on an has already been started.
6893 6895
6894 // TODO(mlippautz): Compute the time slice for incremental marking based on 6896 // TODO(mlippautz): Compute the time slice for incremental marking based on
6895 // memory pressure. 6897 // memory pressure.
6896 double deadline = heap->MonotonicallyIncreasingTimeInMs() + 6898 double deadline = heap->MonotonicallyIncreasingTimeInMs() +
6897 i::FLAG_external_allocation_limit_incremental_time; 6899 i::FLAG_external_allocation_limit_incremental_time;
6898 heap->AdvanceIncrementalMarking( 6900 heap->AdvanceIncrementalMarking(
6899 0, deadline, i::IncrementalMarking::StepActions( 6901 0, deadline, i::IncrementalMarking::StepActions(
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
8418 Address callback_address = 8420 Address callback_address =
8419 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8421 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8420 VMState<EXTERNAL> state(isolate); 8422 VMState<EXTERNAL> state(isolate);
8421 ExternalCallbackScope call_scope(isolate, callback_address); 8423 ExternalCallbackScope call_scope(isolate, callback_address);
8422 callback(info); 8424 callback(info);
8423 } 8425 }
8424 8426
8425 8427
8426 } // namespace internal 8428 } // namespace internal
8427 } // namespace v8 8429 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698