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

Side by Side Diff: src/api.cc

Issue 1813963002: Add memory pressure notification API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 7568 matching lines...) Expand 10 before | Expand all | Expand 10 after
7579 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7579 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7580 return isolate->heap()->SetOptimizeForLatency(); 7580 return isolate->heap()->SetOptimizeForLatency();
7581 } 7581 }
7582 7582
7583 7583
7584 void Isolate::IsolateInBackgroundNotification() { 7584 void Isolate::IsolateInBackgroundNotification() {
7585 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7585 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7586 return isolate->heap()->SetOptimizeForMemoryUsage(); 7586 return isolate->heap()->SetOptimizeForMemoryUsage();
7587 } 7587 }
7588 7588
7589 void Isolate::MemoryPressureNotification(MemoryPressureLevel level) {
7590 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7591 return isolate->heap()->MemoryPressureNotification(
7592 static_cast<i::MemoryPressureLevel>(level), Locker::IsLocked(this));
jochen (gone - plz use gerrit) 2016/03/17 19:33:39 IsLocked() should never be true in blink, right?
ulan 2016/03/18 12:49:40 If V8 is not executing JS code and there is memory
7593 }
7589 7594
7590 void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options, 7595 void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options,
7591 JitCodeEventHandler event_handler) { 7596 JitCodeEventHandler event_handler) {
7592 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7597 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7593 // Ensure that logging is initialized for our isolate. 7598 // Ensure that logging is initialized for our isolate.
7594 isolate->InitializeLoggingAndCounters(); 7599 isolate->InitializeLoggingAndCounters();
7595 isolate->logger()->SetCodeEventHandler(options, event_handler); 7600 isolate->logger()->SetCodeEventHandler(options, event_handler);
7596 } 7601 }
7597 7602
7598 7603
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
8685 Address callback_address = 8690 Address callback_address =
8686 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8691 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8687 VMState<EXTERNAL> state(isolate); 8692 VMState<EXTERNAL> state(isolate);
8688 ExternalCallbackScope call_scope(isolate, callback_address); 8693 ExternalCallbackScope call_scope(isolate, callback_address);
8689 callback(info); 8694 callback(info);
8690 } 8695 }
8691 8696
8692 8697
8693 } // namespace internal 8698 } // namespace internal
8694 } // namespace v8 8699 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698