Skip to content

Commit 20ed811

Browse files
authored
Revert "feat: Updated V8 to latest version (#84)" (#101)
This reverts commit d56a260.
1 parent 92195e8 commit 20ed811

File tree

157 files changed

+22678
-12022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+22678
-12022
lines changed

NativeScript/include/cppgc/common.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

NativeScript/include/inspector/Debugger.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ namespace Paused {
3131
namespace ReasonEnum {
3232
V8_EXPORT extern const char* Ambiguous;
3333
V8_EXPORT extern const char* Assert;
34-
V8_EXPORT extern const char* CSPViolation;
3534
V8_EXPORT extern const char* DebugCommand;
3635
V8_EXPORT extern const char* DOM;
3736
V8_EXPORT extern const char* EventListener;

NativeScript/include/libplatform/libplatform.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,6 @@ V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
4343
InProcessStackDumping::kDisabled,
4444
std::unique_ptr<v8::TracingController> tracing_controller = {});
4545

46-
/**
47-
* The same as NewDefaultPlatform but disables the worker thread pool.
48-
* It must be used with the --single-threaded V8 flag.
49-
*/
50-
V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform>
51-
NewSingleThreadedDefaultPlatform(
52-
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
53-
InProcessStackDumping in_process_stack_dumping =
54-
InProcessStackDumping::kDisabled,
55-
std::unique_ptr<v8::TracingController> tracing_controller = {});
56-
57-
/**
58-
* Returns a new instance of the default v8::JobHandle implementation.
59-
*
60-
* The job will be executed by spawning up to |num_worker_threads| many worker
61-
* threads on the provided |platform| with the given |priority|.
62-
*/
63-
V8_PLATFORM_EXPORT std::unique_ptr<v8::JobHandle> NewDefaultJobHandle(
64-
v8::Platform* platform, v8::TaskPriority priority,
65-
std::unique_ptr<v8::JobTask> job_task, size_t num_worker_threads);
66-
6746
/**
6847
* Pumps the message loop for the given isolate.
6948
*
@@ -100,17 +79,6 @@ V8_PLATFORM_EXPORT void SetTracingController(
10079
v8::Platform* platform,
10180
v8::platform::tracing::TracingController* tracing_controller);
10281

103-
/**
104-
* Notifies the given platform about the Isolate getting deleted soon. Has to be
105-
* called for all Isolates which are deleted - unless we're shutting down the
106-
* platform.
107-
*
108-
* The |platform| has to be created using |NewDefaultPlatform|.
109-
*
110-
*/
111-
V8_PLATFORM_EXPORT void NotifyIsolateShutdown(v8::Platform* platform,
112-
Isolate* isolate);
113-
11482
} // namespace platform
11583
} // namespace v8
11684

NativeScript/include/v8-inspector.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,6 @@ class V8_EXPORT V8InspectorClient {
181181
virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
182182
return nullptr;
183183
}
184-
virtual std::unique_ptr<StringBuffer> descriptionForValueSubtype(
185-
v8::Local<v8::Context>, v8::Local<v8::Value>) {
186-
return nullptr;
187-
}
188184
virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
189185
return false;
190186
}

NativeScript/include/v8-internal.h

Lines changed: 36 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,6 @@ constexpr bool HeapSandboxIsEnabled() {
120120

121121
using ExternalPointer_t = Address;
122122

123-
// If the heap sandbox is enabled, these tag values will be XORed with the
124-
// external pointers in the external pointer table to prevent use of pointers of
125-
// the wrong type.
126-
enum ExternalPointerTag : Address {
127-
kExternalPointerNullTag = static_cast<Address>(0ULL),
128-
kArrayBufferBackingStoreTag = static_cast<Address>(1ULL << 48),
129-
kTypedArrayExternalPointerTag = static_cast<Address>(2ULL << 48),
130-
kDataViewDataPointerTag = static_cast<Address>(3ULL << 48),
131-
kExternalStringResourceTag = static_cast<Address>(4ULL << 48),
132-
kExternalStringResourceDataTag = static_cast<Address>(5ULL << 48),
133-
kForeignForeignAddressTag = static_cast<Address>(6ULL << 48),
134-
kNativeContextMicrotaskQueueTag = static_cast<Address>(7ULL << 48),
135-
// TODO(v8:10391, saelo): Currently has to be zero so that raw zero values are
136-
// also nullptr
137-
kEmbedderDataSlotPayloadTag = static_cast<Address>(0ULL << 48),
138-
};
139-
140123
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
141124
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
142125
#else
@@ -157,20 +140,6 @@ V8_INLINE static constexpr internal::Address IntToSmi(int value) {
157140
kSmiTag;
158141
}
159142

160-
// Converts encoded external pointer to address.
161-
V8_EXPORT Address DecodeExternalPointerImpl(const Isolate* isolate,
162-
ExternalPointer_t pointer,
163-
ExternalPointerTag tag);
164-
165-
// {obj} must be the raw tagged pointer representation of a HeapObject
166-
// that's guaranteed to never be in ReadOnlySpace.
167-
V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
168-
169-
// Returns if we need to throw when an error occurs. This infers the language
170-
// mode based on the current context and the closure. This returns true if the
171-
// language mode is strict.
172-
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
173-
174143
/**
175144
* This class exports constants and functionality from within v8 that
176145
* is necessary to implement inline functions in the v8 api. Don't
@@ -190,9 +159,6 @@ class Internals {
190159
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
191160
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
192161
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
193-
#ifdef V8_HEAP_SANDBOX
194-
static const int kEmbedderDataSlotRawPayloadOffset = kApiTaggedSize;
195-
#endif
196162
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
197163
static const int kFullStringRepresentationMask = 0x0f;
198164
static const int kStringEncodingMask = 0x8;
@@ -203,21 +169,21 @@ class Internals {
203169

204170
// IsolateData layout guarantees.
205171
static const int kIsolateEmbedderDataOffset = 0;
206-
static const int kIsolateFastCCallCallerFpOffset =
172+
static const int kExternalMemoryOffset =
207173
kNumIsolateDataSlots * kApiSystemPointerSize;
174+
static const int kExternalMemoryLimitOffset =
175+
kExternalMemoryOffset + kApiInt64Size;
176+
static const int kExternalMemoryLowSinceMarkCompactOffset =
177+
kExternalMemoryLimitOffset + kApiInt64Size;
178+
static const int kIsolateFastCCallCallerFpOffset =
179+
kExternalMemoryLowSinceMarkCompactOffset + kApiInt64Size;
208180
static const int kIsolateFastCCallCallerPcOffset =
209181
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
210182
static const int kIsolateStackGuardOffset =
211183
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
212184
static const int kIsolateRootsOffset =
213185
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
214186

215-
static const int kExternalPointerTableBufferOffset = 0;
216-
static const int kExternalPointerTableLengthOffset =
217-
kExternalPointerTableBufferOffset + kApiSystemPointerSize;
218-
static const int kExternalPointerTableCapacityOffset =
219-
kExternalPointerTableLengthOffset + kApiInt32Size;
220-
221187
static const int kUndefinedValueRootIndex = 4;
222188
static const int kTheHoleValueRootIndex = 5;
223189
static const int kNullValueRootIndex = 6;
@@ -373,37 +339,16 @@ class Internals {
373339
#endif
374340
}
375341

376-
V8_INLINE static internal::Isolate* GetIsolateForHeapSandbox(
377-
internal::Address obj) {
378-
#ifdef V8_HEAP_SANDBOX
379-
return internal::IsolateFromNeverReadOnlySpaceObject(obj);
380-
#else
381-
// Not used in non-sandbox mode.
382-
return nullptr;
383-
#endif
384-
}
385-
386-
V8_INLINE static Address DecodeExternalPointer(
387-
const Isolate* isolate, ExternalPointer_t encoded_pointer,
388-
ExternalPointerTag tag) {
389-
#ifdef V8_HEAP_SANDBOX
390-
return internal::DecodeExternalPointerImpl(isolate, encoded_pointer, tag);
391-
#else
392-
return encoded_pointer;
393-
#endif
394-
}
395-
396342
V8_INLINE static internal::Address ReadExternalPointerField(
397-
internal::Isolate* isolate, internal::Address heap_object_ptr, int offset,
398-
ExternalPointerTag tag) {
399-
#ifdef V8_HEAP_SANDBOX
400-
internal::ExternalPointer_t encoded_value =
401-
ReadRawField<uint32_t>(heap_object_ptr, offset);
343+
internal::Isolate* isolate, internal::Address heap_object_ptr,
344+
int offset) {
345+
#ifdef V8_COMPRESS_POINTERS
346+
internal::Address value = ReadRawField<Address>(heap_object_ptr, offset);
402347
// We currently have to treat zero as nullptr in embedder slots.
403-
return encoded_value ? DecodeExternalPointer(isolate, encoded_value, tag)
404-
: 0;
348+
if (value) value = DecodeExternalPointer(isolate, value);
349+
return value;
405350
#else
406-
return ReadRawField<Address>(heap_object_ptr, offset);
351+
return ReadRawField<internal::Address>(heap_object_ptr, offset);
407352
#endif
408353
}
409354

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

360+
// See v8:10391 for details about V8 heap sandbox.
361+
static constexpr uint32_t kExternalPointerSalt =
362+
0x7fffffff & ~static_cast<uint32_t>(kHeapObjectTagMask);
363+
415364
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
416365
internal::Address addr) {
417366
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
@@ -423,6 +372,14 @@ class Internals {
423372
return root + static_cast<internal::Address>(static_cast<uintptr_t>(value));
424373
}
425374

375+
V8_INLINE static Address DecodeExternalPointer(
376+
const Isolate* isolate, ExternalPointer_t encoded_pointer) {
377+
#ifndef V8_HEAP_SANDBOX
378+
return encoded_pointer;
379+
#else
380+
return encoded_pointer ^ kExternalPointerSalt;
381+
#endif
382+
}
426383
#endif // V8_COMPRESS_POINTERS
427384
};
428385

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

447404
template <class T>
448405
V8_INLINE void PerformCastCheck(T* data) {
449-
CastCheck<std::is_base_of<Data, T>::value &&
450-
!std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
406+
CastCheck<std::is_base_of<Data, T>::value>::Perform(data);
451407
}
452408

409+
// {obj} must be the raw tagged pointer representation of a HeapObject
410+
// that's guaranteed to never be in ReadOnlySpace.
411+
V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
412+
413+
// Returns if we need to throw when an error occurs. This infers the language
414+
// mode based on the current context and the closure. This returns true if the
415+
// language mode is strict.
416+
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
417+
453418
// A base class for backing stores, which is needed due to vagaries of
454419
// how static casts work with std::shared_ptr.
455420
class BackingStoreBase {};

0 commit comments

Comments
 (0)