mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784295 - Part 2: Compile self-hosted JS in extra warnings mode (in DEBUG builds). r=till
This commit is contained in:
parent
94e96bb8cb
commit
13631af445
@ -556,8 +556,6 @@ function ArrayKeys() {
|
||||
return CreateArrayIterator(this, ITEM_KIND_KEY);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PARALLEL_JS
|
||||
|
||||
/*
|
||||
* Strawman spec:
|
||||
* http://wiki.ecmascript.org/doku.php?id=strawman:data_parallelism
|
||||
@ -616,8 +614,12 @@ function ComputeNumChunks(length) {
|
||||
*/
|
||||
function ComputeSliceBounds(numItems, sliceIndex, numSlices) {
|
||||
var sliceWidth = (numItems / numSlices) | 0;
|
||||
var startIndex = sliceWidth * sliceIndex;
|
||||
var endIndex = sliceIndex === numSlices - 1 ? numItems : sliceWidth * (sliceIndex + 1);
|
||||
var extraChunks = (numItems % numSlices) | 0;
|
||||
|
||||
var startIndex = sliceWidth * sliceIndex + std_Math_min(extraChunks, sliceIndex);
|
||||
var endIndex = startIndex + sliceWidth;
|
||||
if (sliceIndex < extraChunks)
|
||||
endIndex += 1;
|
||||
return [startIndex, endIndex];
|
||||
}
|
||||
|
||||
@ -631,14 +633,24 @@ function ComputeSliceBounds(numItems, sliceIndex, numSlices) {
|
||||
*/
|
||||
function ComputeAllSliceBounds(numItems, numSlices) {
|
||||
// FIXME(bug 844890): Use typed arrays here.
|
||||
var sliceWidth = (numItems / numSlices) | 0;
|
||||
var extraChunks = (numItems % numSlices) | 0;
|
||||
var counter = 0;
|
||||
var info = [];
|
||||
for (var i = 0; i < numSlices; i++) {
|
||||
var [start, end] = ComputeSliceBounds(numItems, i, numSlices);
|
||||
ARRAY_PUSH(info, SLICE_INFO(start, end));
|
||||
var i = 0;
|
||||
for (; i < extraChunks; i++) {
|
||||
ARRAY_PUSH(info, SLICE_INFO(counter, counter + sliceWidth + 1));
|
||||
counter += sliceWidth + 1;
|
||||
}
|
||||
for (; i < numSlices; i++) {
|
||||
ARRAY_PUSH(info, SLICE_INFO(counter, counter + sliceWidth));
|
||||
counter += sliceWidth;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PARALLEL_JS
|
||||
|
||||
/**
|
||||
* Creates a new array by applying |func(e, i, self)| for each element |e|
|
||||
* with index |i|.
|
||||
@ -698,6 +710,8 @@ function ArrayMapPar(func, mode) {
|
||||
|
||||
return chunkEnd === info[SLICE_END(sliceId)];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -782,6 +796,8 @@ function ArrayReducePar(func, mode) {
|
||||
accumulator = func(accumulator, self[i]);
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -969,6 +985,8 @@ function ArrayScanPar(func, mode) {
|
||||
|
||||
return indexEnd === info[SLICE_END(sliceId)];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1121,6 +1139,8 @@ function ArrayScatterPar(targets, defaultValue, conflictFunc, length, mode) {
|
||||
|
||||
return indexEnd === targetsLength;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function parDivideScatterVector() {
|
||||
@ -1199,6 +1219,8 @@ function ArrayScatterPar(targets, defaultValue, conflictFunc, length, mode) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function seq() {
|
||||
@ -1232,6 +1254,8 @@ function ArrayScatterPar(targets, defaultValue, conflictFunc, length, mode) {
|
||||
// It's not enough to return t, as -0 | 0 === -0.
|
||||
return TO_INT32(t);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1367,6 +1391,8 @@ function ArrayFilterPar(func, mode) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1438,6 +1464,8 @@ function ArrayStaticBuildPar(length, func, mode) {
|
||||
for (var i = indexStart; i < indexEnd; i++)
|
||||
UnsafePutElements(buffer, i, func(i));
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4,92 +4,6 @@
|
||||
|
||||
// FIXME(bug 844882): Parallel array properties should not be exposed.
|
||||
|
||||
// The mode asserts options object.
|
||||
#define TRY_PARALLEL(MODE) \
|
||||
((!MODE || MODE.mode !== "seq"))
|
||||
#define ASSERT_SEQUENTIAL_IS_OK(MODE) \
|
||||
do { if (MODE) AssertSequentialIsOK(MODE) } while(false)
|
||||
|
||||
// Slice array: see ComputeAllSliceBounds()
|
||||
#define SLICE_INFO(START, END) START, END, START, 0
|
||||
#define SLICE_START(ID) ((ID << 2) + 0)
|
||||
#define SLICE_END(ID) ((ID << 2) + 1)
|
||||
#define SLICE_POS(ID) ((ID << 2) + 2)
|
||||
|
||||
// How many items at a time do we do recomp. for parallel execution.
|
||||
// Note that filter currently assumes that this is no greater than 32
|
||||
// in order to make use of a bitset.
|
||||
#define CHUNK_SHIFT 5
|
||||
#define CHUNK_SIZE 32
|
||||
|
||||
// Safe versions of ARRAY.push(ELEMENT)
|
||||
#define ARRAY_PUSH(ARRAY, ELEMENT) \
|
||||
callFunction(std_Array_push, ARRAY, ELEMENT);
|
||||
#define ARRAY_SLICE(ARRAY, ELEMENT) \
|
||||
callFunction(std_Array_slice, ARRAY, ELEMENT);
|
||||
|
||||
/**
|
||||
* The ParallelSpew intrinsic is only defined in debug mode, so define a dummy
|
||||
* if debug is not on.
|
||||
*/
|
||||
#ifndef DEBUG
|
||||
#define ParallelSpew(args)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Determine the number of chunks of size CHUNK_SIZE;
|
||||
* note that the final chunk may be smaller than CHUNK_SIZE.
|
||||
*/
|
||||
function ComputeNumChunks(length) {
|
||||
var chunks = length >>> CHUNK_SHIFT;
|
||||
if (chunks << CHUNK_SHIFT === length)
|
||||
return chunks;
|
||||
return chunks + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the bounds for slice |sliceIndex| of |numItems| items,
|
||||
* assuming |numSlices| total slices. If numItems is not evenly
|
||||
* divisible by numSlices, then the final thread may have a bit of
|
||||
* extra work.
|
||||
*/
|
||||
function ComputeSliceBounds(numItems, sliceIndex, numSlices) {
|
||||
var sliceWidth = (numItems / numSlices) | 0;
|
||||
var extraChunks = (numItems % numSlices) | 0;
|
||||
|
||||
var startIndex = sliceWidth * sliceIndex + std_Math_min(extraChunks, sliceIndex);
|
||||
var endIndex = startIndex + sliceWidth;
|
||||
if (sliceIndex < extraChunks)
|
||||
endIndex += 1;
|
||||
return [startIndex, endIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Divides |numItems| items amongst |numSlices| slices. The result
|
||||
* is an array containing multiple values per slice: the start
|
||||
* index, end index, current position, and some padding. The
|
||||
* current position is initially the same as the start index. To
|
||||
* access the values for a particular slice, use the macros
|
||||
* SLICE_START() and so forth.
|
||||
*/
|
||||
function ComputeAllSliceBounds(numItems, numSlices) {
|
||||
// FIXME(bug 844890): Use typed arrays here.
|
||||
var sliceWidth = (numItems / numSlices) | 0;
|
||||
var extraChunks = (numItems % numSlices) | 0;
|
||||
var counter = 0;
|
||||
var info = [];
|
||||
var i = 0;
|
||||
for (; i < extraChunks; i++) {
|
||||
ARRAY_PUSH(info, SLICE_INFO(counter, counter + sliceWidth + 1));
|
||||
counter += sliceWidth + 1;
|
||||
}
|
||||
for (; i < numSlices; i++) {
|
||||
ARRAY_PUSH(info, SLICE_INFO(counter, counter + sliceWidth));
|
||||
counter += sliceWidth;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the partial products in reverse order.
|
||||
* e.g., if the shape is [A,B,C,D], then the
|
||||
@ -161,8 +75,8 @@ function ParallelArrayConstructEmpty() {
|
||||
* This is the function invoked for |new ParallelArray(array)|.
|
||||
* It copies the data from its array-like argument |array|.
|
||||
*/
|
||||
function ParallelArrayConstructFromArray(buffer) {
|
||||
var buffer = ToObject(buffer);
|
||||
function ParallelArrayConstructFromArray(array) {
|
||||
var buffer = ToObject(array);
|
||||
var length = buffer.length >>> 0;
|
||||
if (length !== buffer.length)
|
||||
ThrowError(JSMSG_PAR_ARRAY_BAD_ARG, "");
|
||||
@ -441,6 +355,8 @@ function ParallelArrayMap(func, mode) {
|
||||
|
||||
return chunkEnd == info[SLICE_END(sliceId)];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -525,6 +441,8 @@ function ParallelArrayReduce(func, mode) {
|
||||
accumulator = func(accumulator, self.get(i));
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -713,6 +631,8 @@ function ParallelArrayScan(func, mode) {
|
||||
|
||||
return indexEnd == info[SLICE_END(sliceId)];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -870,6 +790,8 @@ function ParallelArrayScatter(targets, defaultValue, conflictFunc, length, mode)
|
||||
|
||||
return indexEnd == targetsLength;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function parDivideScatterVector() {
|
||||
@ -948,6 +870,8 @@ function ParallelArrayScatter(targets, defaultValue, conflictFunc, length, mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function seq() {
|
||||
@ -981,6 +905,8 @@ function ParallelArrayScatter(targets, defaultValue, conflictFunc, length, mode)
|
||||
// It's not enough to return t, as -0 | 0 === -0.
|
||||
return TO_INT32(t);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1117,6 +1043,8 @@ function ParallelArrayFilter(func, mode) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1289,9 +1217,9 @@ function ForkJoinMode(mode) {
|
||||
return 3;
|
||||
} else if (mode.mode === "bailout") {
|
||||
return 4;
|
||||
} else {
|
||||
ThrowError(JSMSG_PAR_ARRAY_BAD_ARG, "");
|
||||
}
|
||||
ThrowError(JSMSG_PAR_ARRAY_BAD_ARG, "");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -127,6 +127,7 @@ TypedObjectPointer.prototype.moveTo = function(propName) {
|
||||
}
|
||||
|
||||
ThrowError(JSMSG_TYPEDOBJECT_NO_SUCH_PROP, propName);
|
||||
return undefined;
|
||||
};
|
||||
|
||||
// Adjust `this` in place to point at the element `index`. `this`
|
||||
@ -205,6 +206,7 @@ TypedObjectPointer.prototype.get = function() {
|
||||
}
|
||||
|
||||
assert(false, "Unhandled kind: " + REPR_KIND(this.typeRepr));
|
||||
return undefined;
|
||||
}
|
||||
|
||||
TypedObjectPointer.prototype.getScalar = function() {
|
||||
@ -237,6 +239,7 @@ TypedObjectPointer.prototype.getScalar = function() {
|
||||
}
|
||||
|
||||
assert(false, "Unhandled scalar type: " + type);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
TypedObjectPointer.prototype.getReference = function() {
|
||||
@ -253,6 +256,7 @@ TypedObjectPointer.prototype.getReference = function() {
|
||||
}
|
||||
|
||||
assert(false, "Unhandled scalar type: " + type);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
TypedObjectPointer.prototype.getX4 = function() {
|
||||
@ -273,7 +277,9 @@ TypedObjectPointer.prototype.getX4 = function() {
|
||||
var w = Load_int32(this.datum, this.offset + 12);
|
||||
return T.int32x4(x, y, z, w);
|
||||
}
|
||||
|
||||
assert(false, "Unhandled x4 type: " + type);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -352,7 +358,7 @@ TypedObjectPointer.prototype.set = function(fromValue) {
|
||||
|
||||
ThrowError(JSMSG_CANT_CONVERT_TO,
|
||||
typeof(fromValue),
|
||||
this.typeRepr.toSource())
|
||||
this.typeRepr.toSource());
|
||||
}
|
||||
|
||||
// Sets `fromValue` to `this` assuming that `this` is a scalar type.
|
||||
@ -398,6 +404,7 @@ TypedObjectPointer.prototype.setScalar = function(fromValue) {
|
||||
}
|
||||
|
||||
assert(false, "Unhandled scalar type: " + type);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
TypedObjectPointer.prototype.setReference = function(fromValue) {
|
||||
@ -415,6 +422,7 @@ TypedObjectPointer.prototype.setReference = function(fromValue) {
|
||||
}
|
||||
|
||||
assert(false, "Unhandled scalar type: " + type);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Sets `fromValue` to `this` assuming that `this` is a scalar type.
|
||||
@ -425,7 +433,7 @@ TypedObjectPointer.prototype.setX4 = function(fromValue) {
|
||||
// to "adapt" fromValue, but there are no legal adaptions.
|
||||
ThrowError(JSMSG_CANT_CONVERT_TO,
|
||||
typeof(fromValue),
|
||||
this.typeRepr.toSource())
|
||||
this.typeRepr.toSource());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -661,7 +669,9 @@ function X4ProtoString(type) {
|
||||
case JS_X4TYPEREPR_FLOAT32:
|
||||
return "float32x4";
|
||||
}
|
||||
|
||||
assert(false, "Unhandled type constant");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var X4LaneStrings = ["x", "y", "z", "w"];
|
||||
@ -685,7 +695,9 @@ function X4GetLane(datum, type, lane) {
|
||||
case JS_X4TYPEREPR_FLOAT32:
|
||||
return Load_float32(datum, lane * 4);
|
||||
}
|
||||
|
||||
assert(false, "Unhandled type constant");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function Float32x4Lane0() { return X4GetLane(this, JS_X4TYPEREPR_FLOAT32, 0); }
|
||||
|
@ -783,6 +783,7 @@ JSRuntime::initSelfHosting(JSContext *cx)
|
||||
|
||||
#ifdef DEBUG
|
||||
options.strictOption = true;
|
||||
options.extraWarningsOption = true;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user