Skip to content

Commit

Permalink
Bug 1505935 Part 4 - Inform the record/replay system about all script…
Browse files Browse the repository at this point in the history
… compilations, r=jorendorff.
  • Loading branch information
bhackett1024 committed Nov 17, 2018
1 parent 521346c commit 430d764
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
7 changes: 7 additions & 0 deletions js/src/frontend/BytecodeCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ frontend::SourceAwareCompiler<Unit>::createSourceAndParser(BytecodeCompiler& inf
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()) {
Expand Down
8 changes: 4 additions & 4 deletions js/src/vm/JSScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2634,16 +2634,16 @@ ScriptSource::performXDR(XDRState<mode>* xdr)
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());
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions mfbt/RecordReplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,22 +344,22 @@ MFBT_API void AddContentParseData16(const void* aToken,
// 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);
Expand Down

0 comments on commit 430d764

Please sign in to comment.