Bug 1454207 - Part 1: Changes js::ReportIsNotDefined from a value-returning function to a Non-value-returning function r=arai
authorZhang Junzhi <zjz@zjz.name>
Sun, 15 Apr 2018 12:49:23 +0800
changeset 467516 16eb62f2681a58a741fcf6a19150e8ba5bb8866a
parent 467515 6d609d7d44de2918a04c4dcd81e5b4db9421133b
child 467517 4a202b7736923f1858b92459d8e9d5251df59cbd
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1454207
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1454207 - Part 1: Changes js::ReportIsNotDefined from a value-returning function to a Non-value-returning function r=arai MozReview-Commit-ID: Gzb6k0PchNw
js/src/vm/Interpreter-inl.h
js/src/vm/JSContext.cpp
js/src/vm/JSContext.h
js/src/vm/NativeObject.cpp
--- a/js/src/vm/Interpreter-inl.h
+++ b/js/src/vm/Interpreter-inl.h
@@ -175,17 +175,18 @@ enum class GetNameMode { Normal, TypeOf 
 template <GetNameMode mode>
 inline bool
 FetchName(JSContext* cx, HandleObject receiver, HandleObject holder, HandlePropertyName name,
           Handle<PropertyResult> prop, MutableHandleValue vp)
 {
     if (!prop) {
         switch (mode) {
           case GetNameMode::Normal:
-            return ReportIsNotDefined(cx, name);
+            ReportIsNotDefined(cx, name);
+            return false;
           case GetNameMode::TypeOf:
             vp.setUndefined();
             return true;
         }
     }
 
     /* Take the slow path if shape was not found in a native object. */
     if (!receiver->isNative() || !holder->isNative()) {
--- a/js/src/vm/JSContext.cpp
+++ b/js/src/vm/JSContext.cpp
@@ -875,32 +875,30 @@ js::ReportErrorNumberUCArray(JSContext* 
         return false;
     }
 
     ReportError(cx, &report, callback, userRef);
 
     return warning;
 }
 
-bool
+void
 js::ReportIsNotDefined(JSContext* cx, HandleId id)
 {
     JSAutoByteString printable;
-    if (ValueToPrintable(cx, IdToValue(id), &printable)) {
-        JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_NOT_DEFINED,
-                                   printable.ptr());
-    }
-    return false;
+    if (!ValueToPrintable(cx, IdToValue(id), &printable))
+        return;
+    JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_NOT_DEFINED, printable.ptr());
 }
 
-bool
+void
 js::ReportIsNotDefined(JSContext* cx, HandlePropertyName name)
 {
     RootedId id(cx, NameToId(name));
-    return ReportIsNotDefined(cx, id);
+    ReportIsNotDefined(cx, id);
 }
 
 bool
 js::ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
                             HandleString fallback)
 {
     bool ok;
 
--- a/js/src/vm/JSContext.h
+++ b/js/src/vm/JSContext.h
@@ -1023,20 +1023,20 @@ ReportUsageErrorASCII(JSContext* cx, Han
  * and the report doesn't have the JSREPORT_WARNING flag set or reportWarnings
  * is true.
  * Returns false otherwise.
  */
 extern bool
 PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult,
            JSErrorReport* report, bool reportWarnings);
 
-extern bool
+extern void
 ReportIsNotDefined(JSContext* cx, HandlePropertyName name);
 
-extern bool
+extern void
 ReportIsNotDefined(JSContext* cx, HandleId id);
 
 /*
  * Report an attempt to access the property of a null or undefined value (v).
  */
 extern bool
 ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v, HandleString fallback);
 
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -2306,18 +2306,20 @@ enum IsNameLookup { NotNameLookup = fals
  *     Gecko code.)
  */
 static bool
 GetNonexistentProperty(JSContext* cx, HandleId id, IsNameLookup nameLookup, MutableHandleValue vp)
 {
     vp.setUndefined();
 
     // If we are doing a name lookup, this is a ReferenceError.
-    if (nameLookup)
-        return ReportIsNotDefined(cx, id);
+    if (nameLookup) {
+        ReportIsNotDefined(cx, id);
+        return false;
+    }
 
     // Give a strict warning if foo.bar is evaluated by a script for an object
     // foo with no property named 'bar'.
     //
     // Don't warn if extra warnings not enabled or for random getprop
     // operations.
     if (MOZ_LIKELY(!cx->compartment()->behaviors().extraWarnings(cx)))
         return true;
@@ -2376,18 +2378,20 @@ GeneralizedGetProperty(JSContext* cx, Ha
         //
         // If we get here, we've reached a non-native object. Fall back on the
         // algorithm as specified, with two separate lookups. (Note that we
         // throw ReferenceErrors regardless of strictness, technically a bug.)
 
         bool found;
         if (!HasProperty(cx, obj, id, &found))
             return false;
-        if (!found)
-            return ReportIsNotDefined(cx, id);
+        if (!found) {
+            ReportIsNotDefined(cx, id);
+            return false;
+        }
     }
 
     return GetProperty(cx, obj, receiver, id, vp);
 }
 
 static inline bool
 GeneralizedGetProperty(JSContext* cx, JSObject* obj, jsid id, const Value& receiver,
                        IsNameLookup nameLookup, FakeMutableHandle<Value> vp)