Bug 1619007 - Part 2: Remove unnecessary is<T> tests when directly followed by as<T>. r=mgaudet
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 06 Mar 2020 20:21:35 +0000
changeset 517423 de425cf4b2ac5db2b3d58f29624025b278c9318d
parent 517422 7fb3fd9172c5339ccde9d26483d021c02b68e08c
child 517424 c5b5f5a316f2eab8bfd7b34b6a7007e22a485dda
push id37190
push useraciure@mozilla.com
push dateSat, 07 Mar 2020 21:33:39 +0000
treeherdermozilla-central@d2ac41047c10 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1619007
milestone75.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 1619007 - Part 2: Remove unnecessary is<T> tests when directly followed by as<T>. r=mgaudet The standard convention is to omit a `is<T>` test when it is directly followed by `as<T>`, because `as<T>` is also testing for `is<T>`. Depends on D65768 Differential Revision: https://phabricator.services.mozilla.com/D65769
js/src/frontend/BytecodeEmitter.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -8542,29 +8542,26 @@ bool BytecodeEmitter::emitPropertyListOb
                                                  PropListType type,
                                                  ObjLiteralFlags flags) {
   ObjLiteralCreationData data(cx);
   data.writer().beginObject(flags);
   bool noValues = flags.contains(ObjLiteralFlag::NoValues);
   bool singleton = flags.contains(ObjLiteralFlag::Singleton);
 
   for (ParseNode* propdef : obj->contents()) {
-    MOZ_ASSERT(propdef->is<BinaryNode>());
     BinaryNode* prop = &propdef->as<BinaryNode>();
     ParseNode* key = prop->left();
-    MOZ_ASSERT(key->is<NameNode>() || key->is<NumericLiteral>());
 
     if (key->is<NameNode>()) {
       uint32_t propNameIndex = 0;
       if (!data.addAtom(key->as<NameNode>().atom(), &propNameIndex)) {
         return false;
       }
       data.writer().setPropName(propNameIndex);
     } else {
-      MOZ_ASSERT(key->is<NumericLiteral>());
       double numValue = key->as<NumericLiteral>().value();
       int32_t i = 0;
       DebugOnly<bool> numIsInt =
           NumberIsInt32(numValue, &i);  // checked previously.
       MOZ_ASSERT(numIsInt);
       MOZ_ASSERT(
           ObjLiteralWriter::arrayIndexInRange(i));  // checked previously.
       data.writer().setPropIndex(i);