[INFER] Use generated rejoin path for ic::NativeCall/ic::NativeNew, bug 654536. r=bhackett
authorJan de Mooij <jandemooij@gmail.com>
Thu, 05 May 2011 21:35:29 +0200
changeset 74999 8436c7bca2e99176a4433d97607cf6387b5e79b4
parent 74998 4f15ed48c44e35f03a6d4de8f0a285e7191b91ee
child 75000 974e43d7adf8677ae80a25d24117cdd40f7e5219
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersbhackett
bugs654536
milestone6.0a1
[INFER] Use generated rejoin path for ic::NativeCall/ic::NativeNew, bug 654536. r=bhackett
js/src/jit-test/tests/jaeger/recompile/bug654536.js
js/src/methodjit/Compiler.cpp
js/src/methodjit/MonoIC.cpp
js/src/methodjit/MonoIC.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/recompile/bug654536.js
@@ -0,0 +1,6 @@
+function f() {
+    var x = Object.prototype.hasOwnProperty.call(1);
+    assertEq(x, false);
+    isNaN(2);
+}
+f();
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -1966,16 +1966,17 @@ mjit::Compiler::generateMethod()
           BEGIN_CASE(JSOP_FUNCALL)
           {
             REJOIN_SITE_ANY();
           {
             bool callingNew = (op == JSOP_NEW);
 
             AutoRejoinSite autoRejoinCall(this,
                 JS_FUNC_TO_DATA_PTR(void *, callingNew ? ic::New : ic::Call),
+                JS_FUNC_TO_DATA_PTR(void *, callingNew ? ic::NativeNew : ic::NativeCall),
                 JS_FUNC_TO_DATA_PTR(void *, callingNew ? stubs::UncachedNew : stubs::UncachedCall));
             AutoRejoinSite autoRejoinNcode(this, (void *) CallSite::NCODE_RETURN_ID);
 
             bool done = false;
             bool inlined = false;
             if (op == JSOP_CALL) {
                 CompileStatus status = inlineNativeFunction(GET_ARGC(PC), callingNew);
                 if (status == Compile_Okay)
--- a/js/src/methodjit/MonoIC.cpp
+++ b/js/src/methodjit/MonoIC.cpp
@@ -1068,30 +1068,32 @@ ic::Call(VMFrame &f, CallICInfo *ic)
 
 void * JS_FASTCALL
 ic::New(VMFrame &f, CallICInfo *ic)
 {
     CallCompiler cc(f, *ic, true);
     return cc.update();
 }
 
-void JS_FASTCALL
+void * JS_FASTCALL
 ic::NativeCall(VMFrame &f, CallICInfo *ic)
 {
     CallCompiler cc(f, *ic, false);
     if (!cc.generateNativeStub())
         stubs::SlowCall(f, ic->frameSize.getArgc(f));
+    return NULL;
 }
 
-void JS_FASTCALL
+void * JS_FASTCALL
 ic::NativeNew(VMFrame &f, CallICInfo *ic)
 {
     CallCompiler cc(f, *ic, true);
     if (!cc.generateNativeStub())
         stubs::SlowNew(f, ic->frameSize.staticArgc());
+    return NULL;
 }
 
 static const unsigned MANY_ARGS = 1024;
 
 static bool
 BumpStackFull(VMFrame &f, uintN inc)
 {
     /* If we are not passing many args, treat this as a normal call. */
--- a/js/src/methodjit/MonoIC.h
+++ b/js/src/methodjit/MonoIC.h
@@ -289,18 +289,18 @@ struct CallICInfo {
         hasJsFunCheck = false;
         fastGuardedObject = NULL;
         JS_REMOVE_LINK(&links);
     }
 };
 
 void * JS_FASTCALL New(VMFrame &f, ic::CallICInfo *ic);
 void * JS_FASTCALL Call(VMFrame &f, ic::CallICInfo *ic);
-void JS_FASTCALL NativeNew(VMFrame &f, ic::CallICInfo *ic);
-void JS_FASTCALL NativeCall(VMFrame &f, ic::CallICInfo *ic);
+void * JS_FASTCALL NativeNew(VMFrame &f, ic::CallICInfo *ic);
+void * JS_FASTCALL NativeCall(VMFrame &f, ic::CallICInfo *ic);
 JSBool JS_FASTCALL SplatApplyArgs(VMFrame &f);
 
 void GenerateArgumentCheckStub(VMFrame &f);
 
 void PurgeMICs(JSContext *cx, JSScript *script);
 void SweepCallICs(JSContext *cx, JSScript *script, bool purgeAll);
 
 } /* namespace ic */