Bug 487413 - Delete unnecessary fast natives in js shell. r=gal.

--HG--
extra : rebase_source : f9bddb69e037871b9b3b85bf8ab6e181f771bab9
This commit is contained in:
Jason Orendorff 2009-04-09 16:30:10 -05:00
parent e29805bd5a
commit e8a9ce3fda

View File

@ -986,22 +986,6 @@ ReadLine(JSContext *cx, uintN argc, jsval *vp)
return JS_TRUE;
}
#ifdef JS_TRACER
static jsval JS_FASTCALL
Print_tn(JSContext *cx, JSString *str)
{
char *bytes = JS_EncodeString(cx, str);
if (!bytes) {
cx->builtinStatus |= JSBUILTIN_ERROR;
return JSVAL_VOID;
}
fprintf(gOutFile, "%s\n", bytes);
JS_free(cx, bytes);
fflush(gOutFile);
return JSVAL_VOID;
}
#endif
static JSBool
Print(JSContext *cx, uintN argc, jsval *vp)
{
@ -1079,14 +1063,6 @@ AssertEq(JSContext *cx, uintN argc, jsval *vp)
return JS_TRUE;
}
#ifdef JS_TRACER
static jsval JS_FASTCALL
AssertEq_tn(JSContext *cx, jsval v1, jsval v2)
{
return (js_StrictlyEqual(cx, v1, v2)) ? JSVAL_VOID : JSVAL_ERROR_COOKIE;
}
#endif
static JSBool
GC(JSContext *cx, uintN argc, jsval *vp)
{
@ -2903,16 +2879,6 @@ out:
return ok;
}
static int32 JS_FASTCALL
ShapeOf_tn(JSObject *obj)
{
if (!obj)
return 0;
if (!OBJ_IS_NATIVE(obj))
return -1;
return OBJ_SHAPE(obj);
}
static JSBool
ShapeOf(JSContext *cx, uintN argc, jsval *vp)
{
@ -2921,7 +2887,16 @@ ShapeOf(JSContext *cx, uintN argc, jsval *vp)
JS_ReportError(cx, "shapeOf: object expected");
return JS_FALSE;
}
return JS_NewNumberValue(cx, ShapeOf_tn(JSVAL_TO_OBJECT(v)), vp);
JSObject *obj = JSVAL_TO_OBJECT(v);
if (!obj) {
*vp = JSVAL_ZERO;
return JS_TRUE;
}
if (!OBJ_IS_NATIVE(obj)) {
*vp = INT_TO_JSVAL(-1);
return JS_TRUE;
}
return JS_NewNumberValue(cx, OBJ_SHAPE(obj), vp);
}
#ifdef JS_THREADSAFE
@ -3463,10 +3438,6 @@ Elapsed(JSContext *cx, uintN argc, jsval *vp)
return JS_FALSE;
}
JS_DEFINE_TRCINFO_1(AssertEq, (3, (static, JSVAL_RETRY, AssertEq_tn, CONTEXT, JSVAL, JSVAL, 0, 0)))
JS_DEFINE_TRCINFO_1(Print, (2, (static, JSVAL_FAIL, Print_tn, CONTEXT, STRING, 0, 0)))
JS_DEFINE_TRCINFO_1(ShapeOf, (1, (static, INT32, ShapeOf_tn, OBJECT, 0, 0)))
#ifdef XP_UNIX
#include <fcntl.h>
@ -3593,10 +3564,10 @@ static JSFunctionSpec shell_functions[] = {
JS_FS("options", Options, 0,0,0),
JS_FS("load", Load, 1,0,0),
JS_FN("readline", ReadLine, 0,0),
JS_TN("print", Print, 0,0, Print_trcinfo),
JS_FN("print", Print, 0,0),
JS_FS("help", Help, 0,0,0),
JS_FS("quit", Quit, 0,0,0),
JS_TN("assertEq", AssertEq, 2,0, AssertEq_trcinfo),
JS_FN("assertEq", AssertEq, 2,0),
JS_FN("gc", GC, 0,0),
JS_FN("gcparam", GCParameter, 2,0),
JS_FN("countHeap", CountHeap, 0,0),
@ -3632,7 +3603,7 @@ static JSFunctionSpec shell_functions[] = {
JS_FN("getslx", GetSLX, 1,0),
JS_FN("toint32", ToInt32, 1,0),
JS_FS("evalcx", EvalInContext, 1,0,0),
JS_TN("shapeOf", ShapeOf, 1,0, ShapeOf_trcinfo),
JS_FN("shapeOf", ShapeOf, 1,0),
#ifdef MOZ_SHARK
JS_FS("startShark", js_StartShark, 0,0,0),
JS_FS("stopShark", js_StopShark, 0,0,0),