import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1194905 - Build libvpx neon code without -mthumb and -mfloat-abi=softfp. r=mshal (24098bdb7)
- Remove spurious commandline.css from AF tree. (49cf2bb5c)
- Bug 969914 - Make developer toolbar match the light devtools theme when applied;r=jwalker,r=pbrosset (4047862bd)
- Bug 1152304 - Add displaying of block notes to dis() in the JS shell. (r=jimb) (9c1d7fa30)
- Bug 1126987 - Fix _lastEventSize initialization in stack.js. r=vporof (2083cb437)
- Bug 1140569 - Show async stacks attached to timeline markers. r=vporof (f05e1b60c)
- Bug 1141553 - Give function name the devtools-monospace class in the profiler r=vporof (0ca698ea2)
- Bug 1150112 - Markers overview should react to theme change, and other marker views now use CSS to automatically use theme change. r=vporof (6f72cde25)
- Bug 1050500 - Add entry reason to timeline marker. r=jsantell, r=smaug (db9cf8191)
- Bug 922221 - implement console.timeStamp(label) to create profile timeline markers. r=khuey (73e513562)
- Bug 1059908 - Merge FunctionType and FunctionSyntaxKind. r=efaust (2d765bde5)
- Bug 1059908 - Introduce a CONSTRUCTOR flag and make getter/setter/method non-constructable. r=efaust (fddb15f13)
- Bug 1162310 - Do not use nonexistent macro when XGILL_PLUGIN is defined, r=bhackett (57a5c2861)
- pointer style (55ec84b3b)
- Bug 1164602 - Replace js::NullPtr and JS::NullPtr with nullptr_t; r=sfink (9ae473e29)
- pointer style (7d735a2b9)
- pointer style (987c0128b)
- Bug 1135629 - Rename Register::code to Register::encoding for Assembler functions. r=jandem (cf915c814)
- pointer style (ac97f0d0b)
- Bug 1150337 - OdinMonkey: Optimize the full range of immediate offsets on x64. r=luke (fffb82aa6)
- fix typos (511e17002)
- pointer style (c1b54384c)
- Bug 1135707 - Fix interaction between Arm NOP fill and calculation of IonCache rejoin label r=jandem (306365ec4)
- pointer style (a8fe90ade)
- Bug 1166809 - Remove DispatchIonCache and RepatchIonCache. r=bhackett (9b8b02bf1)
- Bug 1147403 part 3 - Make IonSpewer work during off-thread compilation. r=h4writer Bug 1147403 part 3.1 - Replace newly added IonSpewPass after KeepAlive transform. r=KWierso (01bd66aa3)
- Bug 1147403 part 4 - Extract the printer from the serializer. r=h4writer (290a8887e)
- pointer style (fc70e6a1a)
- Bug 1147403 part 0 - Replace contextual information of dispatchHook by lambdas. r=shu (e177990e5)
- Bug 1065657 - Allow multiple Debuggers to track allocations at the same time. r=shu (66b5a3ba9)
- pointer style (bb317bb87)
- Bug 1147403 part 5 - Add Debugger::onIonCompilation hook. r=shu (c14a28de1)
- Bug 1147403 part 6 - Remove GetJitContext from serializing functions. r=h4writer (6d3d605a5)
- pointer style (b2ec50945)
- Bug 1147403 part 7 - Fix inIon, only reset the counter when the function is executed. r=jandem (cb6c180ef)
- Bug 1165392, Bug 1165463 - Various unboxed array fixes and optimizations, r=jandem. (28ec85004)
This commit is contained in:
2020-09-16 21:57:22 +08:00
parent 500383702e
commit d43d81d5ab
204 changed files with 3844 additions and 3041 deletions
+84 -44
View File
@@ -2076,18 +2076,38 @@ js::array_pop(JSContext* cx, unsigned argc, Value* vp)
return SetLengthProperty(cx, obj, index);
}
void
js::ArrayShiftMoveElements(ArrayObject* obj)
template <JSValueType Type>
static inline DenseElementResult
ShiftMoveBoxedOrUnboxedDenseElements(JSObject* obj)
{
MOZ_ASSERT(obj->lengthIsWritable());
MOZ_ASSERT(HasBoxedOrUnboxedDenseElements<Type>(obj));
/*
* At this point the length and initialized length have already been
* decremented and the result fetched, so just shift the array elements
* themselves.
*/
uint32_t initlen = obj->getDenseInitializedLength();
obj->moveDenseElementsNoPreBarrier(0, 1, initlen);
size_t initlen = GetBoxedOrUnboxedInitializedLength<Type>(obj);
if (Type == JSVAL_TYPE_MAGIC) {
obj->as<NativeObject>().moveDenseElementsNoPreBarrier(0, 1, initlen);
} else {
uint8_t* data = obj->as<UnboxedArrayObject>().elements();
size_t elementSize = UnboxedTypeSize(Type);
memmove(data, data + elementSize, initlen * elementSize);
}
return DenseElementResult::Success;
}
DefineBoxedOrUnboxedFunctor1(ShiftMoveBoxedOrUnboxedDenseElements, JSObject*);
void
js::ArrayShiftMoveElements(JSObject* obj)
{
MOZ_ASSERT_IF(obj->is<ArrayObject>(), obj->as<ArrayObject>().lengthIsWritable());
ShiftMoveBoxedOrUnboxedDenseElementsFunctor functor(obj);
JS_ALWAYS_TRUE(CallBoxedOrUnboxedSpecialization(functor, obj) == DenseElementResult::Success);
}
template <JSValueType Type>
@@ -2270,34 +2290,34 @@ js::array_unshift(JSContext* cx, unsigned argc, Value* vp)
// object. The resulting array will have the same boxed/unboxed elements
// representation as the input object, and will either reuse the input
// object's group or will have unknown property types.
static inline JSObject*
NewFullyAllocatedArrayTryReuseGroup(JSContext* cx, JSObject* obj, size_t length)
JSObject*
js::NewFullyAllocatedArrayTryReuseGroup(JSContext* cx, JSObject* obj, size_t length,
NewObjectKind newKind, bool forceAnalyze)
{
if (!obj->is<ArrayObject>() && !obj->is<UnboxedArrayObject>())
return NewDenseFullyAllocatedArray(cx, length);
return NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
if (obj->getProto() != cx->global()->maybeGetArrayPrototype())
return NewDenseFullyAllocatedArray(cx, length);
return NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
RootedObjectGroup group(cx, obj->getGroup(cx));
if (!group)
return nullptr;
if (group->maybePreliminaryObjects())
group->maybePreliminaryObjects()->maybeAnalyze(cx, group);
group->maybePreliminaryObjects()->maybeAnalyze(cx, group, forceAnalyze);
NewObjectKind newKind = GenericObject;
if (group->shouldPreTenure() || group->maybePreliminaryObjects())
newKind = TenuredObject;
if (group->maybeUnboxedLayout()) {
if (length > UnboxedArrayObject::MaximumCapacity)
return NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
return NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
return UnboxedArrayObject::create(cx, group, length, newKind);
}
ArrayObject* res = NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
ArrayObject* res = NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
if (!res)
return nullptr;
@@ -2333,9 +2353,9 @@ NewPartlyAllocatedArrayTryReuseGroup(JSContext* cx, JSObject* obj, size_t length
newKind = TenuredObject;
if (group->maybeUnboxedLayout())
return NewDensePartlyAllocatedArray(cx, length, NullPtr(), newKind);
return NewDensePartlyAllocatedArray(cx, length, nullptr, newKind);
ArrayObject* res = NewDensePartlyAllocatedArray(cx, length, NullPtr(), newKind);
ArrayObject* res = NewDensePartlyAllocatedArray(cx, length, nullptr, newKind);
if (!res)
return nullptr;
@@ -2449,7 +2469,7 @@ js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueI
if (!arr)
return false;
DebugOnly<DenseElementResult> result =
CopyAnyBoxedOrUnboxedDenseElements(cx, arr, obj, actualStart, actualDeleteCount);
CopyAnyBoxedOrUnboxedDenseElements(cx, arr, obj, 0, actualStart, actualDeleteCount);
MOZ_ASSERT(result.value == DenseElementResult::Success);
}
} else {
@@ -2614,29 +2634,49 @@ js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueI
return true;
}
bool
js::array_concat_dense(JSContext* cx, Handle<ArrayObject*> arr1, Handle<ArrayObject*> arr2,
Handle<ArrayObject*> result)
template <JSValueType Type>
DenseElementResult
ArrayConcatDenseKernel(JSContext* cx, JSObject* obj1, JSObject* obj2, JSObject* result)
{
uint32_t initlen1 = arr1->getDenseInitializedLength();
MOZ_ASSERT(initlen1 == arr1->length());
uint32_t initlen1 = GetBoxedOrUnboxedInitializedLength<Type>(obj1);
MOZ_ASSERT(initlen1 == GetAnyBoxedOrUnboxedArrayLength(obj1));
uint32_t initlen2 = arr2->getDenseInitializedLength();
MOZ_ASSERT(initlen2 == arr2->length());
uint32_t initlen2 = GetBoxedOrUnboxedInitializedLength<Type>(obj2);
MOZ_ASSERT(initlen2 == GetAnyBoxedOrUnboxedArrayLength(obj2));
/* No overflow here due to nelements limit. */
uint32_t len = initlen1 + initlen2;
if (!result->ensureElements(cx, len))
return false;
MOZ_ASSERT(GetBoxedOrUnboxedInitializedLength<Type>(result) == 0);
MOZ_ASSERT(!result->getDenseInitializedLength());
result->setDenseInitializedLength(len);
if (Type == JSVAL_TYPE_MAGIC) {
if (!result->as<ArrayObject>().ensureElements(cx, len))
return DenseElementResult::Failure;
} else {
if (result->as<UnboxedArrayObject>().capacity() < len) {
if (!result->as<UnboxedArrayObject>().growElements(cx, len))
return DenseElementResult::Failure;
}
}
result->initDenseElements(0, arr1->getDenseElements(), initlen1);
result->initDenseElements(initlen1, arr2->getDenseElements(), initlen2);
result->setLengthInt32(len);
return true;
CopyBoxedOrUnboxedDenseElements<Type>(cx, result, obj1, 0, 0, initlen1);
CopyBoxedOrUnboxedDenseElements<Type>(cx, result, obj2, initlen1, 0, initlen2);
SetAnyBoxedOrUnboxedArrayLength(cx, result, len);
return DenseElementResult::Success;
}
DefineBoxedOrUnboxedFunctor4(ArrayConcatDenseKernel,
JSContext*, JSObject*, JSObject*, JSObject*);
bool
js::array_concat_dense(JSContext* cx, HandleObject obj1, HandleObject obj2,
HandleObject result)
{
ArrayConcatDenseKernelFunctor functor(cx, obj1, obj2, result);
DenseElementResult rv = CallBoxedOrUnboxedSpecialization(functor, result);
MOZ_ASSERT(rv != DenseElementResult::Incomplete);
return rv == DenseElementResult::Success;
}
/*
@@ -2668,7 +2708,7 @@ js::array_concat(JSContext* cx, unsigned argc, Value* vp)
SetAnyBoxedOrUnboxedArrayLength(cx, narr, length);
DebugOnly<DenseElementResult> result =
CopyAnyBoxedOrUnboxedDenseElements(cx, narr, aobj, 0, initlen);
CopyAnyBoxedOrUnboxedDenseElements(cx, narr, aobj, 0, 0, initlen);
MOZ_ASSERT(result.value == DenseElementResult::Success);
args.rval().setObject(*narr);
@@ -2924,7 +2964,7 @@ js::array_slice(JSContext* cx, unsigned argc, Value* vp)
if (count) {
DebugOnly<DenseElementResult> result =
CopyAnyBoxedOrUnboxedDenseElements(cx, narr, obj, begin, count);
CopyAnyBoxedOrUnboxedDenseElements(cx, narr, obj, 0, begin, count);
MOZ_ASSERT(result.value == DenseElementResult::Success);
}
args.rval().setObject(*narr);
@@ -3305,7 +3345,7 @@ static bool
array_proto_finish(JSContext* cx, JS::HandleObject ctor, JS::HandleObject proto)
{
// Add Array.prototype[@@unscopables]. ECMA-262 6.0 22.1.3.31.
RootedObject unscopables(cx, NewObjectWithGivenProto<PlainObject>(cx, NullPtr(), TenuredObject));
RootedObject unscopables(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr, TenuredObject));
if (!unscopables)
return false;
@@ -3464,7 +3504,7 @@ NewArray(ExclusiveContext* cxArg, uint32_t length,
}
ArrayObject * JS_FASTCALL
js::NewDenseEmptyArray(JSContext* cx, HandleObject proto /* = NullPtr() */,
js::NewDenseEmptyArray(JSContext* cx, HandleObject proto /* = nullptr */,
NewObjectKind newKind /* = GenericObject */)
{
return NewArray<0>(cx, 0, proto, newKind);
@@ -3472,7 +3512,7 @@ js::NewDenseEmptyArray(JSContext* cx, HandleObject proto /* = NullPtr() */,
ArrayObject * JS_FASTCALL
js::NewDenseFullyAllocatedArray(ExclusiveContext* cx, uint32_t length,
HandleObject proto /* = NullPtr() */,
HandleObject proto /* = nullptr */,
NewObjectKind newKind /* = GenericObject */)
{
return NewArray<NativeObject::NELEMENTS_LIMIT>(cx, length, proto, newKind);
@@ -3480,7 +3520,7 @@ js::NewDenseFullyAllocatedArray(ExclusiveContext* cx, uint32_t length,
ArrayObject * JS_FASTCALL
js::NewDensePartlyAllocatedArray(ExclusiveContext* cx, uint32_t length,
HandleObject proto /* = NullPtr() */,
HandleObject proto /* = nullptr */,
NewObjectKind newKind /* = GenericObject */)
{
return NewArray<ArrayObject::EagerAllocationMaxLength>(cx, length, proto, newKind);
@@ -3488,7 +3528,7 @@ js::NewDensePartlyAllocatedArray(ExclusiveContext* cx, uint32_t length,
ArrayObject * JS_FASTCALL
js::NewDenseUnallocatedArray(ExclusiveContext* cx, uint32_t length,
HandleObject proto /* = NullPtr() */,
HandleObject proto /* = nullptr */,
NewObjectKind newKind /* = GenericObject */)
{
return NewArray<0>(cx, length, proto, newKind);
@@ -3504,12 +3544,12 @@ js::NewDenseArray(ExclusiveContext* cx, uint32_t length, HandleObjectGroup group
ArrayObject* arr;
if (allocating == NewArray_Unallocating) {
arr = NewDenseUnallocatedArray(cx, length, NullPtr(), newKind);
arr = NewDenseUnallocatedArray(cx, length, nullptr, newKind);
} else if (allocating == NewArray_PartlyAllocating) {
arr = NewDensePartlyAllocatedArray(cx, length, NullPtr(), newKind);
arr = NewDensePartlyAllocatedArray(cx, length, nullptr, newKind);
} else {
MOZ_ASSERT(allocating == NewArray_FullyAllocating);
arr = NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
arr = NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
}
if (!arr)
return nullptr;
@@ -3530,7 +3570,7 @@ js::NewDenseArray(ExclusiveContext* cx, uint32_t length, HandleObjectGroup group
ArrayObject*
js::NewDenseCopiedArray(JSContext* cx, uint32_t length, HandleArrayObject src,
uint32_t elementOffset, HandleObject proto /* = NullPtr() */)
uint32_t elementOffset, HandleObject proto /* = nullptr */)
{
MOZ_ASSERT(!src->isIndexed());
@@ -3550,7 +3590,7 @@ js::NewDenseCopiedArray(JSContext* cx, uint32_t length, HandleArrayObject src,
// values must point at already-rooted Value objects
ArrayObject*
js::NewDenseCopiedArray(JSContext* cx, uint32_t length, const Value* values,
HandleObject proto /* = NullPtr() */,
HandleObject proto /* = nullptr */,
NewObjectKind newKind /* = GenericObject */)
{
ArrayObject* arr = NewArray<NativeObject::NELEMENTS_LIMIT>(cx, length, proto);
@@ -3615,7 +3655,7 @@ js::ArrayInfo(JSContext* cx, unsigned argc, Value* vp)
HandleValue arg = args[i];
UniquePtr<char[], JS::FreePolicy> bytes =
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, NullPtr());
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
if (!bytes)
return false;
if (arg.isPrimitive() ||