Skip to content
Permalink
Browse files
Rename putDirect to putDirectOffset
https://bugs.webkit.org/show_bug.cgi?id=240992
<rdar://92298537>

Reviewed by Mark Lam.

* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/ftl/FTLOperations.cpp:
(JSC::FTL::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::createEmpty):
* Source/JavaScriptCore/runtime/CommonSlowPaths.cpp:
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):
* Source/JavaScriptCore/runtime/IteratorOperations.cpp:
(JSC::createIteratorResultObject):
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::Walker::walk):
* Source/JavaScriptCore/runtime/JSObject.cpp:
(JSC::JSObject::setPrototypeDirect):
(JSC::JSObject::putDirectCustomGetterSetterWithoutTransition):
(JSC::JSObject::putDirectNonIndexAccessorWithoutTransition):
* Source/JavaScriptCore/runtime/JSObject.h:
(JSC::JSObject::putDirectOffset):
(JSC::JSObject::putDirectWithoutBarrier):
(JSC::JSObject::putDirectUndefined): Deleted.
* Source/JavaScriptCore/runtime/JSObjectInlines.h:
(JSC::JSObject::putDirectWithoutTransition):
(JSC::JSObject::putDirectInternal):
* Source/JavaScriptCore/runtime/ObjectConstructor.h:
(JSC::constructObjectFromPropertyDescriptor):
* Source/JavaScriptCore/runtime/RegExpMatchesArray.h:
(JSC::createRegExpMatchesArray):
* Source/JavaScriptCore/runtime/Structure.cpp:
(JSC::Structure::flattenDictionaryStructure):

Canonical link: https://commits.webkit.org/251035@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
saambarati committed May 27, 2022
1 parent 5303484 commit c21585eb2dd65fd8486bef772d243dbcc36a1fce
Showing 12 changed files with 35 additions and 35 deletions.
@@ -417,7 +417,7 @@ JSC_DEFINE_JIT_OPERATION(operationCreateThis, JSCell*, (JSGlobalObject* globalOb
if (structure->hasPolyProto()) {
JSObject* prototype = allocationProfile->prototype();
ASSERT(prototype == jsCast<JSFunction*>(constructor)->prototypeForConstruction(vm, globalObject));
result->putDirect(vm, knownPolyProtoOffset, prototype);
result->putDirectOffset(vm, knownPolyProtoOffset, prototype);
prototype->didBecomePrototype();
ASSERT_WITH_MESSAGE(!hasIndexedProperties(result->indexingType()), "We rely on JSFinalObject not starting out with an indexing type otherwise we would potentially need to convert to slow put storage");
}
@@ -88,7 +88,7 @@ JSC_DEFINE_JIT_OPERATION(operationPopulateObjectInOSR, void, (JSGlobalObject* gl
if (codeBlock->identifier(property.location().info()).impl() != entry.key())
continue;

object->putDirect(vm, entry.offset(), JSValue::decode(values[i]));
object->putDirectOffset(vm, entry.offset(), JSValue::decode(values[i]));
}
}
break;
@@ -225,7 +225,7 @@ JSC_DEFINE_JIT_OPERATION(operationMaterializeObjectInOSR, JSCell*, (JSGlobalObje
// We use a random-ish number instead of a sensible value like
// undefined to make possible bugs easier to track.
for (const PropertyTableEntry& entry : structure->getPropertiesConcurrently())
result->putDirect(vm, entry.offset(), jsNumber(19723));
result->putDirectOffset(vm, entry.offset(), jsNumber(19723));

return result;
}
@@ -69,7 +69,7 @@ ClonedArguments* ClonedArguments::createEmpty(
result->finishCreation(vm);

result->m_callee.set(vm, result, callee);
result->putDirect(vm, clonedArgumentsLengthPropertyOffset, jsNumber(length));
result->putDirectOffset(vm, clonedArgumentsLengthPropertyOffset, jsNumber(length));
return result;
}

@@ -241,7 +241,7 @@ JSC_DEFINE_COMMON_SLOW_PATH(slow_path_create_this)
if (structure->hasPolyProto()) {
JSObject* prototype = allocationProfile->prototype();
ASSERT(prototype == constructor->prototypeForConstruction(vm, globalObject));
result->putDirect(vm, knownPolyProtoOffset, prototype);
result->putDirectOffset(vm, knownPolyProtoOffset, prototype);
prototype->didBecomePrototype();
ASSERT_WITH_MESSAGE(!hasIndexedProperties(result->indexingType()), "We rely on JSFinalObject not starting out with an indexing type otherwise we would potentially need to convert to slow put storage");
}
@@ -145,8 +145,8 @@ JSObject* createIteratorResultObject(JSGlobalObject* globalObject, JSValue value
{
VM& vm = globalObject->vm();
JSObject* resultObject = constructEmptyObject(vm, globalObject->iteratorResultObjectStructure());
resultObject->putDirect(vm, valuePropertyOffset, value);
resultObject->putDirect(vm, donePropertyOffset, jsBoolean(done));
resultObject->putDirectOffset(vm, valuePropertyOffset, value);
resultObject->putDirectOffset(vm, donePropertyOffset, jsBoolean(done));
return resultObject;
}

@@ -793,9 +793,10 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
else {
unsigned attributes;
PropertyOffset offset = object->getDirectOffset(vm, prop, attributes);
if (LIKELY(offset != invalidOffset && attributes == static_cast<unsigned>(PropertyAttribute::None)))
object->putDirect(vm, offset, filteredValue);
else {
if (LIKELY(offset != invalidOffset && attributes == static_cast<unsigned>(PropertyAttribute::None))) {
object->putDirectOffset(vm, offset, filteredValue);
object->structure()->didReplaceProperty(offset);
} else {
bool shouldThrow = false;
object->createDataProperty(m_globalObject, prop, filteredValue, shouldThrow);
}
@@ -1885,7 +1885,7 @@ void JSObject::setPrototypeDirect(VM& vm, JSValue prototype)
Structure* newStructure = Structure::changePrototypeTransition(vm, structure(), prototype, deferred);
setStructure(vm, newStructure);
} else
putDirect(vm, knownPolyProtoOffset, prototype);
putDirectOffset(vm, knownPolyProtoOffset, prototype);

if (!anyObjectInChainMayInterceptIndexedAccesses())
return;
@@ -2035,7 +2035,7 @@ void JSObject::putDirectCustomGetterSetterWithoutTransition(VM& vm, PropertyName
StructureID structureID = this->structureID();
Structure* structure = structureID.decode();
PropertyOffset offset = prepareToPutDirectWithoutTransition(vm, propertyName, attributes, structureID, structure);
putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);

if (attributes & PropertyAttribute::ReadOnly)
structure->setContainsReadOnlyProperties();
@@ -2062,7 +2062,7 @@ void JSObject::putDirectNonIndexAccessorWithoutTransition(VM& vm, PropertyName p
StructureID structureID = this->structureID();
Structure* structure = structureID.decode();
PropertyOffset offset = prepareToPutDirectWithoutTransition(vm, propertyName, attributes, structureID, structure);
putDirect(vm, offset, accessor);
putDirectOffset(vm, offset, accessor);
if (attributes & PropertyAttribute::ReadOnly)
structure->setContainsReadOnlyProperties();

@@ -838,9 +838,8 @@ class JSObject : public JSCell {
ALWAYS_INLINE JSValue getDirect(PropertyOffset offset) const { return locationForOffset(offset)->get(); }
JSValue getDirect(Concurrency, Structure* expectedStructure, PropertyOffset) const;
JSValue getDirectConcurrently(Structure* expectedStructure, PropertyOffset) const;
void putDirect(VM& vm, PropertyOffset offset, JSValue value) { locationForOffset(offset)->set(vm, this, value); }
void putDirectOffset(VM& vm, PropertyOffset offset, JSValue value) { locationForOffset(offset)->set(vm, this, value); }
void putDirectWithoutBarrier(PropertyOffset offset, JSValue value) { locationForOffset(offset)->setWithoutWriteBarrier(value); }
void putDirectUndefined(PropertyOffset offset) { locationForOffset(offset)->setUndefined(); }

JS_EXPORT_PRIVATE bool putDirectNativeIntrinsicGetter(VM&, JSGlobalObject*, Identifier, NativeFunction, Intrinsic, unsigned attributes);
JS_EXPORT_PRIVATE void putDirectNativeIntrinsicGetterWithoutTransition(VM&, JSGlobalObject*, Identifier, NativeFunction, Intrinsic, unsigned attributes);
@@ -218,7 +218,7 @@ inline void JSObject::putDirectWithoutTransition(VM& vm, PropertyName propertyNa
StructureID structureID = this->structureID();
Structure* structure = structureID.decode();
PropertyOffset offset = prepareToPutDirectWithoutTransition(vm, propertyName, attributes, structureID, structure);
putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);
if (attributes & PropertyAttribute::ReadOnly)
structure->setContainsReadOnlyProperties();
}
@@ -334,7 +334,7 @@ ALWAYS_INLINE ASCIILiteral JSObject::putDirectInternal(VM& vm, PropertyName prop
if ((mode == PutModePut || mode == PutModeDefineOwnProperty) && currentAttributes & PropertyAttribute::ReadOnlyOrAccessorOrCustomAccessor)
return ReadonlyPropertyChangeError;

putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);
structure->didReplaceProperty(offset);

// FIXME: Check attributes against PropertyAttribute::CustomAccessorOrValue. Changing GetterSetter should work w/o transition.
@@ -354,7 +354,7 @@ ALWAYS_INLINE ASCIILiteral JSObject::putDirectInternal(VM& vm, PropertyName prop

offset = prepareToPutDirectWithoutTransition(vm, propertyName, attributes, structureID, structure);
validateOffset(offset);
putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);
slot.setNewProperty(this, offset);
if (attributes & PropertyAttribute::ReadOnly)
this->structure()->setContainsReadOnlyProperties();
@@ -379,7 +379,7 @@ ALWAYS_INLINE ASCIILiteral JSObject::putDirectInternal(VM& vm, PropertyName prop
// This assertion verifies that the concurrent GC won't read garbage if the concurrentGC
// is running at the same time we put without transitioning.
ASSERT(!getDirect(offset) || !JSValue::encode(getDirect(offset)));
putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);
setStructure(vm, newStructure);
slot.setNewProperty(this, offset);
return { };
@@ -392,7 +392,7 @@ ALWAYS_INLINE ASCIILiteral JSObject::putDirectInternal(VM& vm, PropertyName prop
return ReadonlyPropertyChangeError;

structure->didReplaceProperty(offset);
putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);

// FIXME: Check attributes against PropertyAttribute::CustomAccessorOrValue. Changing GetterSetter should work w/o transition.
// https://bugs.webkit.org/show_bug.cgi?id=214342
@@ -430,7 +430,7 @@ ALWAYS_INLINE ASCIILiteral JSObject::putDirectInternal(VM& vm, PropertyName prop
// This assertion verifies that the concurrent GC won't read garbage if the concurrentGC
// is running at the same time we put without transitioning.
ASSERT(!getDirect(offset) || !JSValue::encode(getDirect(offset)));
putDirect(vm, offset, value);
putDirectOffset(vm, offset, value);
setStructure(vm, newStructure);
slot.setNewProperty(this, offset);
if (attributes & PropertyAttribute::ReadOnly)
@@ -138,19 +138,19 @@ inline JSObject* constructObjectFromPropertyDescriptor(JSGlobalObject* globalObj
if (descriptor.enumerablePresent() && descriptor.configurablePresent()) {
if (descriptor.value() && descriptor.writablePresent()) {
JSObject* result = constructEmptyObject(vm, globalObject->dataPropertyDescriptorObjectStructure());
result->putDirect(vm, dataPropertyDescriptorValuePropertyOffset, descriptor.value());
result->putDirect(vm, dataPropertyDescriptorWritablePropertyOffset, jsBoolean(descriptor.writable()));
result->putDirect(vm, dataPropertyDescriptorEnumerablePropertyOffset, jsBoolean(descriptor.enumerable()));
result->putDirect(vm, dataPropertyDescriptorConfigurablePropertyOffset, jsBoolean(descriptor.configurable()));
result->putDirectOffset(vm, dataPropertyDescriptorValuePropertyOffset, descriptor.value());
result->putDirectOffset(vm, dataPropertyDescriptorWritablePropertyOffset, jsBoolean(descriptor.writable()));
result->putDirectOffset(vm, dataPropertyDescriptorEnumerablePropertyOffset, jsBoolean(descriptor.enumerable()));
result->putDirectOffset(vm, dataPropertyDescriptorConfigurablePropertyOffset, jsBoolean(descriptor.configurable()));
return result;
}

if (descriptor.getterPresent() && descriptor.setterPresent()) {
JSObject* result = constructEmptyObject(vm, globalObject->accessorPropertyDescriptorObjectStructure());
result->putDirect(vm, accessorPropertyDescriptorGetPropertyOffset, descriptor.getter());
result->putDirect(vm, accessorPropertyDescriptorSetPropertyOffset, descriptor.setter());
result->putDirect(vm, accessorPropertyDescriptorEnumerablePropertyOffset, jsBoolean(descriptor.enumerable()));
result->putDirect(vm, accessorPropertyDescriptorConfigurablePropertyOffset, jsBoolean(descriptor.configurable()));
result->putDirectOffset(vm, accessorPropertyDescriptorGetPropertyOffset, descriptor.getter());
result->putDirectOffset(vm, accessorPropertyDescriptorSetPropertyOffset, descriptor.setter());
result->putDirectOffset(vm, accessorPropertyDescriptorEnumerablePropertyOffset, jsBoolean(descriptor.enumerable()));
result->putDirectOffset(vm, accessorPropertyDescriptorConfigurablePropertyOffset, jsBoolean(descriptor.configurable()));
return result;
}
}
@@ -92,21 +92,21 @@ ALWAYS_INLINE JSArray* createRegExpMatchesArray(
JSObject* indicesGroups = createIndices && hasNamedCaptures ? constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure()) : nullptr;

auto setProperties = [&] () {
array->putDirect(vm, RegExpMatchesArrayIndexPropertyOffset, jsNumber(result.start));
array->putDirect(vm, RegExpMatchesArrayInputPropertyOffset, input);
array->putDirect(vm, RegExpMatchesArrayGroupsPropertyOffset, hasNamedCaptures ? groups : jsUndefined());
array->putDirectOffset(vm, RegExpMatchesArrayIndexPropertyOffset, jsNumber(result.start));
array->putDirectOffset(vm, RegExpMatchesArrayInputPropertyOffset, input);
array->putDirectOffset(vm, RegExpMatchesArrayGroupsPropertyOffset, hasNamedCaptures ? groups : jsUndefined());

ASSERT(!array->butterfly()->indexingHeader()->preCapacity(matchStructure));
auto capacity = matchStructure->outOfLineCapacity();
auto size = matchStructure->outOfLineSize();
gcSafeZeroMemory(static_cast<JSValue*>(array->butterfly()->base(0, capacity)), (capacity - size) * sizeof(JSValue));

if (createIndices) {
array->putDirect(vm, RegExpMatchesArrayIndicesPropertyOffset, indicesArray);
array->putDirectOffset(vm, RegExpMatchesArrayIndicesPropertyOffset, indicesArray);

Structure* indicesStructure = globalObject->regExpMatchesIndicesArrayStructure();

indicesArray->putDirect(vm, RegExpMatchesIndicesGroupsPropertyOffset, indicesGroups ? indicesGroups : jsUndefined());
indicesArray->putDirectOffset(vm, RegExpMatchesIndicesGroupsPropertyOffset, indicesGroups ? indicesGroups : jsUndefined());

ASSERT(!indicesArray->butterfly()->indexingHeader()->preCapacity(indicesStructure));
auto indicesCapacity = indicesStructure->outOfLineCapacity();
@@ -929,7 +929,7 @@ Structure* Structure::flattenDictionaryStructure(VM& vm, JSObject* object)

// Copies in our values to their compacted locations.
for (unsigned i = 0; i < propertyCount; i++)
object->putDirect(vm, offsetForPropertyNumber(i, m_inlineCapacity), values[i]);
object->putDirectOffset(vm, offsetForPropertyNumber(i, m_inlineCapacity), values[i]);

// We need to zero our unused property space; otherwise the GC might see a
// stale pointer when we add properties in the future.

0 comments on commit c21585e

Please sign in to comment.