#375, #391: branch hint malloc and recursion checks, clean up MAsm type barrier spooge

This commit is contained in:
Cameron Kaiser 2017-05-13 11:27:15 -07:00
parent a6a0b895f1
commit a008a19784
2 changed files with 9 additions and 12 deletions

View File

@ -1064,26 +1064,23 @@ private:
// All barriers are off by default. // All barriers are off by default.
// They are enabled if necessary at the end of CodeGenerator::generate(). // They are enabled if necessary at the end of CodeGenerator::generate().
CodeOffset nopJump = toggledJump(&done); CodeOffset nopJump = toggledJump(&done); // SHORT
writePrebarrierOffset(nopJump); writePrebarrierOffset(nopJump);
callPreBarrier(address, type); callPreBarrier(address, type);
jump(&done);
haltingAlign(8);
bind(&done); bind(&done);
} }
void canonicalizeDouble(FloatRegister reg) { void canonicalizeDouble(FloatRegister reg) {
Label notNaN; Label notNaN;
branchDouble(DoubleOrdered, reg, reg, &notNaN); branchDouble(DoubleOrdered, reg, reg, &notNaN); // SHORT
loadConstantDouble(JS::GenericNaN(), reg); loadConstantDouble(JS::GenericNaN(), reg);
bind(&notNaN); bind(&notNaN);
} }
void canonicalizeFloat(FloatRegister reg) { void canonicalizeFloat(FloatRegister reg) {
Label notNaN; Label notNaN;
branchFloat(DoubleOrdered, reg, reg, &notNaN); branchFloat(DoubleOrdered, reg, reg, &notNaN); // SHORT
loadConstantFloat32(float(JS::GenericNaN()), reg); loadConstantFloat32(float(JS::GenericNaN()), reg);
bind(&notNaN); bind(&notNaN);
} }

View File

@ -969,7 +969,7 @@ IsObjectInContextCompartment(JSObject* obj, const JSContext* cx);
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
RunningWithTrustedPrincipals(JSContext* cx); RunningWithTrustedPrincipals(JSContext* cx);
inline uintptr_t MOZ_ALWAYS_INLINE uintptr_t
GetNativeStackLimit(JSContext* cx, StackKind kind, int extraAllowance = 0) GetNativeStackLimit(JSContext* cx, StackKind kind, int extraAllowance = 0)
{ {
PerThreadDataFriendFields* mainThread = PerThreadDataFriendFields* mainThread =
@ -983,7 +983,7 @@ GetNativeStackLimit(JSContext* cx, StackKind kind, int extraAllowance = 0)
return limit; return limit;
} }
inline uintptr_t MOZ_ALWAYS_INLINE uintptr_t
GetNativeStackLimit(JSContext* cx, int extraAllowance = 0) GetNativeStackLimit(JSContext* cx, int extraAllowance = 0)
{ {
StackKind kind = RunningWithTrustedPrincipals(cx) ? StackForTrustedScript StackKind kind = RunningWithTrustedPrincipals(cx) ? StackForTrustedScript
@ -1003,7 +1003,7 @@ GetNativeStackLimit(JSContext* cx, int extraAllowance = 0)
#define JS_CHECK_RECURSION_LIMIT(cx, limit, onerror) \ #define JS_CHECK_RECURSION_LIMIT(cx, limit, onerror) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
int stackDummy_; \ int stackDummy_; \
if (!JS_CHECK_STACK_SIZE(limit, &stackDummy_)) { \ if (MOZ_UNLIKELY(!JS_CHECK_STACK_SIZE(limit, &stackDummy_))) { \
js::ReportOverRecursed(cx); \ js::ReportOverRecursed(cx); \
onerror; \ onerror; \
} \ } \
@ -1015,7 +1015,7 @@ GetNativeStackLimit(JSContext* cx, int extraAllowance = 0)
#define JS_CHECK_RECURSION_LIMIT_DONT_REPORT(cx, limit, onerror) \ #define JS_CHECK_RECURSION_LIMIT_DONT_REPORT(cx, limit, onerror) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
int stackDummy_; \ int stackDummy_; \
if (!JS_CHECK_STACK_SIZE(limit, &stackDummy_)) { \ if (MOZ_UNLIKELY(!JS_CHECK_STACK_SIZE(limit, &stackDummy_))) { \
onerror; \ onerror; \
} \ } \
JS_END_MACRO JS_END_MACRO
@ -1025,14 +1025,14 @@ GetNativeStackLimit(JSContext* cx, int extraAllowance = 0)
#define JS_CHECK_RECURSION_WITH_SP_DONT_REPORT(cx, sp, onerror) \ #define JS_CHECK_RECURSION_WITH_SP_DONT_REPORT(cx, sp, onerror) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
if (!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp)) { \ if (MOZ_UNLIKELY(!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp))) { \
onerror; \ onerror; \
} \ } \
JS_END_MACRO JS_END_MACRO
#define JS_CHECK_RECURSION_WITH_SP(cx, sp, onerror) \ #define JS_CHECK_RECURSION_WITH_SP(cx, sp, onerror) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
if (!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp)) { \ if (MOZ_UNLIKELY(!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp))) { \
js::ReportOverRecursed(cx); \ js::ReportOverRecursed(cx); \
onerror; \ onerror; \
} \ } \