@@ -1819,8 +1819,14 @@ class V8_EXPORT ScriptCompiler {
18191819 Local<String> arguments[], size_t context_extension_count,
18201820 Local<Object> context_extensions[],
18211821 CompileOptions options = kNoCompileOptions ,
1822- NoCacheReason no_cache_reason = kNoCacheNoReason ,
1823- Local<ScriptOrModule>* script_or_module_out = nullptr );
1822+ NoCacheReason no_cache_reason = kNoCacheNoReason );
1823+
1824+ static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext (
1825+ Local<Context> context, Source* source, size_t arguments_count,
1826+ Local<String> arguments[], size_t context_extension_count,
1827+ Local<Object> context_extensions[], CompileOptions options,
1828+ NoCacheReason no_cache_reason,
1829+ Local<ScriptOrModule>* script_or_module_out);
18241830
18251831 /* *
18261832 * Creates and returns code cache for the specified unbound_script.
@@ -3481,13 +3487,17 @@ enum class IntegrityLevel { kFrozen, kSealed };
34813487 */
34823488class V8_EXPORT Object : public Value {
34833489 public:
3490+ V8_DEPRECATED (" Use maybe version" ,
3491+ bool Set (Local<Value> key, Local<Value> value));
34843492 /* *
34853493 * Set only return Just(true) or Empty(), so if it should never fail, use
34863494 * result.Check().
34873495 */
34883496 V8_WARN_UNUSED_RESULT Maybe<bool > Set (Local<Context> context,
34893497 Local<Value> key, Local<Value> value);
34903498
3499+ V8_DEPRECATED (" Use maybe version" ,
3500+ bool Set (uint32_t index, Local<Value> value));
34913501 V8_WARN_UNUSED_RESULT Maybe<bool > Set (Local<Context> context, uint32_t index,
34923502 Local<Value> value);
34933503
@@ -3532,9 +3542,11 @@ class V8_EXPORT Object : public Value {
35323542 Local<Context> context, Local<Name> key,
35333543 PropertyDescriptor& descriptor); // NOLINT(runtime/references)
35343544
3545+ V8_DEPRECATED (" Use maybe version" , Local<Value> Get (Local<Value> key));
35353546 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get (Local<Context> context,
35363547 Local<Value> key);
35373548
3549+ V8_DEPRECATED (" Use maybe version" , Local<Value> Get (uint32_t index));
35383550 V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get (Local<Context> context,
35393551 uint32_t index);
35403552
@@ -6683,26 +6695,7 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
66836695 */
66846696class V8_EXPORT ResourceConstraints {
66856697 public:
6686- /* *
6687- * Configures the constraints with reasonable default values based on the
6688- * provided heap size limit. The heap size includes both the young and
6689- * the old generation.
6690- *
6691- * \param initial_heap_size_in_bytes The initial heap size or zero.
6692- * By default V8 starts with a small heap and dynamically grows it to
6693- * match the set of live objects. This may lead to ineffective
6694- * garbage collections at startup if the live set is large.
6695- * Setting the initial heap size avoids such garbage collections.
6696- * Note that this does not affect young generation garbage collections.
6697- *
6698- * \param maximum_heap_size_in_bytes The hard limit for the heap size.
6699- * When the heap size approaches this limit, V8 will perform series of
6700- * garbage collections and invoke the NearHeapLimitCallback. If the garbage
6701- * collections do not help and the callback does not increase the limit,
6702- * then V8 will crash with V8::FatalProcessOutOfMemory.
6703- */
6704- void ConfigureDefaultsFromHeapSize (size_t initial_heap_size_in_bytes,
6705- size_t maximum_heap_size_in_bytes);
6698+ ResourceConstraints ();
67066699
67076700 /* *
67086701 * Configures the constraints with reasonable default values based on the
@@ -6726,8 +6719,12 @@ class V8_EXPORT ResourceConstraints {
67266719 * The amount of virtual memory reserved for generated code. This is relevant
67276720 * for 64-bit architectures that rely on code range for calls in code.
67286721 */
6729- size_t code_range_size_in_bytes () const { return code_range_size_; }
6730- void set_code_range_size_in_bytes (size_t limit) { code_range_size_ = limit; }
6722+ size_t code_range_size_in_bytes () const {
6723+ return code_range_size_ * kMB ;
6724+ }
6725+ void set_code_range_size_in_bytes (size_t limit) {
6726+ code_range_size_ = limit / kMB ;
6727+ }
67316728
67326729 /* *
67336730 * The maximum size of the old generation.
@@ -6737,60 +6734,60 @@ class V8_EXPORT ResourceConstraints {
67376734 * increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
67386735 */
67396736 size_t max_old_generation_size_in_bytes () const {
6740- return max_old_generation_size_ ;
6737+ return max_old_space_size_ * kMB ;
67416738 }
67426739 void set_max_old_generation_size_in_bytes (size_t limit) {
6743- max_old_generation_size_ = limit;
6740+ max_old_space_size_ = limit / kMB ;
67446741 }
67456742
67466743 /* *
67476744 * The maximum size of the young generation, which consists of two semi-spaces
67486745 * and a large object space. This affects frequency of Scavenge garbage
67496746 * collections and should be typically much smaller that the old generation.
67506747 */
6751- size_t max_young_generation_size_in_bytes () const {
6752- return max_young_generation_size_;
6753- }
6754- void set_max_young_generation_size_in_bytes (size_t limit) {
6755- max_young_generation_size_ = limit;
6756- }
6748+ size_t max_young_generation_size_in_bytes () const ;
6749+ void set_max_young_generation_size_in_bytes (size_t limit);
67576750
67586751 size_t initial_old_generation_size_in_bytes () const {
6759- return initial_old_generation_size_ ;
6752+ return 0 ;
67606753 }
67616754 void set_initial_old_generation_size_in_bytes (size_t initial_size) {
6762- initial_old_generation_size_ = initial_size;
6755+ // Not available on Node 12.
67636756 }
67646757
67656758 size_t initial_young_generation_size_in_bytes () const {
6766- return initial_young_generation_size_ ;
6759+ return 0 ;
67676760 }
67686761 void set_initial_young_generation_size_in_bytes (size_t initial_size) {
6769- initial_young_generation_size_ = initial_size;
6762+ // Not available on Node 12.
67706763 }
67716764
67726765 /* *
67736766 * Deprecated functions. Do not use in new code.
67746767 */
67756768 V8_DEPRECATE_SOON (" Use code_range_size_in_bytes." ,
67766769 size_t code_range_size () const ) {
6777- return code_range_size_ / kMB ;
6770+ return code_range_size_;
67786771 }
67796772 V8_DEPRECATE_SOON (" Use set_code_range_size_in_bytes." ,
67806773 void set_code_range_size (size_t limit_in_mb)) {
6781- code_range_size_ = limit_in_mb * kMB ;
6774+ code_range_size_ = limit_in_mb;
67826775 }
67836776 V8_DEPRECATE_SOON (" Use max_young_generation_size_in_bytes." ,
6784- size_t max_semi_space_size_in_kb () const );
6777+ size_t max_semi_space_size_in_kb () const ) {
6778+ return max_semi_space_size_in_kb_;
6779+ }
67856780 V8_DEPRECATE_SOON (" Use set_max_young_generation_size_in_bytes." ,
6786- void set_max_semi_space_size_in_kb (size_t limit_in_kb));
6781+ void set_max_semi_space_size_in_kb (size_t limit_in_kb)) {
6782+ max_semi_space_size_in_kb_ = limit_in_kb;
6783+ }
67876784 V8_DEPRECATE_SOON (" Use max_old_generation_size_in_bytes." ,
67886785 size_t max_old_space_size () const ) {
6789- return max_old_generation_size_ / kMB ;
6786+ return max_old_space_size_ ;
67906787 }
67916788 V8_DEPRECATE_SOON (" Use set_max_old_generation_size_in_bytes." ,
67926789 void set_max_old_space_size (size_t limit_in_mb)) {
6793- max_old_generation_size_ = limit_in_mb * kMB ;
6790+ max_old_space_size_ = limit_in_mb;
67946791 }
67956792 V8_DEPRECATE_SOON (" Zone does not pool memory any more." ,
67966793 size_t max_zone_pool_size () const ) {
@@ -6803,13 +6800,15 @@ class V8_EXPORT ResourceConstraints {
68036800
68046801 private:
68056802 static constexpr size_t kMB = 1048576u ;
6803+
6804+ // max_semi_space_size_ is in KB
6805+ size_t max_semi_space_size_in_kb_ = 0 ;
6806+
6807+ // The remaining limits are in MB
6808+ size_t max_old_space_size_ = 0 ;
6809+ uint32_t * stack_limit_ = nullptr ;
68066810 size_t code_range_size_ = 0 ;
6807- size_t max_old_generation_size_ = 0 ;
6808- size_t max_young_generation_size_ = 0 ;
68096811 size_t max_zone_pool_size_ = 0 ;
6810- size_t initial_old_generation_size_ = 0 ;
6811- size_t initial_young_generation_size_ = 0 ;
6812- uint32_t * stack_limit_ = nullptr ;
68136812};
68146813
68156814
0 commit comments