浏览代码

Avoid tracing the nil return case of tonumber().

Mike Pall 15 年之前
父节点
当前提交
6e6034e809
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/lj_record.c

+ 5 - 1
src/lj_record.c

@@ -1237,8 +1237,12 @@ static void LJ_FASTCALL recff_tonumber(jit_State *J, RecordFFData *rd)
       if (!tref_isk(base) || IR(tref_ref(base))->i != 10)
 	recff_nyiu(J);
     }
-    if (tref_isstr(tr))
+    if (tref_isstr(tr)) {
+      TValue tmp;
+      if (!lj_str_tonum(strV(&rd->argv[0]), &tmp))
+	recff_nyiu(J);  /* Would need an inverted STRTO for this case. */
       tr = emitir(IRTG(IR_STRTO, IRT_NUM), tr, 0);
+    }
   } else {
     tr = TREF_NIL;
   }