@@ -1732,8 +1732,14 @@ class V8_EXPORT ScriptCompiler {
1732
1732
Local<String> arguments[], size_t context_extension_count,
1733
1733
Local<Object> context_extensions[],
1734
1734
CompileOptions options = kNoCompileOptions ,
1735
- NoCacheReason no_cache_reason = kNoCacheNoReason ,
1736
- Local<ScriptOrModule>* script_or_module_out = nullptr );
1735
+ NoCacheReason no_cache_reason = kNoCacheNoReason );
1736
+
1737
+ static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext (
1738
+ Local<Context> context, Source* source, size_t arguments_count,
1739
+ Local<String> arguments[], size_t context_extension_count,
1740
+ Local<Object> context_extensions[], CompileOptions options,
1741
+ NoCacheReason no_cache_reason,
1742
+ Local<ScriptOrModule>* script_or_module_out);
1737
1743
1738
1744
/* *
1739
1745
* Creates and returns code cache for the specified unbound_script.
@@ -3393,13 +3399,17 @@ enum class IntegrityLevel { kFrozen, kSealed };
3393
3399
*/
3394
3400
class V8_EXPORT Object : public Value {
3395
3401
public:
3402
+ V8_DEPRECATED (" Use maybe version" ,
3403
+ bool Set (Local<Value> key, Local<Value> value));
3396
3404
/* *
3397
3405
* Set only return Just(true) or Empty(), so if it should never fail, use
3398
3406
* result.Check().
3399
3407
*/
3400
3408
V8_WARN_UNUSED_RESULT Maybe<bool > Set (Local<Context> context,
3401
3409
Local<Value> key, Local<Value> value);
3402
3410
3411
+ V8_DEPRECATED (" Use maybe version" ,
3412
+ bool Set (uint32_t index, Local<Value> value));
3403
3413
V8_WARN_UNUSED_RESULT Maybe<bool > Set (Local<Context> context, uint32_t index,
3404
3414
Local<Value> value);
3405
3415
@@ -3444,9 +3454,11 @@ class V8_EXPORT Object : public Value {
3444
3454
Local<Context> context, Local<Name> key,
3445
3455
PropertyDescriptor& descriptor); // NOLINT(runtime/references)
3446
3456
3457
+ V8_DEPRECATED (" Use maybe version" , Local<Value> Get (Local<Value> key));
3447
3458
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get (Local<Context> context,
3448
3459
Local<Value> key);
3449
3460
3461
+ V8_DEPRECATED (" Use maybe version" , Local<Value> Get (uint32_t index));
3450
3462
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get (Local<Context> context,
3451
3463
uint32_t index);
3452
3464
@@ -6560,19 +6572,7 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
6560
6572
*/
6561
6573
class V8_EXPORT ResourceConstraints {
6562
6574
public:
6563
- /* *
6564
- * Configures the constraints with reasonable default values based on the
6565
- * provided heap size limit. The heap size includes both the young and
6566
- * the old generation.
6567
- *
6568
- * \param maximum_heap_size_in_bytes The hard limit for the heap size.
6569
- * When the heap size approaches this limit, V8 will perform series of
6570
- * garbage collections and invoke the NearHeapLimitCallback.
6571
- * If the garbage collections do not help and the callback does not
6572
- * increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
6573
- */
6574
- void ConfigureDefaultsFromHeapSize (size_t initial_heap_size_in_bytes,
6575
- size_t maximum_heap_size_in_bytes);
6575
+ ResourceConstraints ();
6576
6576
6577
6577
/* *
6578
6578
* Configures the constraints with reasonable default values based on the
@@ -6596,8 +6596,12 @@ class V8_EXPORT ResourceConstraints {
6596
6596
* The amount of virtual memory reserved for generated code. This is relevant
6597
6597
* for 64-bit architectures that rely on code range for calls in code.
6598
6598
*/
6599
- size_t code_range_size_in_bytes () const { return code_range_size_; }
6600
- void set_code_range_size_in_bytes (size_t limit) { code_range_size_ = limit; }
6599
+ size_t code_range_size_in_bytes () const {
6600
+ return code_range_size_ * kMB ;
6601
+ }
6602
+ void set_code_range_size_in_bytes (size_t limit) {
6603
+ code_range_size_ = limit / kMB ;
6604
+ }
6601
6605
6602
6606
/* *
6603
6607
* The maximum size of the old generation.
@@ -6607,60 +6611,60 @@ class V8_EXPORT ResourceConstraints {
6607
6611
* increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.
6608
6612
*/
6609
6613
size_t max_old_generation_size_in_bytes () const {
6610
- return max_old_generation_size_ ;
6614
+ return max_old_space_size_ * kMB ;
6611
6615
}
6612
6616
void set_max_old_generation_size_in_bytes (size_t limit) {
6613
- max_old_generation_size_ = limit;
6617
+ max_old_space_size_ = limit / kMB ;
6614
6618
}
6615
6619
6616
6620
/* *
6617
6621
* The maximum size of the young generation, which consists of two semi-spaces
6618
6622
* and a large object space. This affects frequency of Scavenge garbage
6619
6623
* collections and should be typically much smaller that the old generation.
6620
6624
*/
6621
- size_t max_young_generation_size_in_bytes () const {
6622
- return max_young_generation_size_;
6623
- }
6624
- void set_max_young_generation_size_in_bytes (size_t limit) {
6625
- max_young_generation_size_ = limit;
6626
- }
6625
+ size_t max_young_generation_size_in_bytes () const ;
6626
+ void set_max_young_generation_size_in_bytes (size_t limit);
6627
6627
6628
6628
size_t initial_old_generation_size_in_bytes () const {
6629
- return initial_old_generation_size_ ;
6629
+ return 0 ;
6630
6630
}
6631
6631
void set_initial_old_generation_size_in_bytes (size_t initial_size) {
6632
- initial_old_generation_size_ = initial_size;
6632
+ // Not available on Node 12.
6633
6633
}
6634
6634
6635
6635
size_t initial_young_generation_size_in_bytes () const {
6636
- return initial_young_generation_size_ ;
6636
+ return 0 ;
6637
6637
}
6638
6638
void set_initial_young_generation_size_in_bytes (size_t initial_size) {
6639
- initial_young_generation_size_ = initial_size;
6639
+ // Not available on Node 12.
6640
6640
}
6641
6641
6642
6642
/* *
6643
6643
* Deprecated functions. Do not use in new code.
6644
6644
*/
6645
6645
V8_DEPRECATE_SOON (" Use code_range_size_in_bytes." ,
6646
6646
size_t code_range_size () const ) {
6647
- return code_range_size_ / kMB ;
6647
+ return code_range_size_;
6648
6648
}
6649
6649
V8_DEPRECATE_SOON (" Use set_code_range_size_in_bytes." ,
6650
6650
void set_code_range_size (size_t limit_in_mb)) {
6651
- code_range_size_ = limit_in_mb * kMB ;
6651
+ code_range_size_ = limit_in_mb;
6652
6652
}
6653
6653
V8_DEPRECATE_SOON (" Use max_young_generation_size_in_bytes." ,
6654
- size_t max_semi_space_size_in_kb () const );
6654
+ size_t max_semi_space_size_in_kb () const ) {
6655
+ return max_semi_space_size_in_kb_;
6656
+ }
6655
6657
V8_DEPRECATE_SOON (" Use set_max_young_generation_size_in_bytes." ,
6656
- void set_max_semi_space_size_in_kb (size_t limit_in_kb));
6658
+ void set_max_semi_space_size_in_kb (size_t limit_in_kb)) {
6659
+ max_semi_space_size_in_kb_ = limit_in_kb;
6660
+ }
6657
6661
V8_DEPRECATE_SOON (" Use max_old_generation_size_in_bytes." ,
6658
6662
size_t max_old_space_size () const ) {
6659
- return max_old_generation_size_ / kMB ;
6663
+ return max_old_space_size_ ;
6660
6664
}
6661
6665
V8_DEPRECATE_SOON (" Use set_max_old_generation_size_in_bytes." ,
6662
6666
void set_max_old_space_size (size_t limit_in_mb)) {
6663
- max_old_generation_size_ = limit_in_mb * kMB ;
6667
+ max_old_space_size_ = limit_in_mb;
6664
6668
}
6665
6669
V8_DEPRECATE_SOON (" Zone does not pool memory any more." ,
6666
6670
size_t max_zone_pool_size () const ) {
@@ -6673,13 +6677,15 @@ class V8_EXPORT ResourceConstraints {
6673
6677
6674
6678
private:
6675
6679
static constexpr size_t kMB = 1048576u ;
6680
+
6681
+ // max_semi_space_size_ is in KB
6682
+ size_t max_semi_space_size_in_kb_ = 0 ;
6683
+
6684
+ // The remaining limits are in MB
6685
+ size_t max_old_space_size_ = 0 ;
6686
+ uint32_t * stack_limit_ = nullptr ;
6676
6687
size_t code_range_size_ = 0 ;
6677
- size_t max_old_generation_size_ = 0 ;
6678
- size_t max_young_generation_size_ = 0 ;
6679
6688
size_t max_zone_pool_size_ = 0 ;
6680
- size_t initial_old_generation_size_ = 0 ;
6681
- size_t initial_young_generation_size_ = 0 ;
6682
- uint32_t * stack_limit_ = nullptr ;
6683
6689
};
6684
6690
6685
6691
0 commit comments