Backed out 2 changesets (bug 1643171) for jsapi-tests failures CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Sat, 06 Jun 2020 04:00:27 +0300
changeset 534244 42f05268a80bce0e2d7ec3680de596af0f88c2cc
parent 534243 b830bc407224b171a91ed3e9e128030c020b7fdd
child 534245 db92ded549e9ac5c9a95718ebb7dcabbcf551cc4
push id37484
push userdluca@mozilla.com
push dateSat, 06 Jun 2020 09:46:03 +0000
treeherdermozilla-central@6237102f005d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1643171
milestone79.0a1
backs out094e467aacd74fed6fcccc29f807bc4dac016440
58363dfc9159cd419feb5efd3673181a5f94adfd
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
Backed out 2 changesets (bug 1643171) for jsapi-tests failures CLOSED TREE Backed out changeset 094e467aacd7 (bug 1643171) Backed out changeset 58363dfc9159 (bug 1643171)
js/src/irregexp/RegExpAPI.cpp
js/src/irregexp/RegExpAPI.h
js/src/irregexp/RegExpShim.cpp
js/src/irregexp/RegExpShim.h
js/src/vm/JSContext.cpp
--- a/js/src/irregexp/RegExpAPI.cpp
+++ b/js/src/irregexp/RegExpAPI.cpp
@@ -133,26 +133,17 @@ static uint32_t ErrorNumber(RegExpError 
 Isolate* CreateIsolate(JSContext* cx) {
   auto isolate = MakeUnique<Isolate>(cx);
   if (!isolate || !isolate->init()) {
     return nullptr;
   }
   return isolate.release();
 }
 
-void DestroyIsolate(Isolate* isolate) {
-  MOZ_ASSERT(isolate->liveHandles() == 0);
-  MOZ_ASSERT(isolate->livePseudoHandles() == 0);
-  js_delete(isolate);
-}
-
-size_t IsolateSizeOfIncludingThis(Isolate* isolate,
-                                  mozilla::MallocSizeOf mallocSizeOf) {
-  return isolate->sizeOfIncludingThis(mallocSizeOf);
-}
+void DestroyIsolate(Isolate* isolate) { js_delete(isolate); }
 
 static size_t ComputeColumn(const Latin1Char* begin, const Latin1Char* end) {
   return PointerRangeSize(begin, end);
 }
 
 static size_t ComputeColumn(const char16_t* begin, const char16_t* end) {
   return unicode::CountCodePoints(begin, end);
 }
@@ -448,17 +439,16 @@ static MOZ_MUST_USE AssembleResult Assem
   return AssembleResult::Success;
 }
 
 bool CompilePattern(JSContext* cx, MutableHandleRegExpShared re,
                     HandleLinearString input, RegExpShared::CodeKind codeKind) {
   RootedAtom pattern(cx, re->getSource());
   JS::RegExpFlags flags = re->getFlags();
   LifoAllocScope allocScope(&cx->tempLifoAlloc());
-  HandleScope handleScope(cx->isolate);
   Zone zone(allocScope.alloc());
 
   RegExpCompileData data;
   {
     FlatStringReader patternBytes(cx, pattern);
     if (!RegExpParser::ParseRegExp(cx->isolate, &zone, &patternBytes, flags,
                                    &data)) {
       JS::CompileOptions options(cx);
@@ -501,16 +491,17 @@ bool CompilePattern(JSContext* cx, Mutab
     // All fallible initialization has succeeded, so we can change state.
     // Add one to capture_count to account for the whole-match capture.
     uint32_t pairCount = data.capture_count + 1;
     re->useRegExpMatch(pairCount);
   }
 
   MOZ_ASSERT(re->kind() == RegExpShared::Kind::RegExp);
 
+  HandleScope handleScope(cx->isolate);
   RegExpCompiler compiler(cx->isolate, &zone, data.capture_count,
                           input->hasLatin1Chars());
 
   bool isLatin1 = input->hasLatin1Chars();
 
   FlatStringReader sample_subject(cx, input);
   SampleCharacters(&sample_subject, compiler);
   data.node = compiler.PreprocessRegExp(&data, flags, isLatin1);
--- a/js/src/irregexp/RegExpAPI.h
+++ b/js/src/irregexp/RegExpAPI.h
@@ -4,31 +4,26 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This is the interface that the regexp engine exposes to SpiderMonkey. */
 
 #ifndef regexp_RegExpAPI_h
 #define regexp_RegExpAPI_h
 
-#include "mozilla/MemoryReporting.h"
-
 #include "frontend/TokenStream.h"
 #include "vm/JSContext.h"
 #include "vm/RegExpShared.h"
 
 namespace js {
 namespace irregexp {
 
 Isolate* CreateIsolate(JSContext* cx);
 void DestroyIsolate(Isolate* isolate);
 
-size_t IsolateSizeOfIncludingThis(Isolate* isolate,
-                                  mozilla::MallocSizeOf mallocSizeOf);
-
 bool CheckPatternSyntax(JSContext* cx, frontend::TokenStreamAnyChars& ts,
                         const mozilla::Range<const char16_t> chars,
                         JS::RegExpFlags flags);
 bool CheckPatternSyntax(JSContext* cx, frontend::TokenStreamAnyChars& ts,
                         HandleAtom pattern, JS::RegExpFlags flags);
 
 bool CompilePattern(JSContext* cx, MutableHandleRegExpShared re,
                     HandleLinearString input, RegExpShared::CodeKind codeKind);
--- a/js/src/irregexp/RegExpShim.cpp
+++ b/js/src/irregexp/RegExpShim.cpp
@@ -5,18 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Copyright 2019 the V8 project authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 #include "irregexp/RegExpShim.h"
 
-#include "mozilla/MemoryReporting.h"
-
 #include <iostream>
 
 #include "irregexp/imported/regexp-macro-assembler.h"
 #include "irregexp/imported/regexp-stack.h"
 
 #include "vm/NativeObject-inl.h"
 
 namespace v8 {
@@ -135,31 +133,16 @@ void Isolate::trace(JSTracer* trc) {
   js::gc::AssertRootMarkingPhase(trc);
 
   for (auto iter = handleArena_.Iter(); !iter.Done(); iter.Next()) {
     auto& elem = iter.Get();
     JS::GCPolicy<JS::Value>::trace(trc, &elem, "Isolate handle arena");
   }
 }
 
-size_t Isolate::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
-  size_t size = mallocSizeOf(this);
-
-  // The RegExpStack code is imported from V8, so we peek inside it to
-  // measure its memory from here.
-  size += mallocSizeOf(regexpStack_);
-  if (regexpStack_->thread_local_.owns_memory_) {
-    size += mallocSizeOf(regexpStack_->thread_local_.memory_);
-  }
-
-  size += handleArena_.SizeOfExcludingThis(mallocSizeOf);
-  size += uniquePtrArena_.SizeOfExcludingThis(mallocSizeOf);
-  return size;
-}
-
 /*static*/ Handle<String> String::Flatten(Isolate* isolate,
                                           Handle<String> string) {
   if (string->IsFlat()) {
     return string;
   }
   js::AutoEnterOOMUnsafeRegion oomUnsafe;
   JSLinearString* linear = string->str()->ensureLinear(isolate->cx());
   if (!linear) {
--- a/js/src/irregexp/RegExpShim.h
+++ b/js/src/irregexp/RegExpShim.h
@@ -978,18 +978,16 @@ using StackGuard = Isolate;
 using Factory = Isolate;
 
 class Isolate {
  public:
   Isolate(JSContext* cx) : cx_(cx) {}
   ~Isolate();
   bool init();
 
-  size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
-
   //********** Isolate code **********//
   RegExpStack* regexp_stack() const { return regexpStack_; }
   byte* top_of_regexp_stack() const;
 
   // This is called from inside no-GC code. Instead of suppressing GC
   // to allocate the error, we return false from Execute and call
   // ReportOverRecursed in the caller.
   void StackOverflow() {}
@@ -1044,28 +1042,25 @@ class Isolate {
 
   void trace(JSTracer* trc);
 
   //********** Handle code **********//
 
   JS::Value* getHandleLocation(const JS::Value& value);
 
  private:
-  mozilla::SegmentedVector<JS::Value, 256> handleArena_;
-  mozilla::SegmentedVector<PseudoHandle<void>, 256> uniquePtrArena_;
+  mozilla::SegmentedVector<JS::Value> handleArena_;
+  mozilla::SegmentedVector<PseudoHandle<void>> uniquePtrArena_;
 
   void* allocatePseudoHandle(size_t bytes);
 
  public:
   template <typename T>
   PseudoHandle<T> takeOwnership(void* ptr);
 
-  uint32_t liveHandles() const { return handleArena_.Length(); }
-  uint32_t livePseudoHandles() const { return uniquePtrArena_.Length(); }
-
  private:
   void openHandleScope(HandleScope& scope) {
     scope.level_ = handleArena_.Length();
     scope.non_gc_level_ = uniquePtrArena_.Length();
   }
   void closeHandleScope(size_t prevLevel, size_t prevUniqueLevel) {
     size_t currLevel = handleArena_.Length();
     handleArena_.PopLastN(currLevel - prevLevel);
--- a/js/src/vm/JSContext.cpp
+++ b/js/src/vm/JSContext.cpp
@@ -1128,18 +1128,17 @@ bool JSContext::isThrowingDebuggeeWouldR
 
 size_t JSContext::sizeOfExcludingThis(
     mozilla::MallocSizeOf mallocSizeOf) const {
   /*
    * There are other JSContext members that could be measured; the following
    * ones have been found by DMD to be worth measuring.  More stuff may be
    * added later.
    */
-  return cycleDetectorVector().sizeOfExcludingThis(mallocSizeOf) +
-         irregexp::IsolateSizeOfIncludingThis(isolate, mallocSizeOf);
+  return cycleDetectorVector().sizeOfExcludingThis(mallocSizeOf);
 }
 
 #ifdef DEBUG
 bool JSContext::inAtomsZone() const { return zone_->isAtomsZone(); }
 #endif
 
 void JSContext::trace(JSTracer* trc) {
   cycleDetectorVector().trace(trc);