Bug 777174: Change CallNonGenericMethod to take the predicate and implementation as template arguments, not function arguments. r=luke

On x86_64 Fedora 17, this patch yields an 8ms (1.6%) speedup on SunSpider compared to the tree just prior to the introduction of CallNonGenericMethod, or a ~12ms (2.8%) speedup compared to the tree just after the introduction.
This commit is contained in:
Jim Blandy
2012-08-16 11:40:05 -07:00
parent b30f825d85
commit ba67e59fc0
12 changed files with 231 additions and 216 deletions

View File

@@ -751,13 +751,13 @@ Iterator(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
JS_ALWAYS_INLINE bool
IsIterator(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&PropertyIteratorObject::class_);
}
static bool
JS_ALWAYS_INLINE bool
iterator_next_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsIterator(args.thisv()));
@@ -783,11 +783,11 @@ iterator_iterator(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static JSBool
JSBool
iterator_next(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsIterator, iterator_next_impl, args);
return CallNonGenericMethod<IsIterator, iterator_next_impl>(cx, args);
}
static JSFunctionSpec iterator_methods[] = {
@@ -1589,13 +1589,13 @@ CloseGenerator(JSContext *cx, JSObject *obj)
return SendToGenerator(cx, JSGENOP_CLOSE, obj, gen, UndefinedValue());
}
static bool
JS_ALWAYS_INLINE bool
IsGenerator(const Value &v)
{
return v.isObject() && v.toObject().hasClass(&GeneratorClass);
}
static bool
JS_ALWAYS_INLINE bool
generator_send_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@@ -1625,14 +1625,14 @@ generator_send_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_send(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_send_impl, args);
return CallNonGenericMethod<IsGenerator, generator_send_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
generator_next_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@@ -1652,14 +1652,14 @@ generator_next_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_next(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_next_impl, args);
return CallNonGenericMethod<IsGenerator, generator_next_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
generator_throw_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@@ -1683,14 +1683,14 @@ generator_throw_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_throw(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_throw_impl, args);
return CallNonGenericMethod<IsGenerator, generator_throw_impl>(cx, args);
}
static bool
JS_ALWAYS_INLINE bool
generator_close_impl(JSContext *cx, CallArgs args)
{
JS_ASSERT(IsGenerator(args.thisv()));
@@ -1717,11 +1717,11 @@ generator_close_impl(JSContext *cx, CallArgs args)
return true;
}
static JSBool
JSBool
generator_close(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod(cx, IsGenerator, generator_close_impl, args);
return CallNonGenericMethod<IsGenerator, generator_close_impl>(cx, args);
}
#define JSPROP_ROPERM (JSPROP_READONLY | JSPROP_PERMANENT)