Bug 1487023: Replace the self-hosted SameValue function with Object.is. r=mgaudet

This commit is contained in:
André Bargull 2018-08-29 02:41:28 -07:00
Родитель 6e78f08178
Коммит b82c20b28b
4 изменённых файлов: 6 добавлений и 11 удалений

Просмотреть файл

@ -1655,8 +1655,8 @@ obj_entries(JSContext* cx, unsigned argc, Value* vp)
}
/* ES6 draft 15.2.3.16 */
static bool
obj_is(JSContext* cx, unsigned argc, Value* vp)
bool
js::obj_is(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);

Просмотреть файл

@ -35,6 +35,9 @@ obj_propertyIsEnumerable(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool
obj_create(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
obj_is(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
obj_getOwnPropertyNames(JSContext* cx, unsigned argc, JS::Value* vp);

Просмотреть файл

@ -110,15 +110,6 @@ function ToLength(v) {
return std_Math_min(v, 0x1fffffffffffff);
}
// ES2017 draft rev aebf014403a3e641fb1622aec47c40f051943527
// 7.2.9 SameValue ( x, y )
function SameValue(x, y) {
if (x === y) {
return (x !== 0) || (1 / x === 1 / y);
}
return (x !== x && y !== y);
}
// ES2017 draft rev aebf014403a3e641fb1622aec47c40f051943527
// 7.2.10 SameValueZero ( x, y )
function SameValueZero(x, y) {

Просмотреть файл

@ -2445,6 +2445,7 @@ static const JSFunctionSpec intrinsic_functions[] = {
JS_FN("_DefineDataProperty", intrinsic_DefineDataProperty, 4,0),
JS_FN("_DefineProperty", intrinsic_DefineProperty, 6,0),
JS_FN("CopyDataPropertiesOrGetOwnKeys", intrinsic_CopyDataPropertiesOrGetOwnKeys, 3,0),
JS_INLINABLE_FN("SameValue", js::obj_is, 2,0, ObjectIs),
JS_INLINABLE_FN("_IsConstructing", intrinsic_IsConstructing, 0,0,
IntrinsicIsConstructing),