-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
url: add V8 Fast API for Blob RevokeObjectURL #54712
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54712 +/- ##
==========================================
+ Coverage 87.30% 87.60% +0.30%
==========================================
Files 649 650 +1
Lines 182711 182963 +252
Branches 35031 35403 +372
==========================================
+ Hits 159523 160293 +770
+ Misses 16459 15933 -526
- Partials 6729 6737 +8
|
Generally looks good but needs linting and formatting updates. |
eb40c5c
to
3c1f0ae
Compare
@nodejs/url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are missing from this PR.
// Flags: --expose-internals --no-warnings --allow-natives-syntax
'use strict';
const { internalBinding } = require('internal/test/binding');
const assert = require('assert');
const common = require('../common');
function testFastPaths() {
const url = URL.createObjectURL(new Blob(['hello world', '🍌🍌🍌']));
URL.revokeObjectURL(url);
}
if (common.isDebug) {
const { getV8FastApiCallCount } = internalBinding('debug');
eval('%PrepareFunctionForOptimization(URL.revokeObjectURL)');
testFastPaths();
eval('%OptimizeFunctionOnNextCall(URL.revokeObjectURL)');
testFastPaths();
assert.strictEqual(getV8FastApiCallCount('blob.revokeObjectURL'), 1);
} This test always failed. The TurboFan didn't call the fast method. tannal@desktop:~/tannalwork/projects/node-blob-fast-api$ ./node_g --trace-opt --expose-internals --no-warnings --allow-natives-syntax ./test/parallel/test-whatwg-blob-revokeURL.js
[marking 0x13b400e915d9 <JSFunction getNewKey (sfi = 0x247e0ccb65e9)> for optimization to MAGLEV, ConcurrencyMode::kConcurrent, reason: hot and stable]
[compiling method 0x13b400e915d9 <JSFunction getNewKey (sfi = 0x247e0ccb65e9)> (target MAGLEV), mode: ConcurrencyMode::kConcurrent]
[completed compiling 0x13b400e915d9 <JSFunction getNewKey (sfi = 0x247e0ccb65e9)> (target MAGLEV) - took 0.000, 0.526, 0.007 ms]
[marking 0x3de571bad7f9 <JSFunction getNewKey (sfi = 0x247e0ccb65e9)> for optimization to MAGLEV, ConcurrencyMode::kConcurrent, reason: hot and stable]
[compiling method 0x3de571bad7f9 <JSFunction getNewKey (sfi = 0x247e0ccb65e9)> (target MAGLEV), mode: ConcurrencyMode::kConcurrent]
[completed compiling 0x3de571bad7f9 <JSFunction getNewKey (sfi = 0x247e0ccb65e9)> (target MAGLEV) - took 0.000, 0.209, 0.005 ms]
[marking 0x34a89297dd21 <JSFunction (sfi = 0x26efb9430501)> for optimization to MAGLEV, ConcurrencyMode::kConcurrent, reason: hot and stable]
[compiling method 0x34a89297dd21 <JSFunction (sfi = 0x26efb9430501)> (target MAGLEV), mode: ConcurrencyMode::kConcurrent]
[completed compiling 0x34a89297dd21 <JSFunction (sfi = 0x26efb9430501)> (target MAGLEV) - took 0.000, 0.117, 0.003 ms]
[marking 0x13ccd0acc1d1 <JSFunction isPosixPathSeparator (sfi = 0x1a7d38fba549)> for optimization to MAGLEV, ConcurrencyMode::kConcurrent, reason: hot and stable]
[compiling method 0x13ccd0acc1d1 <JSFunction isPosixPathSeparator (sfi = 0x1a7d38fba549)> (target MAGLEV), mode: ConcurrencyMode::kConcurrent]
[completed compiling 0x13ccd0acc1d1 <JSFunction isPosixPathSeparator (sfi = 0x1a7d38fba549)> (target MAGLEV) - took 0.001, 0.145, 0.002 ms]
[marking 0x13ccd0acc251 <JSFunction normalizeString (sfi = 0x1a7d38fba5f9)> for optimization to MAGLEV, ConcurrencyMode::kConcurrent, reason: hot and stable]
[compiling method 0x0c3a3d8dd769 <JSFunction normalizeString (sfi = 0x1a7d38fba5f9)> (target MAGLEV), mode: ConcurrencyMode::kConcurrent]
[completed compiling 0x0c3a3d8dd769 <JSFunction normalizeString (sfi = 0x1a7d38fba5f9)> (target MAGLEV) - took 0.000, 0.563, 0.005 ms]
[manually marking 0x38f95568cab1 <JSFunction revokeObjectURL (sfi = 0x22baf1417f71)> for optimization to TURBOFAN, ConcurrencyMode::kSynchronous]
[compiling method 0x38f95568cab1 <JSFunction revokeObjectURL (sfi = 0x22baf1417f71)> (target TURBOFAN), mode: ConcurrencyMode::kSynchronous]
[completed compiling 0x38f95568cab1 <JSFunction revokeObjectURL (sfi = 0x22baf1417f71)> (target TURBOFAN) - took 0.011, 1.013, 0.025 ms]
node:assert:126
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
0 !== 1
at Object.<anonymous> (/home/tannal/tannalwork/projects/node-blob-fast-api/test/parallel/test-whatwg-blob-revokeURL.js:21:12)
at Module._compile (node:internal/modules/cjs/loader:1546:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
at Module.load (node:internal/modules/cjs/loader:1317:32)
at Module._load (node:internal/modules/cjs/loader:1127:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5)
at node:internal/main/run_main_module:30:49 {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 0,
expected: 1,
operator: 'strictEqual'
}
Node.js v23.0.0-pre |
Description
This pull request adds a V8 Fast API implementation for the
RevokeObjectURL
method in the Blob API. This optimization aims to improve the performance of URL operations related to Blob objects.Local Evaluation
With fast api.
Without fast api.