Skip to content

Commit

Permalink
fix fast path
Browse files Browse the repository at this point in the history
  • Loading branch information
CarrotzRule123 committed Nov 20, 2024
1 parent 4593a49 commit 4996753
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3116,9 +3116,7 @@ impl ArrayPrototype {
let Heap {
arrays, elements, ..
} = &mut agent.heap;
arrays[array]
.elements
.reserve(elements, len + arg_count as u32);
arrays[array].elements.reserve(elements, final_len.unwrap());
agent[array].elements.len += arg_count as u32;
// Fast path: Copy old items to the end of array,
// copy new items to the front of the array.
Expand All @@ -3129,7 +3127,7 @@ impl ArrayPrototype {
// The transmute effectively turns Value into Some(Value).
std::mem::transmute::<&[Value], &[Option<Value>]>(items.0)
});
return Ok(agent[array].elements.len.into());
return Ok(final_len.unwrap().into());
}
}
// 1. Let O be ? ToObject(this value).
Expand Down

0 comments on commit 4996753

Please sign in to comment.