Bug 1505935 Part 4 - Inform the record/replay system about all script compilations, r=jorendorff.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 17 Nov 2018 10:55:06 -1000
changeset 504021 2b12903dd3784f4e6d1b6190eaf97b20d77f33df
parent 504020 fe27370d1c579b6be61144e613e1a8111f67e607
child 504022 d0c382d99e7646c161244b7e73429362f6caaa58
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1505935
milestone65.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 1505935 Part 4 - Inform the record/replay system about all script compilations, r=jorendorff.
js/src/frontend/BytecodeCompiler.cpp
js/src/vm/JSScript.cpp
mfbt/RecordReplay.h
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -438,16 +438,23 @@ frontend::SourceAwareCompiler<Unit>::cre
     if (!info.createScriptSource(parameterListEnd)) {
         return false;
     }
 
     if (!info.assignSource(sourceBuffer_)) {
         return false;
     }
 
+    // Note the contents of any compiled scripts when recording/replaying.
+    if (mozilla::recordreplay::IsRecordingOrReplaying()) {
+        mozilla::recordreplay::NoteContentParse(this, info.options.filename(),
+                                                "application/javascript",
+                                                sourceBuffer_.units(), sourceBuffer_.length());
+    }
+
     info.createUsedNames();
 
     if (info.canLazilyParse()) {
         syntaxParser.emplace(info.cx, info.cx->tempLifoAlloc(), info.options,
                              sourceBuffer_.units(), sourceBuffer_.length(),
                              /* foldConstants = */ false, *info.usedNames, nullptr, nullptr,
                              info.sourceObject, goal);
         if (!syntaxParser->checkOptions()) {
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -2629,26 +2629,26 @@ ScriptSource::performXDR(XDRState<mode>*
             UncompressedSourceCache::AutoHoldEntry holder;
 
             if (hasSourceType<Utf8Unit>()) {
                 // UTF-8 source text.
                 ScriptSource::PinnedUnits<Utf8Unit> units(xdr->cx(), this, holder, 0, length());
                 if (!units.get()) {
                     return xdr->fail(JS::TranscodeResult_Throw);
                 }
-                mozilla::recordreplay::NoteContentParse8(this, filename(), "application/javascript",
-                                                         units.get(), length());
+                mozilla::recordreplay::NoteContentParse(this, filename(), "application/javascript",
+                                                        units.get(), length());
             } else {
                 // UTF-16 source text.
                 ScriptSource::PinnedUnits<char16_t> units(xdr->cx(), this, holder, 0, length());
                 if (!units.get()) {
                     return xdr->fail(JS::TranscodeResult_Throw);
                 }
-                mozilla::recordreplay::NoteContentParse16(this, filename(), "application/javascript",
-                                                          units.get(), length());
+                mozilla::recordreplay::NoteContentParse(this, filename(), "application/javascript",
+                                                        units.get(), length());
             }
         }
     }
 
     return Ok();
 }
 
 // Format and return a cx->pod_malloc'ed URL for a generated script like:
--- a/mfbt/RecordReplay.h
+++ b/mfbt/RecordReplay.h
@@ -339,32 +339,32 @@ MFBT_API void AddContentParseData8(const
 
 // Add some UTF-16 parse data to an existing content parse.
 MFBT_API void AddContentParseData16(const void* aToken,
                                     const char16_t* aBuffer, size_t aLength);
 
 // Mark a content parse as having completed.
 MFBT_API void EndContentParse(const void* aToken);
 
-// Perform an entire content parse, when the entire URL is available at once.
+// Perform an entire content parse of UTF-8 data.
 static inline void
-NoteContentParse8(const void* aToken,
-                  const char* aURL, const char* aContentType,
-                  const mozilla::Utf8Unit* aUtf8Buffer, size_t aLength)
+NoteContentParse(const void* aToken,
+                 const char* aURL, const char* aContentType,
+                 const Utf8Unit* aUtf8Buffer, size_t aLength)
 {
   BeginContentParse(aToken, aURL, aContentType);
   AddContentParseData8(aToken, aUtf8Buffer, aLength);
   EndContentParse(aToken);
 }
 
-// Perform an entire content parse, when the entire URL is available at once.
+// Perform an entire content parse of UTF-16 data.
 static inline void
-NoteContentParse16(const void* aToken,
-                   const char* aURL, const char* aContentType,
-                   const char16_t* aBuffer, size_t aLength)
+NoteContentParse(const void* aToken,
+                 const char* aURL, const char* aContentType,
+                 const char16_t* aBuffer, size_t aLength)
 {
   BeginContentParse(aToken, aURL, aContentType);
   AddContentParseData16(aToken, aBuffer, aLength);
   EndContentParse(aToken);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // API inline function implementation