Merge m-c to f-t

This commit is contained in:
Phil Ringnalda 2014-03-14 19:09:29 -07:00
commit f374beb614
2 changed files with 19 additions and 13 deletions

View File

@ -272,7 +272,7 @@ support-files =
[browser_dbg_watch-expressions-01.js]
[browser_dbg_watch-expressions-02.js]
[browser_dbg_chrome-create.js]
skip-if = os == "linux" # Bug 847558
skip-if = true # Test doesn't clean up after itself (bug 918507), but also bug 847558 on Linux
[browser_dbg_on-pause-raise.js]
skip-if = os == "linux" # Bug 888811 & bug 891176
[browser_dbg_break-on-dom-event.js]

View File

@ -907,14 +907,20 @@ class TypedArrayObjectTemplate : public TypedArrayObject
copyFromArray(JSContext *cx, HandleObject thisTypedArrayObj,
HandleObject ar, uint32_t len, uint32_t offset = 0)
{
// Exit early if nothing to copy, to simplify loop conditions below.
if (len == 0)
return true;
Rooted<TypedArrayObject*> thisTypedArray(cx, &thisTypedArrayObj->as<TypedArrayObject>());
JS_ASSERT(offset <= thisTypedArray->length());
JS_ASSERT(len <= thisTypedArray->length() - offset);
if (ar->is<TypedArrayObject>())
return copyFromTypedArray(cx, thisTypedArray, ar, offset);
#ifdef DEBUG
JSRuntime *runtime = cx->runtime();
uint64_t gcNumber = runtime->gcNumber;
#endif
NativeType *dest = static_cast<NativeType*>(thisTypedArray->viewData()) + offset;
SkipRoot skipDest(cx, &dest);
@ -929,33 +935,33 @@ class TypedArrayObjectTemplate : public TypedArrayObject
*/
const Value *src = ar->getDenseElements();
SkipRoot skipSrc(cx, &src);
for (uint32_t i = 0; i < len; ++i) {
uint32_t i = 0;
do {
NativeType n;
if (!nativeFromValue(cx, src[i], &n))
return false;
dest[i] = n;
}
} while (++i < len);
JS_ASSERT(runtime->gcNumber == gcNumber);
} else {
RootedValue v(cx);
for (uint32_t i = 0; i < len; ++i) {
uint32_t i = 0;
do {
if (!JSObject::getElement(cx, ar, ar, i, &v))
return false;
NativeType n;
if (!nativeFromValue(cx, v, &n))
return false;
/*
* Detect when a GC has occurred so we can update the dest
* pointers in case it has been moved.
*/
if (runtime->gcNumber != gcNumber) {
dest = static_cast<NativeType*>(thisTypedArray->viewData()) + offset;
gcNumber = runtime->gcNumber;
}
len = Min(len, thisTypedArray->length());
if (i >= len)
break;
// Compute every iteration in case getElement acts wacky.
dest = static_cast<NativeType*>(thisTypedArray->viewData()) + offset;
dest[i] = n;
}
} while (++i < len);
}
return true;