1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
|
/*
* Copyright (C) 2015-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "ObjectPropertyConditionSet.h"
#include "JSCInlines.h"
#include <wtf/ListDump.h>
namespace JSC {
ObjectPropertyCondition ObjectPropertyConditionSet::forObject(JSObject* object) const
{
for (const ObjectPropertyCondition& condition : *this) {
if (condition.object() == object)
return condition;
}
return ObjectPropertyCondition();
}
ObjectPropertyCondition ObjectPropertyConditionSet::forConditionKind(
PropertyCondition::Kind kind) const
{
for (const ObjectPropertyCondition& condition : *this) {
if (condition.kind() == kind)
return condition;
}
return ObjectPropertyCondition();
}
unsigned ObjectPropertyConditionSet::numberOfConditionsWithKind(PropertyCondition::Kind kind) const
{
unsigned result = 0;
for (const ObjectPropertyCondition& condition : *this) {
if (condition.kind() == kind)
result++;
}
return result;
}
bool ObjectPropertyConditionSet::hasOneSlotBaseCondition() const
{
bool sawBase = false;
for (const ObjectPropertyCondition& condition : *this) {
switch (condition.kind()) {
case PropertyCondition::Presence:
case PropertyCondition::Replacement:
case PropertyCondition::Equivalence:
case PropertyCondition::HasStaticProperty:
if (sawBase)
return false;
sawBase = true;
break;
default:
break;
}
}
return sawBase;
}
ObjectPropertyCondition ObjectPropertyConditionSet::slotBaseCondition() const
{
ObjectPropertyCondition result;
unsigned numFound = 0;
for (const ObjectPropertyCondition& condition : *this) {
if (condition.kind() == PropertyCondition::Presence
|| condition.kind() == PropertyCondition::Replacement
|| condition.kind() == PropertyCondition::Equivalence
|| condition.kind() == PropertyCondition::HasStaticProperty) {
result = condition;
numFound++;
}
}
RELEASE_ASSERT(numFound == 1);
return result;
}
ObjectPropertyConditionSet ObjectPropertyConditionSet::mergedWith(
const ObjectPropertyConditionSet& other) const
{
if (!isValid() || !other.isValid())
return invalid();
Vector<ObjectPropertyCondition, 16> result;
if (!isEmpty())
result.append(m_data->span());
for (const ObjectPropertyCondition& newCondition : other) {
bool foundMatch = false;
for (const ObjectPropertyCondition& existingCondition : *this) {
if (newCondition == existingCondition) {
foundMatch = true;
continue;
}
if (!newCondition.isCompatibleWith(existingCondition))
return invalid();
}
if (!foundMatch)
result.append(newCondition);
}
return ObjectPropertyConditionSet::create(WTFMove(result));
}
bool ObjectPropertyConditionSet::structuresEnsureValidity() const
{
if (!isValid())
return false;
for (const ObjectPropertyCondition& condition : *this) {
if (!condition.structureEnsuresValidity(Concurrency::ConcurrentThread))
return false;
}
return true;
}
bool ObjectPropertyConditionSet::isStillValid() const
{
if (!isValid())
return false;
for (const ObjectPropertyCondition& condition : *this) {
if (!condition.isStillValid(Concurrency::ConcurrentThread))
return false;
}
return true;
}
bool ObjectPropertyConditionSet::needImpurePropertyWatchpoint() const
{
for (const ObjectPropertyCondition& condition : *this) {
if (condition.validityRequiresImpurePropertyWatchpoint())
return true;
}
return false;
}
bool ObjectPropertyConditionSet::areStillLive(VM& vm) const
{
bool stillLive = true;
forEachDependentCell([&](JSCell* cell) {
stillLive &= vm.heap.isMarked(cell);
});
return stillLive;
}
void ObjectPropertyConditionSet::dumpInContext(PrintStream& out, DumpContext* context) const
{
if (!isValid()) {
out.print("<invalid>");
return;
}
out.print("[");
if (m_data)
out.print(listDumpInContext(*m_data, context));
out.print("]");
}
void ObjectPropertyConditionSet::dump(PrintStream& out) const
{
dumpInContext(out, nullptr);
}
namespace {
namespace ObjectPropertyConditionSetInternal {
static constexpr bool verbose = false;
}
ObjectPropertyCondition generateCondition(
VM& vm, JSCell* owner, JSObject* object, Structure* structure, UniquedStringImpl* uid, PropertyCondition::Kind conditionKind, Concurrency concurrency)
{
// The structure of object might change by the time we get here, so we need to make sure that our conditions are built against the structure that is passed in.
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Creating condition ", conditionKind, " for ", pointerDump(structure), "\n");
ObjectPropertyCondition result;
switch (conditionKind) {
case PropertyCondition::Presence: {
unsigned attributes;
PropertyOffset offset = structure->get(vm, concurrency, uid, attributes);
if (offset == invalidOffset)
return ObjectPropertyCondition();
result = ObjectPropertyCondition::presence(vm, owner, object, uid, offset, attributes);
break;
}
case PropertyCondition::Replacement: {
unsigned attributes;
PropertyOffset offset = structure->get(vm, concurrency, uid, attributes);
if (offset == invalidOffset || !!(attributes & PropertyAttribute::ReadOnly))
return ObjectPropertyCondition();
result = ObjectPropertyCondition::replacement(vm, owner, object, uid, offset, attributes);
break;
}
case PropertyCondition::Absence: {
if (structure->hasPolyProto())
return ObjectPropertyCondition();
result = ObjectPropertyCondition::absence(
vm, owner, object, uid, structure->storedPrototypeObject());
break;
}
case PropertyCondition::AbsenceOfSetEffect: {
if (structure->hasPolyProto())
return ObjectPropertyCondition();
result = ObjectPropertyCondition::absenceOfSetEffect(
vm, owner, object, uid, structure->storedPrototypeObject());
break;
}
case PropertyCondition::AbsenceOfIndexedProperties: {
if (structure->hasPolyProto())
return ObjectPropertyCondition();
if (hasIndexedProperties(structure->indexingType()))
return ObjectPropertyCondition();
if (structure->mayInterceptIndexedAccesses() || structure->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero())
return ObjectPropertyCondition();
result = ObjectPropertyCondition::absenceOfIndexedProperties(vm, owner, object, structure->storedPrototypeObject());
break;
}
case PropertyCondition::Equivalence: {
JSValue value;
{
Locker<JSCellLock> cellLocker { NoLockingNecessary };
if (concurrency != Concurrency::MainThread) {
cellLocker = Locker { object->cellLock() };
if (object->structure() != structure)
return ObjectPropertyCondition();
// The structure might change from now on, but we are guaranteed to have a sane view of the butterfly.
}
unsigned attributes;
PropertyOffset offset = structure->get(vm, concurrency, uid, attributes);
if (offset == invalidOffset)
return ObjectPropertyCondition();
value = object->getDirect(cellLocker, concurrency, structure, offset);
if (!value)
return ObjectPropertyCondition();
}
result = ObjectPropertyCondition::equivalence(vm, owner, object, uid, value);
break;
}
case PropertyCondition::HasStaticProperty: {
auto entry = object->findPropertyHashEntry(uid);
if (!entry)
return ObjectPropertyCondition();
result = ObjectPropertyCondition::hasStaticProperty(vm, owner, object, uid);
break;
}
default:
RELEASE_ASSERT_NOT_REACHED();
return ObjectPropertyCondition();
}
if (!result.isStillValidAssumingImpurePropertyWatchpoint(concurrency)) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Failed to create condition: ", result, "\n");
return ObjectPropertyCondition();
}
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("New condition: ", result, "\n");
return result;
}
template<typename Functor>
ObjectPropertyConditionSet generateConditions(JSGlobalObject* globalObject, Structure* structure, JSObject* prototype, UniquedStringImpl* uid, const Functor& functor)
{
Vector<ObjectPropertyCondition, 8> conditions;
for (;;) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Considering structure: ", pointerDump(structure), "\n");
if (structure->isProxy()) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("It's a proxy, so invalid.\n");
return ObjectPropertyConditionSet::invalid();
}
if (structure->hasPolyProto()) {
// FIXME: Integrate this with PolyProtoAccessChain:
// https://bugs.webkit.org/show_bug.cgi?id=177339
// Or at least allow OPC set generation when the
// base is not poly proto:
// https://bugs.webkit.org/show_bug.cgi?id=177721
return ObjectPropertyConditionSet::invalid();
}
// TypedArray has an ability to stop [[Prototype]] traversing for numeric index string (e.g. "0.1").
// If we found it, then traverse should stop for Unset case.
// https://262.ecma-international.org/9.0/#_ref_2826
if (!prototype && isTypedArrayType(structure->typeInfo().type()) && uid && isCanonicalNumericIndexString(uid))
break;
JSValue value = structure->prototypeForLookup(globalObject);
if (value.isNull()) {
if (!prototype) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Reached end of prototype chain as expected, done.\n");
break;
}
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Unexpectedly reached end of prototype chain, so invalid.\n");
return ObjectPropertyConditionSet::invalid();
}
JSObject* object = jsCast<JSObject*>(value);
structure = object->structure();
if (structure->isDictionary()) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Cannot cache dictionary.\n");
return ObjectPropertyConditionSet::invalid();
}
if (!functor(conditions, object, structure)) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Functor failed, invalid.\n");
return ObjectPropertyConditionSet::invalid();
}
if (object == prototype) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Reached desired prototype, done.\n");
break;
}
}
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Returning conditions: ", listDump(conditions), "\n");
return ObjectPropertyConditionSet::create(WTFMove(conditions));
}
} // anonymous namespace
ObjectPropertyConditionSet generateConditionsForPropertyMiss(
VM& vm, JSCell* owner, JSGlobalObject* globalObject, Structure* headStructure, UniquedStringImpl* uid)
{
return generateConditions(
globalObject, headStructure, nullptr, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
ObjectPropertyCondition result =
generateCondition(vm, owner, object, structure, uid, PropertyCondition::Absence, Concurrency::MainThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForPropertySetterMiss(
VM& vm, JSCell* owner, JSGlobalObject* globalObject, Structure* headStructure, UniquedStringImpl* uid)
{
return generateConditions(
globalObject, headStructure, nullptr, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
ObjectPropertyCondition result =
generateCondition(vm, owner, object, structure, uid, PropertyCondition::AbsenceOfSetEffect, Concurrency::MainThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForIndexedMiss(VM& vm, JSCell* owner, JSGlobalObject* globalObject, Structure* headStructure)
{
return generateConditions(
globalObject, headStructure, nullptr, nullptr,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
ObjectPropertyCondition result =
generateCondition(vm, owner, object, structure, nullptr, PropertyCondition::AbsenceOfIndexedProperties, Concurrency::MainThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForPrototypePropertyHit(
VM& vm, JSCell* owner, JSGlobalObject* globalObject, Structure* headStructure, JSObject* prototype,
UniquedStringImpl* uid)
{
return generateConditions(
globalObject, headStructure, prototype, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
PropertyCondition::Kind kind =
object == prototype ? PropertyCondition::Presence : PropertyCondition::Absence;
ObjectPropertyCondition result =
generateCondition(vm, owner, object, structure, uid, kind, Concurrency::MainThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForPrototypePropertyHitCustom(
VM& vm, JSCell* owner, JSGlobalObject* globalObject, Structure* headStructure, JSObject* prototype,
UniquedStringImpl* uid, unsigned attributes)
{
return generateConditions(
globalObject, headStructure, prototype, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
auto kind = PropertyCondition::Absence;
if (object == prototype) {
PropertyOffset offset = structure->get(vm, uid);
if (isValidOffset(offset)) {
// When we reify custom accessors, we wrap them in a JSFunction that we shove
// inside a GetterSetter. So, once we've reified a custom accessor, we will
// no longer see it as a "custom" accessor/value. Hence, if our property access actually
// notices a custom, it must be a CustomGetterSetterType cell or something
// in the static property table. Custom values get reified into CustomGetterSetters.
JSValue value = object->getDirect(offset);
if (!value.isCell() || value.asCell()->type() != CustomGetterSetterType) {
// The value could have just got changed to some other type, so check if it's still
// a custom getter setter.
return false;
}
kind = PropertyCondition::Equivalence;
} else if (structure->findPropertyHashEntry(uid))
kind = PropertyCondition::HasStaticProperty;
else if (attributes & PropertyAttribute::DontDelete) {
// This can't change, so we can blindly cache it.
return true;
} else {
// This means we materialized a custom out of thin air and it's not DontDelete (i.e, it can be
// redefined). This is curious. We don't actually need to crash here. We could blindly cache
// the function. Or we could blindly not cache it. However, we don't actually do this in WebKit
// right now, so it's reasonable to decide what to do later (or to warn people of forgetting DoneDelete.)
ASSERT_NOT_REACHED();
return false;
}
}
ObjectPropertyCondition result = generateCondition(vm, owner, object, structure, uid, kind, Concurrency::MainThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForInstanceOf(
VM& vm, JSCell* owner, JSGlobalObject* globalObject, Structure* headStructure, JSObject* prototype,
bool shouldHit)
{
bool didHit = false;
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Searching for prototype ", JSValue(prototype), " starting with structure ", RawPointer(headStructure), " with shouldHit = ", shouldHit, "\n");
ObjectPropertyConditionSet result = generateConditions(
globalObject, headStructure, shouldHit ? prototype : nullptr, nullptr,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("Encountered object: ", RawPointer(object), "\n");
if (object == prototype) {
RELEASE_ASSERT(shouldHit);
didHit = true;
return true;
}
if (structure->hasPolyProto())
return false;
conditions.append(
ObjectPropertyCondition::hasPrototype(
vm, owner, object, structure->storedPrototypeObject()));
return true;
});
if (result.isValid()) {
if (ObjectPropertyConditionSetInternal::verbose)
dataLog("didHit = ", didHit, ", shouldHit = ", shouldHit, "\n");
RELEASE_ASSERT(didHit == shouldHit);
}
return result;
}
ObjectPropertyConditionSet generateConditionsForPrototypeEquivalenceConcurrently(
VM& vm, JSGlobalObject* globalObject, Structure* headStructure, JSObject* prototype, UniquedStringImpl* uid)
{
return generateConditions(globalObject, headStructure, prototype, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
PropertyCondition::Kind kind =
object == prototype ? PropertyCondition::Equivalence : PropertyCondition::Absence;
ObjectPropertyCondition result = generateCondition(vm, nullptr, object, structure, uid, kind, Concurrency::ConcurrentThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForPropertyMissConcurrently(
VM& vm, JSGlobalObject* globalObject, Structure* headStructure, UniquedStringImpl* uid)
{
return generateConditions(
globalObject, headStructure, nullptr, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
ObjectPropertyCondition result = generateCondition(vm, nullptr, object, structure, uid, PropertyCondition::Absence, Concurrency::ConcurrentThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyConditionSet generateConditionsForPropertySetterMissConcurrently(
VM& vm, JSGlobalObject* globalObject, Structure* headStructure, UniquedStringImpl* uid)
{
return generateConditions(
globalObject, headStructure, nullptr, uid,
[&](auto& conditions, JSObject* object, Structure* structure) -> bool {
ObjectPropertyCondition result =
generateCondition(vm, nullptr, object, structure, uid, PropertyCondition::AbsenceOfSetEffect, Concurrency::ConcurrentThread);
if (!result)
return false;
conditions.append(result);
return true;
});
}
ObjectPropertyCondition generateConditionForSelfEquivalence(
VM& vm, JSCell* owner, JSObject* object, UniquedStringImpl* uid)
{
return generateCondition(vm, owner, object, object->structure(), uid, PropertyCondition::Equivalence, Concurrency::MainThread);
}
// Current might be null. Structure can't be null.
static std::optional<PrototypeChainCachingStatus> prepareChainForCaching(JSGlobalObject* globalObject, JSCell* current, Structure* structure, UniquedStringImpl* propertyName, JSObject* target)
{
ASSERT(structure);
VM& vm = globalObject->vm();
bool found = false;
bool usesPolyProto = false;
bool flattenedDictionary = false;
while (true) {
if (structure->isDictionary()) {
if (!current)
return std::nullopt;
ASSERT(structure->isObject());
if (structure->hasBeenFlattenedBefore())
return std::nullopt;
structure->flattenDictionaryStructure(vm, asObject(current));
flattenedDictionary = true;
}
if (!structure->propertyAccessesAreCacheable())
return std::nullopt;
if (structure->isProxy())
return std::nullopt;
if (current && current == target) {
found = true;
break;
}
// TypedArray has an ability to stop [[Prototype]] traversing for numeric index string (e.g. "0.1").
// If we found it, then traverse should stop for Unset case.
// https://262.ecma-international.org/9.0/#_ref_2826
if (!target && propertyName && isTypedArrayType(structure->typeInfo().type()) && isCanonicalNumericIndexString(propertyName)) {
found = true;
break;
}
// We only have poly proto if we need to access our prototype via
// the poly proto protocol. If the slot base is the only poly proto
// thing in the chain, and we have a cache hit on it, then we're not
// poly proto.
JSValue prototype;
if (structure->hasPolyProto()) {
if (!current)
return std::nullopt;
usesPolyProto = true;
prototype = structure->prototypeForLookup(globalObject, current);
} else
prototype = structure->prototypeForLookup(globalObject);
if (prototype.isNull())
break;
current = asObject(prototype);
structure = current->structure();
}
if (!found && !!target)
return std::nullopt;
PrototypeChainCachingStatus result;
result.usesPolyProto = usesPolyProto;
result.flattenedDictionary = flattenedDictionary;
return result;
}
std::optional<PrototypeChainCachingStatus> prepareChainForCaching(JSGlobalObject* globalObject, JSCell* base, UniquedStringImpl* propertyName, JSObject* target)
{
return prepareChainForCaching(globalObject, base, base->structure(), propertyName, target);
}
std::optional<PrototypeChainCachingStatus> prepareChainForCaching(JSGlobalObject* globalObject, JSCell* base, UniquedStringImpl* propertyName, const PropertySlot& slot)
{
JSObject* target = slot.isUnset() ? nullptr : slot.slotBase();
return prepareChainForCaching(globalObject, base, propertyName, target);
}
std::optional<PrototypeChainCachingStatus> prepareChainForCaching(JSGlobalObject* globalObject, Structure* baseStructure, UniquedStringImpl* propertyName, JSObject* target)
{
return prepareChainForCaching(globalObject, nullptr, baseStructure, propertyName, target);
}
} // namespace JSC
|