Skip to content
Open
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
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 15
#define V8_MINOR_VERSION 8
#define V8_BUILD_NUMBER 62
#define V8_PATCH_LEVEL 44
#define V8_PATCH_LEVEL 61

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
13 changes: 13 additions & 0 deletions deps/v8/src/builtins/builtins-wasm-gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,19 @@ TNode<BoolT> WasmBuiltinsAssembler::InSharedSpace(TNode<HeapObject> object) {
return IsPageFlagSet(address, MemoryChunk::kInSharedHeap);
}

TNode<Object> WasmBuiltinsAssembler::LoadWasmRefFromSlot(
TNode<Object> object, TNode<IntPtrT> offset) {
TNode<IntPtrT> untagged_offset =
IntPtrSub(offset, IntPtrConstant(kHeapObjectTag));
#if V8_ENABLE_SANDBOX
return CAST(
LoadFromObject(MachineType::AnyTagged(), object, untagged_offset));
#else
return BitcastWordToTagged(UncheckedCast<IntPtrT>(
LoadFromObject(MachineType::IntPtr(), object, untagged_offset)));
#endif
}

// Wasm uses private symbols (e.g. wasm_exception_tag_symbol) to stamp certain
// objects. This builtin checks for presence of such symbols; it is a
// specialization of "GetOwnProperty" behavior: if the object is not a plain
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/builtins/builtins-wasm-gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class WasmBuiltinsAssembler : public CodeStubAssembler {
TNode<Float64T> StringToFloat64(TNode<String>);

TNode<BoolT> InSharedSpace(TNode<HeapObject>);

TNode<Object> LoadWasmRefFromSlot(TNode<Object> object,
TNode<IntPtrT> offset);
};

} // namespace internal
Expand Down
14 changes: 8 additions & 6 deletions deps/v8/src/builtins/js-to-wasm.tq
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ macro RefCast<To: type>(i: &intptr):
return torque_internal::unsafe::NewReference<To>(i.object, i.offset);
}

macro LoadWasmRef(slot: &intptr): Object {
return LoadWasmRefFromSlot(slot.object, slot.offset);
}

macro TruncateBigIntToI64(context: Context, input: JSAny): intptr {
// This is only safe to use on 64-bit platforms.
dcheck(Is64());
Expand Down Expand Up @@ -953,10 +957,9 @@ builtin JSToWasmHandleReturns(
}
} else {
check((retType & kValueTypeIsRefBit) != 0);
const ptr = %RawDownCast<RawPtr<uintptr>>(
wrapperBuffer + kWrapperBufferGPReturnRegister1);
const rawRef = *GetRefAt<uintptr>(ptr, 0);
const value = BitcastWordToTagged(rawRef);
const slot =
GetRefAt<intptr>(wrapperBuffer, kWrapperBufferGPReturnRegister1);
const value = LoadWasmRef(slot);
return WasmToJSObject(jsContext, value);
}
}
Expand Down Expand Up @@ -1006,8 +1009,7 @@ builtin JSToWasmHandleReturns(
const retType = *retTypes.UncheckedAtIndex(k);
if ((retType & kValueTypeIsRefBit) != 0) {
const slot = locationAllocator.GetGPSlot();
const rawRef = *slot;
const value: Object = BitcastWordToTagged(rawRef);
const value: Object = LoadWasmRef(slot);
// Store the wasm object in the JSArray to make it GC safe. The
// transformation will happen later in a second loop.
fixedArray.objects[k] = value;
Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/builtins/wasm-to-js.tq
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ transitioning macro WasmToJSWrapper(data: WasmImportData): WasmToJSResult {
const paramType = paramIt.NextNotEmpty();
if ((paramType & kValueTypeIsRefBit) != 0) {
const slot = locationAllocator.GetGPSlot();
const rawRef = *slot;
const value = BitcastWordToTagged(rawRef);
const value = LoadWasmRef(slot);
outParams.objects[nextIndex] =
WasmToJSObject(data.native_context, value);
}
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/builtins/wasm.tq
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ extern macro WasmBuiltinsAssembler::LoadContextFromWasmOrJsFrame():
extern macro WasmBuiltinsAssembler::StringToFloat64(String): float64;

extern macro WasmBuiltinsAssembler::InSharedSpace(HeapObject): bool;
extern macro WasmBuiltinsAssembler::LoadWasmRefFromSlot(
HeapObject|TaggedZeroPattern, intptr): Object;

extern macro SwitchToTheCentralStackIfNeeded(): RawPtr;
extern macro SwitchFromTheCentralStack(RawPtr): void;
Expand Down
18 changes: 9 additions & 9 deletions deps/v8/src/common/code-memory-access.cc
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,14 @@ void ThreadIsolation::JitPageReference::UnregisterAllocationsExcept(

std::optional<base::Address>
ThreadIsolation::JitPageReference::StartOfAllocationAt(
base::Address inner_pointer) {
base::Address inner_pointer, JitAllocationType type) {
auto it = jit_page_->allocations_.upper_bound(inner_pointer);
if (it == jit_page_->allocations_.begin()) {
return {};
}
it--;
size_t offset = inner_pointer - it->first;
if (it->second.Size() <= offset) {
if (it->second.Size() <= offset || it->second.Type() != type) {
return {};
}
return it->first;
Expand Down Expand Up @@ -617,9 +617,9 @@ void ThreadIsolation::RegisterJitAllocations(Address start,
}
}

void ThreadIsolation::RegisterJitAllocationForTesting(Address obj,
size_t size) {
RegisterJitAllocation(obj, size, JitAllocationType::kInstructionStream);
void ThreadIsolation::RegisterJitAllocationForTesting(Address obj, size_t size,
JitAllocationType type) {
RegisterJitAllocation(obj, size, type);
}

// static
Expand Down Expand Up @@ -685,13 +685,13 @@ ThreadIsolation::SplitJitPages(Address addr1, size_t size1, Address addr2,

// static
std::optional<Address> ThreadIsolation::StartOfJitAllocationAt(
Address inner_pointer) {
Address inner_pointer, JitAllocationType type) {
CFIMetadataWriteScope write_scope("StartOfJitAllocationAt");
std::optional<JitPageReference> page = TryLookupJitPage(inner_pointer, 1);
if (!page) {
return {};
}
return page->StartOfAllocationAt(inner_pointer);
return page->StartOfAllocationAt(inner_pointer, type);
}

// static
Expand All @@ -711,14 +711,14 @@ bool ThreadIsolation::WriteProtectMemory(

// static
std::optional<Address> ThreadIsolation::TryLookupStartOfJitAllocationAt(
Address inner_pointer) {
Address inner_pointer, JitAllocationType type) {
CFIMetadataWriteScope write_scope("TryLookupStartOfJitAllocationAt");
std::optional<JitPageReference> page =
TryLookupJitPageWithoutBlocking(inner_pointer);
if (!page) {
return {};
}
return page->StartOfAllocationAt(inner_pointer);
return page->StartOfAllocationAt(inner_pointer, type);
}

// static
Expand Down
10 changes: 6 additions & 4 deletions deps/v8/src/common/code-memory-access.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,17 @@ class V8_EXPORT ThreadIsolation {
// Try to lookup the start of a jit allocation from inside a signal handler,
// returning std::nullopt if a required lock is already held.
static std::optional<Address> TryLookupStartOfJitAllocationAt(
Address inner_pointer);
static std::optional<Address> StartOfJitAllocationAt(Address inner_pointer);
Address inner_pointer, JitAllocationType type);
static std::optional<Address> StartOfJitAllocationAt(Address inner_pointer,
JitAllocationType type);

// Write-protect a given range of memory. Address and size need to be page
// aligned.
V8_NODISCARD static bool WriteProtectMemory(
Address addr, size_t size, PageAllocator::Permission page_permissions);

static void RegisterJitAllocationForTesting(Address obj, size_t size);
static void RegisterJitAllocationForTesting(Address obj, size_t size,
JitAllocationType type);
static void UnregisterJitAllocationForTesting(Address addr, size_t size);

#if V8_HAS_PKU_JIT_WRITE_PROTECT
Expand Down Expand Up @@ -285,7 +287,7 @@ class V8_EXPORT ThreadIsolation {
void UnregisterRange(base::Address addr, size_t size);

std::optional<base::Address> StartOfAllocationAt(
base::Address inner_pointer);
base::Address inner_pointer, JitAllocationType type);
std::pair<base::Address, JitAllocation&> AllocationContaining(
base::Address addr);
base::Address EndOfLastAllocation();
Expand Down
71 changes: 35 additions & 36 deletions deps/v8/src/compiler/access-info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <ostream>

#include "src/base/logging.h"
#include "src/builtins/accessors.h"
#include "src/common/globals.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/heap-refs.h"
Expand All @@ -24,6 +23,7 @@
#include "src/objects/field-index-inl.h"
#include "src/objects/field-type.h"
#include "src/objects/instance-type-inl.h"
#include "src/objects/js-array.h"
#include "src/objects/module-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/property-details.h"
Expand Down Expand Up @@ -53,7 +53,7 @@ bool CanInlinePropertyAccess(MapRef map, AccessMode access_mode) {
static_assert(ODDBALL_TYPE == LAST_PRIMITIVE_HEAP_OBJECT_TYPE);
if (IsBooleanMap(*map.object())) return true;
if (map.instance_type() < LAST_PRIMITIVE_HEAP_OBJECT_TYPE) return true;
if (IsJSObjectMap(*map.object())) {
if (map.IsJSObjectMap()) {
if (map.is_dictionary_map()) {
if (!V8_DICT_PROPERTY_CONST_TRACKING_BOOL) return false;
return access_mode == AccessMode::kLoad && map.is_prototype_map();
Expand All @@ -63,7 +63,7 @@ bool CanInlinePropertyAccess(MapRef map, AccessMode access_mode) {
!map.is_access_check_needed();
}
#if V8_ENABLE_WEBASSEMBLY
if (IsAnyWasmObjectMap(*map.object())) {
if (map.IsAnyWasmObjectMap()) {
DCHECK(!map.has_named_interceptor());
DCHECK(!map.is_access_check_needed());
// Accesses to Wasm objects all go through the prototype chain, but
Expand Down Expand Up @@ -118,7 +118,7 @@ ElementAccessInfo::ElementAccessInfo(
ElementAccessInfo::ElementAccessInfo(MapRef map, ObjectRef accessor,
ObjectRef target, bool string_keys,
Zone* zone)
: elements_kind_(map.elements_kind()),
: elements_kind_(NO_ELEMENTS),
string_keys_(string_keys),
lookup_start_object_maps_({map}, zone),
transition_sources_(zone),
Expand Down Expand Up @@ -1020,7 +1020,7 @@ PropertyAccessInfo TryComputeDictionaryDataFieldAccessInfo(
// Receiver map must be a standard JSObject without access checks or
// interceptors.
if (!map.is_dictionary_map() || !map.IsJSObjectMap() ||
IsJSGlobalObjectMap(*map.object()) || map.is_access_check_needed() ||
map.IsJSGlobalObjectMap() || map.is_access_check_needed() ||
map.has_named_interceptor()) {
return PropertyAccessInfo::Invalid(zone);
}
Expand Down Expand Up @@ -1061,7 +1061,7 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
}
}

if (access_mode == AccessMode::kHas && !IsJSReceiverMap(*map.object())) {
if (access_mode == AccessMode::kHas && !map.IsJSReceiverMap()) {
return Invalid();
}

Expand Down Expand Up @@ -1198,7 +1198,7 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(

// Don't search on the prototype chain for special indices in case of
// integer indexed exotic objects (see ES6 section 9.4.5).
if (IsJSTypedArrayMap(*map.object()) && name.IsString()) {
if (map.IsJSTypedArrayMap() && name.IsString()) {
StringRef name_str = name.AsString();
SharedStringAccessGuardIfNeeded access_guard(
*name_str.object(), broker()->local_isolate_or_isolate());
Expand Down Expand Up @@ -1240,11 +1240,11 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
HeapObjectRef prototype = map.prototype(broker());

MapRef map_prototype_map = prototype.map(broker());
if (!IsJSObjectMap(*map_prototype_map.object())) {
if (!map_prototype_map.IsJSObjectMap()) {
// Don't allow proxies on the prototype chain.
if (!prototype.IsNull()) {
DCHECK(IsJSProxy(*prototype.object()) ||
IsWasmObject(*prototype.object()));
DCHECK(map_prototype_map.IsJSProxyMap() ||
map_prototype_map.IsAnyWasmObjectMap());
return Invalid();
}

Expand Down Expand Up @@ -1403,44 +1403,44 @@ std::optional<ElementAccessInfo> AccessInfoFactory::ConsolidateElementLoad(
PropertyAccessInfo AccessInfoFactory::LookupSpecialFieldAccessor(
MapRef map, NameRef name) const {
// Check for String::length field accessor.
if (IsStringMap(*map.object())) {
if (map.IsStringMap()) {
if (Name::Equals(isolate(), name.object(),
isolate()->factory()->length_string())) {
return PropertyAccessInfo::StringLength(zone(), map);
}
return Invalid();
}
if (IsJSPrimitiveWrapperMap(*map.object()) &&
if (map.IsJSPrimitiveWrapperMap() &&
(map.elements_kind() == FAST_STRING_WRAPPER_ELEMENTS ||
map.elements_kind() == SLOW_STRING_WRAPPER_ELEMENTS)) {
if (Name::Equals(isolate(), name.object(),
isolate()->factory()->length_string())) {
return PropertyAccessInfo::StringWrapperLength(zone(), map);
}
}
// Check for special JSObject field accessors.
FieldIndex field_index;
if (Accessors::IsJSObjectFieldAccessor(isolate(), map.object(), name.object(),
&field_index)) {
// Check for special JSObject field accessors. Mirrors
// Accessors::IsJSObjectFieldAccessor, inlined here to use the snapshotted
// MapRef instance type rather than reading the live Map.
if (map.IsJSArrayMap() && !map.is_dictionary_map() &&
Name::Equals(isolate(), name.object(),
isolate()->factory()->length_string())) {
FieldIndex field_index = FieldIndex::ForInObjectOffset(
offsetof(JSArray, length_), FieldIndex::kTagged);
Type field_type = Type::NonInternal();
Representation field_representation = Representation::Tagged();
if (IsJSArrayMap(*map.object())) {
DCHECK(Name::Equals(isolate(), isolate()->factory()->length_string(),
name.object()));
// The JSArray::length property is a smi in the range
// [0, FixedDoubleArray::kMaxLength] in case of fast double
// elements, a smi in the range [0, FixedArray::kMaxLength]
// in case of other fast elements, and [0, kMaxUInt32] in
// case of other arrays.
if (IsDoubleElementsKind(map.elements_kind())) {
field_type = type_cache_->kFixedDoubleArrayLengthType;
field_representation = Representation::Smi();
} else if (IsFastElementsKind(map.elements_kind())) {
field_type = type_cache_->kFixedArrayLengthType;
field_representation = Representation::Smi();
} else {
field_type = type_cache_->kJSArrayLengthType;
}
// The JSArray::length property is a smi in the range
// [0, FixedDoubleArray::kMaxLength] in case of fast double
// elements, a smi in the range [0, FixedArray::kMaxLength]
// in case of other fast elements, and [0, kMaxUInt32] in
// case of other arrays.
if (IsDoubleElementsKind(map.elements_kind())) {
field_type = type_cache_->kFixedDoubleArrayLengthType;
field_representation = Representation::Smi();
} else if (IsFastElementsKind(map.elements_kind())) {
field_type = type_cache_->kFixedArrayLengthType;
field_representation = Representation::Smi();
} else {
field_type = type_cache_->kJSArrayLengthType;
}
// Special fields are always mutable.
return PropertyAccessInfo::DataField(broker(), zone(), map, {{}, zone()},
Expand All @@ -1455,9 +1455,8 @@ PropertyAccessInfo AccessInfoFactory::LookupSpecialFieldAccessorInHolder(
PropertyDetails details, InternalIndex index) const {
// Check whether we're accessing the `length` property in a TypedArray
// prototype.
if (v8_flags.typed_array_length_loading &&
IsJSTypedArrayMap(*receiver_map.object()) &&
!IsJSDetachedTypedArrayMap(*receiver_map.object()) &&
if (v8_flags.typed_array_length_loading && receiver_map.IsJSTypedArrayMap() &&
!receiver_map.IsJSDetachedTypedArrayMap() &&
!IsRabGsabTypedArrayElementsKind(receiver_map.elements_kind()) &&
Name::Equals(isolate(), name.object(),
isolate()->factory()->length_string()) &&
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/compiler/access-info.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ElementAccessInfo final {

void AddTransitionSource(MapRef map) {
CHECK_EQ(lookup_start_object_maps_.size(), 1);
CHECK(!is_proxy_on_prototype());
transition_sources_.push_back(map);
}

Expand Down
5 changes: 5 additions & 0 deletions deps/v8/src/compiler/backend/arm/instruction-selector-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3644,6 +3644,11 @@ InstructionSelector::AlignmentRequirements() {
SomeUnalignedAccessUnsupported(req_aligned, req_aligned);
}

void InstructionSelector::EmitDecompressTaggedParam(
OpIndex node, InstructionOperand temp_op) {
UNREACHABLE();
}

} // namespace compiler
} // namespace internal
} // namespace v8
Loading
Loading