Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2013-06-24 13:41:39 +01:00
Родитель ec5c07ba45 9d5fdcde72
Коммит 985cd83653
8 изменённых файлов: 114 добавлений и 62 удалений

Просмотреть файл

@ -968,10 +968,12 @@ static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log";
static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify"; static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify";
static const char js_disable_explicit_compartment_gc[] = static const char js_disable_explicit_compartment_gc[] =
JS_OPTIONS_DOT_STR "mem.disable_explicit_compartment_gc"; JS_OPTIONS_DOT_STR "mem.disable_explicit_compartment_gc";
static const char js_asmjs_content_str[] = JS_OPTIONS_DOT_STR "asmjs";
static const char js_baselinejit_content_str[] = JS_OPTIONS_DOT_STR "baselinejit.content"; static const char js_baselinejit_content_str[] = JS_OPTIONS_DOT_STR "baselinejit.content";
static const char js_baselinejit_chrome_str[] = JS_OPTIONS_DOT_STR "baselinejit.chrome"; static const char js_baselinejit_chrome_str[] = JS_OPTIONS_DOT_STR "baselinejit.chrome";
static const char js_baselinejit_eager_str[] = JS_OPTIONS_DOT_STR "baselinejit.unsafe_eager_compilation";
static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content"; static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content";
static const char js_asmjs_content_str[] = JS_OPTIONS_DOT_STR "asmjs"; static const char js_ion_eager_str[] = JS_OPTIONS_DOT_STR "ion.unsafe_eager_compilation";
static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation"; static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation";
int int
@ -1010,7 +1012,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
bool useBaselineJIT = Preferences::GetBool(chromeWindow || !contentWindow ? bool useBaselineJIT = Preferences::GetBool(chromeWindow || !contentWindow ?
js_baselinejit_chrome_str : js_baselinejit_chrome_str :
js_baselinejit_content_str); js_baselinejit_content_str);
bool useBaselineJITEager = Preferences::GetBool(js_baselinejit_eager_str);
bool useIon = Preferences::GetBool(js_ion_content_str); bool useIon = Preferences::GetBool(js_ion_content_str);
bool useIonEager = Preferences::GetBool(js_ion_eager_str);
bool useAsmJS = Preferences::GetBool(js_asmjs_content_str); bool useAsmJS = Preferences::GetBool(js_asmjs_content_str);
bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str); bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID); nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
@ -1022,7 +1026,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
useTypeInference = false; useTypeInference = false;
useHardening = false; useHardening = false;
useBaselineJIT = false; useBaselineJIT = false;
useBaselineJITEager = false;
useIon = false; useIon = false;
useIonEager = false;
useAsmJS = false; useAsmJS = false;
} }
} }
@ -1072,6 +1078,12 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
::JS_SetParallelCompilationEnabled(context->mContext, parallelIonCompilation); ::JS_SetParallelCompilationEnabled(context->mContext, parallelIonCompilation);
::JS_SetGlobalCompilerOption(context->mContext, JSCOMPILER_BASELINE_USECOUNT_TRIGGER,
(useBaselineJITEager ? 0 : -1));
::JS_SetGlobalCompilerOption(context->mContext, JSCOMPILER_ION_USECOUNT_TRIGGER,
(useIonEager ? 0 : -1));
// Save the new defaults for the next page load (InitContext). // Save the new defaults for the next page load (InitContext).
context->mDefaultJSOptions = newDefaultJSOptions; context->mDefaultJSOptions = newDefaultJSOptions;

Просмотреть файл

@ -6993,6 +6993,33 @@ JS_SetParallelCompilationEnabled(JSContext *cx, bool enabled)
#endif #endif
} }
JS_PUBLIC_API(void)
JS_SetGlobalCompilerOption(JSContext *cx, JSCompilerOption opt, uint32_t value)
{
#ifdef JS_ION
ion::IonOptions defaultValues;
switch (opt) {
case JSCOMPILER_BASELINE_USECOUNT_TRIGGER:
if (value == uint32_t(-1))
value = defaultValues.baselineUsesBeforeCompile;
ion::js_IonOptions.baselineUsesBeforeCompile = value;
break;
case JSCOMPILER_ION_USECOUNT_TRIGGER:
if (value == uint32_t(-1))
value = defaultValues.usesBeforeCompile;
ion::js_IonOptions.usesBeforeCompile = value;
ion::js_IonOptions.eagerCompilation = (value == 0);
break;
case JSCOMPILER_PJS_ENABLE:
if (value == uint32_t(-1))
value = uint32_t(defaultValues.parallelCompilation);
ion::js_IonOptions.parallelCompilation = bool(value);
break;
}
#endif
}
/************************************************************************/ /************************************************************************/
#if !defined(STATIC_EXPORTABLE_JS_API) && !defined(STATIC_JS_API) && defined(XP_WIN) #if !defined(STATIC_EXPORTABLE_JS_API) && !defined(STATIC_JS_API) && defined(XP_WIN)

Просмотреть файл

@ -4999,6 +4999,15 @@ JS_ScheduleGC(JSContext *cx, uint32_t count);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetParallelCompilationEnabled(JSContext *cx, bool enabled); JS_SetParallelCompilationEnabled(JSContext *cx, bool enabled);
typedef enum JSCompilerOption {
JSCOMPILER_BASELINE_USECOUNT_TRIGGER,
JSCOMPILER_ION_USECOUNT_TRIGGER,
JSCOMPILER_PJS_ENABLE
} JSCompilerOption;
extern JS_PUBLIC_API(void)
JS_SetGlobalCompilerOption(JSContext *cx, JSCompilerOption opt, uint32_t value);
/* /*
* Convert a uint32_t index into a jsid. * Convert a uint32_t index into a jsid.
*/ */

Просмотреть файл

@ -238,14 +238,14 @@ nsSVGTextFrame::ReflowSVG()
"ReflowSVG mechanism not designed for this"); "ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) { if (!nsSVGUtils::NeedsReflowSVG(this)) {
NS_ASSERTION(!mPositioningDirty, "How did this happen?"); NS_ASSERTION(!(mState & NS_STATE_SVG_POSITIONING_DIRTY), "How did this happen?");
return; return;
} }
// UpdateGlyphPositioning may have been called under DOM calls and set // UpdateGlyphPositioning may have been called under DOM calls and cleared
// mPositioningDirty to false. We may now have better positioning, though, so // NS_STATE_SVG_POSITIONING_DIRTY. We may now have better positioning, though, so
// set it to true so that UpdateGlyphPositioning will do its work. // set it to true so that UpdateGlyphPositioning will do its work.
mPositioningDirty = true; AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
UpdateGlyphPositioning(false); UpdateGlyphPositioning(false);
@ -326,7 +326,7 @@ nsSVGTextFrame::NotifyGlyphMetricsChange()
nsSVGEffects::InvalidateRenderingObservers(this); nsSVGEffects::InvalidateRenderingObservers(this);
nsSVGUtils::ScheduleReflowSVG(this); nsSVGUtils::ScheduleReflowSVG(this);
mPositioningDirty = true; AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
} }
void void
@ -374,10 +374,10 @@ nsSVGTextFrame::SetWhitespaceHandling(nsSVGGlyphFrame *aFrame)
void void
nsSVGTextFrame::UpdateGlyphPositioning(bool aForceGlobalTransform) nsSVGTextFrame::UpdateGlyphPositioning(bool aForceGlobalTransform)
{ {
if (!mPositioningDirty) if (!(mState & NS_STATE_SVG_POSITIONING_DIRTY))
return; return;
mPositioningDirty = false; RemoveStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
nsISVGGlyphFragmentNode* node = GetFirstGlyphFragmentChildNode(); nsISVGGlyphFragmentNode* node = GetFirstGlyphFragmentChildNode();
if (!node) if (!node)

Просмотреть файл

@ -26,9 +26,10 @@ class nsSVGTextFrame : public nsSVGTextFrameBase
friend nsIFrame* friend nsIFrame*
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
protected: protected:
nsSVGTextFrame(nsStyleContext* aContext) nsSVGTextFrame(nsStyleContext* aContext) : nsSVGTextFrameBase(aContext)
: nsSVGTextFrameBase(aContext), {
mPositioningDirty(true) {} AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
}
public: public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
@ -101,8 +102,6 @@ private:
void SetWhitespaceHandling(nsSVGGlyphFrame *aFrame); void SetWhitespaceHandling(nsSVGGlyphFrame *aFrame);
nsAutoPtr<gfxMatrix> mCanvasTM; nsAutoPtr<gfxMatrix> mCanvasTM;
bool mPositioningDirty;
}; };
#endif #endif

Просмотреть файл

@ -3261,7 +3261,8 @@ nsSVGTextFrame2::NotifySVGChanged(uint32_t aFlags)
bool needGlyphMetricsUpdate = false; bool needGlyphMetricsUpdate = false;
bool needNewCanvasTM = false; bool needNewCanvasTM = false;
if ((aFlags & COORD_CONTEXT_CHANGED) && mPositioningMayUsePercentages) { if ((aFlags & COORD_CONTEXT_CHANGED) &&
(mState & NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES)) {
needGlyphMetricsUpdate = true; needGlyphMetricsUpdate = true;
} }
@ -3533,7 +3534,7 @@ nsSVGTextFrame2::ReflowSVG()
"ReflowSVG mechanism not designed for this"); "ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) { if (!nsSVGUtils::NeedsReflowSVG(this)) {
NS_ASSERTION(!mPositioningDirty, "How did this happen?"); NS_ASSERTION(!(mState & NS_STATE_SVG_POSITIONING_DIRTY), "How did this happen?");
return; return;
} }
@ -4144,7 +4145,7 @@ nsSVGTextFrame2::ResolvePositions(nsIContent* aContent,
} }
uint32_t count = GetTextContentLength(aContent); uint32_t count = GetTextContentLength(aContent);
bool& percentages = mPositioningMayUsePercentages; bool percentages = false;
// New text anchoring chunks start at each character assigned a position // New text anchoring chunks start at each character assigned a position
// with x="" or y="", or if we forced one with aForceStartOfChunk due to // with x="" or y="", or if we forced one with aForceStartOfChunk due to
@ -4212,6 +4213,10 @@ nsSVGTextFrame2::ResolvePositions(nsIContent* aContent,
j++; j++;
} }
} }
if (percentages) {
AddStateBits(NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES);
}
} }
// Recurse to children. // Recurse to children.
@ -4235,7 +4240,7 @@ bool
nsSVGTextFrame2::ResolvePositions(nsTArray<gfxPoint>& aDeltas) nsSVGTextFrame2::ResolvePositions(nsTArray<gfxPoint>& aDeltas)
{ {
NS_ASSERTION(mPositions.IsEmpty(), "expected mPositions to be empty"); NS_ASSERTION(mPositions.IsEmpty(), "expected mPositions to be empty");
mPositioningMayUsePercentages = false; RemoveStateBits(NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES);
CharIterator it(this, CharIterator::eOriginal); CharIterator it(this, CharIterator::eOriginal);
if (it.AtEnd()) { if (it.AtEnd()) {
@ -4669,7 +4674,7 @@ void
nsSVGTextFrame2::DoGlyphPositioning() nsSVGTextFrame2::DoGlyphPositioning()
{ {
mPositions.Clear(); mPositions.Clear();
mPositioningDirty = false; RemoveStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
// Determine the positions of each character in app units. // Determine the positions of each character in app units.
nsTArray<nsPoint> charPositions; nsTArray<nsPoint> charPositions;
@ -4820,7 +4825,7 @@ nsSVGTextFrame2::ScheduleReflowSVG()
void void
nsSVGTextFrame2::NotifyGlyphMetricsChange() nsSVGTextFrame2::NotifyGlyphMetricsChange()
{ {
mPositioningDirty = true; AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
nsSVGEffects::InvalidateRenderingObservers(this); nsSVGEffects::InvalidateRenderingObservers(this);
ScheduleReflowSVG(); ScheduleReflowSVG();
} }
@ -4833,7 +4838,7 @@ nsSVGTextFrame2::UpdateGlyphPositioning()
return; return;
} }
if (mPositioningDirty) { if (mState & NS_STATE_SVG_POSITIONING_DIRTY) {
MOZ_ASSERT(!NS_SUBTREE_DIRTY(kid), "should have already reflowed the kid"); MOZ_ASSERT(!NS_SUBTREE_DIRTY(kid), "should have already reflowed the kid");
DoGlyphPositioning(); DoGlyphPositioning();
} }
@ -4869,7 +4874,7 @@ nsSVGTextFrame2::DoReflow()
{ {
// Since we are going to reflow the anonymous block frame, we will // Since we are going to reflow the anonymous block frame, we will
// need to update mPositions. // need to update mPositions.
mPositioningDirty = true; AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) {
// Normally, these dirty flags would be cleared in ReflowSVG(), but that // Normally, these dirty flags would be cleared in ReflowSVG(), but that

Просмотреть файл

@ -188,10 +188,9 @@ protected:
nsSVGTextFrame2(nsStyleContext* aContext) nsSVGTextFrame2(nsStyleContext* aContext)
: nsSVGTextFrame2Base(aContext), : nsSVGTextFrame2Base(aContext),
mFontSizeScaleFactor(1.0f), mFontSizeScaleFactor(1.0f),
mGetCanvasTMForFlag(FOR_OUTERSVG_TM), mGetCanvasTMForFlag(FOR_OUTERSVG_TM)
mPositioningDirty(true),
mPositioningMayUsePercentages(false)
{ {
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
} }
public: public:
@ -650,42 +649,6 @@ private:
* having a current mMarkedFrame. * having a current mMarkedFrame.
*/ */
uint32_t mGetCanvasTMForFlag; uint32_t mGetCanvasTMForFlag;
/**
* The NS_FRAME_IS_DIRTY and NS_FRAME_HAS_DIRTY_CHILDREN bits indicate
* that our anonymous block child needs to be reflowed, and that mPositions
* will likely need to be updated as a consequence. These are set, for
* example, when the font-family changes. Sometimes we only need to
* update mPositions though. For example if the x/y attributes change.
* mPositioningDirty is used to indicate this latter "things are dirty" case
* to allow us to avoid reflowing the anonymous block when it is not
* necessary.
*/
bool mPositioningDirty;
/**
* Whether the values from x/y/dx/dy attributes have any percentage values
* that are used in determining the positions of glyphs. The value will
* be true even if a positioning value is overridden by a descendant element's
* attribute with a non-percentage length. For example,
* mPositioningMayUsePercentages would be true for:
*
* <text x="10%"><tspan x="0">abc</tspan></text>
*
* Percentage values beyond the number of addressable characters, however, do
* not influence mPositioningMayUsePercentages. For example,
* mPositioningMayUsePercentages would be false for:
*
* <text x="10 20 30 40%">abc</text>
*
* mPositioningMayUsePercentages is used to determine whether to recompute
* mPositions when the viewport size changes. So although the first example
* above shows that mPositioningMayUsePercentages can be true even if a viewport
* size change will not affect mPositions, determining a completley accurate
* value for mPositioningMayUsePercentages would require extra work that is
* probably not worth it.
*/
bool mPositioningMayUsePercentages;
}; };
#endif #endif

Просмотреть файл

@ -64,10 +64,47 @@ class Element;
#define NS_STATE_IS_OUTER_SVG NS_FRAME_STATE_BIT(20) #define NS_STATE_IS_OUTER_SVG NS_FRAME_STATE_BIT(20)
/* are we the child of a non-display container? */ /* are we the child of a non-display container? */
#define NS_STATE_SVG_NONDISPLAY_CHILD NS_FRAME_STATE_BIT(22) #define NS_STATE_SVG_NONDISPLAY_CHILD NS_FRAME_STATE_BIT(21)
// If this bit is set, we are a <clipPath> element or descendant. // If this bit is set, we are a <clipPath> element or descendant.
#define NS_STATE_SVG_CLIPPATH_CHILD NS_FRAME_STATE_BIT(23) #define NS_STATE_SVG_CLIPPATH_CHILD NS_FRAME_STATE_BIT(22)
/**
* For text, the NS_FRAME_IS_DIRTY and NS_FRAME_HAS_DIRTY_CHILDREN bits indicate
* that our anonymous block child needs to be reflowed, and that mPositions
* will likely need to be updated as a consequence. These are set, for
* example, when the font-family changes. Sometimes we only need to
* update mPositions though. For example if the x/y attributes change.
* mPositioningDirty is used to indicate this latter "things are dirty" case
* to allow us to avoid reflowing the anonymous block when it is not
* necessary.
*/
#define NS_STATE_SVG_POSITIONING_DIRTY NS_FRAME_STATE_BIT(23)
/**
* For text, whether the values from x/y/dx/dy attributes have any percentage values
* that are used in determining the positions of glyphs. The value will
* be true even if a positioning value is overridden by a descendant element's
* attribute with a non-percentage length. For example,
* NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES would be set for:
*
* <text x="10%"><tspan x="0">abc</tspan></text>
*
* Percentage values beyond the number of addressable characters, however, do
* not influence NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES. For example,
* NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES would be false for:
*
* <text x="10 20 30 40%">abc</text>
*
* NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES is used to determine whether
* to recompute mPositions when the viewport size changes. So although the
* first example above shows that NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES
* can be true even if a viewport size change will not affect mPositions,
* determining a completley accurate value for
* NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES would require extra work that is
* probably not worth it.
*/
#define NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES NS_FRAME_STATE_BIT(24)
/** /**
* Byte offsets of channels in a native packed gfxColor or cairo image surface. * Byte offsets of channels in a native packed gfxColor or cairo image surface.