зеркало из https://github.com/mozilla/gecko-dev.git
Bug 964016 - Part 1: Replace JS_LIKELY with MOZ_LIKELY. r=luke
This commit is contained in:
Родитель
81b53bd666
Коммит
17a73ed3f1
|
@ -368,7 +368,7 @@ int32_t
|
|||
TokenStream::getChar()
|
||||
{
|
||||
int32_t c;
|
||||
if (JS_LIKELY(userbuf.hasRawChars())) {
|
||||
if (MOZ_LIKELY(userbuf.hasRawChars())) {
|
||||
c = userbuf.getRawChar();
|
||||
|
||||
// Normalize the jschar if it was a newline. We need to detect any of
|
||||
|
@ -415,7 +415,7 @@ TokenStream::getChar()
|
|||
int32_t
|
||||
TokenStream::getCharIgnoreEOL()
|
||||
{
|
||||
if (JS_LIKELY(userbuf.hasRawChars()))
|
||||
if (MOZ_LIKELY(userbuf.hasRawChars()))
|
||||
return userbuf.getRawChar();
|
||||
|
||||
flags.isEOF = true;
|
||||
|
|
|
@ -854,7 +854,7 @@ class MOZ_STACK_CLASS TokenStream
|
|||
// |expect| cannot be an EOL char.
|
||||
bool matchChar(int32_t expect) {
|
||||
MOZ_ASSERT(!TokenBuf::isRawEOLChar(expect));
|
||||
return JS_LIKELY(userbuf.hasRawChars()) &&
|
||||
return MOZ_LIKELY(userbuf.hasRawChars()) &&
|
||||
userbuf.matchRawChar(expect);
|
||||
}
|
||||
|
||||
|
|
|
@ -276,9 +276,9 @@ struct FreeSpan
|
|||
if (thing < last) {
|
||||
/* Bump-allocate from the current span. */
|
||||
first = thing + thingSize;
|
||||
} else if (JS_LIKELY(thing == last)) {
|
||||
} else if (MOZ_LIKELY(thing == last)) {
|
||||
/*
|
||||
* Move to the next span. We use JS_LIKELY as without PGO
|
||||
* Move to the next span. We use MOZ_LIKELY as without PGO
|
||||
* compilers mis-predict == here as unlikely to succeed.
|
||||
*/
|
||||
*this = *reinterpret_cast<FreeSpan *>(thing);
|
||||
|
|
|
@ -456,7 +456,7 @@ SetProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValu
|
|||
return true;
|
||||
}
|
||||
|
||||
if (JS_LIKELY(!obj->getOps()->setProperty)) {
|
||||
if (MOZ_LIKELY(!obj->getOps()->setProperty)) {
|
||||
unsigned defineHow = (op == JSOP_SETNAME || op == JSOP_SETGNAME) ? DNP_UNQUALIFIED : 0;
|
||||
return baseops::SetPropertyHelper<SequentialExecution>(cx, obj, obj, id, defineHow, &v,
|
||||
strict);
|
||||
|
|
|
@ -125,7 +125,7 @@ IdToString(JSContext *cx, jsid id)
|
|||
if (JSID_IS_STRING(id))
|
||||
return JSID_TO_ATOM(id);
|
||||
|
||||
if (JS_LIKELY(JSID_IS_INT(id)))
|
||||
if (MOZ_LIKELY(JSID_IS_INT(id)))
|
||||
return Int32ToString<CanGC>(cx, JSID_TO_INT(id));
|
||||
|
||||
RootedValue idv(cx, IdToValue(id));
|
||||
|
|
|
@ -1754,9 +1754,9 @@ IdToValue(jsid id)
|
|||
{
|
||||
if (JSID_IS_STRING(id))
|
||||
return JS::StringValue(JSID_TO_STRING(id));
|
||||
if (JS_LIKELY(JSID_IS_INT(id)))
|
||||
if (MOZ_LIKELY(JSID_IS_INT(id)))
|
||||
return JS::Int32Value(JSID_TO_INT(id));
|
||||
if (JS_LIKELY(JSID_IS_OBJECT(id)))
|
||||
if (MOZ_LIKELY(JSID_IS_OBJECT(id)))
|
||||
return JS::ObjectValue(*JSID_TO_OBJECT(id));
|
||||
JS_ASSERT(JSID_IS_VOID(id));
|
||||
return JS::UndefinedValue();
|
||||
|
|
|
@ -912,7 +912,7 @@ Chunk::allocateArena(Zone *zone, AllocKind thingKind)
|
|||
if (!rt->isHeapMinorCollecting() && rt->gcBytes >= rt->gcMaxBytes)
|
||||
return nullptr;
|
||||
|
||||
ArenaHeader *aheader = JS_LIKELY(info.numArenasFreeCommitted > 0)
|
||||
ArenaHeader *aheader = MOZ_LIKELY(info.numArenasFreeCommitted > 0)
|
||||
? fetchNextFreeArena(rt)
|
||||
: fetchNextDecommittedArena();
|
||||
aheader->init(zone, thingKind);
|
||||
|
@ -1694,7 +1694,7 @@ ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind)
|
|||
*/
|
||||
for (bool secondAttempt = false; ; secondAttempt = true) {
|
||||
void *thing = cx->allocator()->arenas.allocateFromArenaInline(zone, thingKind);
|
||||
if (JS_LIKELY(!!thing))
|
||||
if (MOZ_LIKELY(!!thing))
|
||||
return thing;
|
||||
if (secondAttempt)
|
||||
break;
|
||||
|
|
|
@ -220,7 +220,7 @@ class CellIterImpl
|
|||
for (;;) {
|
||||
if (thing != span->first)
|
||||
break;
|
||||
if (JS_LIKELY(span->hasNext())) {
|
||||
if (MOZ_LIKELY(span->hasNext())) {
|
||||
thing = span->last + thingSize;
|
||||
span = span->nextSpan();
|
||||
break;
|
||||
|
|
|
@ -669,13 +669,13 @@ js::GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleVa
|
|||
|
||||
AutoIdVector keys(cx);
|
||||
if (flags & JSITER_FOREACH) {
|
||||
if (JS_LIKELY(obj != nullptr) && !Snapshot(cx, obj, flags, &keys))
|
||||
if (MOZ_LIKELY(obj != nullptr) && !Snapshot(cx, obj, flags, &keys))
|
||||
return false;
|
||||
JS_ASSERT(shapes.empty());
|
||||
if (!VectorToValueIterator(cx, obj, flags, keys, vp))
|
||||
return false;
|
||||
} else {
|
||||
if (JS_LIKELY(obj != nullptr) && !Snapshot(cx, obj, flags, &keys))
|
||||
if (MOZ_LIKELY(obj != nullptr) && !Snapshot(cx, obj, flags, &keys))
|
||||
return false;
|
||||
if (!VectorToKeyIterator(cx, obj, flags, keys, shapes.length(), key, vp))
|
||||
return false;
|
||||
|
|
|
@ -4413,7 +4413,7 @@ js::NativeSet(typename ExecutionModeTraits<mode>::ContextType cxArg,
|
|||
* unless the setter deleted the shape.
|
||||
*/
|
||||
if (shape->hasSlot() &&
|
||||
(JS_LIKELY(cx->runtime()->propertyRemovals == sample) ||
|
||||
(MOZ_LIKELY(cx->runtime()->propertyRemovals == sample) ||
|
||||
obj->nativeContains(cx, shape)))
|
||||
{
|
||||
obj->setSlot(shape->slot(), vp);
|
||||
|
|
|
@ -329,7 +329,7 @@ SetPropertyOperation(JSContext *cx, HandleScript script, jsbytecode *pc, HandleV
|
|||
RootedValue rref(cx, rval);
|
||||
|
||||
RootedId id(cx, NameToId(script->getName(pc)));
|
||||
if (JS_LIKELY(!obj->getOps()->setProperty)) {
|
||||
if (MOZ_LIKELY(!obj->getOps()->setProperty)) {
|
||||
if (!baseops::SetPropertyHelper<SequentialExecution>(cx, obj, obj, id, 0,
|
||||
&rref, script->strict()))
|
||||
{
|
||||
|
@ -1192,7 +1192,7 @@ AddOperation(JSContext *cx, MutableHandleValue lhs, MutableHandleValue rhs, Valu
|
|||
if (lhs.isInt32() && rhs.isInt32()) {
|
||||
int32_t l = lhs.toInt32(), r = rhs.toInt32();
|
||||
int32_t t;
|
||||
if (JS_LIKELY(SafeAdd(l, r, &t))) {
|
||||
if (MOZ_LIKELY(SafeAdd(l, r, &t))) {
|
||||
res->setInt32(t);
|
||||
return true;
|
||||
}
|
||||
|
@ -1820,7 +1820,7 @@ CASE(JSOP_RETRVAL)
|
|||
JS_ASSERT(js_CodeSpec[*REGS.pc].format & JOF_INVOKE);
|
||||
|
||||
/* Resume execution in the calling frame. */
|
||||
if (JS_LIKELY(interpReturnOK)) {
|
||||
if (MOZ_LIKELY(interpReturnOK)) {
|
||||
TypeScript::Monitor(cx, script, REGS.pc, REGS.sp[-1]);
|
||||
|
||||
ADVANCE_AND_DISPATCH(JSOP_CALL_LENGTH);
|
||||
|
|
|
@ -609,14 +609,14 @@ struct MallocProvider
|
|||
Client *client = static_cast<Client *>(this);
|
||||
client->updateMallocCounter(bytes);
|
||||
void *p = js_malloc(bytes);
|
||||
return JS_LIKELY(!!p) ? p : client->onOutOfMemory(nullptr, bytes);
|
||||
return MOZ_LIKELY(!!p) ? p : client->onOutOfMemory(nullptr, bytes);
|
||||
}
|
||||
|
||||
void *calloc_(size_t bytes) {
|
||||
Client *client = static_cast<Client *>(this);
|
||||
client->updateMallocCounter(bytes);
|
||||
void *p = js_calloc(bytes);
|
||||
return JS_LIKELY(!!p) ? p : client->onOutOfMemory(reinterpret_cast<void *>(1), bytes);
|
||||
return MOZ_LIKELY(!!p) ? p : client->onOutOfMemory(reinterpret_cast<void *>(1), bytes);
|
||||
}
|
||||
|
||||
void *realloc_(void *p, size_t oldBytes, size_t newBytes) {
|
||||
|
@ -628,7 +628,7 @@ struct MallocProvider
|
|||
if (newBytes > oldBytes)
|
||||
client->updateMallocCounter(newBytes - oldBytes);
|
||||
void *p2 = js_realloc(p, newBytes);
|
||||
return JS_LIKELY(!!p2) ? p2 : client->onOutOfMemory(p, newBytes);
|
||||
return MOZ_LIKELY(!!p2) ? p2 : client->onOutOfMemory(p, newBytes);
|
||||
}
|
||||
|
||||
void *realloc_(void *p, size_t bytes) {
|
||||
|
@ -640,7 +640,7 @@ struct MallocProvider
|
|||
if (!p)
|
||||
client->updateMallocCounter(bytes);
|
||||
void *p2 = js_realloc(p, bytes);
|
||||
return JS_LIKELY(!!p2) ? p2 : client->onOutOfMemory(p, bytes);
|
||||
return MOZ_LIKELY(!!p2) ? p2 : client->onOutOfMemory(p, bytes);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
Загрузка…
Ссылка в новой задаче