From cd036919f18d005a7eaa700d90c201ff0c4f4cad Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 12 Sep 2013 11:14:20 +0200 Subject: [PATCH] Bug 914341 - Fix BC to wrap primitive |this| in eval scripts. r=djvj --HG-- extra : rebase_source : feea6164910b70dc8db175720c796c7b1aebca51 --- js/src/jit-test/tests/ion/bug914341.js | 5 +++++ js/src/jit/BaselineCompiler.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/ion/bug914341.js diff --git a/js/src/jit-test/tests/ion/bug914341.js b/js/src/jit-test/tests/ion/bug914341.js new file mode 100644 index 000000000000..2f0bb3174d09 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug914341.js @@ -0,0 +1,5 @@ +function f() { + assertEq(typeof eval("this"), "object"); +} +for (var i=0; i<5; i++) + f(); diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 2472443850b5..58d89e756204 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -969,7 +969,7 @@ BaselineCompiler::emit_JSOP_THIS() frame.pushThis(); // In strict mode function or self-hosted function, |this| is left alone. - if (!function() || function()->strict() || function()->isSelfHostedBuiltin()) + if (function() && (function()->strict() || function()->isSelfHostedBuiltin())) return true; Label skipIC;