Skip to content

Commit aa1a3ea

Browse files
addaleaxMylesBorins
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@{#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@{#47} Cr-Branched-From: 1bf2e10ddb194d4c2871a87a4732613419de892d-refs/heads/6.1.534@{#1} Cr-Branched-From: e825c4318eb2065ffdf9044aa6a5278635c36427-refs/heads/master@{#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@{#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@{#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@{#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@{#45671} v8: revert changes to Contents structs The feature is disabled by default anyway,but we disable it completely. Backport-PR-URL: #15393 PR-URL: #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 8471747 commit aa1a3ea

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
@@ -3097,9 +3097,12 @@ class V8_EXPORT Object : public Value {
30973097
//
30983098
// Note also that this only works for named properties.
30993099
V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty",
3100-
Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
3101-
Local<Value> value,
3102-
PropertyAttribute attribs = None));
3100+
bool ForceSet(Local<Value> key, Local<Value> value,
3101+
PropertyAttribute attribs = None));
3102+
V8_DEPRECATE_SOON("Use CreateDataProperty / DefineOwnProperty",
3103+
Maybe<bool> ForceSet(Local<Context> context,
3104+
Local<Value> key, Local<Value> value,
3105+
PropertyAttribute attribs = None));
31033106

31043107
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
31053108
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
@@ -4292,28 +4295,14 @@ class V8_EXPORT ArrayBuffer : public Object {
42924295
*/
42934296
class V8_EXPORT Contents { // NOLINT
42944297
public:
4295-
Contents()
4296-
: data_(nullptr),
4297-
byte_length_(0),
4298-
allocation_base_(nullptr),
4299-
allocation_length_(0),
4300-
allocation_mode_(Allocator::AllocationMode::kNormal) {}
4301-
4302-
void* AllocationBase() const { return allocation_base_; }
4303-
size_t AllocationLength() const { return allocation_length_; }
4304-
Allocator::AllocationMode AllocationMode() const {
4305-
return allocation_mode_;
4306-
}
4298+
Contents() : data_(NULL), byte_length_(0) {}
43074299

43084300
void* Data() const { return data_; }
43094301
size_t ByteLength() const { return byte_length_; }
43104302

43114303
private:
43124304
void* data_;
43134305
size_t byte_length_;
4314-
void* allocation_base_;
4315-
size_t allocation_length_;
4316-
Allocator::AllocationMode allocation_mode_;
43174306

43184307
friend class ArrayBuffer;
43194308
};
@@ -4662,28 +4651,14 @@ class V8_EXPORT SharedArrayBuffer : public Object {
46624651
*/
46634652
class V8_EXPORT Contents { // NOLINT
46644653
public:
4665-
Contents()
4666-
: data_(nullptr),
4667-
byte_length_(0),
4668-
allocation_base_(nullptr),
4669-
allocation_length_(0),
4670-
allocation_mode_(ArrayBuffer::Allocator::AllocationMode::kNormal) {}
4671-
4672-
void* AllocationBase() const { return allocation_base_; }
4673-
size_t AllocationLength() const { return allocation_length_; }
4674-
ArrayBuffer::Allocator::AllocationMode AllocationMode() const {
4675-
return allocation_mode_;
4676-
}
4654+
Contents() : data_(NULL), byte_length_(0) {}
46774655

46784656
void* Data() const { return data_; }
46794657
size_t ByteLength() const { return byte_length_; }
46804658

46814659
private:
46824660
void* data_;
46834661
size_t byte_length_;
4684-
void* allocation_base_;
4685-
size_t allocation_length_;
4686-
ArrayBuffer::Allocator::AllocationMode allocation_mode_;
46874662

46884663
friend class SharedArrayBuffer;
46894664
};
@@ -4930,8 +4905,8 @@ class V8_EXPORT External : public Value {
49304905
F(ArrayProto_forEach, array_for_each_iterator) \
49314906
F(ArrayProto_keys, array_keys_iterator) \
49324907
F(ArrayProto_values, array_values_iterator) \
4908+
F(IteratorPrototype, initial_iterator_prototype) \
49334909
F(ErrorPrototype, initial_error_prototype) \
4934-
F(IteratorPrototype, initial_iterator_prototype)
49354910

49364911
enum Intrinsic {
49374912
#define V8_DECL_INTRINSIC(name, iname) k##name,
@@ -5995,8 +5970,6 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
59955970
*
59965971
* The arguments for set_max_semi_space_size, set_max_old_space_size,
59975972
* set_max_executable_size, set_code_range_size specify limits in MB.
5998-
*
5999-
* The argument for set_max_semi_space_size_in_kb is in KB.
60005973
*/
60015974
class V8_EXPORT ResourceConstraints {
60025975
public:
@@ -6014,28 +5987,10 @@ class V8_EXPORT ResourceConstraints {
60145987
void ConfigureDefaults(uint64_t physical_memory,
60155988
uint64_t virtual_memory_limit);
60165989

6017-
// Returns the max semi-space size in MB.
6018-
V8_DEPRECATE_SOON("Use max_semi_space_size_in_kb()",
6019-
int max_semi_space_size()) {
6020-
return static_cast<int>(max_semi_space_size_in_kb_ / 1024);
6021-
}
6022-
6023-
// Sets the max semi-space size in MB.
6024-
V8_DEPRECATE_SOON("Use set_max_semi_space_size_in_kb(size_t limit_in_kb)",
6025-
void set_max_semi_space_size(int limit_in_mb)) {
6026-
max_semi_space_size_in_kb_ = limit_in_mb * 1024;
5990+
int max_semi_space_size() const { return max_semi_space_size_; }
5991+
void set_max_semi_space_size(int limit_in_mb) {
5992+
max_semi_space_size_ = limit_in_mb;
60275993
}
6028-
6029-
// Returns the max semi-space size in KB.
6030-
size_t max_semi_space_size_in_kb() const {
6031-
return max_semi_space_size_in_kb_;
6032-
}
6033-
6034-
// Sets the max semi-space size in KB.
6035-
void set_max_semi_space_size_in_kb(size_t limit_in_kb) {
6036-
max_semi_space_size_in_kb_ = limit_in_kb;
6037-
}
6038-
60395994
int max_old_space_size() const { return max_old_space_size_; }
60405995
void set_max_old_space_size(int limit_in_mb) {
60415996
max_old_space_size_ = limit_in_mb;
@@ -6061,10 +6016,7 @@ class V8_EXPORT ResourceConstraints {
60616016
}
60626017

60636018
private:
6064-
// max_semi_space_size_ is in KB
6065-
size_t max_semi_space_size_in_kb_;
6066-
6067-
// The remaining limits are in MB
6019+
int max_semi_space_size_;
60686020
int max_old_space_size_;
60696021
int max_executable_size_;
60706022
uint32_t* stack_limit_;
@@ -6293,8 +6245,22 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
62936245
*/
62946246
typedef bool (*DeprecatedAllowCodeGenerationFromStringsCallback)(
62956247
Local<Context> context);
6296-
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
6297-
Local<String> source);
6248+
// The naming of this alias is for **Node v8.x releases only**
6249+
// plain V8 >= 6.1 just calls it AllowCodeGenerationFromStringsCallback
6250+
typedef bool (*FreshNewAllowCodeGenerationFromStringsCallback)(
6251+
Local<Context> context, Local<String> source);
6252+
6253+
// a) no addon uses this anyway
6254+
// b) this is sufficient because c++ type mangling takes care of resolving
6255+
// the typedefs
6256+
// c) doing it this way allows people to use the Fresh New variant
6257+
#ifdef USING_V8_SHARED
6258+
typedef DeprecatedAllowCodeGenerationFromStringsCallback
6259+
AllowCodeGenerationFromStringsCallback;
6260+
#else
6261+
typedef FreshNewAllowCodeGenerationFromStringsCallback
6262+
AllowCodeGenerationFromStringsCallback;
6263+
#endif
62986264

62996265
// --- WebAssembly compilation callbacks ---
63006266
typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&);
@@ -7570,7 +7536,7 @@ class V8_EXPORT Isolate {
75707536
* strings should be allowed.
75717537
*/
75727538
void SetAllowCodeGenerationFromStringsCallback(
7573-
AllowCodeGenerationFromStringsCallback callback);
7539+
FreshNewAllowCodeGenerationFromStringsCallback callback);
75747540
V8_DEPRECATED("Use callback with source parameter.",
75757541
void SetAllowCodeGenerationFromStringsCallback(
75767542
DeprecatedAllowCodeGenerationFromStringsCallback callback));
@@ -7691,7 +7657,6 @@ class V8_EXPORT Isolate {
76917657
friend class PersistentValueMapBase;
76927658

76937659
void ReportExternalAllocationLimitReached();
7694-
void CheckMemoryPressure();
76957660
};
76967661

76977662
class V8_EXPORT StartupData {
@@ -8052,7 +8017,7 @@ class V8_EXPORT V8 {
80528017
*/
80538018
static void ShutdownPlatform();
80548019

8055-
#if V8_OS_POSIX
8020+
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
80568021
/**
80578022
* Give the V8 signal handler a chance to handle a fault.
80588023
*
@@ -8073,7 +8038,7 @@ class V8_EXPORT V8 {
80738038
* points to a ucontext_t structure.
80748039
*/
80758040
static bool TryHandleSignal(int signal_number, void* info, void* context);
8076-
#endif // V8_OS_POSIX
8041+
#endif // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
80778042

80788043
/**
80798044
* Enable the default signal handler rather than using one provided by the
@@ -8941,8 +8906,6 @@ class Internals {
89418906
static const int kExternalMemoryOffset = 4 * kApiPointerSize;
89428907
static const int kExternalMemoryLimitOffset =
89438908
kExternalMemoryOffset + kApiInt64Size;
8944-
static const int kExternalMemoryAtLastMarkCompactOffset =
8945-
kExternalMemoryLimitOffset + kApiInt64Size;
89468909
static const int kIsolateRootsOffset = kExternalMemoryLimitOffset +
89478910
kApiInt64Size + kApiInt64Size +
89488911
kApiPointerSize + kApiPointerSize;
@@ -10161,32 +10124,13 @@ uint32_t Isolate::GetNumberOfDataSlots() {
1016110124
int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
1016210125
int64_t change_in_bytes) {
1016310126
typedef internal::Internals I;
10164-
const int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
1016510127
int64_t* external_memory = reinterpret_cast<int64_t*>(
1016610128
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
10167-
int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
10129+
const int64_t external_memory_limit = *reinterpret_cast<int64_t*>(
1016810130
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
10169-
int64_t* external_memory_at_last_mc =
10170-
reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) +
10171-
I::kExternalMemoryAtLastMarkCompactOffset);
1017210131
const int64_t amount = *external_memory + change_in_bytes;
10173-
1017410132
*external_memory = amount;
10175-
10176-
int64_t allocation_diff_since_last_mc =
10177-
*external_memory_at_last_mc - *external_memory;
10178-
allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0
10179-
? -allocation_diff_since_last_mc
10180-
: allocation_diff_since_last_mc;
10181-
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10182-
CheckMemoryPressure();
10183-
}
10184-
10185-
if (change_in_bytes < 0) {
10186-
*external_memory_limit += change_in_bytes;
10187-
}
10188-
10189-
if (change_in_bytes > 0 && amount > *external_memory_limit) {
10133+
if (change_in_bytes > 0 && amount > external_memory_limit) {
1019010134
ReportExternalAllocationLimitReached();
1019110135
}
1019210136
return *external_memory;
@@ -10220,7 +10164,8 @@ void V8::SetAllowCodeGenerationFromStringsCallback(
1022010164
DeprecatedAllowCodeGenerationFromStringsCallback callback) {
1022110165
Isolate* isolate = Isolate::GetCurrent();
1022210166
isolate->SetAllowCodeGenerationFromStringsCallback(
10223-
reinterpret_cast<AllowCodeGenerationFromStringsCallback>(callback));
10167+
reinterpret_cast<FreshNewAllowCodeGenerationFromStringsCallback>(
10168+
callback));
1022410169
}
1022510170

1022610171

deps/v8/src/api.cc

+24-27
Original file line numberDiff line numberDiff line change
@@ -878,16 +878,16 @@ Extension::Extension(const char* name,
878878
}
879879

880880
ResourceConstraints::ResourceConstraints()
881-
: max_semi_space_size_in_kb_(0),
881+
: max_semi_space_size_(0),
882882
max_old_space_size_(0),
883883
stack_limit_(NULL),
884884
code_range_size_(0),
885885
max_zone_pool_size_(0) {}
886886

887887
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
888888
uint64_t virtual_memory_limit) {
889-
set_max_semi_space_size_in_kb(
890-
i::Heap::ComputeMaxSemiSpaceSize(physical_memory));
889+
set_max_semi_space_size(
890+
static_cast<int>(i::Heap::ComputeMaxSemiSpaceSize(physical_memory)));
891891
set_max_old_space_size(
892892
static_cast<int>(i::Heap::ComputeMaxOldGenerationSize(physical_memory)));
893893
set_max_zone_pool_size(i::AccountingAllocator::kMaxPoolSize);
@@ -903,7 +903,7 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
903903

904904
void SetResourceConstraints(i::Isolate* isolate,
905905
const ResourceConstraints& constraints) {
906-
size_t semi_space_size = constraints.max_semi_space_size_in_kb();
906+
int semi_space_size = constraints.max_semi_space_size();
907907
int old_space_size = constraints.max_old_space_size();
908908
size_t code_range_size = constraints.code_range_size();
909909
size_t max_pool_size = constraints.max_zone_pool_size();
@@ -4505,6 +4505,24 @@ Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context,
45054505
}
45064506

45074507

4508+
bool v8::Object::ForceSet(v8::Local<Value> key, v8::Local<Value> value,
4509+
v8::PropertyAttribute attribs) {
4510+
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4511+
ENTER_V8_HELPER_DO_NOT_USE(isolate, Local<Context>(), Object, ForceSet,
4512+
false, i::HandleScope, false);
4513+
i::Handle<i::JSObject> self =
4514+
i::Handle<i::JSObject>::cast(Utils::OpenHandle(this));
4515+
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
4516+
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
4517+
has_pending_exception =
4518+
DefineObjectProperty(self, key_obj, value_obj,
4519+
static_cast<i::PropertyAttributes>(attribs))
4520+
.is_null();
4521+
EXCEPTION_BAILOUT_CHECK_SCOPED_DO_NOT_USE(isolate, false);
4522+
return true;
4523+
}
4524+
4525+
45084526
Maybe<bool> v8::Object::SetPrivate(Local<Context> context, Local<Private> key,
45094527
Local<Value> value) {
45104528
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
@@ -6331,16 +6349,11 @@ bool v8::V8::Initialize() {
63316349
return true;
63326350
}
63336351

6334-
#if V8_OS_POSIX
6335-
bool V8::TryHandleSignal(int signum, void* info, void* context) {
63366352
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
6337-
return v8::internal::trap_handler::TryHandleSignal(
6338-
signum, static_cast<siginfo_t*>(info), static_cast<ucontext_t*>(context));
6339-
#else // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
6353+
bool V8::TryHandleSignal(int signum, void* info, void* context) {
63406354
return false;
6341-
#endif
63426355
}
6343-
#endif
6356+
#endif // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
63446357

63456358
bool V8::RegisterDefaultSignalHandler() {
63466359
return v8::internal::trap_handler::RegisterDefaultSignalHandler();
@@ -7882,11 +7895,6 @@ v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() {
78827895
i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
78837896
size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
78847897
Contents contents;
7885-
contents.allocation_base_ = self->allocation_base();
7886-
contents.allocation_length_ = self->allocation_length();
7887-
contents.allocation_mode_ = self->has_guard_region()
7888-
? Allocator::AllocationMode::kReservation
7889-
: Allocator::AllocationMode::kNormal;
78907898
contents.data_ = self->backing_store();
78917899
contents.byte_length_ = byte_length;
78927900
return contents;
@@ -8095,12 +8103,6 @@ v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() {
80958103
Contents contents;
80968104
contents.data_ = self->backing_store();
80978105
contents.byte_length_ = byte_length;
8098-
// SharedArrayBuffers never have guard regions, so their allocation and data
8099-
// are equivalent.
8100-
contents.allocation_base_ = self->backing_store();
8101-
contents.allocation_length_ = byte_length;
8102-
contents.allocation_mode_ =
8103-
ArrayBufferAllocator::Allocator::AllocationMode::kNormal;
81048106
return contents;
81058107
}
81068108

@@ -8257,11 +8259,6 @@ void Isolate::ReportExternalAllocationLimitReached() {
82578259
heap->ReportExternalMemoryPressure();
82588260
}
82598261

8260-
void Isolate::CheckMemoryPressure() {
8261-
i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
8262-
if (heap->gc_state() != i::Heap::NOT_IN_GC) return;
8263-
heap->CheckMemoryPressure();
8264-
}
82658262

82668263
HeapProfiler* Isolate::GetHeapProfiler() {
82678264
i::HeapProfiler* heap_profiler =

0 commit comments

Comments
 (0)