Commit 641a3d0c authored by Jan de Mooij's avatar Jan de Mooij
Browse files

Bug 1825014 part 5 - Assert we never create an arguments object for self-hosted code. r=iain

Depends on D173954

Differential Revision: https://phabricator.services.mozilla.com/D173955
parent dc4a53ba
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10815,6 +10815,9 @@ bool BytecodeEmitter::emitInitializeFunctionSpecialNames() {

  // Do nothing if the function doesn't have an arguments binding.
  if (funbox->needsArgsObj()) {
    // Self-hosted code should use the more efficient ArgumentsLength and
    // GetArgument intrinsics instead of `arguments`.
    MOZ_ASSERT(emitterMode != BytecodeEmitter::SelfHosting);
    if (!emitInitializeFunctionSpecialName(
            this, TaggedParserAtomIndex::WellKnown::arguments(),
            JSOp::Arguments)) {
+4 −0
Original line number Diff line number Diff line
@@ -317,6 +317,10 @@ template <typename CopyArgs>
/* static */
ArgumentsObject* ArgumentsObject::create(JSContext* cx, HandleFunction callee,
                                         unsigned numActuals, CopyArgs& copy) {
  // Self-hosted code should use the more efficient ArgumentsLength and
  // GetArgument intrinsics instead of `arguments`.
  MOZ_ASSERT(!callee->isSelfHostedBuiltin());

  bool mapped = callee->baseScript()->hasMappedArgsObj();
  ArgumentsObject* templateObj =
      GlobalObject::getOrCreateArgumentsTemplateObject(cx, mapped);