903389 - Make Make NativeGet[Getter]PureInline handle dense/typed array shapes.

This commit is contained in:
Gaming4JC 2019-06-08 17:13:01 -04:00 committed by Roy Tam
commit 5d929d8c47

View file

@ -2326,9 +2326,18 @@ js::LookupOwnPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Shape**
}
static inline bool
NativeGetPureInline(NativeObject* pobj, Shape* shape, Value* vp)
NativeGetPureInline(NativeObject* pobj, jsid id, Shape* shape, Value* vp)
{
/* Fail if we have a custom getter. */
if (IsImplicitDenseOrTypedArrayElement(shape)) {
// For simplicity we ignore the TypedArray with string index case.
if (!JSID_IS_INT(id))
return false;
*vp = pobj->getDenseOrTypedArrayElement(JSID_TO_INT(id));
return true;
}
// Fail if we have a custom getter.
if (!shape->hasDefaultGetter())
return false;
@ -2355,13 +2364,13 @@ js::GetPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Value* vp)
return true;
}
return pobj->isNative() && NativeGetPureInline(&pobj->as<NativeObject>(), shape, vp);
return pobj->isNative() && NativeGetPureInline(&pobj->as<NativeObject>(), id, shape, vp);
}
static inline bool
NativeGetGetterPureInline(Shape* shape, JSFunction** fp)
{
if (shape->hasGetterObject()) {
if (!IsImplicitDenseOrTypedArrayElement(shape) && shape->hasGetterObject()) {
if (shape->getterObject()->is<JSFunction>()) {
*fp = &shape->getterObject()->as<JSFunction>();
return true;