Bug 953337 - Set ImplicitlyUsed flag for inlined callees. r=nbp
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 18 Jan 2014 13:44:04 +0100
changeset 164137 103c0b6c135d5b0ad65d018b2054165bae2a9532
parent 164136 f8c14bd80676f6f845f739782fb273b739e0e266
child 164138 56f89ea332f75e67657fbadf81d1370a31f68267
push id26026
push userphilringnalda@gmail.com
push dateSat, 18 Jan 2014 23:17:27 +0000
treeherdermozilla-central@61fd0f987cf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs953337
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 953337 - Set ImplicitlyUsed flag for inlined callees. r=nbp
js/src/jit-test/tests/bug953337.js
js/src/jit/IonBuilder.h
js/src/jit/MCallOptimize.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/bug953337.js
@@ -0,0 +1,8 @@
+setJitCompilerOption("ion.usecount.trigger", 20);
+Function.prototype.__proto__ = new Boolean({ get: function() {} }, {});
+function g(x, y) {}
+function f() {
+    g.apply(this, arguments);
+}
+for (var i = 0; i < 130; ++i)
+    f(i, i*2);
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -959,16 +959,17 @@ class CallInfo
         return fun_;
     }
 
     void setFun(MDefinition *fun) {
         fun_ = fun;
     }
 
     void setImplicitlyUsedUnchecked() {
+        fun_->setImplicitlyUsedUnchecked();
         thisArg_->setImplicitlyUsedUnchecked();
         for (uint32_t i = 0; i < argc(); i++)
             getArg(i)->setImplicitlyUsedUnchecked();
     }
 };
 
 bool TypeSetIncludes(types::TypeSet *types, MIRType input, types::TypeSet *inputTypes);
 
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -191,16 +191,17 @@ IonBuilder::inlineMathFunction(CallInfo 
         return InliningStatus_NotInlined;
     if (!IsNumberType(callInfo.getArg(0)->type()))
         return InliningStatus_NotInlined;
 
     const MathCache *cache = compartment->runtime()->maybeGetMathCache();
     if (!cache)
         return InliningStatus_NotInlined;
 
+    callInfo.fun()->setImplicitlyUsedUnchecked();
     callInfo.thisArg()->setImplicitlyUsedUnchecked();
 
     MMathFunction *ins = MMathFunction::New(alloc(), callInfo.getArg(0), function, cache);
     current->add(ins);
     current->push(ins);
     return InliningStatus_Inlined;
 }