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

Side by Side Diff: include/v8.h

Issue 1777883002: Add memory pressure interrupt for memory pressure notification Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enable memory pressure level 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
« no previous file with comments | « no previous file | src/api.cc » ('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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 5536 matching lines...) Expand 10 before | Expand all | Expand 10 after
5547 kArrayInstanceConstructorModified = 28, 5547 kArrayInstanceConstructorModified = 28,
5548 kLegacyFunctionDeclaration = 29, 5548 kLegacyFunctionDeclaration = 29,
5549 kRegExpPrototypeSourceGetter = 30, 5549 kRegExpPrototypeSourceGetter = 30,
5550 kRegExpPrototypeOldFlagGetter = 31, 5550 kRegExpPrototypeOldFlagGetter = 31,
5551 5551
5552 // If you add new values here, you'll also need to update V8Initializer.cpp 5552 // If you add new values here, you'll also need to update V8Initializer.cpp
5553 // in Chromium. 5553 // in Chromium.
5554 kUseCounterFeatureCount // This enum value must be last. 5554 kUseCounterFeatureCount // This enum value must be last.
5555 }; 5555 };
5556 5556
5557 enum MemoryPressureLevel { kNone, kModerate, kCritical };
jochen (gone - plz use gerrit) 2016/03/15 20:57:18 this should be an enum class
5558
5557 typedef void (*UseCounterCallback)(Isolate* isolate, 5559 typedef void (*UseCounterCallback)(Isolate* isolate,
5558 UseCounterFeature feature); 5560 UseCounterFeature feature);
5559 5561
5560 5562
5561 /** 5563 /**
5562 * Creates a new isolate. Does not change the currently entered 5564 * Creates a new isolate. Does not change the currently entered
5563 * isolate. 5565 * isolate.
5564 * 5566 *
5565 * When an isolate is no longer used its resources should be freed 5567 * When an isolate is no longer used its resources should be freed
5566 * by calling Dispose(). Using the delete operator is not allowed. 5568 * by calling Dispose(). Using the delete operator is not allowed.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
5868 * Request V8 to interrupt long running JavaScript code and invoke 5870 * Request V8 to interrupt long running JavaScript code and invoke
5869 * the given |callback| passing the given |data| to it. After |callback| 5871 * the given |callback| passing the given |data| to it. After |callback|
5870 * returns control will be returned to the JavaScript code. 5872 * returns control will be returned to the JavaScript code.
5871 * There may be a number of interrupt requests in flight. 5873 * There may be a number of interrupt requests in flight.
5872 * Can be called from another thread without acquiring a |Locker|. 5874 * Can be called from another thread without acquiring a |Locker|.
5873 * Registered |callback| must not reenter interrupted Isolate. 5875 * Registered |callback| must not reenter interrupted Isolate.
5874 */ 5876 */
5875 void RequestInterrupt(InterruptCallback callback, void* data); 5877 void RequestInterrupt(InterruptCallback callback, void* data);
5876 5878
5877 /** 5879 /**
5880 * Request V8 to interrupt long running JavaScript code and do GC,
5881 * when system memory is pressured.
5882 */
5883 void RequestMemoryPressureInterrupt(MemoryPressureLevel level);
jochen (gone - plz use gerrit) 2016/03/15 20:57:18 this should be NotifyMemoryPressure(MemoryPressure
5884
5885 /**
5878 * Request garbage collection in this Isolate. It is only valid to call this 5886 * Request garbage collection in this Isolate. It is only valid to call this
5879 * function if --expose_gc was specified. 5887 * function if --expose_gc was specified.
5880 * 5888 *
5881 * This should only be used for testing purposes and not to enforce a garbage 5889 * This should only be used for testing purposes and not to enforce a garbage
5882 * collection schedule. It has strong negative impact on the garbage 5890 * collection schedule. It has strong negative impact on the garbage
5883 * collection performance. Use IdleNotificationDeadline() or 5891 * collection performance. Use IdleNotificationDeadline() or
5884 * LowMemoryNotification() instead to influence the garbage collection 5892 * LowMemoryNotification() instead to influence the garbage collection
5885 * schedule. 5893 * schedule.
5886 */ 5894 */
5887 void RequestGarbageCollectionForTesting(GarbageCollectionType type); 5895 void RequestGarbageCollectionForTesting(GarbageCollectionType type);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
6178 */ 6186 */
6179 void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor); 6187 void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor);
6180 6188
6181 /** 6189 /**
6182 * Iterates through all the persistent handles in the current isolate's heap 6190 * Iterates through all the persistent handles in the current isolate's heap
6183 * that have class_ids and are weak to be marked as inactive if there is no 6191 * that have class_ids and are weak to be marked as inactive if there is no
6184 * pending activity for the handle. 6192 * pending activity for the handle.
6185 */ 6193 */
6186 void VisitWeakHandles(PersistentHandleVisitor* visitor); 6194 void VisitWeakHandles(PersistentHandleVisitor* visitor);
6187 6195
6196 /**
6197 * This method can handle memory pressure interrupt, no matter v8 is busy or
6198 * idle.
6199 */
6200 void HandleMemoryPressureInterrupt();
jochen (gone - plz use gerrit) 2016/03/15 20:57:18 please remove this.
6201
6188 private: 6202 private:
6189 template <class K, class V, class Traits> 6203 template <class K, class V, class Traits>
6190 friend class PersistentValueMapBase; 6204 friend class PersistentValueMapBase;
6191 6205
6192 Isolate(); 6206 Isolate();
6193 Isolate(const Isolate&); 6207 Isolate(const Isolate&);
6194 ~Isolate(); 6208 ~Isolate();
6195 Isolate& operator=(const Isolate&); 6209 Isolate& operator=(const Isolate&);
6196 void* operator new(size_t size); 6210 void* operator new(size_t size);
6197 void operator delete(void*, size_t); 6211 void operator delete(void*, size_t);
(...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after
8658 */ 8672 */
8659 8673
8660 8674
8661 } // namespace v8 8675 } // namespace v8
8662 8676
8663 8677
8664 #undef TYPE_CHECK 8678 #undef TYPE_CHECK
8665 8679
8666 8680
8667 #endif // INCLUDE_V8_H_ 8681 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698