1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

perf(ext/web): Avoid changing prototype by setting hostObjectBrand directly (#21358)

This commit is contained in:
Laurence Rowe 2023-11-30 13:06:16 -08:00 committed by GitHub
parent ffa09541d7
commit 8050cbf39e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 11 deletions

13
Cargo.lock generated
View file

@ -1067,9 +1067,9 @@ dependencies = [
[[package]]
name = "deno_core"
version = "0.233.0"
version = "0.234.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1c9dadf191bb484179cf4a599e0ccbe8ea62f35676a15397f171aff14bd9a0"
checksum = "94fe0979c3e6fe8fada5d4895ddd043fb8d5936e0f4c4b4e76fab403bf21ee22"
dependencies = [
"anyhow",
"bytes",
@ -1085,6 +1085,7 @@ dependencies = [
"serde_v8",
"smallvec",
"sourcemap 7.0.0",
"static_assertions",
"tokio",
"url",
"v8",
@ -1492,9 +1493,9 @@ dependencies = [
[[package]]
name = "deno_ops"
version = "0.109.0"
version = "0.110.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3901bf4ce170c37d936ce8b947ba0217e5d235ebbbc1c340703268141c359d3"
checksum = "dab9fca550a1241267e56a9a8185f6263964233f980233cf70d47e587b5f866f"
dependencies = [
"proc-macro-rules",
"proc-macro2",
@ -4636,9 +4637,9 @@ dependencies = [
[[package]]
name = "serde_v8"
version = "0.142.0"
version = "0.143.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6abec9ca384cb6869fcbf7ab816bd0d342cd2668fa7b090d80554831e2d93e60"
checksum = "331359280930e186b14c0f931433b75ec174edb017fa390bab8716d8e36c29ee"
dependencies = [
"bytes",
"derive_more",

View file

@ -40,7 +40,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "0.31.6", features = ["transpiling"] }
deno_core = { version = "0.233.0" }
deno_core = { version = "0.234.0" }
deno_runtime = { version = "0.133.0", path = "./runtime" }
napi_sym = { version = "0.55.0", path = "./cli/napi/sym" }

View file

@ -26,7 +26,6 @@ const {
ArrayPrototypeIncludes,
ArrayPrototypePush,
ObjectPrototypeIsPrototypeOf,
ObjectSetPrototypeOf,
Symbol,
SymbolFor,
SymbolIterator,
@ -84,9 +83,8 @@ const _enabled = Symbol("enabled");
* @returns {MessagePort}
*/
function createMessagePort(id) {
const port = core.createHostObject();
ObjectSetPrototypeOf(port, MessagePortPrototype);
port[webidl.brand] = webidl.brand;
const port = webidl.createBranded(MessagePort);
port[core.hostObjectBrand] = core.hostObjectBrand;
setEventTargetData(port);
port[_id] = id;
return port;