LibJS: Replace Array.fromAsync with a native JavaScript implementation

This allows us to use the bytecode implementation of await, which
correctly suspends execution contexts and handles completion
injections.

This gains us 4 test262 tests around mutating Array.fromAsync's
iterable whilst it's suspended as well.

This is also one step towards removing spin_until, which the
non-bytecode implementation of await uses.

```
Duration:
     -5.98s

Summary:
    Diff Tests:
        +4     -4 

Diff Tests:
    [...]/Array/fromAsync/asyncitems-array-add-to-singleton.js  -> 
    [...]/Array/fromAsync/asyncitems-array-add.js               -> 
    [...]/Array/fromAsync/asyncitems-array-mutate.js            -> 
    [...]/Array/fromAsync/asyncitems-array-remove.js            -> 
```
This commit is contained in:
Luke Wilde 2025-11-06 19:20:29 +00:00 committed by Andreas Kling
parent a63b0cfaba
commit 0eceee0a05
Notes: github-actions[bot] 2025-11-30 10:56:04 +00:00
15 changed files with 942 additions and 233 deletions

View file

@ -153,6 +153,20 @@ op CreateArguments < Instruction
m_is_immutable: bool
endop
op CreateAsyncFromSyncIterator < Instruction
@nothrow
m_dst: Operand
m_iterator: Operand
m_next_method: Operand
m_done: Operand
endop
op CreateDataPropertyOrThrow < Instruction
m_object: Operand
m_property: Operand
m_value: Operand
endop
op CreateLexicalEnvironment < Instruction
@nothrow
m_dst: Optional<Operand>
@ -422,6 +436,18 @@ op InstanceOf < Instruction
m_rhs: Operand
endop
op IsCallable < Instruction
@nothrow
m_dst: Operand
m_value: Operand
endop
op IsConstructor < Instruction
@nothrow
m_dst: Operand
m_value: Operand
endop
op IteratorClose < Instruction
m_iterator_object: Operand
m_iterator_next: Operand
@ -640,6 +666,11 @@ op NewArray < Instruction
m_elements: Operand[]
endop
op NewArrayWithLength < Instruction
m_dst: Operand
m_array_length: Operand
endop
op NewClass < Instruction
m_length: u32
m_dst: Operand
@ -663,6 +694,11 @@ op NewObject < Instruction
m_dst: Operand
endop
op NewObjectWithNoPrototype < Instruction
@nothrow
m_dst: Operand
endop
op NewPrimitiveArray < Instruction
@nothrow
m_length: u32
@ -1041,6 +1077,22 @@ op ThrowIfTDZ < Instruction
m_src: Operand
endop
op ToBoolean < Instruction
@nothrow
m_dst: Operand
m_value: Operand
endop
op ToLength < Instruction
m_dst: Operand
m_value: Operand
endop
op ToObject < Instruction
m_dst: Operand
m_value: Operand
endop
op Typeof < Instruction
m_dst: Operand
m_src: Operand