Skip to content

revert: "feat: Updated V8 to latest version (8.9.0)" #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions NativeScript/include/cppgc/common.h

This file was deleted.

1 change: 0 additions & 1 deletion NativeScript/include/inspector/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace Paused {
namespace ReasonEnum {
V8_EXPORT extern const char* Ambiguous;
V8_EXPORT extern const char* Assert;
V8_EXPORT extern const char* CSPViolation;
V8_EXPORT extern const char* DebugCommand;
V8_EXPORT extern const char* DOM;
V8_EXPORT extern const char* EventListener;
Expand Down
32 changes: 0 additions & 32 deletions NativeScript/include/libplatform/libplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,6 @@ V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
InProcessStackDumping::kDisabled,
std::unique_ptr<v8::TracingController> tracing_controller = {});

/**
* The same as NewDefaultPlatform but disables the worker thread pool.
* It must be used with the --single-threaded V8 flag.
*/
V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform>
NewSingleThreadedDefaultPlatform(
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
InProcessStackDumping in_process_stack_dumping =
InProcessStackDumping::kDisabled,
std::unique_ptr<v8::TracingController> tracing_controller = {});

/**
* Returns a new instance of the default v8::JobHandle implementation.
*
* The job will be executed by spawning up to |num_worker_threads| many worker
* threads on the provided |platform| with the given |priority|.
*/
V8_PLATFORM_EXPORT std::unique_ptr<v8::JobHandle> NewDefaultJobHandle(
v8::Platform* platform, v8::TaskPriority priority,
std::unique_ptr<v8::JobTask> job_task, size_t num_worker_threads);

/**
* Pumps the message loop for the given isolate.
*
Expand Down Expand Up @@ -100,17 +79,6 @@ V8_PLATFORM_EXPORT void SetTracingController(
v8::Platform* platform,
v8::platform::tracing::TracingController* tracing_controller);

/**
* Notifies the given platform about the Isolate getting deleted soon. Has to be
* called for all Isolates which are deleted - unless we're shutting down the
* platform.
*
* The |platform| has to be created using |NewDefaultPlatform|.
*
*/
V8_PLATFORM_EXPORT void NotifyIsolateShutdown(v8::Platform* platform,
Isolate* isolate);

} // namespace platform
} // namespace v8

Expand Down
4 changes: 0 additions & 4 deletions NativeScript/include/v8-inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ class V8_EXPORT V8InspectorClient {
virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
return nullptr;
}
virtual std::unique_ptr<StringBuffer> descriptionForValueSubtype(
v8::Local<v8::Context>, v8::Local<v8::Value>) {
return nullptr;
}
virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
return false;
}
Expand Down
107 changes: 36 additions & 71 deletions NativeScript/include/v8-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,6 @@ constexpr bool HeapSandboxIsEnabled() {

using ExternalPointer_t = Address;

// If the heap sandbox is enabled, these tag values will be XORed with the
// external pointers in the external pointer table to prevent use of pointers of
// the wrong type.
enum ExternalPointerTag : Address {
kExternalPointerNullTag = static_cast<Address>(0ULL),
kArrayBufferBackingStoreTag = static_cast<Address>(1ULL << 48),
kTypedArrayExternalPointerTag = static_cast<Address>(2ULL << 48),
kDataViewDataPointerTag = static_cast<Address>(3ULL << 48),
kExternalStringResourceTag = static_cast<Address>(4ULL << 48),
kExternalStringResourceDataTag = static_cast<Address>(5ULL << 48),
kForeignForeignAddressTag = static_cast<Address>(6ULL << 48),
kNativeContextMicrotaskQueueTag = static_cast<Address>(7ULL << 48),
// TODO(v8:10391, saelo): Currently has to be zero so that raw zero values are
// also nullptr
kEmbedderDataSlotPayloadTag = static_cast<Address>(0ULL << 48),
};

#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
#else
Expand All @@ -157,20 +140,6 @@ V8_INLINE static constexpr internal::Address IntToSmi(int value) {
kSmiTag;
}

// Converts encoded external pointer to address.
V8_EXPORT Address DecodeExternalPointerImpl(const Isolate* isolate,
ExternalPointer_t pointer,
ExternalPointerTag tag);

// {obj} must be the raw tagged pointer representation of a HeapObject
// that's guaranteed to never be in ReadOnlySpace.
V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);

// Returns if we need to throw when an error occurs. This infers the language
// mode based on the current context and the closure. This returns true if the
// language mode is strict.
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);

/**
* This class exports constants and functionality from within v8 that
* is necessary to implement inline functions in the v8 api. Don't
Expand All @@ -190,9 +159,6 @@ class Internals {
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
#ifdef V8_HEAP_SANDBOX
static const int kEmbedderDataSlotRawPayloadOffset = kApiTaggedSize;
#endif
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
static const int kFullStringRepresentationMask = 0x0f;
static const int kStringEncodingMask = 0x8;
Expand All @@ -203,21 +169,21 @@ class Internals {

// IsolateData layout guarantees.
static const int kIsolateEmbedderDataOffset = 0;
static const int kIsolateFastCCallCallerFpOffset =
static const int kExternalMemoryOffset =
kNumIsolateDataSlots * kApiSystemPointerSize;
static const int kExternalMemoryLimitOffset =
kExternalMemoryOffset + kApiInt64Size;
static const int kExternalMemoryLowSinceMarkCompactOffset =
kExternalMemoryLimitOffset + kApiInt64Size;
static const int kIsolateFastCCallCallerFpOffset =
kExternalMemoryLowSinceMarkCompactOffset + kApiInt64Size;
static const int kIsolateFastCCallCallerPcOffset =
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
static const int kIsolateStackGuardOffset =
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
static const int kIsolateRootsOffset =
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;

static const int kExternalPointerTableBufferOffset = 0;
static const int kExternalPointerTableLengthOffset =
kExternalPointerTableBufferOffset + kApiSystemPointerSize;
static const int kExternalPointerTableCapacityOffset =
kExternalPointerTableLengthOffset + kApiInt32Size;

static const int kUndefinedValueRootIndex = 4;
static const int kTheHoleValueRootIndex = 5;
static const int kNullValueRootIndex = 6;
Expand Down Expand Up @@ -373,37 +339,16 @@ class Internals {
#endif
}

V8_INLINE static internal::Isolate* GetIsolateForHeapSandbox(
internal::Address obj) {
#ifdef V8_HEAP_SANDBOX
return internal::IsolateFromNeverReadOnlySpaceObject(obj);
#else
// Not used in non-sandbox mode.
return nullptr;
#endif
}

V8_INLINE static Address DecodeExternalPointer(
const Isolate* isolate, ExternalPointer_t encoded_pointer,
ExternalPointerTag tag) {
#ifdef V8_HEAP_SANDBOX
return internal::DecodeExternalPointerImpl(isolate, encoded_pointer, tag);
#else
return encoded_pointer;
#endif
}

V8_INLINE static internal::Address ReadExternalPointerField(
internal::Isolate* isolate, internal::Address heap_object_ptr, int offset,
ExternalPointerTag tag) {
#ifdef V8_HEAP_SANDBOX
internal::ExternalPointer_t encoded_value =
ReadRawField<uint32_t>(heap_object_ptr, offset);
internal::Isolate* isolate, internal::Address heap_object_ptr,
int offset) {
#ifdef V8_COMPRESS_POINTERS
internal::Address value = ReadRawField<Address>(heap_object_ptr, offset);
// We currently have to treat zero as nullptr in embedder slots.
return encoded_value ? DecodeExternalPointer(isolate, encoded_value, tag)
: 0;
if (value) value = DecodeExternalPointer(isolate, value);
return value;
#else
return ReadRawField<Address>(heap_object_ptr, offset);
return ReadRawField<internal::Address>(heap_object_ptr, offset);
#endif
}

Expand All @@ -412,6 +357,10 @@ class Internals {
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;

// See v8:10391 for details about V8 heap sandbox.
static constexpr uint32_t kExternalPointerSalt =
0x7fffffff & ~static_cast<uint32_t>(kHeapObjectTagMask);

V8_INLINE static internal::Address GetRootFromOnHeapAddress(
internal::Address addr) {
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
Expand All @@ -423,6 +372,14 @@ class Internals {
return root + static_cast<internal::Address>(static_cast<uintptr_t>(value));
}

V8_INLINE static Address DecodeExternalPointer(
const Isolate* isolate, ExternalPointer_t encoded_pointer) {
#ifndef V8_HEAP_SANDBOX
return encoded_pointer;
#else
return encoded_pointer ^ kExternalPointerSalt;
#endif
}
#endif // V8_COMPRESS_POINTERS
};

Expand All @@ -446,10 +403,18 @@ void CastCheck<false>::Perform(T* data) {}

template <class T>
V8_INLINE void PerformCastCheck(T* data) {
CastCheck<std::is_base_of<Data, T>::value &&
!std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
CastCheck<std::is_base_of<Data, T>::value>::Perform(data);
}

// {obj} must be the raw tagged pointer representation of a HeapObject
// that's guaranteed to never be in ReadOnlySpace.
V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);

// Returns if we need to throw when an error occurs. This infers the language
// mode based on the current context and the closure. This returns true if the
// language mode is strict.
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);

// A base class for backing stores, which is needed due to vagaries of
// how static casts work with std::shared_ptr.
class BackingStoreBase {};
Expand Down
Loading