mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 06:18:38 +09:00
1344477 - Part 2: Optimize Array.prototype.splice with JSOP_NORVCALL.
This commit is contained in:
parent
417aa02122
commit
4f51cc381d
16 changed files with 28 additions and 149 deletions
|
|
@ -2380,13 +2380,6 @@ CopyDenseElements(JSContext* cx, NativeObject* dst, NativeObject* src,
|
|||
return DenseElementResult::Success;
|
||||
}
|
||||
|
||||
/* ES 2016 draft Mar 25, 2016 22.1.3.26. */
|
||||
bool
|
||||
js::array_splice(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return array_splice_impl(cx, argc, vp, true);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ArraySpliceCopy(JSContext* cx, HandleObject arr, HandleObject obj,
|
||||
uint32_t actualStart, uint32_t actualDeleteCount)
|
||||
|
|
@ -2416,8 +2409,8 @@ ArraySpliceCopy(JSContext* cx, HandleObject arr, HandleObject obj,
|
|||
return SetLengthProperty(cx, arr, actualDeleteCount);
|
||||
}
|
||||
|
||||
bool
|
||||
js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueIsUsed)
|
||||
static bool
|
||||
array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueIsUsed)
|
||||
{
|
||||
AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.splice");
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
|
@ -2667,6 +2660,19 @@ js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueI
|
|||
return true;
|
||||
}
|
||||
|
||||
/* ES 2016 draft Mar 25, 2016 22.1.3.26. */
|
||||
bool
|
||||
js::array_splice(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return array_splice_impl(cx, argc, vp, true);
|
||||
}
|
||||
|
||||
static bool
|
||||
array_splice_noRetVal(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return array_splice_impl(cx, argc, vp, false);
|
||||
}
|
||||
|
||||
struct SortComparatorIndexes
|
||||
{
|
||||
bool operator()(uint32_t a, uint32_t b, bool* lessOrEqualp) {
|
||||
|
|
@ -3084,6 +3090,15 @@ array_of(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
const JSJitInfo js::array_splice_info = {
|
||||
{ (JSJitGetterOp)array_splice_noRetVal },
|
||||
{ 0 }, /* unused */
|
||||
{ 0 }, /* unused */
|
||||
JSJitInfo::IgnoresReturnValueNative,
|
||||
JSJitInfo::AliasEverything,
|
||||
JSVAL_TYPE_UNDEFINED,
|
||||
};
|
||||
|
||||
static const JSFunctionSpec array_methods[] = {
|
||||
#if JS_HAS_TOSOURCE
|
||||
JS_FN(js_toSource_str, array_toSource, 0,0),
|
||||
|
|
@ -3099,7 +3114,7 @@ static const JSFunctionSpec array_methods[] = {
|
|||
JS_INLINABLE_FN("pop", array_pop, 0,0, ArrayPop),
|
||||
JS_INLINABLE_FN("shift", array_shift, 0,0, ArrayShift),
|
||||
JS_FN("unshift", array_unshift, 1,0),
|
||||
JS_INLINABLE_FN("splice", array_splice, 2,0, ArraySplice),
|
||||
JS_FNINFO("splice", array_splice, &array_splice_info, 2,0),
|
||||
|
||||
/* Pythonic sequence methods. */
|
||||
JS_SELF_HOSTED_FN("concat", "ArrayConcat", 1,0),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue