Skip to content

Commit c90e5dc

Browse files
author
Kevin Smith
committed
Do not attempt to reuse Utf8SourceInfo if asmjs parse fails
1 parent 2b3c566 commit c90e5dc

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

lib/Runtime/Base/ScriptContext.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,23 +1995,20 @@ namespace Js
19951995
else
19961996
{
19971997
// We do not own the memory passed into DefaultLoadScriptUtf8. We need to save it so we copy the memory.
1998-
if (*ppSourceInfo == nullptr)
1999-
{
20001998
#ifndef NTBUILD
2001-
if (loadScriptFlag & LoadScriptFlag_ExternalArrayBuffer)
2002-
{
2003-
*ppSourceInfo = Utf8SourceInfo::NewWithNoCopy(this,
2004-
script, (int)length, cb, pSrcInfo, isLibraryCode,
2005-
scriptSource);
2006-
}
2007-
else
1999+
if (loadScriptFlag & LoadScriptFlag_ExternalArrayBuffer)
2000+
{
2001+
*ppSourceInfo = Utf8SourceInfo::NewWithNoCopy(this,
2002+
script, (int)length, cb, pSrcInfo, isLibraryCode,
2003+
scriptSource);
2004+
}
2005+
else
20082006
#endif
2009-
{
2010-
// the 'length' here is not correct - we will get the length from the parser - however parser hasn't done yet.
2011-
// Once the parser is done we will update the utf8sourceinfo's lenght correctly with parser's
2012-
*ppSourceInfo = Utf8SourceInfo::New(this, script,
2013-
(int)length, cb, pSrcInfo, isLibraryCode);
2014-
}
2007+
{
2008+
// The 'length' here is not correct (we will get the length from the parser) however parser isn't done yet.
2009+
// Once the parser is done we will update the utf8sourceinfo's length correctly
2010+
*ppSourceInfo = Utf8SourceInfo::New(this, script,
2011+
(int)length, cb, pSrcInfo, isLibraryCode);
20152012
}
20162013
}
20172014
}

lib/Runtime/Base/Utf8SourceInfo.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,6 @@ namespace Js
148148
}
149149
#endif
150150

151-
void ClearFunctions()
152-
{
153-
if (this->functionBodyDictionary)
154-
{
155-
this->functionBodyDictionary->Clear();
156-
}
157-
}
158-
159151
bool HasFunctions() const
160152
{
161153
return (this->functionBodyDictionary ? this->functionBodyDictionary->Count() > 0 : false);

0 commit comments

Comments
 (0)