File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ // Flags: --expose-internals --no-warnings --allow-natives-syntax
2+ 'use strict' ;
3+
4+ const common = require ( '../common' ) ;
5+ const assert = require ( 'assert' ) ;
6+ const zlib = require ( 'zlib' ) ;
7+
8+ {
9+ function testFastPath ( ) {
10+ const expected = 0xd87f7e0c ; // zlib.crc32('test', 0)
11+ assert . strictEqual ( zlib . crc32 ( 'test' , 0 ) , expected ) ;
12+ return expected ;
13+ }
14+
15+ eval ( '%PrepareFunctionForOptimization(zlib.crc32)' ) ;
16+ testFastPath ( ) ;
17+ eval ( '%OptimizeFunctionOnNextCall(zlib.crc32)' ) ;
18+ testFastPath ( ) ;
19+ testFastPath ( ) ;
20+
21+ if ( common . isDebug ) {
22+ const { internalBinding } = require ( 'internal/test/binding' ) ;
23+ const { getV8FastApiCallCount } = internalBinding ( 'debug' ) ;
24+ assert . strictEqual ( getV8FastApiCallCount ( 'zlib.crc32' ) , 2 ) ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments