Bug 1216140 - Load the global lexical scope for the BINDGNAME Baseline IC when the script doesn't have a non-syntactic scope chain. r=jandem, a=ritu
authorShu-yu Guo <shu@rfrn.org>
Fri, 30 Oct 2015 12:43:37 -0700
changeset 305389 cc7fe955ffdd7f99c2fa9dc5bd2a81d475e33fd7
parent 305388 7b8547621a2ea5ff58fbbd2e5a8b9c7c6727b768
child 305390 6d1ddef2576c04b37ffb9a7a8c186722d5714fc2
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, ritu
bugs1216140
milestone44.0a2
Bug 1216140 - Load the global lexical scope for the BINDGNAME Baseline IC when the script doesn't have a non-syntactic scope chain. r=jandem, a=ritu
js/src/jit-test/tests/baseline/bug1216140.js
js/src/jit/BaselineCompiler.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/baseline/bug1216140.js
@@ -0,0 +1,6 @@
+function newFunc(x) Function(x)()
+newFunc(` 
+  var BUGNUMBER = 8[ anonymous = true ]--;
+  () => BUGNUMBER;
+`);
+
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -2431,17 +2431,20 @@ BaselineCompiler::emit_JSOP_GETNAME()
     return true;
 }
 
 bool
 BaselineCompiler::emit_JSOP_BINDNAME()
 {
     frame.syncStack(0);
 
-    masm.loadPtr(frame.addressOfScopeChain(), R0.scratchReg());
+    if (*pc == JSOP_BINDGNAME && !script->hasNonSyntacticScope())
+        masm.movePtr(ImmGCPtr(&script->global().lexicalScope()), R0.scratchReg());
+    else
+        masm.loadPtr(frame.addressOfScopeChain(), R0.scratchReg());
 
     // Call IC.
     ICBindName_Fallback::Compiler stubCompiler(cx);
     if (!emitOpIC(stubCompiler.getStub(&stubSpace_)))
         return false;
 
     // Mark R0 as pushed stack value.
     frame.push(R0);