GeezerVison is showing github.com — test: run V8 Fast API tests in release mode too · nodejs/node@522d5a3
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/contributing/adding-v8-fast-api.md +15-16Lines changed: 15 additions & 16 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -173,25 +173,24 @@ A typical function that communicates between JavaScript and C++ is as follows. | 173 | 173 | // We could also require a function that uses the internal binding internally. | 174 | 174 | const { divide } = internalBinding('custom_namespace'); | 175 | 175 |
| 176 | | - if (common.isDebug) { | 177 | | - const { getV8FastApiCallCount } = internalBinding('debug'); | 178 | | - | 179 | | - // The function that will be optimized. It has to be a function written in | 180 | | - // JavaScript. Since `divide` comes from the C++ side, we need to wrap it. | 181 | | - function testFastPath(a, b) { | 182 | | - return divide(a, b); | 183 | | - } | | 176 | + // The function that will be optimized. It has to be a function written in | | 177 | + // JavaScript. Since `divide` comes from the C++ side, we need to wrap it. | | 178 | + function testFastPath(a, b) { | | 179 | + return divide(a, b); | | 180 | + } | 184 | 181 |
| 185 | | - eval('%PrepareFunctionForOptimization(testFastPath)'); | 186 | | - // This call will let V8 know about the argument types that the function expects. | 187 | | - assert.strictEqual(testFastPath(6, 3), 2); | | 182 | + eval('%PrepareFunctionForOptimization(testFastPath)'); | | 183 | + // This call will let V8 know about the argument types that the function expects. | | 184 | + assert.strictEqual(testFastPath(6, 3), 2); | 188 | 185 |
| 189 | | - eval('%OptimizeFunctionOnNextCall(testFastPath)'); | 190 | | - assert.strictEqual(testFastPath(8, 2), 4); | 191 | | - assert.throws(() => testFastPath(1, 0), { | 192 | | - code: 'ERR_INVALID_STATE', | 193 | | - }); | | 186 | + eval('%OptimizeFunctionOnNextCall(testFastPath)'); | | 187 | + assert.strictEqual(testFastPath(8, 2), 4); | | 188 | + assert.throws(() => testFastPath(1, 0), { | | 189 | + code: 'ERR_INVALID_STATE', | | 190 | + }); | 194 | 191 |
| | 192 | + if (common.isDebug) { | | 193 | + const { getV8FastApiCallCount } = internalBinding('debug'); | 195 | 194 | assert.strictEqual(getV8FastApiCallCount('custom_namespace.divide.ok'), 1); | 196 | 195 | assert.strictEqual(getV8FastApiCallCount('custom_namespace.divide.error'), 1); | 197 | 196 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-url-canparse.js +7-5Lines changed: 7 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,9 +19,8 @@ assert.throws(() => { | 19 | 19 | // It should not throw when called without a base string | 20 | 20 | assert.strictEqual(URL.canParse('https://example.org'), true); | 21 | 21 |
| 22 | | -if (common.isDebug) { | 23 | | - const { getV8FastApiCallCount } = internalBinding('debug'); | 24 | | - | | 22 | +{ | | 23 | + // V8 Fast API | 25 | 24 | function testFastPaths() { | 26 | 25 | // `canParse` binding has two overloads. | 27 | 26 | assert.strictEqual(URL.canParse('https://www.example.com/path/?query=param#hash'), true); | @@ -33,6 +32,9 @@ if (common.isDebug) { | 33 | 32 | eval('%OptimizeFunctionOnNextCall(URL.canParse)'); | 34 | 33 | testFastPaths(); | 35 | 34 |
| 36 | | - assert.strictEqual(getV8FastApiCallCount('url.canParse'), 1); | 37 | | - assert.strictEqual(getV8FastApiCallCount('url.canParse.withBase'), 1); | | 35 | + if (common.isDebug) { | | 36 | + const { getV8FastApiCallCount } = internalBinding('debug'); | | 37 | + assert.strictEqual(getV8FastApiCallCount('url.canParse'), 1); | | 38 | + assert.strictEqual(getV8FastApiCallCount('url.canParse.withBase'), 1); | | 39 | + } | 38 | 40 | } |
Collapse file Copy file name to clipboardExpand all lines: test/sequential/test-crypto-timing-safe-equal.js +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -93,10 +93,8 @@ assert.throws( | 93 | 93 | } | 94 | 94 | ); | 95 | 95 |
| 96 | | -if (common.isDebug) { | 97 | | - const { internalBinding } = require('internal/test/binding'); | 98 | | - const { getV8FastApiCallCount } = internalBinding('debug'); | 99 | | - | | 96 | +{ | | 97 | + // V8 Fast API | 100 | 98 | const foo = Buffer.from('foo'); | 101 | 99 | const bar = Buffer.from('bar'); | 102 | 100 | const longer = Buffer.from('longer'); | @@ -111,6 +109,11 @@ if (common.isDebug) { | 111 | 109 | assert.throws(() => testFastPath(foo, longer), { | 112 | 110 | code: 'ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH', | 113 | 111 | }); | 114 | | - assert.strictEqual(getV8FastApiCallCount('crypto.timingSafeEqual.ok'), 2); | 115 | | - assert.strictEqual(getV8FastApiCallCount('crypto.timingSafeEqual.error'), 1); | | 112 | + | | 113 | + if (common.isDebug) { | | 114 | + const { internalBinding } = require('internal/test/binding'); | | 115 | + const { getV8FastApiCallCount } = internalBinding('debug'); | | 116 | + assert.strictEqual(getV8FastApiCallCount('crypto.timingSafeEqual.ok'), 2); | | 117 | + assert.strictEqual(getV8FastApiCallCount('crypto.timingSafeEqual.error'), 1); | | 118 | + } | 116 | 119 | } |
|