Skip to content

Commit 0e14e89

Browse files
committed
v8: revert changes to Contents structs
The feature is disabled by default anyway,but we disable it completely.
1 parent c0bbd57 commit 0e14e89

File tree

5 files changed

+9
-115
lines changed

5 files changed

+9
-115
lines changed

deps/v8/include/v8.h

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,28 +4295,14 @@ class V8_EXPORT ArrayBuffer : public Object {
42954295
*/
42964296
class V8_EXPORT Contents { // NOLINT
42974297
public:
4298-
Contents()
4299-
: data_(nullptr),
4300-
byte_length_(0),
4301-
allocation_base_(nullptr),
4302-
allocation_length_(0),
4303-
allocation_mode_(Allocator::AllocationMode::kNormal) {}
4304-
4305-
void* AllocationBase() const { return allocation_base_; }
4306-
size_t AllocationLength() const { return allocation_length_; }
4307-
Allocator::AllocationMode AllocationMode() const {
4308-
return allocation_mode_;
4309-
}
4298+
Contents() : data_(NULL), byte_length_(0) {}
43104299

43114300
void* Data() const { return data_; }
43124301
size_t ByteLength() const { return byte_length_; }
43134302

43144303
private:
43154304
void* data_;
43164305
size_t byte_length_;
4317-
void* allocation_base_;
4318-
size_t allocation_length_;
4319-
Allocator::AllocationMode allocation_mode_;
43204306

43214307
friend class ArrayBuffer;
43224308
};
@@ -4665,28 +4651,14 @@ class V8_EXPORT SharedArrayBuffer : public Object {
46654651
*/
46664652
class V8_EXPORT Contents { // NOLINT
46674653
public:
4668-
Contents()
4669-
: data_(nullptr),
4670-
byte_length_(0),
4671-
allocation_base_(nullptr),
4672-
allocation_length_(0),
4673-
allocation_mode_(ArrayBuffer::Allocator::AllocationMode::kNormal) {}
4674-
4675-
void* AllocationBase() const { return allocation_base_; }
4676-
size_t AllocationLength() const { return allocation_length_; }
4677-
ArrayBuffer::Allocator::AllocationMode AllocationMode() const {
4678-
return allocation_mode_;
4679-
}
4654+
Contents() : data_(NULL), byte_length_(0) {}
46804655

46814656
void* Data() const { return data_; }
46824657
size_t ByteLength() const { return byte_length_; }
46834658

46844659
private:
46854660
void* data_;
46864661
size_t byte_length_;
4687-
void* allocation_base_;
4688-
size_t allocation_length_;
4689-
ArrayBuffer::Allocator::AllocationMode allocation_mode_;
46904662

46914663
friend class SharedArrayBuffer;
46924664
};
@@ -8046,7 +8018,7 @@ class V8_EXPORT V8 {
80468018
*/
80478019
static void ShutdownPlatform();
80488020

8049-
#if V8_OS_POSIX
8021+
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
80508022
/**
80518023
* Give the V8 signal handler a chance to handle a fault.
80528024
*
@@ -8067,7 +8039,7 @@ class V8_EXPORT V8 {
80678039
* points to a ucontext_t structure.
80688040
*/
80698041
static bool TryHandleSignal(int signal_number, void* info, void* context);
8070-
#endif // V8_OS_POSIX
8042+
#endif // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
80718043

80728044
/**
80738045
* Enable the default signal handler rather than using one provided by the

deps/v8/src/api.cc

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6349,16 +6349,11 @@ bool v8::V8::Initialize() {
63496349
return true;
63506350
}
63516351

6352-
#if V8_OS_POSIX
6353-
bool V8::TryHandleSignal(int signum, void* info, void* context) {
63546352
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
6355-
return v8::internal::trap_handler::TryHandleSignal(
6356-
signum, static_cast<siginfo_t*>(info), static_cast<ucontext_t*>(context));
6357-
#else // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
6353+
bool V8::TryHandleSignal(int signum, void* info, void* context) {
63586354
return false;
6359-
#endif
63606355
}
6361-
#endif
6356+
#endif // V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
63626357

63636358
bool V8::RegisterDefaultSignalHandler() {
63646359
return v8::internal::trap_handler::RegisterDefaultSignalHandler();
@@ -7900,11 +7895,6 @@ v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() {
79007895
i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
79017896
size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
79027897
Contents contents;
7903-
contents.allocation_base_ = self->allocation_base();
7904-
contents.allocation_length_ = self->allocation_length();
7905-
contents.allocation_mode_ = self->has_guard_region()
7906-
? Allocator::AllocationMode::kReservation
7907-
: Allocator::AllocationMode::kNormal;
79087898
contents.data_ = self->backing_store();
79097899
contents.byte_length_ = byte_length;
79107900
return contents;
@@ -8113,12 +8103,6 @@ v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() {
81138103
Contents contents;
81148104
contents.data_ = self->backing_store();
81158105
contents.byte_length_ = byte_length;
8116-
// SharedArrayBuffers never have guard regions, so their allocation and data
8117-
// are equivalent.
8118-
contents.allocation_base_ = self->backing_store();
8119-
contents.allocation_length_ = byte_length;
8120-
contents.allocation_mode_ =
8121-
ArrayBufferAllocator::Allocator::AllocationMode::kNormal;
81228106
return contents;
81238107
}
81248108

deps/v8/src/trap-handler/handler-inside.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ namespace trap_handler {
3636

3737
namespace {
3838

39+
#if V8_TRAP_HANDLER_SUPPORTED
3940
bool IsKernelGeneratedSignal(siginfo_t* info) {
4041
return info->si_code > 0 && info->si_code != SI_USER &&
4142
info->si_code != SI_QUEUE && info->si_code != SI_TIMER &&
4243
info->si_code != SI_ASYNCIO && info->si_code != SI_MESGQ;
4344
}
4445

45-
#if V8_TRAP_HANDLER_SUPPORTED
4646
class SigUnmaskStack {
4747
public:
4848
explicit SigUnmaskStack(sigset_t sigs) {

deps/v8/src/trap-handler/trap-handler.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ namespace v8 {
2121
namespace internal {
2222
namespace trap_handler {
2323

24-
// TODO(eholk): Support trap handlers on other platforms.
25-
#if V8_TARGET_ARCH_X64 && V8_OS_LINUX && !V8_OS_ANDROID
26-
#define V8_TRAP_HANDLER_SUPPORTED 1
27-
#else
2824
#define V8_TRAP_HANDLER_SUPPORTED 0
29-
#endif
3025

3126
struct ProtectedInstructionData {
3227
// The offset of this instruction from the start of its code object.

deps/v8/test/cctest/test-api.cc

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3453,16 +3453,10 @@ class ScopedArrayBufferContents {
34533453
public:
34543454
explicit ScopedArrayBufferContents(const v8::ArrayBuffer::Contents& contents)
34553455
: contents_(contents) {}
3456-
~ScopedArrayBufferContents() { free(contents_.AllocationBase()); }
3456+
~ScopedArrayBufferContents() { free(contents_.Data()); }
34573457
void* Data() const { return contents_.Data(); }
34583458
size_t ByteLength() const { return contents_.ByteLength(); }
34593459

3460-
void* AllocationBase() const { return contents_.AllocationBase(); }
3461-
size_t AllocationLength() const { return contents_.AllocationLength(); }
3462-
v8::ArrayBuffer::Allocator::AllocationMode AllocationMode() const {
3463-
return contents_.AllocationMode();
3464-
}
3465-
34663460
private:
34673461
const v8::ArrayBuffer::Contents contents_;
34683462
};
@@ -3738,43 +3732,15 @@ THREADED_TEST(ArrayBuffer_NeuteringScript) {
37383732
CheckDataViewIsNeutered(dv);
37393733
}
37403734

3741-
THREADED_TEST(ArrayBuffer_AllocationInformation) {
3742-
LocalContext env;
3743-
v8::Isolate* isolate = env->GetIsolate();
3744-
v8::HandleScope handle_scope(isolate);
3745-
3746-
const size_t ab_size = 1024;
3747-
Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, ab_size);
3748-
ScopedArrayBufferContents contents(ab->Externalize());
3749-
3750-
// Array buffers should have normal allocation mode.
3751-
CHECK(contents.AllocationMode() ==
3752-
v8::ArrayBuffer::Allocator::AllocationMode::kNormal);
3753-
// The allocation must contain the buffer (normally they will be equal, but
3754-
// this is not required by the contract).
3755-
CHECK_NOT_NULL(contents.AllocationBase());
3756-
const uintptr_t alloc =
3757-
reinterpret_cast<uintptr_t>(contents.AllocationBase());
3758-
const uintptr_t data = reinterpret_cast<uintptr_t>(contents.Data());
3759-
CHECK_LE(alloc, data);
3760-
CHECK_LE(data + contents.ByteLength(), alloc + contents.AllocationLength());
3761-
}
3762-
37633735
class ScopedSharedArrayBufferContents {
37643736
public:
37653737
explicit ScopedSharedArrayBufferContents(
37663738
const v8::SharedArrayBuffer::Contents& contents)
37673739
: contents_(contents) {}
3768-
~ScopedSharedArrayBufferContents() { free(contents_.AllocationBase()); }
3740+
~ScopedSharedArrayBufferContents() { free(contents_.Data()); }
37693741
void* Data() const { return contents_.Data(); }
37703742
size_t ByteLength() const { return contents_.ByteLength(); }
37713743

3772-
void* AllocationBase() const { return contents_.AllocationBase(); }
3773-
size_t AllocationLength() const { return contents_.AllocationLength(); }
3774-
v8::ArrayBuffer::Allocator::AllocationMode AllocationMode() const {
3775-
return contents_.AllocationMode();
3776-
}
3777-
37783744
private:
37793745
const v8::SharedArrayBuffer::Contents contents_;
37803746
};
@@ -26057,29 +26023,6 @@ TEST(FutexInterruption) {
2605726023
timeout_thread.Join();
2605826024
}
2605926025

26060-
THREADED_TEST(SharedArrayBuffer_AllocationInformation) {
26061-
i::FLAG_harmony_sharedarraybuffer = true;
26062-
LocalContext env;
26063-
v8::Isolate* isolate = env->GetIsolate();
26064-
v8::HandleScope handle_scope(isolate);
26065-
26066-
const size_t ab_size = 1024;
26067-
Local<v8::SharedArrayBuffer> ab =
26068-
v8::SharedArrayBuffer::New(isolate, ab_size);
26069-
ScopedSharedArrayBufferContents contents(ab->Externalize());
26070-
26071-
// Array buffers should have normal allocation mode.
26072-
CHECK(contents.AllocationMode() ==
26073-
v8::ArrayBuffer::Allocator::AllocationMode::kNormal);
26074-
// The allocation must contain the buffer (normally they will be equal, but
26075-
// this is not required by the contract).
26076-
CHECK_NOT_NULL(contents.AllocationBase());
26077-
const uintptr_t alloc =
26078-
reinterpret_cast<uintptr_t>(contents.AllocationBase());
26079-
const uintptr_t data = reinterpret_cast<uintptr_t>(contents.Data());
26080-
CHECK_LE(alloc, data);
26081-
CHECK_LE(data + contents.ByteLength(), alloc + contents.AllocationLength());
26082-
}
2608326026

2608426027
static int nb_uncaught_exception_callback_calls = 0;
2608526028

0 commit comments

Comments
 (0)