Bug 1780517 - Part 1: Emit JSOP::Undefined for undefined in self-hosted JS. r=jandem
authorTooru Fujisawa <arai_a@mac.com>
Thu, 21 Jul 2022 14:23:06 +0000
changeset 624758 72664babe2c66b35c0a8f63672ce3cfd745736b7
parent 624757 24e43da65a498ec3c30a8ffb39ddb52f955c3427
child 624759 28d512ea39d561a96dc2c77eaf92bf6ff93ab05b
push id40013
push userapavel@mozilla.com
push dateThu, 21 Jul 2022 21:40:08 +0000
treeherdermozilla-central@675d5c0e4d1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1780517
milestone104.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 1780517 - Part 1: Emit JSOP::Undefined for undefined in self-hosted JS. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D152387
js/src/frontend/NameOpEmitter.cpp
--- a/js/src/frontend/NameOpEmitter.cpp
+++ b/js/src/frontend/NameOpEmitter.cpp
@@ -46,19 +46,26 @@ bool NameOpEmitter::emitGet() {
         if (!bce_->emitAtomOp(JSOp::GetGName, name_)) {
           //        [stack] VAL
           return false;
         }
       }
       break;
     }
     case NameLocation::Kind::Intrinsic:
-      if (!bce_->emitAtomOp(JSOp::GetIntrinsic, name_)) {
-        //          [stack] VAL
-        return false;
+      if (name_ == TaggedParserAtomIndex::WellKnown::undefined()) {
+        if (!bce_->emit1(JSOp::Undefined)) {
+          //        [stack] Undefined
+          return false;
+        }
+      } else {
+        if (!bce_->emitAtomOp(JSOp::GetIntrinsic, name_)) {
+          //        [stack] VAL
+          return false;
+        }
       }
       break;
     case NameLocation::Kind::NamedLambdaCallee:
       if (!bce_->emit1(JSOp::Callee)) {
         //          [stack] VAL
         return false;
       }
       break;