Bug 1457125 - Use interpreter fast path for calls also for calls to non-constructors. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 28 Apr 2018 10:19:53 +0200
changeset 469717 314f5e5e4502bb4621710fb77678a2d4ae2b0d5f
parent 469716 1fb52e3bc8afade91ad9f13b9cbdb06c40fe0697
child 469718 996616295128d61343f50270fe79b3ee49b9579b
push id9174
push userarchaeopteryx@coole-files.de
push dateMon, 30 Apr 2018 15:33:30 +0000
treeherdermozilla-beta@1b1a8ab75f1f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1457125
milestone61.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 1457125 - Use interpreter fast path for calls also for calls to non-constructors. r=tcampbell
js/src/vm/Interpreter.cpp
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -3063,18 +3063,20 @@ CASE(JSOP_FUNCALL)
     unsigned argStackSlots = GET_ARGC(REGS.pc) + construct;
 
     MOZ_ASSERT(REGS.stackDepth() >= 2u + GET_ARGC(REGS.pc));
     CallArgs args = CallArgsFromSp(argStackSlots, REGS.sp, construct, ignoresReturnValue);
 
     JSFunction* maybeFun;
     bool isFunction = IsFunctionObject(args.calleev(), &maybeFun);
 
-    /* Don't bother trying to fast-path calls to scripted non-constructors. */
-    if (!isFunction || !maybeFun->isInterpreted() || !maybeFun->isConstructor() ||
+    // Use the slow path if the callee is not an interpreted function or if we
+    // have to throw an exception.
+    if (!isFunction || !maybeFun->isInterpreted() ||
+        (construct && !maybeFun->isConstructor()) ||
         (!construct && maybeFun->isClassConstructor()))
     {
         if (construct) {
             if (!ConstructFromStack(cx, args))
                 goto error;
         } else {
             if (*REGS.pc == JSOP_CALLITER && args.calleev().isPrimitive()) {
                 MOZ_ASSERT(args.length() == 0, "thisv must be on top of the stack");