Skip to content

Commit

Permalink
Remove unnecessary assertion in the ArrayObject's setArrayLength func…
Browse files Browse the repository at this point in the history
…tion

There's no need to put an assertion there because:
 - The ArrayObject's length can be changed even when it's not extensible, it just fills the Array with empty values.
 - Modifying the length of an ArrayObject should not throw an error, the only time it should when an element is pushed to a non-extensible ArrayObject.

Fixes #33

Signed-off-by: Daniel Balla [email protected]
  • Loading branch information
Daniel Balla committed Jan 2, 2019
1 parent 8f6925a commit 8be5c70
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/runtime/ArrayObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ void ArrayObject::convertIntoNonFastMode(ExecutionState& state)

bool ArrayObject::setArrayLength(ExecutionState& state, const uint64_t& newLength)
{
ASSERT(isExtensible() || newLength <= getArrayLength(state));

if (UNLIKELY(isFastModeArray() && (newLength > ESCARGOT_ARRAY_NON_FASTMODE_MIN_SIZE))) {
uint32_t orgLength = getArrayLength(state);
if (newLength > orgLength) {
Expand Down

0 comments on commit 8be5c70

Please sign in to comment.