Bug 1113139 - Don't attach stubs in NameIC if the lookup would throw. (r=shu)

This commit is contained in:
Eric Faust 2015-01-05 14:26:57 -08:00
parent 2a57f2a27c
commit 7e5619ddac
2 changed files with 18 additions and 8 deletions

View File

@ -0,0 +1,9 @@
var lfcode = new Array();
lfcode.push = function(x) { eval("(function() { " + x + " })();"); };
lfcode.push("\
function error(str) { try { eval(str); } catch (e) { return e; } }\
const YIELD_PAREN = error('(function*(){(for (y of (yield 1, 2)) y)})').message;\
const GENEXP_YIELD = error('(function*(){(for (x of yield 1) x)})').message;\
const GENERIC = error('(for)').message;\
const eval = [];\
");

View File

@ -4389,6 +4389,15 @@ NameIC::update(JSContext *cx, size_t cacheIndex, HandleObject scopeChain,
if (!LookupName(cx, name, scopeChain, &obj, &holder, &shape))
return false;
// Look first. Don't generate cache entries if the lookup fails.
if (cache.isTypeOf()) {
if (!FetchName<true>(cx, obj, holder, name, shape, vp))
return false;
} else {
if (!FetchName<false>(cx, obj, holder, name, shape, vp))
return false;
}
if (cache.canAttachStub()) {
if (IsCacheableNameReadSlot(scopeChain, obj, holder, shape, pc, cache.outputReg())) {
if (!cache.attachReadSlot(cx, outerScript, ion, scopeChain, obj,
@ -4402,14 +4411,6 @@ NameIC::update(JSContext *cx, size_t cacheIndex, HandleObject scopeChain,
}
}
if (cache.isTypeOf()) {
if (!FetchName<true>(cx, obj, holder, name, shape, vp))
return false;
} else {
if (!FetchName<false>(cx, obj, holder, name, shape, vp))
return false;
}
// Monitor changes to cache entry.
types::TypeScript::Monitor(cx, script, pc, vp);