Skip to content
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

feat: v8 version 11.1.277.17 #219

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c4f5771
Upgrade v8 to v11.1.277.17
caitp Mar 27, 2023
b0b1a3e
Don't use libm trig functions in v8
caitp Mar 30, 2023
09d6cf2
rebuild v8 without the undefined symbols
caitp Mar 30, 2023
43ebf3d
incorporate updated v8 inspector files
caitp Mar 30, 2023
798391e
Allocate Wrapper objects using cppgc
caitp Mar 30, 2023
5adf2d8
Comment out no-longer-exposed API
caitp Mar 30, 2023
be72ea8
Simplify PrimitiveDataWrapper
caitp Apr 11, 2023
8e80998
Support v8::Isolate* as a first parameter to DataWrapper constructor
caitp May 1, 2023
a633f2d
Add class-name printers for debugging
caitp May 27, 2023
205f91c
ExternalData -- tool for identifying type of single-pointer instance …
caitp May 27, 2023
667fd73
Do not freeze flags after init
caitp May 27, 2023
740fec5
Initialize cppgc and attach CppHeap to Isolate
caitp May 27, 2023
474bad3
Add a convenience function for moving a wrapper to a new value (Unnee…
caitp May 27, 2023
5d5f227
Ignore -Werror failures due to deprecated string conversion apis
caitp May 27, 2023
29ec6d3
Rewrite SetValue/DeleteValue Helpers to use GarbageCollected<T> utils
caitp May 27, 2023
ad084af
Add an ObjectTemplate for a traceable ordinary Object wrapper
caitp May 27, 2023
c5738c0
Track "super" references in ObjCDataWrappers using traceable structs
caitp May 27, 2023
bf06c79
Add Clear() method to ConcurrentMap
caitp May 27, 2023
bfbd301
Revert "Add Clear() method to ConcurrentMap"
caitp May 27, 2023
7539351
get Reference tests passing
caitp May 27, 2023
ddc164f
get Pointer tests passing
caitp May 29, 2023
e87de02
get various function/block tests passing
caitp May 29, 2023
e36df03
refactor Struct types
caitp May 29, 2023
36d5e1a
Refactoring native Apple types
caitp May 29, 2023
92682ed
fixup ExtVectorWrapper
caitp May 29, 2023
a8f7125
Garbage changes to revert
caitp May 29, 2023
3b0e697
Revert "Garbage changes to revert"
caitp May 29, 2023
9f6d0b9
inspector: avoid diagnostic issue regarding use of deprecated string …
caitp May 29, 2023
84a3c57
Add Common.mm to project (ScriptWrappable helpers used by CPPGC code)
caitp May 29, 2023
bea9cad
Disable ObjectManager functionality (Temporarily)
caitp May 29, 2023
d2134c3
Addon to the Common.mm change from earlier
caitp May 29, 2023
740d468
Misc changes that might not be needed
caitp May 29, 2023
1b2c354
Pull in v8 library updates for m1
caitp May 29, 2023
ad9670b
Revert "Misc changes that might not be needed"
caitp May 29, 2023
9523366
chore: tmp disable worker tests
NathanWalker Jun 20, 2023
781d419
release: 8.6.0-alpha.0
NathanWalker Jun 20, 2023
11893ce
chore: cleanup changelog
NathanWalker Jun 20, 2023
6004801
release: 8.6.0-alpha.1
NathanWalker Jun 20, 2023
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
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# [8.6.0-alpha.1](https://github.com/NativeScript/ios/compare/v8.5.2...v8.6.0-alpha.1) (2023-06-20)


### Bug Fixes

* delay isolate disposal when isolate is in use ([5a6c2ee](https://github.com/NativeScript/ios/commit/5a6c2ee5efa0c557c94ae56da0d3b3a31911d1b8))


### Reverts

* Revert "Misc changes that might not be needed" ([ad9670b](https://github.com/NativeScript/ios/commit/ad9670b9c7fb347b5d59698adbadbf40c31fe86c))
* Revert "Garbage changes to revert" ([3b0e697](https://github.com/NativeScript/ios/commit/3b0e697b2ec9f4d5fc14f2c218fe25b16159f32f))
* Revert "Add Clear() method to ConcurrentMap" ([bfbd301](https://github.com/NativeScript/ios/commit/bfbd30198510d7526c7eef1e6949408a0aad992e))



# [8.6.0-alpha.0](https://github.com/NativeScript/ios/compare/v8.5.2...v8.6.0-alpha.0) (2023-06-20)


### Bug Fixes

* delay isolate disposal when isolate is in use ([5a6c2ee](https://github.com/NativeScript/ios/commit/5a6c2ee5efa0c557c94ae56da0d3b3a31911d1b8))


### Features

* Support v8 11.1.277.17 ([20be18a](https://github.com/NativeScript/ios/pull/218/commits/20be18ac6fe44a4cc517ccdb776f249f98a31b27))


## [8.5.2](https://github.com/NativeScript/ios/compare/v8.5.1...v8.5.2) (2023-05-24)


Expand Down
2 changes: 2 additions & 0 deletions NativeScript/include/cppgc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This allows Oilpan to run garbage collection in parallel with mutators running i
References to objects belonging to another thread's heap are modeled using cross-thread roots.
This is even true for on-heap to on-heap references.

Oilpan heaps may generally not be accessed from different threads unless otherwise noted.

## Heap partitioning

Oilpan's heaps are partitioned into spaces.
Expand Down
1 change: 0 additions & 1 deletion NativeScript/include/cppgc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef INCLUDE_CPPGC_COMMON_H_
#define INCLUDE_CPPGC_COMMON_H_

// TODO(chromium:1056170): Remove dependency on v8.
#include "v8config.h" // NOLINT(build/include_directory)

namespace cppgc {
Expand Down
15 changes: 7 additions & 8 deletions NativeScript/include/cppgc/cross-thread-persistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
if (!IsValid(raw)) return;
PersistentRegionLock guard;
CrossThreadPersistentRegion& region = this->GetPersistentRegion(raw);
SetNode(region.AllocateNode(this, &Trace));
SetNode(region.AllocateNode(this, &TraceAsRoot));
this->CheckPointer(raw);
}

Expand All @@ -138,7 +138,7 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
: CrossThreadPersistentBase(raw), LocationPolicy(loc) {
if (!IsValid(raw)) return;
CrossThreadPersistentRegion& region = this->GetPersistentRegion(raw);
SetNode(region.AllocateNode(this, &Trace));
SetNode(region.AllocateNode(this, &TraceAsRoot));
this->CheckPointer(raw);
}

Expand Down Expand Up @@ -349,9 +349,8 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
return ptr && ptr != kSentinelPointer;
}

static void Trace(Visitor* v, const void* ptr) {
const auto* handle = static_cast<const BasicCrossThreadPersistent*>(ptr);
v->TraceRoot(*handle, handle->Location());
static void TraceAsRoot(RootVisitor& root_visitor, const void* ptr) {
root_visitor.Trace(*static_cast<const BasicCrossThreadPersistent*>(ptr));
}

void AssignUnsafe(T* ptr) {
Expand All @@ -378,7 +377,7 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
SetValue(ptr);
if (!IsValid(ptr)) return;
PersistentRegionLock guard;
SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &Trace));
SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &TraceAsRoot));
this->CheckPointer(ptr);
}

Expand All @@ -398,7 +397,7 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
}
SetValue(ptr);
if (!IsValid(ptr)) return;
SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &Trace));
SetNode(this->GetPersistentRegion(ptr).AllocateNode(this, &TraceAsRoot));
this->CheckPointer(ptr);
}

Expand All @@ -416,7 +415,7 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
return static_cast<T*>(const_cast<void*>(GetValueFromGC()));
}

friend class cppgc::Visitor;
friend class internal::RootVisitor;
};

template <typename T, typename LocationPolicy, typename CheckingPolicy>
Expand Down
49 changes: 46 additions & 3 deletions NativeScript/include/cppgc/heap-consistency.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "cppgc/internal/write-barrier.h"
#include "cppgc/macros.h"
#include "cppgc/member.h"
#include "cppgc/trace-trait.h"
#include "v8config.h" // NOLINT(build/include_directory)

Expand Down Expand Up @@ -47,6 +48,29 @@ class HeapConsistency final {
return internal::WriteBarrier::GetWriteBarrierType(slot, value, params);
}

/**
* Gets the required write barrier type for a specific write. This override is
* only used for all the BasicMember types.
*
* \param slot Slot containing the pointer to the object. The slot itself
* must reside in an object that has been allocated using
* `MakeGarbageCollected()`.
* \param value The pointer to the object held via `BasicMember`.
* \param params Parameters that may be used for actual write barrier calls.
* Only filled if return value indicates that a write barrier is needed. The
* contents of the `params` are an implementation detail.
* \returns whether a write barrier is needed and which barrier to invoke.
*/
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
typename CheckingPolicy>
static V8_INLINE WriteBarrierType GetWriteBarrierType(
const internal::BasicMember<T, WeaknessTag, WriteBarrierPolicy,
CheckingPolicy>& value,
WriteBarrierParams& params) {
return internal::WriteBarrier::GetWriteBarrierType(
value.GetRawSlot(), value.GetRawStorage(), params);
}

/**
* Gets the required write barrier type for a specific write.
*
Expand Down Expand Up @@ -146,7 +170,25 @@ class HeapConsistency final {
*/
static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params,
const void* slot) {
internal::WriteBarrier::GenerationalBarrier(params, slot);
internal::WriteBarrier::GenerationalBarrier<
internal::WriteBarrier::GenerationalBarrierType::kPreciseSlot>(params,
slot);
}

/**
* Generational barrier for maintaining consistency when running with multiple
* generations. This version is used when slot contains uncompressed pointer.
*
* \param params The parameters retrieved from `GetWriteBarrierType()`.
* \param slot Uncompressed slot containing the direct pointer to the object.
* The slot itself must reside in an object that has been allocated using
* `MakeGarbageCollected()`.
*/
static V8_INLINE void GenerationalBarrierForUncompressedSlot(
const WriteBarrierParams& params, const void* uncompressed_slot) {
internal::WriteBarrier::GenerationalBarrier<
internal::WriteBarrier::GenerationalBarrierType::
kPreciseUncompressedSlot>(params, uncompressed_slot);
}

/**
Expand All @@ -158,8 +200,9 @@ class HeapConsistency final {
*/
static V8_INLINE void GenerationalBarrierForSourceObject(
const WriteBarrierParams& params, const void* inner_pointer) {
internal::WriteBarrier::GenerationalBarrierForSourceObject(params,
inner_pointer);
internal::WriteBarrier::GenerationalBarrier<
internal::WriteBarrier::GenerationalBarrierType::kImpreciseSlot>(
params, inner_pointer);
}

private:
Expand Down
48 changes: 48 additions & 0 deletions NativeScript/include/cppgc/heap-handle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef INCLUDE_CPPGC_HEAP_HANDLE_H_
#define INCLUDE_CPPGC_HEAP_HANDLE_H_

#include "v8config.h" // NOLINT(build/include_directory)

namespace cppgc {

namespace internal {
class HeapBase;
class WriteBarrierTypeForCagedHeapPolicy;
class WriteBarrierTypeForNonCagedHeapPolicy;
} // namespace internal

/**
* Opaque handle used for additional heap APIs.
*/
class HeapHandle {
public:
// Deleted copy ctor to avoid treating the type by value.
HeapHandle(const HeapHandle&) = delete;
HeapHandle& operator=(const HeapHandle&) = delete;

private:
HeapHandle() = default;

V8_INLINE bool is_incremental_marking_in_progress() const {
return is_incremental_marking_in_progress_;
}

V8_INLINE bool is_young_generation_enabled() const {
return is_young_generation_enabled_;
}

bool is_incremental_marking_in_progress_ = false;
bool is_young_generation_enabled_ = false;

friend class internal::HeapBase;
friend class internal::WriteBarrierTypeForCagedHeapPolicy;
friend class internal::WriteBarrierTypeForNonCagedHeapPolicy;
};

} // namespace cppgc

#endif // INCLUDE_CPPGC_HEAP_HANDLE_H_
4 changes: 2 additions & 2 deletions NativeScript/include/cppgc/heap-statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct HeapStatistics final {
/** Amount of memory actually used on the page. */
size_t used_size_bytes = 0;
/** Statistics for object allocated on the page. Filled only when
* NameProvider::HideInternalNames() is false. */
* NameProvider::SupportsCppClassNamesAsObjectNames() is true. */
std::vector<ObjectStatsEntry> object_statistics;
};

Expand Down Expand Up @@ -98,7 +98,7 @@ struct HeapStatistics final {

/** Overall committed amount of memory for the heap. */
size_t committed_size_bytes = 0;
/** Resident amount of memory help by the heap. */
/** Resident amount of memory held by the heap. */
size_t resident_size_bytes = 0;
/** Amount of memory actually used on the heap. */
size_t used_size_bytes = 0;
Expand Down
10 changes: 3 additions & 7 deletions NativeScript/include/cppgc/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace cppgc {

class AllocationHandle;
class HeapHandle;

/**
* Implementation details of cppgc. Those details are considered internal and
Expand All @@ -31,11 +32,6 @@ namespace internal {
class Heap;
} // namespace internal

/**
* Used for additional heap APIs.
*/
class HeapHandle;

class V8_EXPORT Heap {
public:
/**
Expand All @@ -59,7 +55,7 @@ class V8_EXPORT Heap {
};

/**
* Specifies supported marking types
* Specifies supported marking types.
*/
enum class MarkingType : uint8_t {
/**
Expand All @@ -79,7 +75,7 @@ class V8_EXPORT Heap {
};

/**
* Specifies supported sweeping types
* Specifies supported sweeping types.
*/
enum class SweepingType : uint8_t {
/**
Expand Down
12 changes: 11 additions & 1 deletion NativeScript/include/cppgc/internal/api-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};

static constexpr size_t kPageSize = size_t{1} << 17;

#if defined(V8_TARGET_ARCH_ARM64) && defined(V8_OS_MACOS)
constexpr size_t kGuardPageSize = 0;
#else
constexpr size_t kGuardPageSize = 4096;
#endif

static constexpr size_t kLargeObjectSizeThreshold = kPageSize / 2;

#if defined(CPPGC_CAGED_HEAP)
#if defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapReservationSize = static_cast<size_t>(2) * kGB;
#else // !defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapReservationSize = static_cast<size_t>(4) * kGB;
#endif // !defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapReservationAlignment = kCagedHeapReservationSize;
#endif
#endif // defined(CPPGC_CAGED_HEAP)

static constexpr size_t kDefaultAlignment = sizeof(void*);

Expand Down
45 changes: 45 additions & 0 deletions NativeScript/include/cppgc/internal/base-page-handle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef INCLUDE_CPPGC_INTERNAL_BASE_PAGE_HANDLE_H_
#define INCLUDE_CPPGC_INTERNAL_BASE_PAGE_HANDLE_H_

#include "cppgc/heap-handle.h"
#include "cppgc/internal/api-constants.h"
#include "cppgc/internal/logging.h"
#include "v8config.h" // NOLINT(build/include_directory)

namespace cppgc {
namespace internal {

// The class is needed in the header to allow for fast access to HeapHandle in
// the write barrier.
class BasePageHandle {
public:
static V8_INLINE BasePageHandle* FromPayload(void* payload) {
return reinterpret_cast<BasePageHandle*>(
(reinterpret_cast<uintptr_t>(payload) &
~(api_constants::kPageSize - 1)) +
api_constants::kGuardPageSize);
}
static V8_INLINE const BasePageHandle* FromPayload(const void* payload) {
return FromPayload(const_cast<void*>(payload));
}

HeapHandle& heap_handle() { return heap_handle_; }
const HeapHandle& heap_handle() const { return heap_handle_; }

protected:
explicit BasePageHandle(HeapHandle& heap_handle) : heap_handle_(heap_handle) {
CPPGC_DCHECK(reinterpret_cast<uintptr_t>(this) % api_constants::kPageSize ==
api_constants::kGuardPageSize);
}

HeapHandle& heap_handle_;
};

} // namespace internal
} // namespace cppgc

#endif // INCLUDE_CPPGC_INTERNAL_BASE_PAGE_HANDLE_H_
Loading