Commit c4a4da7f authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

Plumb Isolate through FastPropertyAt

Currently the Isolate is gotten off of the object that the operation is
being performed on. Shared objects return the shared Isolate, which is
incorrect as it shouldn't be used to run JS, nor does it have
HandleScopes open. Plumb the executing Isolate through.

Bug: v8:12547
Change-Id: I1cd23b18b5b841c5b4339f52adecf1b86f3253dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3441398Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78964}
parent 6ba2b6da
...@@ -5959,8 +5959,8 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from, ...@@ -5959,8 +5959,8 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
// If the property is already there we skip it. // If the property is already there we skip it.
if (PropertyAlreadyExists(isolate(), to, key)) continue; if (PropertyAlreadyExists(isolate(), to, key)) continue;
FieldIndex index = FieldIndex::ForDescriptor(from->map(), i); FieldIndex index = FieldIndex::ForDescriptor(from->map(), i);
Handle<Object> value = Handle<Object> value = JSObject::FastPropertyAt(
JSObject::FastPropertyAt(from, details.representation(), index); isolate(), from, details.representation(), index);
JSObject::AddProperty(isolate(), to, key, value, JSObject::AddProperty(isolate(), to, key, value,
details.attributes()); details.attributes());
} else { } else {
......
...@@ -845,8 +845,8 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject( ...@@ -845,8 +845,8 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
*map == object->map(cage_base)) { *map == object->map(cage_base)) {
DCHECK_EQ(PropertyKind::kData, details.kind()); DCHECK_EQ(PropertyKind::kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
property = JSObject::FastPropertyAt(object, details.representation(), property = JSObject::FastPropertyAt(
field_index); isolate_, object, details.representation(), field_index);
} else { } else {
ASSIGN_RETURN_ON_EXCEPTION_VALUE( ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate_, property, isolate_, property,
......
...@@ -291,7 +291,8 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastAssign( ...@@ -291,7 +291,8 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastAssign(
Representation representation = details.representation(); Representation representation = details.representation();
FieldIndex index = FieldIndex::ForPropertyIndex( FieldIndex index = FieldIndex::ForPropertyIndex(
*map, details.field_index(), representation); *map, details.field_index(), representation);
prop_value = JSObject::FastPropertyAt(from, representation, index); prop_value =
JSObject::FastPropertyAt(isolate, from, representation, index);
} }
} else { } else {
LookupIterator it(isolate, from, next_key, LookupIterator it(isolate, from, next_key,
...@@ -2042,8 +2043,8 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastGetOwnValuesOrEntries( ...@@ -2042,8 +2043,8 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastGetOwnValuesOrEntries(
Representation representation = details.representation(); Representation representation = details.representation();
FieldIndex field_index = FieldIndex::ForPropertyIndex( FieldIndex field_index = FieldIndex::ForPropertyIndex(
*map, details.field_index(), representation); *map, details.field_index(), representation);
prop_value = prop_value = JSObject::FastPropertyAt(isolate, object, representation,
JSObject::FastPropertyAt(object, representation, field_index); field_index);
} }
} else { } else {
LookupIterator it(isolate, object, next_key, LookupIterator it(isolate, object, next_key,
...@@ -4301,10 +4302,10 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition( ...@@ -4301,10 +4302,10 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition(
return Just(true); return Just(true);
} }
Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, Handle<Object> JSObject::FastPropertyAt(Isolate* isolate,
Handle<JSObject> object,
Representation representation, Representation representation,
FieldIndex index) { FieldIndex index) {
Isolate* isolate = object->GetIsolate();
Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
return Object::WrapForRead(isolate, raw_value, representation); return Object::WrapForRead(isolate, raw_value, representation);
} }
......
...@@ -675,7 +675,8 @@ class JSObject : public TorqueGeneratedJSObject<JSObject, JSReceiver> { ...@@ -675,7 +675,8 @@ class JSObject : public TorqueGeneratedJSObject<JSObject, JSReceiver> {
Heap* heap); Heap* heap);
// Access fast-case object properties at index. // Access fast-case object properties at index.
static Handle<Object> FastPropertyAt(Handle<JSObject> object, static Handle<Object> FastPropertyAt(Isolate* isolate,
Handle<JSObject> object,
Representation representation, Representation representation,
FieldIndex index); FieldIndex index);
inline Object RawFastPropertyAt(FieldIndex index) const; inline Object RawFastPropertyAt(FieldIndex index) const;
......
...@@ -926,8 +926,8 @@ Handle<Object> LookupIterator::FetchValue( ...@@ -926,8 +926,8 @@ Handle<Object> LookupIterator::FetchValue(
field_index.is_inobject() && field_index.is_double()) { field_index.is_inobject() && field_index.is_double()) {
return isolate_->factory()->undefined_value(); return isolate_->factory()->undefined_value();
} }
return JSObject::FastPropertyAt(holder, property_details_.representation(), return JSObject::FastPropertyAt(
field_index); isolate_, holder, property_details_.representation(), field_index);
} else { } else {
result = result =
holder_->map(isolate_).instance_descriptors(isolate_).GetStrongValue( holder_->map(isolate_).instance_descriptors(isolate_).GetStrongValue(
......
...@@ -63,7 +63,7 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj, ...@@ -63,7 +63,7 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
Handle<Object> value; Handle<Object> value;
if (details.location() == PropertyLocation::kField) { if (details.location() == PropertyLocation::kField) {
if (details.kind() == PropertyKind::kData) { if (details.kind() == PropertyKind::kData) {
value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj), value = JSObject::FastPropertyAt(isolate, Handle<JSObject>::cast(obj),
details.representation(), details.representation(),
FieldIndex::ForDescriptor(*map, i)); FieldIndex::ForDescriptor(*map, i));
} else { } else {
......
...@@ -635,8 +635,8 @@ Maybe<bool> ValueSerializer::WriteJSObject(Handle<JSObject> object) { ...@@ -635,8 +635,8 @@ Maybe<bool> ValueSerializer::WriteJSObject(Handle<JSObject> object) {
details.location() == PropertyLocation::kField)) { details.location() == PropertyLocation::kField)) {
DCHECK_EQ(PropertyKind::kData, details.kind()); DCHECK_EQ(PropertyKind::kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
value = JSObject::FastPropertyAt(object, details.representation(), value = JSObject::FastPropertyAt(isolate_, object,
field_index); details.representation(), field_index);
} else { } else {
// This logic should essentially match WriteJSObjectPropertiesSlow. // This logic should essentially match WriteJSObjectPropertiesSlow.
// If the property is no longer found, do not serialize it. // If the property is no longer found, do not serialize it.
......
...@@ -763,8 +763,8 @@ void WebSnapshotSerializer::DiscoverObject(Handle<JSObject> object) { ...@@ -763,8 +763,8 @@ void WebSnapshotSerializer::DiscoverObject(Handle<JSObject> object) {
PropertyDetails details = PropertyDetails details =
map->instance_descriptors(kRelaxedLoad).GetDetails(i); map->instance_descriptors(kRelaxedLoad).GetDetails(i);
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
Handle<Object> value = Handle<Object> value = JSObject::FastPropertyAt(
JSObject::FastPropertyAt(object, details.representation(), field_index); isolate_, object, details.representation(), field_index);
discovery_queue_.push(value); discovery_queue_.push(value);
} }
} }
...@@ -860,8 +860,8 @@ void WebSnapshotSerializer::SerializeObject(Handle<JSObject> object) { ...@@ -860,8 +860,8 @@ void WebSnapshotSerializer::SerializeObject(Handle<JSObject> object) {
PropertyDetails details = PropertyDetails details =
map->instance_descriptors(kRelaxedLoad).GetDetails(i); map->instance_descriptors(kRelaxedLoad).GetDetails(i);
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
Handle<Object> value = Handle<Object> value = JSObject::FastPropertyAt(
JSObject::FastPropertyAt(object, details.representation(), field_index); isolate_, object, details.representation(), field_index);
WriteValue(value, object_serializer_); WriteValue(value, object_serializer_);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment