Commit c77f0e31 authored by Bogdan Szekely's avatar Bogdan Szekely
Browse files

Backed out 4 changesets (bug 1756003, bug 1764280) for causing build bustages...

Backed out 4 changesets (bug 1756003, bug 1764280) for causing build bustages on ScriptLoader.cpp. CLOSED TREE

Backed out changeset 51b6c13941b6 (bug 1764280)
Backed out changeset 399a9a92ff78 (bug 1756003)
Backed out changeset 2dc65ba6edce (bug 1756003)
Backed out changeset 5b982beda860 (bug 1756003)
parent cbc8b3e4
Loading
Loading
Loading
Loading
+2 −35
Original line number Diff line number Diff line
@@ -76,13 +76,6 @@ enum class AsmJSOption : uint8_t {
  /* Do not delazify anything eagerly. */                                      \
  _(OnDemandOnly)                                                              \
                                                                               \
  /*                                                                           \
   * Compare the stencil produced by concurrent depth first delazification and \
   * on-demand delazification. Any differences would crash SpiderMonkey with   \
   * an assertion.                                                             \
   */                                                                          \
  _(CheckConcurrentWithOnDemand)                                               \
                                                                               \
  /*                                                                           \
   * Delazifiy functions in a depth first traversal of the functions.          \
   */                                                                          \
@@ -236,41 +229,15 @@ class JS_PUBLIC_API TransitiveCompileOptions {
  // rooting, or other hand-holding) to their values in |rhs|.
  void copyPODTransitiveOptions(const TransitiveCompileOptions& rhs);

  bool isEagerDelazificationEqualTo(DelazificationOption val) const {
    return eagerDelazificationStrategy() == val;
  }

  template <DelazificationOption... Values>
  bool eagerDelazificationIsOneOf() const {
    return (isEagerDelazificationEqualTo(Values) || ...);
  }

 public:
  // Read-only accessors for non-POD options. The proper way to set these
  // depends on the derived type.
  bool mutedErrors() const { return mutedErrors_; }
  bool forceFullParse() const {
    return eagerDelazificationIsOneOf<
      DelazificationOption::ParseEverythingEagerly>();
    return eagerDelazificationStrategy_ ==
           DelazificationOption::ParseEverythingEagerly;
  }
  bool forceStrictMode() const { return forceStrictMode_; }
  bool consumeDelazificationCache() const {
    return eagerDelazificationIsOneOf<
      DelazificationOption::ConcurrentDepthFirst>();
  }
  bool populateDelazificationCache() const {
    return eagerDelazificationIsOneOf<
      DelazificationOption::CheckConcurrentWithOnDemand,
      DelazificationOption::ConcurrentDepthFirst>();
  }
  bool waitForDelazificationCache() const {
    return eagerDelazificationIsOneOf<
      DelazificationOption::CheckConcurrentWithOnDemand>();
  }
  bool checkDelazificationCache() const {
    return eagerDelazificationIsOneOf<
      DelazificationOption::CheckConcurrentWithOnDemand>();
  }
  DelazificationOption eagerDelazificationStrategy() const {
    return eagerDelazificationStrategy_;
  }
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#include "js/Value.h"               // JS::Value, JS::StringValue
#include "vm/JSContext.h"           // JSContext
#include "vm/JSObject.h"            // JSObject
#include "vm/Realm.h"               // JSRealm
#include "vm/StringType.h"          // JSString

bool js::ParseCompileOptions(JSContext* cx, JS::CompileOptions& options,
+10 −68
Original line number Diff line number Diff line
@@ -228,21 +228,6 @@ template <typename Unit>
      return false;
    }
    if (extensibleStencil) {
      if (input.options.populateDelazificationCache() &&
          !cx->isHelperThreadContext()) {
        BorrowingCompilationStencil borrowingStencil(*extensibleStencil);
        if (!StartOffThreadDelazification(cx, input.options, borrowingStencil)) {
          return false;
        }

        // When we are trying to validate whether on-demand delazification
        // generate the same stencil as concurrent delazification, we want to
        // parse everything eagerly off-thread ahead of re-parsing everything on
        // demand, to compare the outcome.
        if (input.options.waitForDelazificationCache()) {
          WaitForAllDelazifyTasks(cx->runtime());
        }
      }
      if (output.is<UniquePtr<ExtensibleCompilationStencil>>()) {
        output.as<UniquePtr<ExtensibleCompilationStencil>>() =
            std::move(extensibleStencil);
@@ -295,22 +280,6 @@ template <typename Unit>
    return false;
  }

  if (input.options.populateDelazificationCache() &&
      !cx->isHelperThreadContext()) {
    BorrowingCompilationStencil borrowingStencil(compiler.stencil());
    if (!StartOffThreadDelazification(cx, input.options, borrowingStencil)) {
      return false;
    }

    // When we are trying to validate whether on-demand delazification
    // generate the same stencil as concurrent delazification, we want to
    // parse everything eagerly off-thread ahead of re-parsing everything on
    // demand, to compare the outcome.
    if (input.options.waitForDelazificationCache()) {
      WaitForAllDelazifyTasks(cx->runtime());
    }
  }

  if (output.is<UniquePtr<ExtensibleCompilationStencil>>()) {
    auto stencil = cx->make_unique<ExtensibleCompilationStencil>(
        std::move(compiler.stencil()));
@@ -1140,7 +1109,6 @@ static bool CompileLazyFunctionToStencilMaybeInstantiate(
  MOZ_ASSERT(input.source);

  AutoAssertReportedException assertException(cx);
  if (input.options.consumeDelazificationCache()) {
  auto res = GetCachedLazyFunctionStencilMaybeInstantiate(cx, input, output);
  switch (res) {
    case GetCachedResult::Error:
@@ -1151,7 +1119,6 @@ static bool CompileLazyFunctionToStencilMaybeInstantiate(
    case GetCachedResult::NotFound:
      break;
  }
  }

  InheritThis inheritThis =
      input.functionFlags().isArrow() ? InheritThis::Yes : InheritThis::No;
@@ -1198,30 +1165,6 @@ static bool CompileLazyFunctionToStencilMaybeInstantiate(
        .setAllowRelazify();
  }

  if (input.options.checkDelazificationCache()) {
    using OutputType = RefPtr<CompilationStencil>;
    BytecodeCompilerOutput cached((OutputType()));
    auto res = GetCachedLazyFunctionStencilMaybeInstantiate(cx, input, cached);
    if (res == GetCachedResult::Error) {
      return false;
    }
    // Cached results might be removed by GCs.
    if (res == GetCachedResult::Found) {
      auto& concurrentSharedData = cached.as<OutputType>().get()->sharedData;
      auto concurrentData = concurrentSharedData.isSingle() ?
        concurrentSharedData.asSingle()->get()->immutableData() :
        concurrentSharedData.asBorrow()->asSingle()->get()->immutableData();
      auto ondemandData =
        compilationState.sharedData.asSingle()->get()->immutableData();
      MOZ_RELEASE_ASSERT(concurrentData.Length() == ondemandData.Length(),
                         "Non-deterministic stencils");
      for (size_t i = 0; i < concurrentData.Length(); i++) {
        MOZ_RELEASE_ASSERT(concurrentData[i] == ondemandData[i],
                           "Non-deterministic stencils");
      }
    }
  }

  if (output.is<UniquePtr<ExtensibleCompilationStencil>>()) {
    auto stencil = cx->make_unique<ExtensibleCompilationStencil>(
        std::move(compilationState));
@@ -1292,8 +1235,7 @@ static bool DelazifyCanonicalScriptedFunctionImpl(JSContext* cx,
      .setColumn(lazy->column())
      .setScriptSourceOffset(lazy->sourceStart())
      .setNoScriptRval(false)
      .setSelfHostingMode(false)
      .setEagerDelazificationStrategy(lazy->delazificationMode());
      .setSelfHostingMode(false);

  Rooted<CompilationInput> input(cx, CompilationInput(options));
  input.get().initFromLazy(cx, lazy, ss);
+0 −26
Original line number Diff line number Diff line
let source = `
  var m = function() {
    "use asm"
    function g(){}
    return g;
  }

  function check() {
    var objM = new m;
    var g = m();
    // g is a ctor returning an primitive value, thus an empty object
    assertEq(Object.getOwnPropertyNames(new g).length, 0);
  }

  check()
`;

// Check that on-demand delazification and concurrent delazification are not
// attempting to parse "use asm" functions.
const options = {
    fileName: "tests/asm.js/testBug999790.js",
    lineNumber: 1,
    eagerDelazificationStrategy: "CheckConcurrentWithOnDemand",
    newContext: true,
};
evaluate(source, options);
+0 −9
Original line number Diff line number Diff line
//|jit-test| --delazification-mode=on-demand

function foo() {
    return "foo";
}

// Wait is skipped as the source is not registered in the stencil cache.
waitForStencilCache(foo);
assertEq(isInStencilCache(foo), false);
Loading