Commit 8ecb53e4 authored by Jan de Mooij's avatar Jan de Mooij
Browse files

Bug 1832582 part 4 - Add JOF_USES_ENV to JSOp::Arguments and JSOp::Generator. r=iain a=pascalc

This shouldn't affect behavior because for `JSOp::Arguments` this replaces a similar check
in `WarpOracle`, and generators have their own environment object causing us to return
true from `ScriptUsesEnvironmentChain`.

Differential Revision: https://phabricator.services.mozilla.com/D178653
parent 1684a68a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1557,6 +1557,7 @@ bool WarpBuilder::build_Arguments(BytecodeLocation loc) {
  auto* snapshot = getOpSnapshot<WarpArguments>(loc);
  MOZ_ASSERT(info().needsArgsObj());
  MOZ_ASSERT(snapshot);
  MOZ_ASSERT(usesEnvironmentChain());

  ArgumentsObject* templateObj = snapshot->templateObj();
  MDefinition* env = current->environmentChain();
@@ -1836,6 +1837,8 @@ MConstant* WarpBuilder::globalLexicalEnvConstant() {
}

bool WarpBuilder::build_GetName(BytecodeLocation loc) {
  MOZ_ASSERT(usesEnvironmentChain());

  MDefinition* env = current->environmentChain();
  return buildIC(loc, CacheKind::GetName, {env});
}
@@ -1865,6 +1868,8 @@ bool WarpBuilder::build_GetGName(BytecodeLocation loc) {
}

bool WarpBuilder::build_BindName(BytecodeLocation loc) {
  MOZ_ASSERT(usesEnvironmentChain());

  MDefinition* env = current->environmentChain();
  return buildIC(loc, CacheKind::BindName, {env});
}
@@ -2226,6 +2231,8 @@ bool WarpBuilder::build_CheckThisReinit(BytecodeLocation loc) {
}

bool WarpBuilder::build_Generator(BytecodeLocation loc) {
  MOZ_ASSERT(usesEnvironmentChain());

  MDefinition* callee = getCallee();
  MDefinition* environmentChain = current->environmentChain();
  MDefinition* argsObj = info().needsArgsObj() ? current->argumentsObject()
+1 −5
Original line number Diff line number Diff line
@@ -256,11 +256,7 @@ ICEntry& WarpScriptOracle::getICEntryAndFallback(BytecodeLocation loc,

WarpEnvironment WarpScriptOracle::createEnvironment() {
  // Don't do anything if the script doesn't use the environment chain.
  // Always make an environment chain if the script needs an arguments object
  // because ArgumentsObject construction requires the environment chain to be
  // passed in.
  if (!script_->jitScript()->usesEnvironmentChain() &&
      !script_->needsArgsObj()) {
  if (!script_->jitScript()->usesEnvironmentChain()) {
    return WarpEnvironment(NoEnvironment());
  }

+2 −2
Original line number Diff line number Diff line
@@ -2005,7 +2005,7 @@
     *   Operands:
     *   Stack: => gen
     */ \
    MACRO(Generator, generator, NULL, 1, 0, 1, JOF_BYTE) \
    MACRO(Generator, generator, NULL, 1, 0, 1, JOF_BYTE|JOF_USES_ENV) \
    /*
     * Suspend the current generator and return to the caller.
     *
@@ -3378,7 +3378,7 @@
     *   Operands:
     *   Stack: => arguments
     */ \
    MACRO(Arguments, arguments, NULL, 1, 0, 1, JOF_BYTE) \
    MACRO(Arguments, arguments, NULL, 1, 0, 1, JOF_BYTE|JOF_USES_ENV) \
    /*
     * Create and push the rest parameter array for current function call.
     *