Bug 1289050 - Part 8.5: Convert js::ErrorObject::checkAndUnwrapThis to file static function. r=jwalden
authorTooru Fujisawa <arai_a@mac.com>
Fri, 30 Sep 2016 12:34:49 +0900
changeset 315962 44ddce7c9b96316464b66b90a2f4d98fb763f52f
parent 315961 7a24ab0cb4f0d6173edb259c2623e079ccdd2adb
child 315963 14ef4a8f55f36318d169db10c638726928fd59e0
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1289050
milestone52.0a1
Bug 1289050 - Part 8.5: Convert js::ErrorObject::checkAndUnwrapThis to file static function. r=jwalden
js/src/vm/ErrorObject.cpp
js/src/vm/ErrorObject.h
--- a/js/src/vm/ErrorObject.cpp
+++ b/js/src/vm/ErrorObject.cpp
@@ -153,19 +153,19 @@ js::ErrorObject::getOrCreateErrorReport(
     // Cache and return.
     JSErrorReport* copy = CopyErrorReport(cx, &report);
     if (!copy)
         return nullptr;
     setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(copy));
     return copy;
 }
 
-/* static */ bool
-js::ErrorObject::checkAndUnwrapThis(JSContext* cx, CallArgs& args, const char* fnName,
-                                    MutableHandle<ErrorObject*> error)
+static bool
+ErrorObject_checkAndUnwrapThis(JSContext* cx, CallArgs& args, const char* fnName,
+                               MutableHandle<ErrorObject*> error)
 {
     const Value& thisValue = args.thisv();
 
     if (!thisValue.isObject()) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT,
                                   InformalValueTypeName(thisValue));
         return false;
     }
@@ -204,17 +204,17 @@ js::ErrorObject::checkAndUnwrapThis(JSCo
     return true;
 }
 
 /* static */ bool
 js::ErrorObject::getStack(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     Rooted<ErrorObject*> error(cx);
-    if (!checkAndUnwrapThis(cx, args, "(get stack)", &error))
+    if (!ErrorObject_checkAndUnwrapThis(cx, args, "(get stack)", &error))
         return false;
 
     RootedObject savedFrameObj(cx, error->stack());
     RootedString stackString(cx);
     if (!BuildStackString(cx, savedFrameObj, &stackString))
         return false;
     args.rval().setString(stackString);
     return true;
--- a/js/src/vm/ErrorObject.h
+++ b/js/src/vm/ErrorObject.h
@@ -33,19 +33,16 @@ class ErrorObject : public NativeObject
     friend JSObject*
     js::InitExceptionClasses(JSContext* cx, HandleObject global);
 
     static bool
     init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
          ScopedJSFreePtr<JSErrorReport>* errorReport, HandleString fileName, HandleObject stack,
          uint32_t lineNumber, uint32_t columnNumber, HandleString message);
 
-    static bool checkAndUnwrapThis(JSContext* cx, CallArgs& args, const char* fnName,
-                                   MutableHandle<ErrorObject*> error);
-
     static const ClassSpec errorClassSpec_;
     static const ClassSpec subErrorClassSpec_;
     static const ClassSpec nonGlobalErrorClassSpec_;
 
   protected:
     static const uint32_t EXNTYPE_SLOT          = 0;
     static const uint32_t STACK_SLOT            = EXNTYPE_SLOT + 1;
     static const uint32_t ERROR_REPORT_SLOT     = STACK_SLOT + 1;