mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786801 - Fix perf regression from adab1fdcfe0a by using currentScript again (r=jorendorff)
--HG-- extra : rebase_source : e04b138fa3f68ec893e546a601318923b6655aff
This commit is contained in:
parent
e435199147
commit
31ed2ae6c2
@ -2450,15 +2450,14 @@ unsigned
|
|||||||
js_InferFlags(JSContext *cx, unsigned defaultFlags)
|
js_InferFlags(JSContext *cx, unsigned defaultFlags)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Use ScriptFrameIter since we intentionally want to look across
|
* We intentionally want to look across compartment boundaries to correctly
|
||||||
* compartment boundaries in the case of cross-compartment property access.
|
* handle the case of cross-compartment property access.
|
||||||
*/
|
*/
|
||||||
ScriptFrameIter i(cx);
|
jsbytecode *pc;
|
||||||
if (i.done())
|
JSScript *script = cx->stack.currentScript(&pc, ContextStack::ALLOW_CROSS_COMPARTMENT);
|
||||||
|
if (!script)
|
||||||
return defaultFlags;
|
return defaultFlags;
|
||||||
|
|
||||||
jsbytecode *pc = i.pc();
|
|
||||||
JSScript *script = i.script();
|
|
||||||
const JSCodeSpec *cs = &js_CodeSpec[*pc];
|
const JSCodeSpec *cs = &js_CodeSpec[*pc];
|
||||||
uint32_t format = cs->format;
|
uint32_t format = cs->format;
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
|
@ -516,7 +516,8 @@ ContextStack::popFrameAfterOverflow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline JSScript *
|
inline JSScript *
|
||||||
ContextStack::currentScript(jsbytecode **ppc) const
|
ContextStack::currentScript(jsbytecode **ppc,
|
||||||
|
MaybeAllowCrossCompartment allowCrossCompartment) const
|
||||||
{
|
{
|
||||||
if (ppc)
|
if (ppc)
|
||||||
*ppc = NULL;
|
*ppc = NULL;
|
||||||
@ -531,7 +532,7 @@ ContextStack::currentScript(jsbytecode **ppc) const
|
|||||||
if (fp->beginsIonActivation()) {
|
if (fp->beginsIonActivation()) {
|
||||||
JSScript *script = NULL;
|
JSScript *script = NULL;
|
||||||
ion::GetPcScript(cx_, &script, ppc);
|
ion::GetPcScript(cx_, &script, ppc);
|
||||||
if (script->compartment() != cx_->compartment)
|
if (!allowCrossCompartment && script->compartment() != cx_->compartment)
|
||||||
return NULL;
|
return NULL;
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
@ -544,7 +545,7 @@ ContextStack::currentScript(jsbytecode **ppc) const
|
|||||||
JS_ASSERT(inlined->inlineIndex < chunk->nInlineFrames);
|
JS_ASSERT(inlined->inlineIndex < chunk->nInlineFrames);
|
||||||
mjit::InlineFrame *frame = &chunk->inlineFrames()[inlined->inlineIndex];
|
mjit::InlineFrame *frame = &chunk->inlineFrames()[inlined->inlineIndex];
|
||||||
JSScript *script = frame->fun->script();
|
JSScript *script = frame->fun->script();
|
||||||
if (script->compartment() != cx_->compartment)
|
if (!allowCrossCompartment && script->compartment() != cx_->compartment)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ppc)
|
if (ppc)
|
||||||
*ppc = script->code + inlined->pcOffset;
|
*ppc = script->code + inlined->pcOffset;
|
||||||
@ -553,7 +554,7 @@ ContextStack::currentScript(jsbytecode **ppc) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JSScript *script = fp->script();
|
JSScript *script = fp->script();
|
||||||
if (script->compartment() != cx_->compartment)
|
if (!allowCrossCompartment && script->compartment() != cx_->compartment)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (ppc)
|
if (ppc)
|
||||||
|
@ -1588,8 +1588,18 @@ class ContextStack
|
|||||||
/* Pop a partially-pushed frame after hitting the limit before throwing. */
|
/* Pop a partially-pushed frame after hitting the limit before throwing. */
|
||||||
void popFrameAfterOverflow();
|
void popFrameAfterOverflow();
|
||||||
|
|
||||||
/* Get the topmost script and optional pc on the stack. */
|
/*
|
||||||
inline JSScript *currentScript(jsbytecode **pc = NULL) const;
|
* Get the topmost script and optional pc on the stack. By default, this
|
||||||
|
* function only returns a JSScript in the current compartment, returning
|
||||||
|
* NULL if the current script is in a different compartment. This behavior
|
||||||
|
* can be overridden by passing ALLOW_CROSS_COMPARTMENT.
|
||||||
|
*/
|
||||||
|
enum MaybeAllowCrossCompartment {
|
||||||
|
DONT_ALLOW_CROSS_COMPARTMENT = false,
|
||||||
|
ALLOW_CROSS_COMPARTMENT = true
|
||||||
|
};
|
||||||
|
inline JSScript *currentScript(jsbytecode **pc = NULL,
|
||||||
|
MaybeAllowCrossCompartment = DONT_ALLOW_CROSS_COMPARTMENT) const;
|
||||||
|
|
||||||
/* Get the scope chain for the topmost scripted call on the stack. */
|
/* Get the scope chain for the topmost scripted call on the stack. */
|
||||||
inline HandleObject currentScriptedScopeChain() const;
|
inline HandleObject currentScriptedScopeChain() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user