mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
Bug 1200108 - Remove NewDenseArray intrinsic, use std_Array instead. r=till
This commit is contained in:
parent
d5cdc73864
commit
d3f5baeb34
@ -253,7 +253,7 @@ function ArrayMap(callbackfn/*, thisArg*/) {
|
||||
var T = arguments.length > 1 ? arguments[1] : void 0;
|
||||
|
||||
/* Step 6. */
|
||||
var A = NewDenseArray(len);
|
||||
var A = std_Array(len);
|
||||
|
||||
/* Step 7-8. */
|
||||
/* Step a (implicit), and d. */
|
||||
@ -718,9 +718,7 @@ function ArrayIteratorNext() {
|
||||
}
|
||||
|
||||
if (itemKind === ITEM_KIND_KEY_AND_VALUE) {
|
||||
var pair = NewDenseArray(2);
|
||||
pair[0] = index;
|
||||
pair[1] = a[index];
|
||||
var pair = [index, a[index]];
|
||||
result.value = pair;
|
||||
return result;
|
||||
}
|
||||
@ -807,7 +805,7 @@ function ArrayFrom(items, mapfn=undefined, thisArg=undefined) {
|
||||
var len = ToLength(arrayLike.length);
|
||||
|
||||
// Steps 12-14.
|
||||
var A = IsConstructor(C) ? new C(len) : NewDenseArray(len);
|
||||
var A = IsConstructor(C) ? new C(len) : std_Array(len);
|
||||
|
||||
// Steps 15-16.
|
||||
for (var k = 0; k < len; k++) {
|
||||
|
@ -1,9 +0,0 @@
|
||||
function t() {
|
||||
var o = {l: 0xfffffffff};
|
||||
var l = o.l - 0xffffffffe;
|
||||
var a = getSelfHostedValue('NewDenseArray');
|
||||
var arr = a(l);
|
||||
assertEq(arr.length, 1);
|
||||
}
|
||||
t();
|
||||
t();
|
5
js/src/jit-test/tests/basic/bug1200108.js
Normal file
5
js/src/jit-test/tests/basic/bug1200108.js
Normal file
@ -0,0 +1,5 @@
|
||||
// |jit-test| error: 987
|
||||
var obj = {length: -1, 0: 0};
|
||||
Array.prototype.map.call(obj, function () {
|
||||
throw 987;
|
||||
});
|
@ -754,7 +754,6 @@ bool intrinsic_ToString(JSContext* cx, unsigned argc, Value* vp);
|
||||
bool intrinsic_IsCallable(JSContext* cx, unsigned argc, Value* vp);
|
||||
bool intrinsic_ThrowRangeError(JSContext* cx, unsigned argc, Value* vp);
|
||||
bool intrinsic_ThrowTypeError(JSContext* cx, unsigned argc, Value* vp);
|
||||
bool intrinsic_NewDenseArray(JSContext* cx, unsigned argc, Value* vp);
|
||||
bool intrinsic_IsConstructing(JSContext* cx, unsigned argc, Value* vp);
|
||||
bool intrinsic_SubstringKernel(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
|
@ -287,31 +287,6 @@ intrinsic_DecompileArg(JSContext* cx, unsigned argc, Value* vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* NewDenseArray(length): Allocates and returns a new dense array with
|
||||
* the given length where all values are initialized to holes.
|
||||
*/
|
||||
bool
|
||||
js::intrinsic_NewDenseArray(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
double lengthDouble = args[0].toNumber();
|
||||
MOZ_ASSERT(lengthDouble >= 0);
|
||||
MOZ_ASSERT(lengthDouble < INT32_MAX);
|
||||
MOZ_ASSERT(uint32_t(lengthDouble) == lengthDouble);
|
||||
|
||||
uint32_t length = uint32_t(lengthDouble);
|
||||
|
||||
// Make a new buffer and initialize it up to length.
|
||||
RootedObject buffer(cx, NewFullyAllocatedArrayForCallingAllocationSite(cx, length));
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js::intrinsic_DefineDataProperty(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
@ -1270,6 +1245,7 @@ intrinsic_ConstructorForTypedArray(JSContext* cx, unsigned argc, Value* vp)
|
||||
// Additionally, a set of C++-implemented helper functions is defined on the
|
||||
// self-hosting global.
|
||||
static const JSFunctionSpec intrinsic_functions[] = {
|
||||
JS_FN("std_Array", ArrayConstructor, 1,0),
|
||||
JS_FN("std_Array_join", array_join, 1,0),
|
||||
JS_FN("std_Array_push", array_push, 1,0),
|
||||
JS_FN("std_Array_pop", array_pop, 0,0),
|
||||
@ -1417,8 +1393,6 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
||||
|
||||
JS_FN("IsWeakSet", intrinsic_IsWeakSet, 1,0),
|
||||
|
||||
JS_FN("NewDenseArray", intrinsic_NewDenseArray, 1,0),
|
||||
|
||||
// See builtin/TypedObject.h for descriptors of the typedobj functions.
|
||||
JS_FN("NewOpaqueTypedObject", js::NewOpaqueTypedObject, 1, 0),
|
||||
JS_FN("NewDerivedTypedObject", js::NewDerivedTypedObject, 3, 0),
|
||||
|
Loading…
Reference in New Issue
Block a user