Add BigInt64Array and BigUint64Array support#365
Conversation
- Add BigInt64Array and BigUint64Array constructors and runtime support - Update TypedArray operations, harness helpers, docs, and tests - Enforce BigInt-only element handling and mixed-type error paths
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds full BigInt typed-array support (BigInt64Array, BigUint64Array): new typed-array kinds, constructor registration and runtime BigInt plumbing, BigInt element read/write and validation, error/suggestion messages, test-harness updates, many new tests, and documentation/decision-log updates. Changes
Sequence Diagram(s)sequenceDiagram
participant Bootstrap as RuntimeBootstrap
participant Engine as TGocciaEngine
participant TAValue as TypedArrayValue
participant Buffer as ArrayBuffer
Bootstrap->>Engine: RegisterBuiltinConstructors()
Engine->>Engine: register BigInt64Array / BigUint64Array (takBigInt64 / takBigUint64)
Note over Engine,TAValue: Constructors reference TypedArrayValue kinds
TAValue->>Buffer: CreateNativeInstance(length/ArrayBuffer)
TAValue->>TAValue: Initialize elements (WriteBigIntElement / WriteValueToElement)
User->>TAValue: ta[0] = 1n
TAValue->>TAValue: Validate BigInt assignment (throw TypeError if not BigInt)
User->>TAValue: v = ta[0]
TAValue->>User: returns 1n (TGocciaBigIntValue)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (10)
tests/built-ins/TypedArray/prototype/indexOf.js (1)
35-39: Add a mixed-typeindexOfassertion for BigInt arrays.A quick Number-vs-BigInt check here would guard against accidental coercion regressions.
Suggested test addition
test.each([BigInt64Array, BigUint64Array])("%s indexOf", (TA) => { const ta = new TA([1n, 2n, 3n, 2n]); expect(ta.indexOf(2n)).toBe(1); expect(ta.indexOf(4n)).toBe(-1); + expect(ta.indexOf(2)).toBe(-1); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/indexOf.js` around lines 35 - 39, Add a mixed-type Number vs BigInt assertion to the existing BigInt typed-array indexOf tests to ensure no coercion occurs: inside the test.each block that iterates over BigInt64Array and BigUint64Array (the test using the local variable ta and calling ta.indexOf), add an assertion that searching with a Number (e.g., ta.indexOf(2)) does not match the BigInt entry and returns -1, in addition to the existing ta.indexOf(2n) and ta.indexOf(4n) checks.tests/built-ins/TypedArray/prototype/filter.js (1)
41-47: Assert constructor preservation forfilterresult.
Current checks validate values but not thatfilterreturns the same typed-array kind (TA), which is important in this PR scope.Proposed test strengthening
test.each([BigInt64Array, BigUint64Array])("%s filter", (TA) => { const ta = new TA([1n, 2n, 3n, 4n]); const filtered = ta.filter(x => x > 2n); + expect(filtered).toBeInstanceOf(TA); expect(filtered.length).toBe(2); expect(filtered[0]).toBe(3n); expect(filtered[1]).toBe(4n); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/filter.js` around lines 41 - 47, The test checks values from ta.filter but doesn't assert the result keeps the same typed-array constructor; update the test in test.each (the TA/ta/filter/filtered scope) to also assert that the filtered object's constructor equals the input TA (or that filtered is an instance of TA) so the filtered result preserves the TypedArray kind (e.g., add an expectation like filtered.constructor === TA or expect(filtered instanceof TA)).tests/built-ins/TypedArray/prototype/entries.js (1)
22-28: Add explicit second-index assertion for iterator tuples.
This makes the iterator ordering check more complete.Proposed test strengthening
test.each([BigInt64Array, BigUint64Array])("%s entries iterator", (TA) => { const ta = new TA([10n, 20n]); const entries = [...ta.entries()]; expect(entries[0][0]).toBe(0); expect(entries[0][1]).toBe(10n); + expect(entries[1][0]).toBe(1); expect(entries[1][1]).toBe(20n); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/entries.js` around lines 22 - 28, The entries iterator test for BigInt64Array/BigUint64Array is missing an explicit assertion for the second tuple's index; update the test (the test.each callback that creates ta and entries) to assert the index of the second tuple as well (i.e., add an expectation that entries[1][0] is 1) so both tuple index and value positions are verified alongside the existing checks (entries[0][0], entries[0][1], entries[1][1]).tests/built-ins/TypedArray/prototype/copyWithin.js (1)
39-44: Consider asserting full post-copyWithinstate.
Only checking indices 0/1 may miss BigInt-specific copy edge regressions in remaining positions.Proposed test strengthening
test.each([BigInt64Array, BigUint64Array])("%s copyWithin", (TA) => { const ta = new TA([1n, 2n, 3n, 4n, 5n]); ta.copyWithin(0, 3); - expect(ta[0]).toBe(4n); - expect(ta[1]).toBe(5n); + expect([...ta]).toEqual([4n, 5n, 3n, 4n, 5n]); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/copyWithin.js` around lines 39 - 44, The test currently only checks indices 0 and 1 after ta.copyWithin(0, 3) in the test.each block; update the assertions to verify the entire TypedArray contents for both BigInt64Array and BigUint64Array to catch regressions—after calling ta.copyWithin(0, 3) assert that the full array equals [4n, 5n, 3n, 4n, 5n] (use Array.from(ta) or an equivalent full-array comparison) so the TA variable and the copyWithin behavior are fully validated.tests/built-ins/TypedArray/prototype/subarray.js (1)
47-55: Consider also asserting shared-buffer aliasing for BigInt subarrays.Current assertions validate values and length, but not the key
subarrayaliasing behavior already checked in Lines 2-10 forInt32Array.➕ Optional assertion
test.each([BigInt64Array, BigUint64Array])("%s subarray", (TA) => { @@ expect(sub.length).toBe(2); expect(sub[0]).toBe(20n); expect(sub[1]).toBe(30n); + ta[1] = 99n; + expect(sub[0]).toBe(99n); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/subarray.js` around lines 47 - 55, Add an assertion that the subarray shares the same underlying buffer as the original typed array to verify aliasing: in the test.each block for BigInt64Array and BigUint64Array, after creating ta and sub (using ta.subarray(1, 3)), assert that sub.buffer === ta.buffer (and optionally that modifying ta[...] changes sub[...] or vice versa) so the BigInt typed arrays confirm the same shared-buffer behavior checked earlier for Int32Array.tests/built-ins/TypedArray/prototype/toString-tag.js (1)
36-44: Prefer adding BigInt constructors to the shared matrix.These standalone tests cover only
Object.prototype.toString, but skip the shared accessor checks already run for other typed arrays. Folding BigInt constructors intoconstructorsgives fuller coverage with less duplication.♻️ Suggested refactor
const constructors = [ @@ [Float32Array, "[object Float32Array]"], [Float64Array, "[object Float64Array]"], + [BigInt64Array, "[object BigInt64Array]"], + [BigUint64Array, "[object BigUint64Array]"], ]; @@ - test("BigInt64Array toStringTag", () => { - const ta = new BigInt64Array(0); - expect(Object.prototype.toString.call(ta)).toBe("[object BigInt64Array]"); - }); - - test("BigUint64Array toStringTag", () => { - const ta = new BigUint64Array(0); - expect(Object.prototype.toString.call(ta)).toBe("[object BigUint64Array]"); - });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/toString-tag.js` around lines 36 - 44, Add BigInt64Array and BigUint64Array to the shared constructors matrix used by the existing typed-array test suite instead of keeping these as standalone tests; locate the constructors array/matrix (named like constructors or the shared "constructors" matrix used by the other typed-array tests) and append BigInt64Array and BigUint64Array so they run through the same shared accessor and toStringTag checks, then remove or convert the two standalone tests in tests/built-ins/TypedArray/prototype/toString-tag.js to avoid duplication.tests/built-ins/TypedArray/prototype/sort.js (1)
82-88: Assert comparator arguments are BigInt values.Current assertions validate order, but not callback argument type. Adding
typeofchecks in comparefn will catch accidental Number coercion regressions.Proposed test adjustment
- ta.sort((a, b) => (a > b ? -1 : a < b ? 1 : 0)); + ta.sort((a, b) => { + expect(typeof a).toBe("bigint"); + expect(typeof b).toBe("bigint"); + return a > b ? -1 : a < b ? 1 : 0; + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/prototype/sort.js` around lines 82 - 88, The test "sort with comparefn" should also assert that the comparator receives BigInt arguments to catch accidental Number coercion; update the compare function passed to TA.prototype.sort (the callback inside the test using ta.sort((a, b) => ...)) to include typeof checks for a and b being "bigint" (e.g., assert or expect that typeof a === "bigint" and typeof b === "bigint") before performing the comparison and returning -1/1/0, ensuring the test both verifies ordering and the argument types.tests/built-ins/TypedArray/from.js (1)
42-56: Add rejection-path coverage for BigInt-only coercion.These tests cover valid BigInt inputs well, but they don’t assert
TypeErrorfor non-BigInt sources/mapFn results (e.g.,TA.from([1,2,3]),TA.from([1n], () => 1)). Adding those will protect the new type-check behavior from regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/from.js` around lines 42 - 56, Add tests that assert TypeError is thrown when BigInt-only typed arrays receive non-BigInt inputs or when the mapping function returns non-BigInt values: for the existing describe.each over BigInt64Array and BigUint64Array, add cases calling TA.from([1,2,3]) and expecting a TypeError, and a case calling TA.from([1n], () => 1) (and similar variations) and expecting a TypeError; place these alongside the existing ".from array of BigInts" and ".from with mapFn" tests so TA.from and the mapFn behavior are covered for rejection paths.source/units/Goccia.Engine.pas (1)
962-973: Consider centralizing typed-array constructor registration to avoid drift.This constructor list is duplicated in
source/units/Goccia.Runtime.Bootstrap.pas(Lines 435-446). A shared helper would reduce future mismatch risk when adding/removing typed-array kinds.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@source/units/Goccia.Engine.pas` around lines 962 - 973, The typed-array constructor registrations (calls to RegisterTypedArrayConstructor for CONSTRUCTOR_INT8_ARRAY, CONSTRUCTOR_UINT8_ARRAY, CONSTRUCTOR_UINT8_CLAMPED_ARRAY, CONSTRUCTOR_INT16_ARRAY, CONSTRUCTOR_UINT16_ARRAY, CONSTRUCTOR_INT32_ARRAY, CONSTRUCTOR_UINT32_ARRAY, CONSTRUCTOR_FLOAT16_ARRAY, CONSTRUCTOR_FLOAT32_ARRAY, CONSTRUCTOR_FLOAT64_ARRAY, CONSTRUCTOR_BIGINT64_ARRAY, CONSTRUCTOR_BIGUINT64_ARRAY) are duplicated across units (e.g., Goccia.Engine and Goccia.Runtime.Bootstrap); extract them into a single shared routine (e.g., RegisterAllTypedArrayConstructors or RegisterDefaultTypedArrayConstructors) in a common unit and replace the duplicated blocks by calling that helper from both places so future additions/removals are centralized and cannot drift.tests/built-ins/TypedArray/constructors.js (1)
234-282: Add upper-half and mixed-kind regression cases.These tests only exercise small signed-safe values, so they won't catch two easy failure modes here:
BigUint64Arrayvalues above2^63 - 1, and the requiredTypeErrorwhen copying between BigInt-backed and Number-backed typed arrays. A couple of cases around18446744073709551615n,-1n, andnew BigInt64Array(new Int32Array([1]))/.set(new Int32Array([1]))would lock those down.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/built-ins/TypedArray/constructors.js` around lines 234 - 282, Add regression tests that cover large unsigned values and mixed-kind copies: add cases creating BigUint64Array with values above 2^63-1 (e.g., 18446744073709551615n) and BigInt64Array with negative values like -1n to ensure correct representation, and add tests that copying between BigInt-backed arrays and Number-backed arrays (e.g., new BigInt64Array(new Int32Array([1])) and calling .set(new Int32Array([1]))) throws a TypeError; update the test block around the BigInt64Array/BigUint64Array constructors and the "shares underlying buffer" section to include these new cases so BigUint64Array, BigInt64Array, and their .set/copy behavior are validated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/decision-log.md`:
- Line 20: Remove the duplicated word in the new decision-log entry by replacing
the phrase "BigInt-typed typed array constructors" with "BigInt-typed array
constructors" in the entry that starts with "**2026-04-20** · `runtime` —
BigInt64Array/BigUint64Array (ES2020)"; ensure the rest of the sentence and the
link to [built-ins-binary-data.md] remain unchanged.
In `@source/units/Goccia.Runtime.Bootstrap.pas`:
- Around line 445-446: Register the BigInt global constructor alongside the
BigInt typed-array registrations: add a registration call for
TGocciaGlobalBigInt (the same pattern used for other globals) near the two
RegisterTypedArrayConstructor calls for CONSTRUCTOR_BIGINT64_ARRAY and
CONSTRUCTOR_BIGUINT64_ARRAY so bootstrap exposes BigInt() at runtime; implement
it using the same constructor handler used elsewhere (e.g., ObjectConstructor)
and the matching constructor identifier (e.g., CONSTRUCTOR_BIGINT) so behavior
matches the TGocciaGlobalBigInt registration in the engine unit.
In `@source/units/Goccia.Values.TypedArrayValue.pas`:
- Around line 1067-1108: The code treats BigUint64Array elements as signed by
using TA.ReadBigIntElement with TBigInteger.FromInt64 when building
comparator/callback args and in the default comparator; replace those usages
with the existing GetElementAsValue(...) (which applies BigIntFromQWord for
takBigUint64) when creating TGocciaBigIntValue arguments for Call, and for the
default comparison branch (where it currently compares TA.ReadBigIntElement(...)
to TmpBig) implement an unsigned-aware comparison when FKind = takBigUint64
(compare raw QWord/UInt64 representations or use BigIntFromQWord for both
operands) so values >= 2^63 are handled correctly; update the same pattern in
the corresponding block around lines 1551-1569 as well.
- Around line 1999-2017: Remove the BigInt-special branch: delete the "if
FirstArg is TGocciaBigIntValue then ..." block and instead always call
FirstArg.ToNumberLiteral (as the code already does in the else branch) to obtain
Num; preserve the existing NaN/truncation/negative-length checks and
ThrowRangeError calls (SErrorInvalidTypedArrayLength, SSuggestTypedArrayLength).
This ensures ToNumber is applied to FirstArg (causing BigInt to raise TypeError)
per ES2026 §23.2.1.2 and avoids extracting a BigInt via
TGocciaBigIntValue.ToInt64.
- Around line 793-809: The fill()/with() implementation is incorrectly
hardcoding omitted value to zero; instead, when AArgs.Length = 0 you must coerce
undefined through the normal conversion path (so BigInt kinds throw via the
TGocciaBigIntValue check and numeric kinds preserve NaN behavior), so remove the
special-case assignments (FillBigInt := 0 and FillNum :=
TGocciaNumberLiteralValue.ZeroValue) and let the code call the existing
type-check/coercion logic: for bigints keep the TGocciaBigIntValue type
assertion and ThrowTypeError using
SErrorBigIntTypedArrayRequiresBigInt/SSuggestBigIntTypedArrayValue, and for
numbers call AArgs.GetElement(0).ToNumberLiteral (or pass the absent element
through the same ToNumberLiteral/conversion flow) so undefined is coerced
normally; apply the same change in the with() implementation referenced around
line 1782.
---
Nitpick comments:
In `@source/units/Goccia.Engine.pas`:
- Around line 962-973: The typed-array constructor registrations (calls to
RegisterTypedArrayConstructor for CONSTRUCTOR_INT8_ARRAY,
CONSTRUCTOR_UINT8_ARRAY, CONSTRUCTOR_UINT8_CLAMPED_ARRAY,
CONSTRUCTOR_INT16_ARRAY, CONSTRUCTOR_UINT16_ARRAY, CONSTRUCTOR_INT32_ARRAY,
CONSTRUCTOR_UINT32_ARRAY, CONSTRUCTOR_FLOAT16_ARRAY, CONSTRUCTOR_FLOAT32_ARRAY,
CONSTRUCTOR_FLOAT64_ARRAY, CONSTRUCTOR_BIGINT64_ARRAY,
CONSTRUCTOR_BIGUINT64_ARRAY) are duplicated across units (e.g., Goccia.Engine
and Goccia.Runtime.Bootstrap); extract them into a single shared routine (e.g.,
RegisterAllTypedArrayConstructors or RegisterDefaultTypedArrayConstructors) in a
common unit and replace the duplicated blocks by calling that helper from both
places so future additions/removals are centralized and cannot drift.
In `@tests/built-ins/TypedArray/constructors.js`:
- Around line 234-282: Add regression tests that cover large unsigned values and
mixed-kind copies: add cases creating BigUint64Array with values above 2^63-1
(e.g., 18446744073709551615n) and BigInt64Array with negative values like -1n to
ensure correct representation, and add tests that copying between BigInt-backed
arrays and Number-backed arrays (e.g., new BigInt64Array(new Int32Array([1]))
and calling .set(new Int32Array([1]))) throws a TypeError; update the test block
around the BigInt64Array/BigUint64Array constructors and the "shares underlying
buffer" section to include these new cases so BigUint64Array, BigInt64Array, and
their .set/copy behavior are validated.
In `@tests/built-ins/TypedArray/from.js`:
- Around line 42-56: Add tests that assert TypeError is thrown when BigInt-only
typed arrays receive non-BigInt inputs or when the mapping function returns
non-BigInt values: for the existing describe.each over BigInt64Array and
BigUint64Array, add cases calling TA.from([1,2,3]) and expecting a TypeError,
and a case calling TA.from([1n], () => 1) (and similar variations) and expecting
a TypeError; place these alongside the existing ".from array of BigInts" and
".from with mapFn" tests so TA.from and the mapFn behavior are covered for
rejection paths.
In `@tests/built-ins/TypedArray/prototype/copyWithin.js`:
- Around line 39-44: The test currently only checks indices 0 and 1 after
ta.copyWithin(0, 3) in the test.each block; update the assertions to verify the
entire TypedArray contents for both BigInt64Array and BigUint64Array to catch
regressions—after calling ta.copyWithin(0, 3) assert that the full array equals
[4n, 5n, 3n, 4n, 5n] (use Array.from(ta) or an equivalent full-array comparison)
so the TA variable and the copyWithin behavior are fully validated.
In `@tests/built-ins/TypedArray/prototype/entries.js`:
- Around line 22-28: The entries iterator test for BigInt64Array/BigUint64Array
is missing an explicit assertion for the second tuple's index; update the test
(the test.each callback that creates ta and entries) to assert the index of the
second tuple as well (i.e., add an expectation that entries[1][0] is 1) so both
tuple index and value positions are verified alongside the existing checks
(entries[0][0], entries[0][1], entries[1][1]).
In `@tests/built-ins/TypedArray/prototype/filter.js`:
- Around line 41-47: The test checks values from ta.filter but doesn't assert
the result keeps the same typed-array constructor; update the test in test.each
(the TA/ta/filter/filtered scope) to also assert that the filtered object's
constructor equals the input TA (or that filtered is an instance of TA) so the
filtered result preserves the TypedArray kind (e.g., add an expectation like
filtered.constructor === TA or expect(filtered instanceof TA)).
In `@tests/built-ins/TypedArray/prototype/indexOf.js`:
- Around line 35-39: Add a mixed-type Number vs BigInt assertion to the existing
BigInt typed-array indexOf tests to ensure no coercion occurs: inside the
test.each block that iterates over BigInt64Array and BigUint64Array (the test
using the local variable ta and calling ta.indexOf), add an assertion that
searching with a Number (e.g., ta.indexOf(2)) does not match the BigInt entry
and returns -1, in addition to the existing ta.indexOf(2n) and ta.indexOf(4n)
checks.
In `@tests/built-ins/TypedArray/prototype/sort.js`:
- Around line 82-88: The test "sort with comparefn" should also assert that the
comparator receives BigInt arguments to catch accidental Number coercion; update
the compare function passed to TA.prototype.sort (the callback inside the test
using ta.sort((a, b) => ...)) to include typeof checks for a and b being
"bigint" (e.g., assert or expect that typeof a === "bigint" and typeof b ===
"bigint") before performing the comparison and returning -1/1/0, ensuring the
test both verifies ordering and the argument types.
In `@tests/built-ins/TypedArray/prototype/subarray.js`:
- Around line 47-55: Add an assertion that the subarray shares the same
underlying buffer as the original typed array to verify aliasing: in the
test.each block for BigInt64Array and BigUint64Array, after creating ta and sub
(using ta.subarray(1, 3)), assert that sub.buffer === ta.buffer (and optionally
that modifying ta[...] changes sub[...] or vice versa) so the BigInt typed
arrays confirm the same shared-buffer behavior checked earlier for Int32Array.
In `@tests/built-ins/TypedArray/prototype/toString-tag.js`:
- Around line 36-44: Add BigInt64Array and BigUint64Array to the shared
constructors matrix used by the existing typed-array test suite instead of
keeping these as standalone tests; locate the constructors array/matrix (named
like constructors or the shared "constructors" matrix used by the other
typed-array tests) and append BigInt64Array and BigUint64Array so they run
through the same shared accessor and toStringTag checks, then remove or convert
the two standalone tests in tests/built-ins/TypedArray/prototype/toString-tag.js
to avoid duplication.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 220b8515-70ea-47e9-809a-39089841ce0a
📒 Files selected for processing (43)
docs/built-ins-binary-data.mddocs/built-ins.mddocs/decision-log.mdscripts/test262_harness/testTypedArray.jssource/units/Goccia.Constants.ConstructorNames.passource/units/Goccia.Engine.passource/units/Goccia.Error.Messages.passource/units/Goccia.Error.Suggestions.passource/units/Goccia.Runtime.Bootstrap.passource/units/Goccia.Values.TypedArrayValue.pastests/built-ins/TypedArray/constructors.jstests/built-ins/TypedArray/element-access.jstests/built-ins/TypedArray/from.jstests/built-ins/TypedArray/of.jstests/built-ins/TypedArray/prototype/at.jstests/built-ins/TypedArray/prototype/copyWithin.jstests/built-ins/TypedArray/prototype/entries.jstests/built-ins/TypedArray/prototype/every.jstests/built-ins/TypedArray/prototype/fill.jstests/built-ins/TypedArray/prototype/filter.jstests/built-ins/TypedArray/prototype/find.jstests/built-ins/TypedArray/prototype/findIndex.jstests/built-ins/TypedArray/prototype/findLast.jstests/built-ins/TypedArray/prototype/findLastIndex.jstests/built-ins/TypedArray/prototype/forEach.jstests/built-ins/TypedArray/prototype/includes.jstests/built-ins/TypedArray/prototype/indexOf.jstests/built-ins/TypedArray/prototype/join.jstests/built-ins/TypedArray/prototype/lastIndexOf.jstests/built-ins/TypedArray/prototype/map.jstests/built-ins/TypedArray/prototype/reduce.jstests/built-ins/TypedArray/prototype/reduceRight.jstests/built-ins/TypedArray/prototype/reverse.jstests/built-ins/TypedArray/prototype/set.jstests/built-ins/TypedArray/prototype/slice.jstests/built-ins/TypedArray/prototype/some.jstests/built-ins/TypedArray/prototype/sort.jstests/built-ins/TypedArray/prototype/subarray.jstests/built-ins/TypedArray/prototype/toReversed.jstests/built-ins/TypedArray/prototype/toSorted.jstests/built-ins/TypedArray/prototype/toString-tag.jstests/built-ins/TypedArray/prototype/values.jstests/built-ins/TypedArray/prototype/with.js
…nt-typed-arrays # Conflicts: # docs/decision-log.md
- Fix duplicated word in decision-log entry - Register BigInt global constructor in Bootstrap for parity - Fix fill()/with() to throw TypeError when value omitted on BigInt arrays (coerce undefined per ES spec instead of hardcoding zero) - Fix BigUint64Array signedness: sort comparator and filter callback now use unsigned-aware logic for values >= 2^63 - Remove BigInt special case from TypedArray length constructor; ToNumber correctly throws TypeError for BigInt per ES2026 §7.1.4 - Enforce TypeError on set() when mixing BigInt/Number typed arrays - Strengthen tests: mixed-type indexOf, constructor preservation, entries index, full copyWithin state, subarray aliasing, sort typeof checks, from() rejection paths, upper-half BigUint64 values, toStringTag matrix Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/decision-log.md (1)
20-21: Add the PR link for decision-trace consistency.The new entry is clear, but it would be easier to audit later if it also includes
[#365](https://github.com/frostney/GocciaScript/pull/365), consistent with nearby entries that link both PR and docs.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/decision-log.md` around lines 20 - 21, Update the 2026-04-20 runtime entry for BigInt64Array/BigUint64Array in decision-log.md to include the PR link for traceability: append " [`#365`](https://github.com/frostney/GocciaScript/pull/365)" to the end of the existing bullet (the entry that starts with "2026-04-20 · `runtime` — BigInt64Array/BigUint64Array (ES2020)"), matching surrounding entries' format so both the docs link and PR number are present for that line.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/decision-log.md`:
- Around line 20-21: Update the 2026-04-20 runtime entry for
BigInt64Array/BigUint64Array in decision-log.md to include the PR link for
traceability: append "
[`#365`](https://github.com/frostney/GocciaScript/pull/365)" to the end of the
existing bullet (the entry that starts with "2026-04-20 · `runtime` —
BigInt64Array/BigUint64Array (ES2020)"), matching surrounding entries' format so
both the docs link and PR number are present for that line.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1c4a1722-ec9c-49a2-bf06-fc8792cd1c23
📒 Files selected for processing (14)
docs/decision-log.mdsource/units/Goccia.Engine.passource/units/Goccia.Error.Messages.passource/units/Goccia.Runtime.Bootstrap.passource/units/Goccia.Values.TypedArrayValue.pastests/built-ins/TypedArray/constructors.jstests/built-ins/TypedArray/from.jstests/built-ins/TypedArray/prototype/copyWithin.jstests/built-ins/TypedArray/prototype/entries.jstests/built-ins/TypedArray/prototype/filter.jstests/built-ins/TypedArray/prototype/indexOf.jstests/built-ins/TypedArray/prototype/sort.jstests/built-ins/TypedArray/prototype/subarray.jstests/built-ins/TypedArray/prototype/toString-tag.js
✅ Files skipped from review due to trivial changes (8)
- tests/built-ins/TypedArray/prototype/filter.js
- tests/built-ins/TypedArray/prototype/indexOf.js
- tests/built-ins/TypedArray/prototype/entries.js
- tests/built-ins/TypedArray/prototype/subarray.js
- tests/built-ins/TypedArray/prototype/toString-tag.js
- tests/built-ins/TypedArray/prototype/sort.js
- tests/built-ins/TypedArray/constructors.js
- source/units/Goccia.Error.Messages.pas
🚧 Files skipped from review as they are similar to previous changes (5)
- tests/built-ins/TypedArray/from.js
- source/units/Goccia.Engine.pas
- tests/built-ins/TypedArray/prototype/copyWithin.js
- source/units/Goccia.Runtime.Bootstrap.pas
- source/units/Goccia.Values.TypedArrayValue.pas
Benchmark Results386 benchmarks Interpreted: 🟢 386 improved · avg +33.4% arraybuffer.js — Interp: 🟢 14 · avg +31.2% · Bytecode: 🟢 8, 🔴 3, 3 unch. · avg +3.0%
arrays.js — Interp: 🟢 19 · avg +35.8% · Bytecode: 🟢 15, 4 unch. · avg +8.5%
async-await.js — Interp: 🟢 6 · avg +36.4% · Bytecode: 🟢 5, 1 unch. · avg +5.6%
base64.js — Interp: 🟢 10 · avg +39.0% · Bytecode: 🟢 8, 2 unch. · avg +7.6%
classes.js — Interp: 🟢 31 · avg +30.2% · Bytecode: 🟢 18, 13 unch. · avg +3.7%
closures.js — Interp: 🟢 11 · avg +38.9% · Bytecode: 🟢 10, 1 unch. · avg +8.5%
collections.js — Interp: 🟢 12 · avg +39.8% · Bytecode: 🟢 3, 🔴 1, 8 unch. · avg +1.0%
csv.js — Interp: 🟢 13 · avg +40.1% · Bytecode: 🟢 11, 2 unch. · avg +13.5%
destructuring.js — Interp: 🟢 22 · avg +34.0% · Bytecode: 🟢 15, 🔴 2, 5 unch. · avg +3.9%
fibonacci.js — Interp: 🟢 8 · avg +37.8% · Bytecode: 🟢 2, 6 unch. · avg +1.6%
float16array.js — Interp: 🟢 32 · avg +29.6% · Bytecode: 🟢 4, 🔴 15, 13 unch. · avg -5.0%
for-of.js — Interp: 🟢 7 · avg +42.9% · Bytecode: 🟢 7 · avg +10.7%
helpers/bench-module.js — Interp: 0 · Bytecode: 0
iterators.js — Interp: 🟢 42 · avg +22.4% · Bytecode: 🟢 35, 7 unch. · avg +8.7%
json.js — Interp: 🟢 20 · avg +37.1% · Bytecode: 🟢 20 · avg +8.6%
jsx.jsx — Interp: 🟢 21 · avg +37.6% · Bytecode: 🟢 6, 🔴 2, 13 unch. · avg +1.7%
modules.js — Interp: 🟢 9 · avg +35.8% · Bytecode: 🟢 9 · avg +12.7%
numbers.js — Interp: 🟢 11 · avg +44.8% · Bytecode: 🟢 5, 🔴 1, 5 unch. · avg +4.0%
objects.js — Interp: 🟢 7 · avg +30.2% · Bytecode: 🟢 6, 1 unch. · avg +13.7%
promises.js — Interp: 🟢 12 · avg +37.5% · Bytecode: 🟢 1, 11 unch. · avg +1.0%
regexp.js — Interp: 🟢 11 · avg +31.4% · Bytecode: 🟢 11 · avg +12.1%
strings.js — Interp: 🟢 19 · avg +34.7% · Bytecode: 🟢 6, 🔴 7, 6 unch. · avg -11.7%
tsv.js — Interp: 🟢 9 · avg +40.5% · Bytecode: 🟢 9 · avg +17.7%
typed-arrays.js — Interp: 🟢 22 · avg +22.0% · Bytecode: 🔴 22 · avg -14.7%
uint8array-encoding.js — Interp: 🟢 18 · avg +40.0% · Bytecode: 🟢 11, 🔴 6, 1 unch. · avg -4.9%
Measured on ubuntu-latest x64. Benchmark ranges compare cached main-branch min/max ops/sec with the PR run; overlapping ranges are treated as unchanged noise. Percentage deltas are secondary context. |
Suite Timing
Measured on ubuntu-latest x64. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
BigInt64ArrayandBigUint64Arrayas supported typed array constructors and wires them into engine/runtime bootstrap registration.fill,set,sort,includes,indexOf,map,filter,reduce,toReversed,toSorted, andwith.