mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1170676: Fix null dereference in PluginModuleParent::StreamCast; r=jimm (72e60e403) - Bug 1164543 - Remove gAllInstances from PluginModuleChild (r=jimm) (15e035939) - Bug 1164543 - Make plugin shutdown async in e10s (r=jimm) (e5239585f) - Bug 1195527 - Part 1: Move D3D11 texture allocation into the TextureClient. r=jrmuizel (16e67d7e8) - Bug 1195527 - Part 2: Add D3D11 video TextureClient recycler. r=jrmuizel (2c44d311b) - more stuff todo (7b1bce288) - Bug 1136945 - Add to Debugger.Memory docs possible outcomes of the nonincrementalReason in the onGarbageCollection event. r=fitzgen (33c6408ff) - pointer style (05cc032b4) - Bug 1197970 - Expose the GC cycle's number through Debugger.Memory's onGarbageCollection hook. r=sfink (5a420105f) - Bug 1168992 - Part 1: Fix up reflection of classes. (r=Waldo) (5346e941b) - Bug 1168992 - Part 2: Fix reflection of new.target. (r=Waldo) (38701b76d) - Bug 1179063 - Hook up FunctionBox directly to the JSFunction being parsed to avoid allocating extra static scopes. (r=efaust) (d35252e18) - Bug 1084319: Actually patter-match SIMD.bool (rebasing mistake); r=nbp (0980117b4) - Bug 1200809 part 1 - Add InlinableNatives JitInfo infrastructure, use it for Math natives. r=bz,nbp (141e78aac) - Bug 1193280 - Part 1: test stack trace handling of native frames with dedicated function. r=fitzgen (dd1c63891) - Bug 1193280 - Part 2: Self-host Array.prototype.filter. r=jandem (82cbe1512) - Bug 1200782 - Inline Array.isArray when we know the result statically. r=bhackett (546917507) - Bug 1200809 part 2 - Convert Array natives to new InlinableNatives system. r=nbp (901aae723) - Bug 1200809 part 3 - Convert String/RegExp natives to new InlinableNatives system. r=nbp (8e8eb68fd) - Bug 1200809 part 4 - Convert Atomics natives to new InlinableNatives system. r=lth (430d8a6b8)
This commit is contained in:
+12
-90
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "ds/Sort.h"
|
||||
#include "gc/Heap.h"
|
||||
#include "jit/InlinableNatives.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "vm/ArgumentsObject.h"
|
||||
@@ -2345,8 +2346,8 @@ CanOptimizeForDenseStorage(HandleObject arr, uint32_t startingIndex, uint32_t co
|
||||
}
|
||||
|
||||
/* ES5 15.4.4.12. */
|
||||
bool
|
||||
js::array_splice(JSContext* cx, unsigned argc, Value* vp)
|
||||
static bool
|
||||
array_splice(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
return array_splice_impl(cx, argc, vp, true);
|
||||
}
|
||||
@@ -3023,86 +3024,6 @@ js::array_slice_dense(JSContext* cx, HandleObject obj, int32_t begin, int32_t en
|
||||
return &argv[0].toObject();
|
||||
}
|
||||
|
||||
/* ES5 15.4.4.20. */
|
||||
static bool
|
||||
array_filter(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
/* Step 1. */
|
||||
RootedObject obj(cx, ToObject(cx, args.thisv()));
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
/* Step 2-3. */
|
||||
uint32_t len;
|
||||
if (!GetLengthProperty(cx, obj, &len))
|
||||
return false;
|
||||
|
||||
/* Step 4. */
|
||||
if (args.length() == 0) {
|
||||
ReportMissingArg(cx, args.calleev(), 0);
|
||||
return false;
|
||||
}
|
||||
RootedObject callable(cx, ValueToCallable(cx, args[0], args.length() - 1));
|
||||
if (!callable)
|
||||
return false;
|
||||
|
||||
/* Step 5. */
|
||||
RootedValue thisv(cx, args.length() >= 2 ? args[1] : UndefinedValue());
|
||||
|
||||
/* Step 6. */
|
||||
RootedObject arr(cx, NewFullyAllocatedArrayForCallingAllocationSite(cx, 0));
|
||||
if (!arr)
|
||||
return false;
|
||||
|
||||
/* Step 7. */
|
||||
uint32_t k = 0;
|
||||
|
||||
/* Step 8. */
|
||||
uint32_t to = 0;
|
||||
|
||||
/* Step 9. */
|
||||
FastInvokeGuard fig(cx, ObjectValue(*callable));
|
||||
InvokeArgs& args2 = fig.args();
|
||||
RootedValue kValue(cx);
|
||||
while (k < len) {
|
||||
if (!CheckForInterrupt(cx))
|
||||
return false;
|
||||
|
||||
/* Step a, b, and c.i. */
|
||||
bool kNotPresent;
|
||||
if (!GetElement(cx, obj, k, &kNotPresent, &kValue))
|
||||
return false;
|
||||
|
||||
/* Step c.ii-iii. */
|
||||
if (!kNotPresent) {
|
||||
if (!args2.init(3))
|
||||
return false;
|
||||
args2.setCallee(ObjectValue(*callable));
|
||||
args2.setThis(thisv);
|
||||
args2[0].set(kValue);
|
||||
args2[1].setNumber(k);
|
||||
args2[2].setObject(*obj);
|
||||
if (!fig.invoke(cx))
|
||||
return false;
|
||||
|
||||
if (ToBoolean(args2.rval())) {
|
||||
if (!SetArrayElement(cx, arr, to, kValue))
|
||||
return false;
|
||||
to++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Step d. */
|
||||
k++;
|
||||
}
|
||||
|
||||
/* Step 10. */
|
||||
args.rval().setObject(*arr);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
array_isArray(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
@@ -3193,23 +3114,23 @@ static const JSFunctionSpec array_methods[] = {
|
||||
JS_FN("join", array_join, 1,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("reverse", array_reverse, 0,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("sort", array_sort, 1,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("push", array_push, 1,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("pop", array_pop, 0,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("shift", array_shift, 0,JSFUN_GENERIC_NATIVE),
|
||||
JS_INLINABLE_FN("push", array_push, 1,JSFUN_GENERIC_NATIVE, ArrayPush),
|
||||
JS_INLINABLE_FN("pop", array_pop, 0,JSFUN_GENERIC_NATIVE, ArrayPop),
|
||||
JS_INLINABLE_FN("shift", array_shift, 0,JSFUN_GENERIC_NATIVE, ArrayShift),
|
||||
JS_FN("unshift", array_unshift, 1,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("splice", array_splice, 2,JSFUN_GENERIC_NATIVE),
|
||||
JS_INLINABLE_FN("splice", array_splice, 2,JSFUN_GENERIC_NATIVE, ArraySplice),
|
||||
|
||||
/* Pythonic sequence methods. */
|
||||
JS_FN("concat", array_concat, 1,JSFUN_GENERIC_NATIVE),
|
||||
JS_FN("slice", array_slice, 2,JSFUN_GENERIC_NATIVE),
|
||||
JS_INLINABLE_FN("concat", array_concat, 1,JSFUN_GENERIC_NATIVE, ArrayConcat),
|
||||
JS_INLINABLE_FN("slice", array_slice, 2,JSFUN_GENERIC_NATIVE, ArraySlice),
|
||||
|
||||
JS_SELF_HOSTED_FN("lastIndexOf", "ArrayLastIndexOf", 1,0),
|
||||
JS_SELF_HOSTED_FN("indexOf", "ArrayIndexOf", 1,0),
|
||||
JS_SELF_HOSTED_FN("forEach", "ArrayForEach", 1,0),
|
||||
JS_SELF_HOSTED_FN("map", "ArrayMap", 1,0),
|
||||
JS_SELF_HOSTED_FN("filter", "ArrayFilter", 1,0),
|
||||
JS_SELF_HOSTED_FN("reduce", "ArrayReduce", 1,0),
|
||||
JS_SELF_HOSTED_FN("reduceRight", "ArrayReduceRight", 1,0),
|
||||
JS_FN("filter", array_filter, 1,JSFUN_GENERIC_NATIVE),
|
||||
JS_SELF_HOSTED_FN("some", "ArraySome", 1,0),
|
||||
JS_SELF_HOSTED_FN("every", "ArrayEvery", 1,0),
|
||||
|
||||
@@ -3231,11 +3152,12 @@ static const JSFunctionSpec array_methods[] = {
|
||||
};
|
||||
|
||||
static const JSFunctionSpec array_static_methods[] = {
|
||||
JS_FN("isArray", array_isArray, 1,0),
|
||||
JS_INLINABLE_FN("isArray", array_isArray, 1,0, ArrayIsArray),
|
||||
JS_SELF_HOSTED_FN("lastIndexOf", "ArrayStaticLastIndexOf", 2,0),
|
||||
JS_SELF_HOSTED_FN("indexOf", "ArrayStaticIndexOf", 2,0),
|
||||
JS_SELF_HOSTED_FN("forEach", "ArrayStaticForEach", 2,0),
|
||||
JS_SELF_HOSTED_FN("map", "ArrayStaticMap", 2,0),
|
||||
JS_SELF_HOSTED_FN("filter", "ArrayStaticFilter", 2,0),
|
||||
JS_SELF_HOSTED_FN("every", "ArrayStaticEvery", 2,0),
|
||||
JS_SELF_HOSTED_FN("some", "ArrayStaticSome", 2,0),
|
||||
JS_SELF_HOSTED_FN("reduce", "ArrayStaticReduce", 2,0),
|
||||
|
||||
Reference in New Issue
Block a user