Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update v8 flags #707

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should disable this one now - it will start crashing on assert keyword. Or do you plan to conditionally enable it in Deno?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert keyword is also enabled by default, so this change has no effect.

https://github.com/v8/v8/blob/12.4.254.12/src/flags/flag-definitions.h#L295

I plan to conditionally disable it in Deno. It seems that it is probably enabled if both --harmony-import-assertions and --no-harmony-import-assertions are specified.

" --harmony-import-attributes",
" --no-validate-asm",
" --turbo_fast_api_calls",
" --harmony-array-from_async",
" --harmony-iterator-helpers",
bartlomieju marked this conversation as resolved.
Show resolved Hide resolved
" --harmony-temporal",
" --js-float16array",
bartlomieju marked this conversation as resolved.
Show resolved Hide resolved
);
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");
});
Loading