Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
[Merge chakra-core/ChakraCore@345870f035] [MERGE #3979 @boingoing] Re…
Browse files Browse the repository at this point in the history
…move an assert in `FindOrAddPidRef`

Merge pull request #3979 from boingoing:RemoveFindOrAddPidRefAssert

We loosened this assert last week to handle cases of the PidRefStack
being out-of-order in the case of reparsing lambda parameters but there
are additional cases, apparently. Looks like we should just remove this
assert entirely.
  • Loading branch information
chakrabot authored and kfarnung committed Jan 9, 2018
1 parent 599be2f commit 4749007
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
7 changes: 1 addition & 6 deletions deps/chakrashim/core/lib/Parser/Hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ struct Ident
return prevRef;
}

PidRefStack * FindOrAddPidRef(ArenaAllocator *alloc, int scopeId, Js::LocalFunctionId funcId
#if DBG
, bool isReparseLambdaParams = false
#endif
)
PidRefStack * FindOrAddPidRef(ArenaAllocator *alloc, int scopeId, Js::LocalFunctionId funcId)
{
// If the stack is empty, or we are pushing to the innermost scope already,
// we can go ahead and push a new PidRef on the stack.
Expand Down Expand Up @@ -309,7 +305,6 @@ struct Ident
return newRef;
}

Assert(ref->prev->id <= ref->id || isReparseLambdaParams);
prevRef = ref;
ref = ref->prev;
}
Expand Down
12 changes: 2 additions & 10 deletions deps/chakrashim/core/lib/Parser/Parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9057,11 +9057,7 @@ PidRefStack* Parser::PushPidRef(IdentPtr pid)
// NOTE: the phase check is here to protect perf. See OSG 1020424.
// In some LS AST-rewrite cases we lose a lot of perf searching the PID ref stack rather
// than just pushing on the top. This hasn't shown up as a perf issue in non-LS benchmarks.
return pid->FindOrAddPidRef(&m_nodeAllocator, GetCurrentBlock()->sxBlock.blockId, GetCurrentFunctionNode()->sxFnc.functionId
#if DBG
, this->m_reparsingLambdaParams
#endif
);
return pid->FindOrAddPidRef(&m_nodeAllocator, GetCurrentBlock()->sxBlock.blockId, GetCurrentFunctionNode()->sxFnc.functionId);
}

Assert(GetCurrentBlock() != nullptr);
Expand Down Expand Up @@ -9092,11 +9088,7 @@ PidRefStack* Parser::PushPidRef(IdentPtr pid)

PidRefStack* Parser::FindOrAddPidRef(IdentPtr pid, int scopeId, Js::LocalFunctionId funcId)
{
PidRefStack *ref = pid->FindOrAddPidRef(&m_nodeAllocator, scopeId, funcId
#if DBG
, this->m_reparsingLambdaParams
#endif
);
PidRefStack *ref = pid->FindOrAddPidRef(&m_nodeAllocator, scopeId, funcId);
if (ref == NULL)
{
Error(ERRnoMemory);
Expand Down
1 change: 1 addition & 0 deletions deps/chakrashim/core/test/Basics/SpecialSymbolCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ var tests = [
body: function() {
// Failure causes an assert to fire
WScript.LoadScript(`(a = function() { this }, b = (this)) => {}`);
assert.throws(() => WScript.LoadScript(`[ a = function () { this; } ((this)) = 1 ] = []`), ReferenceError, "Not a valid destructuring assignment but should not fire assert", "Invalid left-hand side in assignment");
}
},
{
Expand Down

0 comments on commit 4749007

Please sign in to comment.