Bug 1499471: Mark unsafe API functions to allow calling from recovery code r=tcampbell
authorIain Ireland <iireland@mozilla.com>
Tue, 16 Oct 2018 20:55:41 +0000
changeset 489888 d4fe026dee75521ac39478591cb84d782eb0b189
parent 489887 425bec190a04d3de38be9ded779d25b57c35849e
child 489889 778427bb6353f85c1656f4ebcd2041560cd70c16
child 489938 bb2acd046eae1fbedfe11348dc3f31530a645fd8
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerstcampbell
bugs1499471
milestone64.0a1
Bug 1499471: Mark unsafe API functions to allow calling from recovery code r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D8899
js/src/builtin/Boolean-inl.h
js/src/jslibmath.h
js/src/jsmath.cpp
--- a/js/src/builtin/Boolean-inl.h
+++ b/js/src/builtin/Boolean-inl.h
@@ -15,16 +15,16 @@
 
 namespace js {
 
 inline bool
 EmulatesUndefined(JSObject* obj)
 {
     // This may be called off the main thread. It's OK not to expose the object
     // here as it doesn't escape.
-    AutoUnsafeCallWithABI unsafe;
+    AutoUnsafeCallWithABI unsafe(UnsafeABIStrictness::AllowPendingExceptions);
     JSObject* actual = MOZ_LIKELY(!obj->is<WrapperObject>()) ? obj : UncheckedUnwrapWithoutExpose(obj);
     return actual->getClass()->emulatesUndefined();
 }
 
 } /* namespace js */
 
 #endif /* builtin_Boolean_inl_h */
--- a/js/src/jslibmath.h
+++ b/js/src/jslibmath.h
@@ -14,34 +14,34 @@
 #include "js/Value.h"
 #include "vm/JSContext.h"
 
 namespace js {
 
 inline double
 NumberDiv(double a, double b)
 {
-    AutoUnsafeCallWithABI unsafe;
+    AutoUnsafeCallWithABI unsafe(UnsafeABIStrictness::AllowPendingExceptions);
     if (b == 0) {
         if (a == 0 || mozilla::IsNaN(a)) {
             return JS::GenericNaN();
         }
         if (mozilla::IsNegative(a) != mozilla::IsNegative(b)) {
             return mozilla::NegativeInfinity<double>();
         }
         return mozilla::PositiveInfinity<double>();
     }
 
     return a / b;
 }
 
 inline double
 NumberMod(double a, double b)
 {
-    AutoUnsafeCallWithABI unsafe;
+    AutoUnsafeCallWithABI unsafe(UnsafeABIStrictness::AllowPendingExceptions);
     if (b == 0) {
         return JS::GenericNaN();
     }
     return fmod(a, b);
 }
 
 } // namespace js
 
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -538,17 +538,17 @@ js::minmax_impl(JSContext* cx, bool max,
     }
 
     return true;
 }
 
 double
 js::powi(double x, int32_t y)
 {
-    AutoUnsafeCallWithABI unsafe;
+    AutoUnsafeCallWithABI unsafe(UnsafeABIStrictness::AllowPendingExceptions);
     uint32_t n = Abs(y);
     double m = x;
     double p = 1;
     while (true) {
         if ((n & 1) != 0) p *= m;
         n >>= 1;
         if (n == 0) {
             if (y < 0) {