Skip to content

Commit

Permalink
feat: update v8 flags (#707)
Browse files Browse the repository at this point in the history
Ref:
denoland/deno#17944 (comment),
denoland/deno#23450

Removed flags enabled by default and added flag Float16Array.
  • Loading branch information
petamoriken authored Apr 22, 2024
1 parent ae3dc3f commit a0f1b57
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
5 changes: 1 addition & 4 deletions core/runtime/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ fn v8_init(

let base_flags = concat!(
" --wasm-test-streaming",
" --harmony-import-assertions",
" --harmony-import-attributes",
" --no-validate-asm",
" --turbo_fast_api_calls",
" --harmony-array-from_async",
" --harmony-iterator-helpers",
" --harmony-temporal",
" --js-float16array",
);
let snapshot_flags = "--predictable --random-seed=42";
let expose_natives_flags = "--expose_gc --allow_natives_syntax";
Expand Down
24 changes: 22 additions & 2 deletions testing/unit/tc39_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,28 @@ test(function testIteratorHelpers() {
}
});

// Verify that the "Temporal" proposal is enabled
test(function testTemporalEnabled() {
// Verify that "Set methods" proposal is enabled (https://github.com/tc39/proposal-set-methods)
test(function testSetMethods() {
// @ts-expect-error: Not available in TypeScript yet
const a: Set<number> = new Set([1, 2, 3]).intersection(new Set([3, 4, 5]));
if (a.size !== 1 && !a.has(3)) {
fail("failed");
}
});

// Verify that the "Temporal" proposal is enabled (https://github.com/tc39/proposal-temporal)
test(function testTemporal() {
// @ts-expect-error: Not available in TypeScript yet
assert(typeof Temporal !== "undefined");
});

// Verify that the "Float16Array" proposal is enabled (https://github.com/tc39/proposal-float16array)
test(function testFloat16Array() {
// @ts-expect-error: Not available in TypeScript yet
const a = new Float16Array([Math.PI]);
assert(a[0] === 3.140625);
// @ts-expect-error: Not available in TypeScript yet
assert(typeof DataView.prototype.getFloat16 !== "undefined");
// @ts-expect-error: Not available in TypeScript yet
assert(typeof DataView.prototype.setFloat16 !== "undefined");
});

0 comments on commit a0f1b57

Please sign in to comment.