@@ -1819,8 +1819,14 @@ class V8_EXPORT ScriptCompiler {
1819
1819
Local<String> arguments[], size_t context_extension_count,
1820
1820
Local<Object> context_extensions[],
1821
1821
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);
1824
1830
1825
1831
/* *
1826
1832
* Creates and returns code cache for the specified unbound_script.
@@ -3481,13 +3487,17 @@ enum class IntegrityLevel { kFrozen, kSealed };
3481
3487
*/
3482
3488
class V8_EXPORT Object : public Value {
3483
3489
public:
3490
+ V8_DEPRECATED (" Use maybe version" ,
3491
+ bool Set (Local<Value> key, Local<Value> value));
3484
3492
/* *
3485
3493
* Set only return Just(true) or Empty(), so if it should never fail, use
3486
3494
* result.Check().
3487
3495
*/
3488
3496
V8_WARN_UNUSED_RESULT Maybe<bool > Set (Local<Context> context,
3489
3497
Local<Value> key, Local<Value> value);
3490
3498
3499
+ V8_DEPRECATED (" Use maybe version" ,
3500
+ bool Set (uint32_t index, Local<Value> value));
3491
3501
V8_WARN_UNUSED_RESULT Maybe<bool > Set (Local<Context> context, uint32_t index,
3492
3502
Local<Value> value);
3493
3503
@@ -3532,9 +3542,11 @@ class V8_EXPORT Object : public Value {
3532
3542
Local<Context> context, Local<Name> key,
3533
3543
PropertyDescriptor& descriptor); // NOLINT(runtime/references)
3534
3544
3545
+ V8_DEPRECATED (" Use maybe version" , Local<Value> Get (Local<Value> key));
3535
3546
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get (Local<Context> context,
3536
3547
Local<Value> key);
3537
3548
3549
+ V8_DEPRECATED (" Use maybe version" , Local<Value> Get (uint32_t index));
3538
3550
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get (Local<Context> context,
3539
3551
uint32_t index);
3540
3552
@@ -6683,26 +6695,7 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
6683
6695
*/
6684
6696
class V8_EXPORT ResourceConstraints {
6685
6697
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 ();
6706
6699
6707
6700
/* *
6708
6701
* Configures the constraints with reasonable default values based on the
@@ -6726,8 +6719,12 @@ class V8_EXPORT ResourceConstraints {
6726
6719
* The amount of virtual memory reserved for generated code. This is relevant
6727
6720
* for 64-bit architectures that rely on code range for calls in code.
6728
6721
*/
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
+ }
6731
6728
6732
6729
/* *
6733
6730
* The maximum size of the old generation.
@@ -6737,60 +6734,60 @@ class V8_EXPORT ResourceConstraints {
6737
6734
* increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
6738
6735
*/
6739
6736
size_t max_old_generation_size_in_bytes () const {
6740
- return max_old_generation_size_ ;
6737
+ return max_old_space_size_ * kMB ;
6741
6738
}
6742
6739
void set_max_old_generation_size_in_bytes (size_t limit) {
6743
- max_old_generation_size_ = limit;
6740
+ max_old_space_size_ = limit / kMB ;
6744
6741
}
6745
6742
6746
6743
/* *
6747
6744
* The maximum size of the young generation, which consists of two semi-spaces
6748
6745
* and a large object space. This affects frequency of Scavenge garbage
6749
6746
* collections and should be typically much smaller that the old generation.
6750
6747
*/
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);
6757
6750
6758
6751
size_t initial_old_generation_size_in_bytes () const {
6759
- return initial_old_generation_size_ ;
6752
+ return 0 ;
6760
6753
}
6761
6754
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.
6763
6756
}
6764
6757
6765
6758
size_t initial_young_generation_size_in_bytes () const {
6766
- return initial_young_generation_size_ ;
6759
+ return 0 ;
6767
6760
}
6768
6761
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.
6770
6763
}
6771
6764
6772
6765
/* *
6773
6766
* Deprecated functions. Do not use in new code.
6774
6767
*/
6775
6768
V8_DEPRECATE_SOON (" Use code_range_size_in_bytes." ,
6776
6769
size_t code_range_size () const ) {
6777
- return code_range_size_ / kMB ;
6770
+ return code_range_size_;
6778
6771
}
6779
6772
V8_DEPRECATE_SOON (" Use set_code_range_size_in_bytes." ,
6780
6773
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;
6782
6775
}
6783
6776
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
+ }
6785
6780
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
+ }
6787
6784
V8_DEPRECATE_SOON (" Use max_old_generation_size_in_bytes." ,
6788
6785
size_t max_old_space_size () const ) {
6789
- return max_old_generation_size_ / kMB ;
6786
+ return max_old_space_size_ ;
6790
6787
}
6791
6788
V8_DEPRECATE_SOON (" Use set_max_old_generation_size_in_bytes." ,
6792
6789
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;
6794
6791
}
6795
6792
V8_DEPRECATE_SOON (" Zone does not pool memory any more." ,
6796
6793
size_t max_zone_pool_size () const ) {
@@ -6803,13 +6800,15 @@ class V8_EXPORT ResourceConstraints {
6803
6800
6804
6801
private:
6805
6802
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 ;
6806
6810
size_t code_range_size_ = 0 ;
6807
- size_t max_old_generation_size_ = 0 ;
6808
- size_t max_young_generation_size_ = 0 ;
6809
6811
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 ;
6813
6812
};
6814
6813
6815
6814
0 commit comments