Skip to content

Commit 2241a47

Browse files
addaleaxgibfahn
authored andcommitted
deps: revert ABI breaking changes in V8 6.1
Below is the list of changes: deps: revert 70de12b73c150 from upstream V8 Original commit message: Remove deprecated ForceSet Also move the soon-to-be-deprecated version to deprecated BUG=none [email protected] Change-Id: I2252404f63e25ac35c7798daf66b36144bef6a7e Reviewed-on: https://chromium-review.googlesource.com/518162 Reviewed-by: Ulan Degenbaev <[email protected]> Commit-Queue: Jochen Eisinger <[email protected]> Cr-Commit-Position: refs/heads/master@{nodejs#45554} [squash] use renamed internal utilities v8: reorder V8_INTRINSICS_LIST for ABI compat Make `kErrorPrototype` added at the end of the `Intrinsic` for ABI compatibility. deps: revert 0089c786ed882 from V8 upstream Original commit message: Merged: Squashed multiple commits. Merged: [heap] Add API to set heap semi-space limits in KB. Revision: bb29f9a4d6fb5e32 Merged: [heap] Partially reland "Allow a minimum semi-space size of 512K." Revision: 7486dc3331 Merged: [heap] Set initial semi-space size to 512K. Revision: a5230d81d1f73c BUG=chromium:716032,chromium:735649 LOG=N NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true [email protected] Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: Ia9946e28ce41dee6199fac571274aa196576385b Reviewed-on: https://chromium-review.googlesource.com/616283 Reviewed-by: Michael Lippautz <[email protected]> Cr-Commit-Position: refs/branch-heads/6.1@{nodejs#47} Cr-Branched-From: 1bf2e10ddb194d4c2871a87a4732613419de892d-refs/heads/6.1.534@{#1} Cr-Branched-From: e825c4318eb2065ffdf9044aa6a5278635c36427-refs/heads/master@{nodejs#46746} v8: work around callback typedef renaming Do some clever tricks to have an easy way around V8 renaming one of its typedef to a deprecated version and then introducing a new typedef with the same name. deps: revert 5ebd6fcd269de from V8 upstream Original commit message: [heap] Lower external allocation limit when external memory shrinks. BUG=chromium:728228 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng Review-Url: https://codereview.chromium.org/2921883002 Cr-Commit-Position: refs/heads/master@{nodejs#45726} deps: revert cf8f7bdc9d5ee from V8 upstream Original commit message: [heap] Increase memory reducer activation limit for external memory changes. BUG=chromium:729521 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng Review-Url: https://codereview.chromium.org/2923563006 Cr-Commit-Position: refs/heads/master@{nodejs#45763} deps: revert 11fc9fab94d48 from V8 upstream Original commit message: [heap] Guard against re-entering GC on external memory change. [email protected] BUG=chromium:729868,chromium:729521 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng Review-Url: https://codereview.chromium.org/2929463002 Cr-Commit-Position: refs/heads/master@{nodejs#45745} deps: revert 502c6ae6a0397 from V8 upstream Original commit message: [heap] Activate memory reducer on external memory activity. BUG=chromium:728228,chromium:626082 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng Review-Url: https://codereview.chromium.org/2917853004 Cr-Commit-Position: refs/heads/master@{nodejs#45671} v8: revert changes to Contents structs The feature is disabled by default anyway,but we disable it completely. Backport-PR-URL: nodejs#16413 PR-URL: nodejs#15393 Author: Anna Henningsen <[email protected]> Author: Peter Marshall <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 914999b commit 2241a47

File tree

11 files changed

+102
-238
lines changed

11 files changed

+102
-238
lines changed

deps/v8/include/v8.h

+36-91
Original file line numberDiff line numberDiff line change
@@ -3112,9 +3112,12 @@ class V8_EXPORT Object : public Value {
31123112
//
31133113
// Note also that this only works for named properties.
31143114
V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty",
3115-
Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
3116-
Local<Value> value,
3117-
PropertyAttribute attribs = None));
3115+
bool ForceSet(Local<Value> key, Local<Value> value,
3116+
PropertyAttribute attribs = None));
3117+
V8_DEPRECATE_SOON("Use CreateDataProperty / DefineOwnProperty",
3118+
Maybe<bool> ForceSet(Local<Context> context,
3119+
Local<Value> key, Local<Value> value,
3120+
PropertyAttribute attribs = None));
31183121

31193122
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
31203123
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
@@ -4343,28 +4346,14 @@ class V8_EXPORT ArrayBuffer : public Object {
43434346
*/
43444347
class V8_EXPORT Contents { // NOLINT
43454348
public:
4346-
Contents()
4347-
: data_(nullptr),
4348-
byte_length_(0),
4349-
allocation_base_(nullptr),
4350-
allocation_length_(0),
4351-
allocation_mode_(Allocator::AllocationMode::kNormal) {}
4352-
4353-
void* AllocationBase() const { return allocation_base_; }
4354-
size_t AllocationLength() const { return allocation_length_; }
4355-
Allocator::AllocationMode AllocationMode() const {
4356-
return allocation_mode_;
4357-
}
4349+
Contents() : data_(NULL), byte_length_(0) {}
43584350

43594351
void* Data() const { return data_; }
43604352
size_t ByteLength() const { return byte_length_; }
43614353

43624354
private:
43634355
void* data_;
43644356
size_t byte_length_;
4365-
void* allocation_base_;
4366-
size_t allocation_length_;
4367-
Allocator::AllocationMode allocation_mode_;
43684357

43694358
friend class ArrayBuffer;
43704359
};
@@ -4719,28 +4708,14 @@ class V8_EXPORT SharedArrayBuffer : public Object {
47194708
*/
47204709
class V8_EXPORT Contents { // NOLINT
47214710
public:
4722-
Contents()
4723-
: data_(nullptr),
4724-
byte_length_(0),
4725-
allocation_base_(nullptr),
4726-
allocation_length_(0),
4727-
allocation_mode_(ArrayBuffer::Allocator::AllocationMode::kNormal) {}
4728-
4729-
void* AllocationBase() const { return allocation_base_; }
4730-
size_t AllocationLength() const { return allocation_length_; }
4731-
ArrayBuffer::Allocator::AllocationMode AllocationMode() const {
4732-
return allocation_mode_;
4733-
}
4711+
Contents() : data_(NULL), byte_length_(0) {}
47344712

47354713
void* Data() const { return data_; }
47364714
size_t ByteLength() const { return byte_length_; }
47374715

47384716
private:
47394717
void* data_;
47404718
size_t byte_length_;
4741-
void* allocation_base_;
4742-
size_t allocation_length_;
4743-
ArrayBuffer::Allocator::AllocationMode allocation_mode_;
47444719

47454720
friend class SharedArrayBuffer;
47464721
};
@@ -4987,8 +4962,8 @@ class V8_EXPORT External : public Value {
49874962
F(ArrayProto_forEach, array_for_each_iterator) \
49884963
F(ArrayProto_keys, array_keys_iterator) \
49894964
F(ArrayProto_values, array_values_iterator) \
4965+
F(IteratorPrototype, initial_iterator_prototype) \
49904966
F(ErrorPrototype, initial_error_prototype) \
4991-
F(IteratorPrototype, initial_iterator_prototype)
49924967

49934968
enum Intrinsic {
49944969
#define V8_DECL_INTRINSIC(name, iname) k##name,
@@ -6050,8 +6025,6 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
60506025
*
60516026
* The arguments for set_max_semi_space_size, set_max_old_space_size,
60526027
* set_max_executable_size, set_code_range_size specify limits in MB.
6053-
*
6054-
* The argument for set_max_semi_space_size_in_kb is in KB.
60556028
*/
60566029
class V8_EXPORT ResourceConstraints {
60576030
public:
@@ -6069,28 +6042,10 @@ class V8_EXPORT ResourceConstraints {
60696042
void ConfigureDefaults(uint64_t physical_memory,
60706043
uint64_t virtual_memory_limit);
60716044

6072-
// Returns the max semi-space size in MB.
6073-
V8_DEPRECATE_SOON("Use max_semi_space_size_in_kb()",
6074-
int max_semi_space_size()) {
6075-
return static_cast<int>(max_semi_space_size_in_kb_ / 1024);
6076-
}
6077-
6078-
// Sets the max semi-space size in MB.
6079-
V8_DEPRECATE_SOON("Use set_max_semi_space_size_in_kb(size_t limit_in_kb)",
6080-
void set_max_semi_space_size(int limit_in_mb)) {
6081-
max_semi_space_size_in_kb_ = limit_in_mb * 1024;
6045+
int max_semi_space_size() const { return max_semi_space_size_; }
6046+
void set_max_semi_space_size(int limit_in_mb) {
6047+
max_semi_space_size_ = limit_in_mb;
60826048
}
6083-
6084-
// Returns the max semi-space size in KB.
6085-
size_t max_semi_space_size_in_kb() const {
6086-
return max_semi_space_size_in_kb_;
6087-
}
6088-
6089-
// Sets the max semi-space size in KB.
6090-
void set_max_semi_space_size_in_kb(size_t limit_in_kb) {
6091-
max_semi_space_size_in_kb_ = limit_in_kb;
6092-
}
6093-
60946049
int max_old_space_size() const { return max_old_space_size_; }
60956050
void set_max_old_space_size(int limit_in_mb) {
60966051
max_old_space_size_ = limit_in_mb;
@@ -6116,10 +6071,7 @@ class V8_EXPORT ResourceConstraints {
61166071
}
61176072

61186073
private:
6119-
// max_semi_space_size_ is in KB
6120-
size_t max_semi_space_size_in_kb_;
6121-
6122-
// The remaining limits are in MB
6074+
int max_semi_space_size_;
61236075
int max_old_space_size_;
61246076
int max_executable_size_;
61256077
uint32_t* stack_limit_;
@@ -6350,8 +6302,22 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
63506302
*/
63516303
typedef bool (*DeprecatedAllowCodeGenerationFromStringsCallback)(
63526304
Local<Context> context);
6353-
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
6354-
Local<String> source);
6305+
// The naming of this alias is for **Node v8.x releases only**
6306+
// plain V8 >= 6.1 just calls it AllowCodeGenerationFromStringsCallback
6307+
typedef bool (*FreshNewAllowCodeGenerationFromStringsCallback)(
6308+
Local<Context> context, Local<String> source);
6309+
6310+
// a) no addon uses this anyway
6311+
// b) this is sufficient because c++ type mangling takes care of resolving
6312+
// the typedefs
6313+
// c) doing it this way allows people to use the Fresh New variant
6314+
#ifdef USING_V8_SHARED
6315+
typedef DeprecatedAllowCodeGenerationFromStringsCallback
6316+
AllowCodeGenerationFromStringsCallback;
6317+
#else
6318+
typedef FreshNewAllowCodeGenerationFromStringsCallback
6319+
AllowCodeGenerationFromStringsCallback;
6320+
#endif
63556321

63566322
// --- WebAssembly compilation callbacks ---
63576323
typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&);
@@ -7637,7 +7603,7 @@ class V8_EXPORT Isolate {
76377603
* strings should be allowed.
76387604
*/
76397605
void SetAllowCodeGenerationFromStringsCallback(
7640-
AllowCodeGenerationFromStringsCallback callback);
7606+
FreshNewAllowCodeGenerationFromStringsCallback callback);
76417607
V8_DEPRECATED("Use callback with source parameter.",
76427608
void SetAllowCodeGenerationFromStringsCallback(
76437609
DeprecatedAllowCodeGenerationFromStringsCallback callback));
@@ -7758,7 +7724,6 @@ class V8_EXPORT Isolate {
77587724
friend class PersistentValueMapBase;
77597725

77607726
void ReportExternalAllocationLimitReached();
7761-
void CheckMemoryPressure();
77627727
};
77637728

77647729
class V8_EXPORT StartupData {
@@ -8119,7 +8084,7 @@ class V8_EXPORT V8 {
81198084
*/
81208085
static void ShutdownPlatform();
81218086

8122-
#if V8_OS_POSIX
8087+
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
81238088
/**
81248089
* Give the V8 signal handler a chance to handle a fault.
81258090
*
@@ -8140,7 +8105,7 @@ class V8_EXPORT V8 {
81408105
* points to a ucontext_t structure.
81418106
*/
81428107
static bool TryHandleSignal(int signal_number, void* info, void* context);
8143-
#endif // V8_OS_POSIX
8108+
#endif // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
81448109

81458110
/**
81468111
* Enable the default signal handler rather than using one provided by the
@@ -9008,8 +8973,6 @@ class Internals {
90088973
static const int kExternalMemoryOffset = 4 * kApiPointerSize;
90098974
static const int kExternalMemoryLimitOffset =
90108975
kExternalMemoryOffset + kApiInt64Size;
9011-
static const int kExternalMemoryAtLastMarkCompactOffset =
9012-
kExternalMemoryLimitOffset + kApiInt64Size;
90138976
static const int kIsolateRootsOffset = kExternalMemoryLimitOffset +
90148977
kApiInt64Size + kApiInt64Size +
90158978
kApiPointerSize + kApiPointerSize;
@@ -10228,32 +10191,13 @@ uint32_t Isolate::GetNumberOfDataSlots() {
1022810191
int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
1022910192
int64_t change_in_bytes) {
1023010193
typedef internal::Internals I;
10231-
const int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
1023210194
int64_t* external_memory = reinterpret_cast<int64_t*>(
1023310195
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
10234-
int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
10196+
const int64_t external_memory_limit = *reinterpret_cast<int64_t*>(
1023510197
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
10236-
int64_t* external_memory_at_last_mc =
10237-
reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) +
10238-
I::kExternalMemoryAtLastMarkCompactOffset);
1023910198
const int64_t amount = *external_memory + change_in_bytes;
10240-
1024110199
*external_memory = amount;
10242-
10243-
int64_t allocation_diff_since_last_mc =
10244-
*external_memory_at_last_mc - *external_memory;
10245-
allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0
10246-
? -allocation_diff_since_last_mc
10247-
: allocation_diff_since_last_mc;
10248-
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10249-
CheckMemoryPressure();
10250-
}
10251-
10252-
if (change_in_bytes < 0) {
10253-
*external_memory_limit += change_in_bytes;
10254-
}
10255-
10256-
if (change_in_bytes > 0 && amount > *external_memory_limit) {
10200+
if (change_in_bytes > 0 && amount > external_memory_limit) {
1025710201
ReportExternalAllocationLimitReached();
1025810202
}
1025910203
return *external_memory;
@@ -10287,7 +10231,8 @@ void V8::SetAllowCodeGenerationFromStringsCallback(
1028710231
DeprecatedAllowCodeGenerationFromStringsCallback callback) {
1028810232
Isolate* isolate = Isolate::GetCurrent();
1028910233
isolate->SetAllowCodeGenerationFromStringsCallback(
10290-
reinterpret_cast<AllowCodeGenerationFromStringsCallback>(callback));
10234+
reinterpret_cast<FreshNewAllowCodeGenerationFromStringsCallback>(
10235+
callback));
1029110236
}
1029210237

1029310238

deps/v8/src/api.cc

+24-27
Original file line numberDiff line numberDiff line change
@@ -874,16 +874,16 @@ Extension::Extension(const char* name,
874874
}
875875

876876
ResourceConstraints::ResourceConstraints()
877-
: max_semi_space_size_in_kb_(0),
877+
: max_semi_space_size_(0),
878878
max_old_space_size_(0),
879879
stack_limit_(NULL),
880880
code_range_size_(0),
881881
max_zone_pool_size_(0) {}
882882

883883
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
884884
uint64_t virtual_memory_limit) {
885-
set_max_semi_space_size_in_kb(
886-
i::Heap::ComputeMaxSemiSpaceSize(physical_memory));
885+
set_max_semi_space_size(
886+
static_cast<int>(i::Heap::ComputeMaxSemiSpaceSize(physical_memory)));
887887
set_max_old_space_size(
888888
static_cast<int>(i::Heap::ComputeMaxOldGenerationSize(physical_memory)));
889889
set_max_zone_pool_size(i::AccountingAllocator::kMaxPoolSize);
@@ -899,7 +899,7 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
899899

900900
void SetResourceConstraints(i::Isolate* isolate,
901901
const ResourceConstraints& constraints) {
902-
size_t semi_space_size = constraints.max_semi_space_size_in_kb();
902+
int semi_space_size = constraints.max_semi_space_size();
903903
int old_space_size = constraints.max_old_space_size();
904904
size_t code_range_size = constraints.code_range_size();
905905
size_t max_pool_size = constraints.max_zone_pool_size();
@@ -4492,6 +4492,24 @@ Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context,
44924492
}
44934493

44944494

4495+
bool v8::Object::ForceSet(v8::Local<Value> key, v8::Local<Value> value,
4496+
v8::PropertyAttribute attribs) {
4497+
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4498+
ENTER_V8_HELPER_DO_NOT_USE(isolate, Local<Context>(), Object, ForceSet,
4499+
false, i::HandleScope, false);
4500+
i::Handle<i::JSObject> self =
4501+
i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
4502+
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
4503+
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
4504+
has_pending_exception =
4505+
DefineObjectProperty(self, key_obj, value_obj,
4506+
static_cast<i::PropertyAttributes>(attribs))
4507+
.is_null();
4508+
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, false);
4509+
return true;
4510+
}
4511+
4512+
44954513
Maybe<bool> v8::Object::SetPrivate(Local<Context> context, Local<Private> key,
44964514
Local<Value> value) {
44974515
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
@@ -6318,16 +6336,11 @@ bool v8::V8::Initialize() {
63186336
return true;
63196337
}
63206338

6321-
#if V8_OS_POSIX
6322-
bool V8::TryHandleSignal(int signum, void* info, void* context) {
63236339
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
6324-
return v8::internal::trap_handler::TryHandleSignal(
6325-
signum, static_cast<siginfo_t*>(info), static_cast<ucontext_t*>(context));
6326-
#else // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
6340+
bool V8::TryHandleSignal(int signum, void* info, void* context) {
63276341
return false;
6328-
#endif
63296342
}
6330-
#endif
6343+
#endif // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
63316344

63326345
bool V8::RegisterDefaultSignalHandler() {
63336346
return v8::internal::trap_handler::RegisterDefaultSignalHandler();
@@ -7912,11 +7925,6 @@ v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() {
79127925
i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
79137926
size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
79147927
Contents contents;
7915-
contents.allocation_base_ = self->allocation_base();
7916-
contents.allocation_length_ = self->allocation_length();
7917-
contents.allocation_mode_ = self->has_guard_region()
7918-
? Allocator::AllocationMode::kReservation
7919-
: Allocator::AllocationMode::kNormal;
79207928
contents.data_ = self->backing_store();
79217929
contents.byte_length_ = byte_length;
79227930
return contents;
@@ -8128,12 +8136,6 @@ v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() {
81288136
Contents contents;
81298137
contents.data_ = self->backing_store();
81308138
contents.byte_length_ = byte_length;
8131-
// SharedArrayBuffers never have guard regions, so their allocation and data
8132-
// are equivalent.
8133-
contents.allocation_base_ = self->backing_store();
8134-
contents.allocation_length_ = byte_length;
8135-
contents.allocation_mode_ =
8136-
ArrayBufferAllocator::Allocator::AllocationMode::kNormal;
81378139
return contents;
81388140
}
81398141

@@ -8290,11 +8292,6 @@ void Isolate::ReportExternalAllocationLimitReached() {
82908292
heap->ReportExternalMemoryPressure();
82918293
}
82928294

8293-
void Isolate::CheckMemoryPressure() {
8294-
i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
8295-
if (heap->gc_state() != i::Heap::NOT_IN_GC) return;
8296-
heap->CheckMemoryPressure();
8297-
}
82988295

82998296
HeapProfiler* Isolate::GetHeapProfiler() {
83008297
i::HeapProfiler* heap_profiler =

0 commit comments

Comments
 (0)