NEVER_INLINE JSValue jsAddSlowCase(CallFrame*, JSValue, JSValue);
JSValue jsTypeStringForValue(CallFrame*, JSValue);
JSValue jsTypeStringForValue(VM&, JSGlobalObject*, JSValue);
-bool jsIsObjectType(CallFrame*, JSValue);
+bool jsIsObjectTypeOrNull(CallFrame*, JSValue);
bool jsIsFunctionType(JSValue);
ALWAYS_INLINE JSValue jsString(ExecState* exec, JSString* s1, JSString* s2)
#define InvalidPrototypeChain (std::numeric_limits<size_t>::max())
-inline size_t normalizePrototypeChainForChainAccess(CallFrame* callFrame, JSValue base, JSValue slotBase, const Identifier& propertyName, PropertyOffset& slotOffset)
+inline size_t normalizePrototypeChainForChainAccess(CallFrame* callFrame, Structure* structure, JSValue slotBase, const Identifier& propertyName, PropertyOffset& slotOffset)
{
VM& vm = callFrame->vm();
- JSCell* cell = base.asCell();
size_t count = 0;
- while (!slotBase || slotBase != cell) {
- if (cell->isProxy())
+ while (1) {
+ if (structure->isProxy())
return InvalidPrototypeChain;
- const TypeInfo& typeInfo = cell->structure()->typeInfo();
+ const TypeInfo& typeInfo = structure->typeInfo();
if (typeInfo.hasImpureGetOwnPropertySlot() && !typeInfo.newImpurePropertyFiresWatchpoints())
return InvalidPrototypeChain;
- JSValue v = cell->structure()->prototypeForLookup(callFrame);
+ JSValue v = structure->prototypeForLookup(callFrame);
- // If we didn't find slotBase in base's prototype chain, then base
+ // If we didn't find slotBase in the base's prototype chain, then the base
// must be a proxy for another object.
if (v.isNull()) {
if (!slotBase)
- return count;
+ break;
return InvalidPrototypeChain;
}
- cell = v.asCell();
-
+ JSCell* cell = v.asCell();
+ structure = cell->structure(vm);
// Since we're accessing a prototype in a loop, it's a good bet that it
// should not be treated as a dictionary.
- if (cell->structure(vm)->isDictionary()) {
- asObject(cell)->flattenDictionaryObject(callFrame->vm());
+ if (structure->isDictionary()) {
+ structure->flattenDictionaryStructure(vm, asObject(cell));
if (slotBase == cell)
- slotOffset = cell->structure(vm)->get(callFrame->vm(), propertyName);
+ slotOffset = structure->get(vm, propertyName);
}
-
++count;
+
+ if (slotBase == cell)
+ break;
}
return count;
}
-inline size_t normalizePrototypeChain(CallFrame* callFrame, JSCell* base)
+inline size_t normalizePrototypeChain(CallFrame* callFrame, Structure* structure)
{
VM& vm = callFrame->vm();
size_t count = 0;
while (1) {
- if (base->isProxy())
+ if (structure->isProxy())
return InvalidPrototypeChain;
-
- JSValue v = base->structure(vm)->prototypeForLookup(callFrame);
+ JSValue v = structure->prototypeForLookup(callFrame);
if (v.isNull())
return count;
- base = v.asCell();
-
+ JSCell* base = v.asCell();
+ structure = base->structure(vm);
// Since we're accessing a prototype in a loop, it's a good bet that it
// should not be treated as a dictionary.
- if (base->structure(vm)->isDictionary())
- asObject(base)->flattenDictionaryObject(callFrame->vm());
+ if (structure->isDictionary())
+ structure->flattenDictionaryStructure(vm, asObject(base));
++count;
}