cherry-picked upstream changes:

bug841547, bug884920, bug881102, bug864099, bug872331, bug885800, bug884053, bug885959, bug885169, bug883570, bug875912, bug885176, bug857076, bug759257
This commit is contained in:
2018-07-22 23:06:10 +08:00
parent 6271f2d7a5
commit 5015907e62
50 changed files with 248 additions and 165 deletions
+2 -2
View File
@@ -455,7 +455,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
nsDOMTokenList* classList = mImageContent->AsElement()->GetClassList();
mozilla::ErrorResult rv;
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
if (mImageContent) {
if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
// Update the background-color of the image only after the
// image has been decoded to prevent flashes of just the
// background-color.
@@ -466,7 +466,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
if (aType == imgINotificationObserver::DISCARD) {
// mImageContent can be null if the document is already destroyed
if (mImageContent) {
if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
// Remove any decoded-related styling when the image is unloaded.
classList->Remove(NS_LITERAL_STRING("decoded"), rv);
NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
@@ -18,7 +18,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGAnimatedLength)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGAnimatedLength)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
+1 -8
View File
@@ -8,7 +8,6 @@
#include "mozilla/Attributes.h"
#include "nsSVGElement.h"
#include "nsIDOMSVGAnimatedLength.h"
class nsSVGLength2;
class nsIDOMSVGLength;
@@ -16,7 +15,7 @@ class nsIDOMSVGLength;
namespace mozilla {
namespace dom {
class SVGAnimatedLength MOZ_FINAL : public nsIDOMSVGAnimatedLength,
class SVGAnimatedLength MOZ_FINAL : public nsISupports,
public nsWrapperCache
{
public:
@@ -29,12 +28,6 @@ public:
~SVGAnimatedLength();
NS_IMETHOD GetBaseVal(nsIDOMSVGLength **aBaseVal) MOZ_OVERRIDE
{ *aBaseVal = BaseVal().get(); return NS_OK; }
NS_IMETHOD GetAnimVal(nsIDOMSVGLength **aAnimVal) MOZ_OVERRIDE
{ *aAnimVal = AnimVal().get(); return NS_OK; }
// WebIDL
nsSVGElement* GetParentObject() { return mSVGElement; }
virtual JSObject* WrapObject(JSContext* aCx,
@@ -7,7 +7,6 @@
#include "nsISVGPoint.h"
#include "nsSVGTextContainerFrame.h"
#include "nsSVGTextFrame2.h"
#include "nsIDOMSVGAnimatedLength.h"
#include "mozilla/dom/SVGIRect.h"
#include "nsIDOMSVGAnimatedEnum.h"
-8
View File
@@ -471,14 +471,6 @@ nsSVGLength2::SetAnimValue(float aValue, nsSVGElement *aSVGElement)
aSVGElement);
}
nsresult
nsSVGLength2::ToDOMAnimatedLength(nsIDOMSVGAnimatedLength **aResult,
nsSVGElement *aSVGElement)
{
*aResult = ToDOMAnimatedLength(aSVGElement).get();
return NS_OK;
}
already_AddRefed<SVGAnimatedLength>
nsSVGLength2::ToDOMAnimatedLength(nsSVGElement* aSVGElement)
{
-4
View File
@@ -11,7 +11,6 @@
#include "nsCoord.h"
#include "nsCycleCollectionParticipant.h"
#include "nsError.h"
#include "nsIDOMSVGAnimatedLength.h"
#include "nsIDOMSVGLength.h"
#include "nsISMILAttr.h"
#include "nsMathUtils.h"
@@ -89,9 +88,6 @@ public:
// useable, and represents the default base value of the attribute.
bool IsExplicitlySet() const
{ return mIsAnimated || mIsBaseSet; }
nsresult ToDOMAnimatedLength(nsIDOMSVGAnimatedLength **aResult,
nsSVGElement* aSVGElement);
already_AddRefed<mozilla::dom::SVGAnimatedLength>
ToDOMAnimatedLength(nsSVGElement* aSVGElement);
-1
View File
@@ -7,7 +7,6 @@
XPIDL_SOURCES += [
'nsIDOMSVGAnimatedEnum.idl',
'nsIDOMSVGAnimatedInteger.idl',
'nsIDOMSVGAnimatedLength.idl',
'nsIDOMSVGAnimatedNumber.idl',
'nsIDOMSVGElement.idl',
'nsIDOMSVGLength.idl',
@@ -1,16 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
interface nsIDOMSVGLength;
[scriptable, uuid(a52f0322-7f4d-418d-af6d-a7b14abd5cdf)]
interface nsIDOMSVGAnimatedLength : nsISupports
{
readonly attribute nsIDOMSVGLength baseVal;
readonly attribute nsIDOMSVGLength animVal;
};
+2 -5
View File
@@ -12,7 +12,6 @@
#include "nsIContentViewer.h"
#include "nsIDocument.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDOMSVGAnimatedLength.h"
#include "nsIDOMSVGLength.h"
#include "nsIHttpChannel.h"
#include "nsIObserverService.h"
@@ -86,14 +85,12 @@ SVGDocumentWrapper::GetWidthOrHeight(Dimension aDimension,
NS_ENSURE_TRUE(domAnimLength, false);
// Get the animated value from the object
nsRefPtr<nsIDOMSVGLength> domLength;
nsresult rv = domAnimLength->GetAnimVal(getter_AddRefs(domLength));
NS_ENSURE_SUCCESS(rv, false);
nsRefPtr<nsIDOMSVGLength> domLength = domAnimLength->AnimVal();
NS_ENSURE_TRUE(domLength, false);
// Check if it's a percent value (and fail if so)
uint16_t unitType;
rv = domLength->GetUnitType(&unitType);
nsresult rv = domLength->GetUnitType(&unitType);
NS_ENSURE_SUCCESS(rv, false);
if (unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
return false;
+8 -7
View File
@@ -907,18 +907,19 @@ js::testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp)
static JSObject *objectMetadataFunction = NULL;
static JSObject *
ShellObjectMetadataCallback(JSContext *cx)
static bool
ShellObjectMetadataCallback(JSContext *cx, JSObject **pmetadata)
{
Value thisv = UndefinedValue();
RootedValue rval(cx);
if (!Invoke(cx, thisv, ObjectValue(*objectMetadataFunction), 0, NULL, rval.address())) {
cx->clearPendingException();
return NULL;
}
if (!Invoke(cx, thisv, ObjectValue(*objectMetadataFunction), 0, NULL, rval.address()))
return false;
return rval.isObject() ? &rval.toObject() : NULL;
if (rval.isObject())
*pmetadata = &rval.toObject();
return true;
}
static JSBool
+10 -13
View File
@@ -2328,6 +2328,10 @@ typename ParseHandler::Node
Parser<ParseHandler>::functionStmt()
{
JS_ASSERT(tokenStream.currentToken().type == TOK_FUNCTION);
TokenStream::Position start(keepAtoms);
tokenStream.tell(&start);
RootedPropertyName name(context);
if (tokenStream.getToken(TSF_KEYWORD_IS_NAME) == TOK_NAME) {
name = tokenStream.currentToken().name();
@@ -2337,9 +2341,6 @@ Parser<ParseHandler>::functionStmt()
return null();
}
TokenStream::Position start(keepAtoms);
tokenStream.positionAfterLastFunctionKeyword(start);
/* We forbid function statements in strict mode code. */
if (!pc->atBodyLevel() && pc->sc->needStrictChecks() &&
!report(ParseStrictError, pc->sc->strict, null(), JSMSG_STRICT_FUNCTION_STATEMENT))
@@ -2355,7 +2356,7 @@ Parser<ParseHandler>::functionExpr()
RootedPropertyName name(context);
JS_ASSERT(tokenStream.currentToken().type == TOK_FUNCTION);
TokenStream::Position start(keepAtoms);
tokenStream.positionAfterLastFunctionKeyword(start);
tokenStream.tell(&start);
if (tokenStream.getToken(TSF_KEYWORD_IS_NAME) == TOK_NAME)
name = tokenStream.currentToken().name();
else
@@ -2762,16 +2763,12 @@ Parser<ParseHandler>::bindVarOrConst(JSContext *cx, BindData<ParseHandler> *data
/*
* This definition isn't being added to the parse context's
* declarations, so make sure to indicate the need to deoptimize
* the script's arguments object.
* the script's arguments object. Mark the function as if it
* contained a debugger statement, which will deoptimize arguments
* as much as possible.
*/
HandlePropertyName arguments = cx->names().arguments;
if (name == arguments) {
Node pn = parser->newName(arguments);
if (!pc->define(parser->context, arguments, pn, Definition::VAR))
return false;
funbox->setArgumentsHasLocalBinding();
funbox->setDefinitelyNeedsArgsObj();
}
if (name == cx->names().arguments)
funbox->setHasDebuggerStatement();
}
return true;
}
+1 -1
View File
@@ -38,7 +38,7 @@ class AnyContextFlags
// - direct eval
// - function::
// - with
// since both effectively allow any name to be accessed. Non-exmaples are:
// since both effectively allow any name to be accessed. Non-examples are:
// - upvars of nested functions
// - function statement
// since the set of assigned name is known dynamically. 'with' could be in
+1 -13
View File
@@ -287,7 +287,6 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
originPrincipals(JSScript::normalizeOriginPrincipals(options.principals,
options.originPrincipals)),
strictModeGetter(smg),
lastFunctionKeyword(keepAtoms),
tokenSkip(cx, &tokens),
linebaseSkip(cx, &linebase),
prevLinebaseSkip(cx, &prevLinebase)
@@ -578,18 +577,10 @@ TokenStream::seek(const Position &pos, const TokenStream &other)
{
if (!srcCoords.fill(other.srcCoords))
return false;
lastFunctionKeyword = other.lastFunctionKeyword;
seek(pos);
return true;
}
void
TokenStream::positionAfterLastFunctionKeyword(Position &pos)
{
JS_ASSERT(lastFunctionKeyword.buf > userbuf.base());
PodAssign(&pos, &lastFunctionKeyword);
}
bool
TokenStream::reportStrictModeErrorNumberVA(uint32_t offset, bool strictMode, unsigned errorNumber,
va_list args)
@@ -1177,11 +1168,8 @@ TokenStream::getTokenInternal()
tt = TOK_NAME;
if (!checkForKeyword(chars, length, &tt, &tp->t_op))
goto error;
if (tt != TOK_NAME) {
if (tt == TOK_FUNCTION)
tell(&lastFunctionKeyword);
if (tt != TOK_NAME)
goto out;
}
}
/*
-2
View File
@@ -660,7 +660,6 @@ class MOZ_STACK_CLASS TokenStream
void tell(Position *);
void seek(const Position &pos);
bool seek(const Position &pos, const TokenStream &other);
void positionAfterLastFunctionKeyword(Position &pos);
size_t positionToOffset(const Position &pos) const {
return pos.buf - userbuf.base();
@@ -920,7 +919,6 @@ class MOZ_STACK_CLASS TokenStream
JSContext *const cx;
JSPrincipals *const originPrincipals;
StrictModeGetter *strictModeGetter; /* used to test for strict mode */
Position lastFunctionKeyword; /* used as a starting point for reparsing strict functions */
/*
* The tokens array stores pointers to JSAtoms. These are rooted by the
+13
View File
@@ -0,0 +1,13 @@
a = (function() {
with({}) var x, arguments, arguments
})()
b = (function() {
with({}) {
var x = Math, arguments
({
get: (1 for (x in [])),
})
}
})()
+7
View File
@@ -0,0 +1,7 @@
// |jit-test| error:SyntaxError
function testcase({}, a = b, ... x) {
"use strict";
function f() { };
with ( f(3) );
}
+10
View File
@@ -0,0 +1,10 @@
function d(t) {
if (t >= undefined) {}
}
function s() {
d(null);
}
d(3);
s();
s();
+4 -2
View File
@@ -787,8 +787,9 @@ jit::BuildDominatorTree(MIRGraph &graph)
block->setDomIndex(index);
if (!worklist.append(block->immediatelyDominatedBlocksBegin(),
block->immediatelyDominatedBlocksEnd()))
block->immediatelyDominatedBlocksEnd())) {
return false;
}
index++;
}
@@ -1358,8 +1359,9 @@ jit::EliminateRedundantChecks(MIRGraph &graph)
// Add all immediate dominators to the front of the worklist.
if (!worklist.append(block->immediatelyDominatedBlocksBegin(),
block->immediatelyDominatedBlocksEnd()))
block->immediatelyDominatedBlocksEnd())) {
return false;
}
for (MDefinitionIterator iter(block); iter; ) {
bool eliminated = false;
+2 -2
View File
@@ -296,7 +296,7 @@ IonFrameIterator::machineState() const
// are unable to restore any FPUs registers from an OOL VM call. This can
// cause some trouble for f.arguments.
MachineState machine;
for (GeneralRegisterIterator iter(reader.allSpills()); iter.more(); iter++)
for (GeneralRegisterBackwardIterator iter(reader.allSpills()); iter.more(); iter++)
machine.setRegisterLocation(*iter, --spill);
return machine;
@@ -726,7 +726,7 @@ MarkIonJSFrame(JSTracer *trc, const IonFrameIterator &frame)
uintptr_t *spill = frame.spillBase();
GeneralRegisterSet gcRegs = safepoint.gcSpills();
GeneralRegisterSet valueRegs = safepoint.valueSpills();
for (GeneralRegisterIterator iter(safepoint.allSpills()); iter.more(); iter++) {
for (GeneralRegisterBackwardIterator iter(safepoint.allSpills()); iter.more(); iter++) {
--spill;
if (gcRegs.has(*iter))
gc::MarkGCThingRoot(trc, reinterpret_cast<void **>(spill), "ion-gc-spill");
+10 -7
View File
@@ -144,7 +144,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set)
if (set.gprs().size() > 1) {
adjustFrame(diffG);
startDataTransferM(IsStore, StackPointer, DB, WriteBack);
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
transferReg(*iter);
}
@@ -153,7 +153,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set)
#endif
{
reserveStack(diffG);
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
storePtr(*iter, Address(StackPointer, diffG));
}
@@ -165,7 +165,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set)
diffF += transferMultipleByRuns(set.fpus(), IsStore, StackPointer, DB);
#else
reserveStack(diffF);
for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
for (FloatRegisterBackwardIterator iter(set.fpus()); iter.more(); iter++) {
diffF -= sizeof(double);
storeDouble(*iter, Address(StackPointer, diffF));
}
@@ -190,7 +190,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
} else
#endif
{
for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
for (FloatRegisterBackwardIterator iter(set.fpus()); iter.more(); iter++) {
diffF -= sizeof(double);
if (!ignore.has(*iter))
loadDouble(Address(StackPointer, diffF), *iter);
@@ -202,7 +202,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
#ifdef JS_CPU_ARM
if (set.gprs().size() > 1 && ignore.empty(false)) {
startDataTransferM(IsLoad, StackPointer, IA, WriteBack);
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
transferReg(*iter);
}
@@ -211,7 +211,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
} else
#endif
{
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
if (!ignore.has(*iter))
loadPtr(Address(StackPointer, diffG), *iter);
@@ -717,7 +717,10 @@ MacroAssembler::performOsr()
bind(&isFunction);
{
// Function - create the callee token, then get the script.
orPtr(Imm32(CalleeToken_Function), calleeToken);
// Skip the or-ing of CalleeToken_Function into calleeToken since it is zero.
JS_ASSERT(CalleeToken_Function == 0);
loadPtr(Address(script, JSFunction::offsetOfNativeOrScript()), script);
}
+16 -3
View File
@@ -242,11 +242,9 @@ void
MDefinition::printOpcode(FILE *fp)
{
PrintOpcodeName(fp, op());
fprintf(fp, " ");
for (size_t j = 0; j < numOperands(); j++) {
fprintf(fp, " ");
getOperand(j)->printName(fp);
if (j != numOperands() - 1)
fprintf(fp, " ");
}
}
@@ -457,6 +455,21 @@ MConstant::printOpcode(FILE *fp)
}
}
void
MControlInstruction::printOpcode(FILE *fp)
{
MDefinition::printOpcode(fp);
for (size_t j = 0; j < numSuccessors(); j++)
fprintf(fp, " block%d", getSuccessor(j)->id());
}
void
MCompare::printOpcode(FILE *fp)
{
MDefinition::printOpcode(fp);
fprintf(fp, " %s", js_CodeName[jsop()]);
}
void
MConstantElements::printOpcode(FILE *fp)
{
+4
View File
@@ -814,6 +814,8 @@ class MControlInstruction : public MInstruction
bool isControlInstruction() const {
return true;
}
void printOpcode(FILE *fp);
};
class MTableSwitch
@@ -1907,6 +1909,8 @@ class MCompare
return AliasSet::None();
}
void printOpcode(FILE *fp);
protected:
bool congruentTo(MDefinition *const &ins) const {
if (!MBinaryInstruction::congruentTo(ins))
+25
View File
@@ -1063,3 +1063,28 @@ MBasicBlock::immediateDominatorBranch(BranchDirection *pdirection)
return NULL;
}
void
MIRGraph::dump(FILE *fp)
{
#ifdef DEBUG
for (MBasicBlockIterator iter(begin()); iter != end(); iter++) {
iter->dump(fp);
}
#endif
}
void
MBasicBlock::dump(FILE *fp)
{
#ifdef DEBUG
for (MPhiIterator iter(phisBegin()); iter != phisEnd(); iter++) {
iter->printOpcode(fp);
fprintf(fp, "\n");
}
for (MInstructionIterator iter(begin()); iter != end(); iter++) {
iter->printOpcode(fp);
fprintf(fp, "\n");
}
#endif
}
+4
View File
@@ -468,6 +468,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
void dumpStack(FILE *fp);
void dump(FILE *fp);
// Track bailouts by storing the current pc in MIR instruction added at this
// cycle. This is also used for tracking calls when profiling.
void updateTrackedPc(jsbytecode *pc) {
@@ -661,6 +663,8 @@ class MIRGraph
// lazilly insert an MParSlice instruction in the entry block and
// return the definition.
MDefinition *parSlice();
void dump(FILE *fp);
};
class MDefinitionIterator
+47 -2
View File
@@ -406,6 +406,11 @@ class TypedRegisterSet
int ireg = js_bitscan_ctz32(bits_);
return T::FromCode(ireg);
}
T getLast() const {
JS_ASSERT(!empty());
int ireg = 31 - js_bitscan_clz32(bits_);
return T::FromCode(ireg);
}
T takeAny() {
JS_ASSERT(!empty());
T reg = getAny();
@@ -439,6 +444,12 @@ class TypedRegisterSet
take(reg);
return reg;
}
T takeLast() {
JS_ASSERT(!empty());
T reg = getLast();
take(reg);
return reg;
}
void clear() {
bits_ = 0;
}
@@ -622,7 +633,9 @@ class RegisterSet {
}
};
// iterates backwards, that is, rn to r0
// iterates in whatever order happens to be convenient.
// Use TypedRegisterBackwardIterator or TypedRegisterForwardIterator if a
// specific order is required.
template <typename T>
class TypedRegisterIterator
{
@@ -651,6 +664,36 @@ class TypedRegisterIterator
}
};
// iterates backwards, that is, rn to r0
template <typename T>
class TypedRegisterBackwardIterator
{
TypedRegisterSet<T> regset_;
public:
TypedRegisterBackwardIterator(TypedRegisterSet<T> regset) : regset_(regset)
{ }
TypedRegisterBackwardIterator(const TypedRegisterBackwardIterator &other)
: regset_(other.regset_)
{ }
bool more() const {
return !regset_.empty();
}
TypedRegisterBackwardIterator<T> operator ++(int) {
TypedRegisterBackwardIterator<T> old(*this);
regset_.takeLast();
return old;
}
TypedRegisterBackwardIterator<T>& operator ++() {
regset_.getLast();
return *this;
}
T operator *() const {
return regset_.getLast();
}
};
// iterates forwards, that is r0 to rn
template <typename T>
class TypedRegisterForwardIterator
@@ -667,7 +710,7 @@ class TypedRegisterForwardIterator
return !regset_.empty();
}
TypedRegisterForwardIterator<T> operator ++(int) {
TypedRegisterIterator<T> old(*this);
TypedRegisterForwardIterator<T> old(*this);
regset_.takeFirst();
return old;
}
@@ -682,6 +725,8 @@ class TypedRegisterForwardIterator
typedef TypedRegisterIterator<Register> GeneralRegisterIterator;
typedef TypedRegisterIterator<FloatRegister> FloatRegisterIterator;
typedef TypedRegisterBackwardIterator<Register> GeneralRegisterBackwardIterator;
typedef TypedRegisterBackwardIterator<FloatRegister> FloatRegisterBackwardIterator;
typedef TypedRegisterForwardIterator<Register> GeneralRegisterForwardIterator;
typedef TypedRegisterForwardIterator<FloatRegister> FloatRegisterForwardIterator;
+1 -1
View File
@@ -66,7 +66,7 @@ SafepointWriter::writeGcRegs(LSafepoint *safepoint)
#ifdef DEBUG
if (IonSpewEnabled(IonSpew_Safepoints)) {
for (GeneralRegisterIterator iter(spilled); iter.more(); iter++) {
for (GeneralRegisterForwardIterator iter(spilled); iter.more(); iter++) {
const char *type = gc.has(*iter)
? "gc"
: valueRegs.has(*iter)
+4 -1
View File
@@ -191,8 +191,11 @@ ComparePolicy::adjustInputs(MInstruction *def)
convert = MToDouble::NonNullNonStringPrimitives;
else if (compare->compareType() == MCompare::Compare_DoubleMaybeCoerceRHS && i == 1)
convert = MToDouble::NonNullNonStringPrimitives;
if (convert == MToDouble::NumbersOnly && in->type() == MIRType_Boolean)
if (in->type() == MIRType_Null ||
(in->type() == MIRType_Boolean && convert == MToDouble::NumbersOnly))
{
in = boxAt(def, in);
}
replace = MToDouble::New(in, convert);
break;
}
+2 -1
View File
@@ -366,8 +366,9 @@ ValueNumberer::eliminateRedundancies()
// Add all immediate dominators to the front of the worklist.
if (!worklist.append(block->immediatelyDominatedBlocksBegin(),
block->immediatelyDominatedBlocksEnd()))
block->immediatelyDominatedBlocksEnd())) {
return false;
}
// For each instruction, attempt to look up a dominating definition.
for (MDefinitionIterator iter(block); iter; ) {
+1 -1
View File
@@ -357,7 +357,7 @@ class MacroAssemblerARM : public Assembler
}
if (mode == DB) {
return transferMultipleByRunsImpl
<FloatRegisterIterator>(set, ls, rm, mode, -1);
<FloatRegisterBackwardIterator>(set, ls, rm, mode, -1);
}
JS_NOT_REACHED("Invalid data transfer addressing mode");
}
+10 -2
View File
@@ -2941,8 +2941,12 @@ js_InitArrayClass(JSContext *cx, HandleObject obj)
if (!type)
return NULL;
JSObject *metadata = NULL;
if (!NewObjectMetadata(cx, &metadata))
return NULL;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, &ArrayClass, TaggedProto(proto),
proto->getParent(), NewObjectMetadata(cx),
proto->getParent(), metadata,
gc::FINALIZE_OBJECT0));
RootedObject arrayProto(cx, JSObject::createArray(cx, gc::FINALIZE_OBJECT4, gc::TenuredHeap, shape, type, 0));
@@ -3036,12 +3040,16 @@ NewArray(JSContext *cx, uint32_t length, JSObject *protoArg, NewObjectKind newKi
if (!type)
return NULL;
JSObject *metadata = NULL;
if (!NewObjectMetadata(cx, &metadata))
return NULL;
/*
* Get a shape with zero fixed slots, regardless of the size class.
* See JSObject::createArray.
*/
RootedShape shape(cx, EmptyShape::getInitialShape(cx, &ArrayClass, TaggedProto(proto),
cx->global(), NewObjectMetadata(cx), gc::FINALIZE_OBJECT0));
cx->global(), metadata, gc::FINALIZE_OBJECT0));
if (!shape)
return NULL;
+2 -2
View File
@@ -1865,8 +1865,8 @@ assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id);
inline void assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id) {};
#endif
typedef JSObject *
(* ObjectMetadataCallback)(JSContext *cx);
typedef bool
(* ObjectMetadataCallback)(JSContext *cx, JSObject **pmetadata);
/*
* Specify a callback to invoke when creating each JS object in the current
+5 -1
View File
@@ -378,8 +378,12 @@ NewPropertyIteratorObject(JSContext *cx, unsigned flags)
if (!type)
return NULL;
JSObject *metadata = NULL;
if (!NewObjectMetadata(cx, &metadata))
return NULL;
Class *clasp = &PropertyIteratorObject::class_;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, NULL, NULL, NewObjectMetadata(cx),
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, NULL, NULL, metadata,
ITERATOR_FINALIZE_KIND));
if (!shape)
return NULL;
+8 -2
View File
@@ -1308,8 +1308,12 @@ NewObject(JSContext *cx, Class *clasp, types::TypeObject *type_, JSObject *paren
RootedTypeObject type(cx, type_);
JSObject *metadata = NULL;
if (!NewObjectMetadata(cx, &metadata))
return NULL;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, TaggedProto(type->proto),
parent, NewObjectMetadata(cx), kind));
parent, metadata, kind));
if (!shape)
return NULL;
@@ -1606,7 +1610,9 @@ js::CreateThisForFunctionWithProto(JSContext *cx, HandleObject callee, JSObject
}
if (res && cx->typeInferenceEnabled()) {
JSScript *script = callee->as<JSFunction>().nonLazyScript();
JSScript *script = callee->as<JSFunction>().getOrCreateScript(cx);
if (!script)
return NULL;
TypeScript::SetThis(cx, script, types::Type::ObjectType(res));
}
+5 -4
View File
@@ -1667,18 +1667,19 @@ DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey key, H
JSObject **ctorp = NULL,
gc::AllocKind ctorKind = JSFunction::FinalizeKind);
static JS_ALWAYS_INLINE JSObject *
NewObjectMetadata(JSContext *cx)
static JS_ALWAYS_INLINE bool
NewObjectMetadata(JSContext *cx, JSObject **pmetadata)
{
// The metadata callback is invoked before each created object, except when
// analysis is active as the callback may reenter JS.
JS_ASSERT(!*pmetadata);
if (JS_UNLIKELY((size_t)cx->compartment()->objectMetadataCallback) &&
!cx->compartment()->activeAnalysis)
{
gc::AutoSuppressGC suppress(cx);
return cx->compartment()->objectMetadataCallback(cx);
return cx->compartment()->objectMetadataCallback(cx, pmetadata);
}
return NULL;
return true;
}
} /* namespace js */
+5 -1
View File
@@ -184,8 +184,12 @@ ArgumentsObject::create(JSContext *cx, HandleScript script, HandleFunction calle
if (!type)
return NULL;
JSObject *metadata = NULL;
if (!NewObjectMetadata(cx, &metadata))
return NULL;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, TaggedProto(proto),
proto->getParent(), NewObjectMetadata(cx), FINALIZE_KIND,
proto->getParent(), metadata, FINALIZE_KIND,
BaseShape::INDEXED));
if (!shape)
return NULL;
+4 -1
View File
@@ -4471,7 +4471,10 @@ nsXPCComponents_Utils::IsDeadWrapper(const jsval &obj, bool *out)
if (JSVAL_IS_PRIMITIVE(obj))
return NS_ERROR_INVALID_ARG;
*out = JS_IsDeadWrapper(JSVAL_TO_OBJECT(obj));
// Make sure to unwrap first. Once a proxy is nuked, it ceases to be a
// wrapper, meaning that, if passed to another compartment, we'll generate
// a CCW for it. Make sure that IsDeadWrapper sees through the confusion.
*out = JS_IsDeadWrapper(js::CheckedUnwrap(JSVAL_TO_OBJECT(obj)));
return NS_OK;
}
+13
View File
@@ -0,0 +1,13 @@
const Cu = Components.utils;
function run_test() {
var sb = new Cu.Sandbox('http://www.example.com');
var obj = Cu.evalInSandbox('this.obj = {foo: 2}; obj', sb);
var chromeSb = new Cu.Sandbox(this);
chromeSb.objRef = obj;
do_check_eq(Cu.evalInSandbox('objRef.foo', chromeSb), 2);
Cu.nukeSandbox(sb);
do_check_true(Cu.isDeadWrapper(obj));
// CCWs to nuked wrappers should be considered dead.
do_check_true(Cu.isDeadWrapper(chromeSb.objRef));
}
+1
View File
@@ -22,6 +22,7 @@ tail =
[test_bug854558.js]
[test_bug868675.js]
[test_bug872772.js]
[test_bug885800.js]
[test_bug_442086.js]
[test_file.js]
[test_blob.js]
@@ -110,13 +110,6 @@ struct ParamTraits<nsHttpHeaderArray::nsEntry>
};
template<>
struct ParamTraits<mozilla::net::InfallableCopyCString>
: public ParamTraits<nsCString>
{
};
template<>
struct ParamTraits<nsHttpHeaderArray>
{
+2 -2
View File
@@ -228,10 +228,10 @@ private:
const uint32_t mLoadFlags;
const bool mCacheForOfflineUse;
const bool mFallbackChannel;
const InfallableCopyCString mClientID;
const nsCString mClientID;
const nsCacheStoragePolicy mStoragePolicy;
const bool mUsingPrivateBrowsing;
const InfallableCopyCString mCacheKey;
const nsCString mCacheKey;
const nsCacheAccessMode mAccessToRequest;
const bool mNoWait;
const bool mUsingSSL;
+1 -31
View File
@@ -14,36 +14,6 @@
#include "nsCOMPtr.h"
#include "nsString.h"
namespace mozilla { namespace net {
// A nsCString that aborts if it fails to successfully copy its input during
// copy construction and/or assignment. This is useful for building classes
// that are safely copy-constructable and safely assignable using the compiler-
// generated copy constructor and assignment operator.
class InfallableCopyCString : public nsCString
{
public:
InfallableCopyCString() { }
InfallableCopyCString(const nsACString & other)
: nsCString(other)
{
if (Length() != other.Length())
NS_RUNTIMEABORT("malloc");
}
InfallableCopyCString & operator=(const nsACString & other)
{
nsCString::operator=(other);
if (Length() != other.Length())
NS_RUNTIMEABORT("malloc");
return *this;
}
};
} } // namespace mozilla::net
class nsHttpHeaderArray
{
public:
@@ -93,7 +63,7 @@ public:
struct nsEntry
{
nsHttpAtom header;
mozilla::net::InfallableCopyCString value;
nsCString value;
struct MatchHeader {
bool Equals(const nsEntry &entry, const nsHttpAtom &header) const {
+1 -1
View File
@@ -67,7 +67,7 @@ private:
nsHttpHeaderArray mHeaders;
nsHttpAtom mMethod;
nsHttpVersion mVersion;
mozilla::net::InfallableCopyCString mRequestURI;
nsCString mRequestURI;
};
#endif // nsHttpRequestHead_h__
+3 -3
View File
@@ -121,10 +121,10 @@ private:
nsHttpHeaderArray mHeaders;
nsHttpVersion mVersion;
uint16_t mStatus;
mozilla::net::InfallableCopyCString mStatusText;
nsCString mStatusText;
int64_t mContentLength;
mozilla::net::InfallableCopyCString mContentType;
mozilla::net::InfallableCopyCString mContentCharset;
nsCString mContentType;
nsCString mContentCharset;
bool mCacheControlNoStore;
bool mCacheControlNoCache;
bool mPragmaNoCache;
@@ -13,6 +13,7 @@
#include "nsIStreamListener.h"
#include "nsIX509CertDB.h"
#include "mozilla/Casting.h"
#include "mozilla/Services.h"
#include "nsCRT.h"
@@ -92,7 +93,7 @@ PSMContentDownloader::OnStartRequest(nsIRequest* request, nsISupports* context)
mBufferOffset = 0;
mBufferSize = 0;
mByteData = (char*) nsMemory::Alloc(contentLength);
mByteData = (char*) nsMemory::Alloc(SafeCast<size_t>(contentLength));
if (!mByteData)
return NS_ERROR_OUT_OF_MEMORY;
@@ -806,10 +806,11 @@ BlockServerCertChangeForSpdy(nsNSSSocketInfo *infoObject,
return SECSuccess;
// If GetNegotiatedNPN() failed we will assume spdy for safety's safe
if (NS_FAILED(rv))
if (NS_FAILED(rv)) {
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
("BlockServerCertChangeForSpdy failed GetNegotiatedNPN() call."
" Assuming spdy.\n"));
}
// Check to see if the cert has actually changed
ScopedCERTCertificate c(cert2->GetCert());
+1
View File
@@ -259,6 +259,7 @@ nsresult nsCMSMessage::CommonVerifySignature(unsigned char* aDigestData, uint32_
nsigners = NSS_CMSSignedData_SignerInfoCount(sigd);
PR_ASSERT(nsigners > 0);
NS_ENSURE_TRUE(nsigners > 0, NS_ERROR_UNEXPECTED);
si = NSS_CMSSignedData_GetSignerInfo(sigd, 0);
// See bug 324474. We want to make sure the signing cert is
+2 -1
View File
@@ -11,6 +11,7 @@
#include "nsIObserver.h"
#include "nsNSSShutDown.h"
#include "PSMRunnable.h"
#include "mozilla/DebugOnly.h"
using namespace mozilla;
using namespace mozilla::psm;
@@ -235,7 +236,7 @@ void nsKeygenThread::Run(void)
}
if (notifyObserver) {
nsresult rv = NS_DispatchToMainThread(notifyObserver);
DebugOnly<nsresult> rv = NS_DispatchToMainThread(notifyObserver);
NS_ASSERTION(NS_SUCCEEDED(rv),
"failed to dispatch keygen thread observer to main thread");
}
+3 -1
View File
@@ -7,6 +7,8 @@
#include "nsNSSComponent.h"
#include "nsNSSIOLayer.h"
#include "mozilla/DebugOnly.h"
#include "prlog.h"
#include "prnetdb.h"
#include "nsIPrefService.h"
@@ -414,7 +416,7 @@ void nsNSSSocketInfo::GetPreviousCert(nsIX509Cert** _result)
#ifndef NSS_NO_LIBPKIX
RefPtr<PreviousCertRunnable> runnable(new PreviousCertRunnable(mCallbacks));
nsresult rv = runnable->DispatchToMainThreadAndWait();
DebugOnly<nsresult> rv = runnable->DispatchToMainThreadAndWait();
NS_ASSERTION(NS_SUCCEEDED(rv), "runnable->DispatchToMainThreadAndWait() failed");
runnable->mPreviousCert.forget(_result);
#endif
+1 -1
View File
@@ -138,7 +138,7 @@ nsPKCS12Blob::ImportFromFileHelper(nsIFile *file,
nsPKCS12Blob::RetryReason &aWantRetry)
{
nsNSSShutDownPreventionLock locker;
nsresult rv;
nsresult rv = NS_OK;
SECStatus srv = SECSuccess;
SEC_PKCS12DecoderContext *dcx = nullptr;
SECItem unicodePw;
@@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "pk11func.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "PSMRunnable.h"
@@ -129,7 +130,7 @@ void nsProtectedAuthThread::Run(void)
}
if (notifyObserver) {
nsresult rv = NS_DispatchToMainThread(notifyObserver);
DebugOnly<nsresult> rv = NS_DispatchToMainThread(notifyObserver);
NS_ASSERTION(NS_SUCCEEDED(rv),
"failed to dispatch protected auth observer to main thread");
}