harperdb 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -11
- package/bin/BinObjects.jsc +0 -0
- package/bin/harperdb.jsc +0 -0
- package/bin/install.jsc +0 -0
- package/bin/register.jsc +0 -0
- package/bin/run.jsc +0 -0
- package/bin/stop.jsc +0 -0
- package/bin/upgrade.jsc +0 -0
- package/bin/utility.jsc +0 -0
- package/bin/version.jsc +0 -0
- package/coverage/lcov.info +6624 -6141
- package/data_layer/CreateAttributeObject.jsc +0 -0
- package/data_layer/CreateTableObject.jsc +0 -0
- package/data_layer/DataLayerObjects.jsc +0 -0
- package/data_layer/DeleteBeforeObject.jsc +0 -0
- package/data_layer/DeleteObject.jsc +0 -0
- package/data_layer/DropAttributeObject.jsc +0 -0
- package/data_layer/InsertObject.jsc +0 -0
- package/data_layer/ReadTransactionLogObject.jsc +0 -0
- package/data_layer/SQLSearch.jsc +0 -0
- package/data_layer/SearchByConditionsObject.jsc +0 -0
- package/data_layer/SearchByHashObject.jsc +0 -0
- package/data_layer/SearchObject.jsc +0 -0
- package/data_layer/SqlSearchObject.jsc +0 -0
- package/data_layer/UpdateObject.jsc +0 -0
- package/data_layer/UpsertObject.jsc +0 -0
- package/data_layer/bulkLoad.jsc +0 -0
- package/data_layer/data_objects/BulkLoadObjects.jsc +0 -0
- package/data_layer/data_objects/UpsertObject.jsc +0 -0
- package/data_layer/delete.jsc +0 -0
- package/data_layer/export.jsc +0 -0
- package/data_layer/harperBridge/BridgeMethods.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/checkForNewAttr.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/convertOperationToTransaction.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/evaluateTableGetAttributes.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/insertUpdateReturnObj.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/insertUpdateValidate.jsc +0 -0
- package/data_layer/harperBridge/harperBridge.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/LMDBBridge.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/DeleteTransactionsBeforeResults.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecordsBefore.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteTransactionLogsBefore.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadTransactionLog.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/ThreadSearchObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsEnvironment.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbDropAllAttributes.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbThreadSearch.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.jsc +0 -0
- package/data_layer/hdbInfoController.jsc +0 -0
- package/data_layer/insert.jsc +0 -0
- package/data_layer/readTransactionLog.jsc +0 -0
- package/data_layer/schema.jsc +0 -0
- package/data_layer/schemaDescribe.jsc +0 -0
- package/data_layer/search.jsc +0 -0
- package/data_layer/update.jsc +0 -0
- package/events/ClusterStatusEmitter.jsc +0 -0
- package/events/SioServerStoppedEvent.jsc +0 -0
- package/events/SocketClusterStatusEmitter.jsc +0 -0
- package/license/LICENSE +91 -1
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/README.md +1 -0
- package/node_modules/{node-addon-api/src/nothing.c → @msgpackr-extract/msgpackr-extract-linux-x64/index.js} +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.abi93.glibc.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.abi93.musl.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.napi.glibc.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.napi.musl.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/package.json +53 -0
- package/node_modules/{msgpackr-extract → lmdb-store}/.github/workflows/prebuild.yml +9 -10
- package/node_modules/lmdb-store/.idea/lmdb-store.iml +12 -0
- package/node_modules/lmdb-store/.idea/misc.xml +6 -0
- package/node_modules/lmdb-store/.idea/modules.xml +8 -0
- package/node_modules/lmdb-store/.idea/workspace.xml +4 -0
- package/node_modules/lmdb-store/README.md +393 -388
- package/node_modules/lmdb-store/benchmark/index.js +162 -162
- package/node_modules/lmdb-store/binding.gyp +79 -88
- package/node_modules/lmdb-store/caching.js +113 -113
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/COPYRIGHT +20 -20
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/Doxyfile +1631 -1631
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/LICENSE +47 -47
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.c +183 -183
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.h +14 -14
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/crypto.c +121 -121
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/intro.doc +192 -192
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.c +12125 -12125
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_copy.1 +74 -74
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_copy.c +106 -106
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_drop.1 +53 -53
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_drop.c +154 -154
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_dump.1 +94 -94
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_dump.c +333 -333
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_load.1 +97 -97
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_load.c +530 -530
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_stat.1 +83 -83
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_stat.c +276 -276
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.c +452 -452
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.h +208 -208
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/module.c +101 -101
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/module.h +16 -16
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest.c +178 -178
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest2.c +124 -124
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest3.c +133 -133
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest4.c +168 -168
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest5.c +135 -135
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest6.c +141 -141
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_enc.c +190 -190
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_enc2.c +189 -189
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_remap.c +177 -177
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/sample-bdb.txt +73 -73
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/sample-mdb.txt +62 -62
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/tooltag +27 -27
- package/node_modules/lmdb-store/dependencies/lz4/LICENSE +11 -11
- package/node_modules/lmdb-store/dependencies/lz4/lib/README.md +137 -137
- package/node_modules/lmdb-store/dependencies/lz4/lib/dll/example/README.md +69 -69
- package/node_modules/lmdb-store/dependencies/lz4/lib/lz4frame.c +1899 -1899
- package/node_modules/lmdb-store/dependencies/lz4/lib/xxhash.c +1030 -1030
- package/node_modules/lmdb-store/dependencies/lz4/lib/xxhash.h +328 -328
- package/node_modules/lmdb-store/dist/index.cjs +2591 -0
- package/node_modules/lmdb-store/dist/index.cjs.map +1 -0
- package/node_modules/lmdb-store/index.d.ts +323 -323
- package/node_modules/lmdb-store/index.js +1274 -1274
- package/node_modules/lmdb-store/index.mjs +3 -3
- package/node_modules/lmdb-store/package.json +16 -11
- package/node_modules/lmdb-store/prebuilds/darwin-arm64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-arm64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-arm64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-arm64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-arm64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-arm64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi83.musl.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi93.musl.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/src/compression.cpp +181 -181
- package/node_modules/lmdb-store/src/cursor.cpp +407 -407
- package/node_modules/lmdb-store/src/dbi.cpp +354 -354
- package/node_modules/lmdb-store/src/env.cpp +1134 -1134
- package/node_modules/lmdb-store/src/misc.cpp +528 -528
- package/node_modules/lmdb-store/src/node-lmdb.cpp +44 -44
- package/node_modules/lmdb-store/src/node-lmdb.h +965 -965
- package/node_modules/lmdb-store/src/ordered-binary.cpp +337 -337
- package/node_modules/lmdb-store/src/txn.cpp +513 -513
- package/node_modules/lmdb-store/src/v8-fast-api-calls.h +419 -419
- package/node_modules/lmdb-store/src/windows.c +30 -30
- package/node_modules/lmdb-store/test/index.test.js +584 -584
- package/node_modules/lmdb-store/test/node-lmdb.test.js +1525 -1525
- package/node_modules/lmdb-store/test/threads.js +100 -100
- package/node_modules/lmdb-store/util/ArrayLikeIterable.js +136 -136
- package/node_modules/lmdb-store/util/WeakValueMap.js +40 -40
- package/node_modules/lmdb-store/util/upgrade-lmdb.js +46 -46
- package/node_modules/lmdb-store/util/when.js +8 -8
- package/node_modules/microtime/.github/workflows/release.yml +76 -0
- package/node_modules/microtime/.github/workflows/test.yml +46 -0
- package/node_modules/microtime/README.md +0 -2
- package/node_modules/microtime/binding.gyp +28 -10
- package/node_modules/microtime/package.json +25 -20
- package/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm/node.napi.armv7.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/node.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-ia32/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-ia32/node.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/node.napi.node +0 -0
- package/node_modules/msgpackr/dist/index.js +1929 -1917
- package/node_modules/msgpackr/dist/index.min.js +67 -68
- package/node_modules/msgpackr/dist/node.cjs +1994 -1980
- package/node_modules/msgpackr/dist/test.js +683 -1235
- package/node_modules/msgpackr/index.d.ts +23 -12
- package/node_modules/msgpackr/node-index.js +23 -21
- package/node_modules/msgpackr/pack.js +935 -931
- package/node_modules/msgpackr/package.json +24 -12
- package/node_modules/msgpackr/unpack.d.ts +52 -50
- package/node_modules/msgpackr/unpack.js +1061 -1053
- package/node_modules/msgpackr-extract/bin/download-prebuilds.js +11 -0
- package/node_modules/msgpackr-extract/binding.gyp +22 -5
- package/node_modules/msgpackr-extract/index.js +1 -1
- package/node_modules/msgpackr-extract/package.json +46 -21
- package/node_modules/msgpackr-extract/src/.vs/ProjectSettings.json +3 -0
- package/node_modules/msgpackr-extract/src/.vs/VSWorkspaceState.json +7 -0
- package/node_modules/msgpackr-extract/src/.vs/slnx.sqlite +0 -0
- package/node_modules/msgpackr-extract/src/.vs/src/v16/.suo +0 -0
- package/node_modules/msgpackr-extract/src/.vs/src/v16/Browse.VC.db +0 -0
- package/node_modules/msgpackr-extract/{prebuilds/darwin-x64/node.abi72.node → src/.vs/src/v16/Browse.VC.db-shm} +0 -0
- package/node_modules/msgpackr-extract/src/.vs/src/v16/Browse.VC.db-wal +0 -0
- package/node_modules/msgpackr-extract/src/extract.cpp +272 -269
- package/node_modules/nan/package.json +0 -1
- package/node_modules/node-addon-api/README.md +146 -53
- package/node_modules/node-addon-api/common.gypi +21 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +7 -41
- package/node_modules/node-addon-api/napi-inl.deprecated.h +8 -8
- package/node_modules/node-addon-api/napi-inl.h +2795 -633
- package/node_modules/node-addon-api/napi.h +1547 -597
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +203 -13
- package/node_modules/node-addon-api/tools/README.md +12 -6
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +4 -8
- package/node_modules/node-addon-api/tools/eslint-format.js +71 -0
- package/node_modules/node-gyp-build/README.md +17 -14
- package/node_modules/node-gyp-build/bin.js +28 -15
- package/node_modules/node-gyp-build/index.js +145 -34
- package/node_modules/node-gyp-build/package.json +18 -15
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/LICENSE +0 -0
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/README.md +0 -0
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/bin.js +1 -1
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/build-test.js +0 -0
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/index.js +17 -11
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/optional.js +0 -0
- package/node_modules/{msgpackr-extract/node_modules/node-gyp-build → node-gyp-build-optional-packages}/package.json +17 -17
- package/package.json +12 -11
- package/security/JWTObjects.jsc +0 -0
- package/security/auth.jsc +0 -0
- package/security/cryptoHash.jsc +0 -0
- package/security/data_objects/PermissionAttributeResponseObject.jsc +0 -0
- package/security/data_objects/PermissionResponseObject.jsc +0 -0
- package/security/data_objects/PermissionTableResponseObject.jsc +0 -0
- package/security/permissionsTranslator.jsc +0 -0
- package/security/role.jsc +0 -0
- package/security/tokenAuthentication.jsc +0 -0
- package/security/user.jsc +0 -0
- package/server/ClusteringOriginObject.jsc +0 -0
- package/server/JobObject.jsc +0 -0
- package/server/clustering/ClusterStatusObject.jsc +0 -0
- package/server/clustering/NodeObject.jsc +0 -0
- package/server/clustering/clusterUtilities.jsc +0 -0
- package/server/configuration.jsc +0 -0
- package/server/customFunctions/customFunctionsServer.jsc +0 -0
- package/server/customFunctions/helpers/getCORSOptions.jsc +0 -0
- package/server/customFunctions/helpers/getHeaderTimeoutConfig.jsc +0 -0
- package/server/customFunctions/helpers/getServerOptions.jsc +0 -0
- package/server/customFunctions/operations.jsc +0 -0
- package/server/customFunctions/operationsValidation.jsc +0 -0
- package/server/harperdb/hdbServer.jsc +0 -0
- package/server/ipc/IPCClient.jsc +0 -0
- package/server/ipc/hdbIpcServer.jsc +0 -0
- package/server/ipc/serverHandlers.jsc +0 -0
- package/server/ipc/utility/IPCEventObject.jsc +0 -0
- package/server/ipc/utility/ipcUtils.jsc +0 -0
- package/server/jobRunner.jsc +0 -0
- package/server/jobThread.jsc +0 -0
- package/server/jobs.jsc +0 -0
- package/server/serverHelpers/OperationFunctionObject.jsc +0 -0
- package/server/serverHelpers/requestTimePlugin.jsc +0 -0
- package/server/serverHelpers/serverHandlers.jsc +0 -0
- package/server/serverHelpers/serverUtilities.jsc +0 -0
- package/server/socketcluster/Server.jsc +0 -0
- package/server/socketcluster/broker.jsc +0 -0
- package/server/socketcluster/connector/HDBSocketConnector.jsc +0 -0
- package/server/socketcluster/connector/InterNodeSocketConnector.jsc +0 -0
- package/server/socketcluster/connector/SocketConnector.jsc +0 -0
- package/server/socketcluster/connector/spawnSCConnection.jsc +0 -0
- package/server/socketcluster/decisionMatrix/CoreDecisionMatrix.jsc +0 -0
- package/server/socketcluster/decisionMatrix/DecisionMatrixIF.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/AssignToHdbChildWorkerRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/CallRoomMsgHandlerRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/CleanDataObjectRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/CommandCollection.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/DummyRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/RulesIF.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/StripHdbHeaderRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/TestRule.jsc +0 -0
- package/server/socketcluster/handlers/NodeConnectionsHandler.jsc +0 -0
- package/server/socketcluster/handlers/SCServer.jsc +0 -0
- package/server/socketcluster/handlers/ServerSocket.jsc +0 -0
- package/server/socketcluster/interNodeConnectionLauncher.jsc +0 -0
- package/server/socketcluster/messageQueue/MessageQueueIF.jsc +0 -0
- package/server/socketcluster/middleware/AuthMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/ConnectionNameCheckMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/GenericMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/MessagePrepMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/MiddlewareFactory.jsc +0 -0
- package/server/socketcluster/middleware/MiddlewareIF.jsc +0 -0
- package/server/socketcluster/middleware/OriginatorCheckMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/RequestDataValidMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/StampOriginatorMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/StampRequestMiddleware.jsc +0 -0
- package/server/socketcluster/observer/EventableIF.jsc +0 -0
- package/server/socketcluster/room/AddUserRoom.jsc +0 -0
- package/server/socketcluster/room/AlterUserRoom.jsc +0 -0
- package/server/socketcluster/room/CoreRoom.jsc +0 -0
- package/server/socketcluster/room/CreateAttributeRoom.jsc +0 -0
- package/server/socketcluster/room/CreateSchemaRoom.jsc +0 -0
- package/server/socketcluster/room/CreateTableRoom.jsc +0 -0
- package/server/socketcluster/room/DropUserRoom.jsc +0 -0
- package/server/socketcluster/room/HDBNodeRoom.jsc +0 -0
- package/server/socketcluster/room/RoomIF.jsc +0 -0
- package/server/socketcluster/room/RoomMessageObjects.jsc +0 -0
- package/server/socketcluster/room/UsersRoom.jsc +0 -0
- package/server/socketcluster/room/WatchHDBWorkersRoom.jsc +0 -0
- package/server/socketcluster/room/WorkerRoom.jsc +0 -0
- package/server/socketcluster/room/roomFactory.jsc +0 -0
- package/server/socketcluster/socketClusterObjects.jsc +0 -0
- package/server/socketcluster/types.jsc +0 -0
- package/server/socketcluster/util/clusterData.jsc +0 -0
- package/server/socketcluster/util/socketClusterUtils.jsc +0 -0
- package/server/socketcluster/worker/ClusterWorker.jsc +0 -0
- package/server/socketcluster/worker/WorkerIF.jsc +0 -0
- package/server/socketcluster/worker/WorkerObjects.jsc +0 -0
- package/server/transactToClusteringUtilities.jsc +0 -0
- package/sqlTranslator/SelectValidator.jsc +0 -0
- package/sqlTranslator/alasqlFunctionImporter.jsc +0 -0
- package/sqlTranslator/conditionPatterns.jsc +0 -0
- package/sqlTranslator/deleteTranslator.jsc +0 -0
- package/sqlTranslator/index.jsc +0 -0
- package/sqlTranslator/sql_statement_bucket.jsc +0 -0
- package/upgrade/EnvironmentVariable.jsc +0 -0
- package/upgrade/UpgradeDirective.jsc +0 -0
- package/upgrade/UpgradeObjects.jsc +0 -0
- package/upgrade/directives/3-0-0.jsc +0 -0
- package/upgrade/directives/3-1-0.jsc +0 -0
- package/upgrade/directives/directivesController.jsc +0 -0
- package/upgrade/directives/upgrade_scripts/3_0_0_reindex_script.jsc +0 -0
- package/upgrade/directivesManager.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/DBIDefinition.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/OpenDBIObject.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/OpenEnvironmentObject.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/commonErrors.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/commonUtility.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/environmentUtility.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/terms.jsc +0 -0
- package/upgrade/upgradePrompt.jsc +0 -0
- package/upgrade/upgradeUtilities.jsc +0 -0
- package/utility/AWS/AWSConnector.jsc +0 -0
- package/utility/OperationFunctionCaller.jsc +0 -0
- package/utility/common_utils.jsc +0 -0
- package/utility/environment/SystemInformationObject.jsc +0 -0
- package/utility/environment/SystemInformationOperation.jsc +0 -0
- package/utility/environment/environmentManager.jsc +0 -0
- package/utility/environment/systemInformation.jsc +0 -0
- package/utility/errors/commonErrors.jsc +0 -0
- package/utility/errors/hdbError.jsc +0 -0
- package/utility/functions/date/dateFunctions.jsc +0 -0
- package/utility/functions/geo.jsc +0 -0
- package/utility/functions/math/avg.jsc +0 -0
- package/utility/functions/math/count.jsc +0 -0
- package/utility/functions/sql/alaSQLExtension.jsc +0 -0
- package/utility/functions/string/compare.jsc +0 -0
- package/utility/globalSchema.jsc +0 -0
- package/utility/hdbTerms.jsc +0 -0
- package/utility/install/checkJWTTokensExist.jsc +0 -0
- package/utility/install/installer.jsc +0 -0
- package/utility/install_user_permission.jsc +0 -0
- package/utility/lmdb/DBIDefinition.jsc +0 -0
- package/utility/lmdb/DeleteRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/InsertRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/OpenDBIObject.jsc +0 -0
- package/utility/lmdb/OpenEnvironmentObject.jsc +0 -0
- package/utility/lmdb/UpdateRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/UpsertRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/cleanLMDBMap.jsc +0 -0
- package/utility/lmdb/commonUtility.jsc +0 -0
- package/utility/lmdb/deleteUtility.jsc +0 -0
- package/utility/lmdb/environmentUtility.jsc +0 -0
- package/utility/lmdb/searchCursorFunctions.jsc +0 -0
- package/utility/lmdb/searchUtility.jsc +0 -0
- package/utility/lmdb/terms.jsc +0 -0
- package/utility/lmdb/writeUtility.jsc +0 -0
- package/utility/logging/harper_logger.jsc +0 -0
- package/utility/mount_hdb.jsc +0 -0
- package/utility/npmUtilities.jsc +0 -0
- package/utility/operation_authorization.jsc +0 -0
- package/utility/password.jsc +0 -0
- package/utility/pm2/servicesConfig.jsc +0 -0
- package/utility/pm2/utilityFunctions.jsc +0 -0
- package/utility/psList.jsc +0 -0
- package/utility/registration/hdb_license.jsc +0 -0
- package/utility/registration/licenseObjects.jsc +0 -0
- package/utility/registration/registrationHandler.jsc +0 -0
- package/utility/scripts/restartHdb.jsc +0 -0
- package/utility/signalling.jsc +0 -0
- package/utility/system_info.jsc +0 -0
- package/validation/bulkDeleteValidator.jsc +0 -0
- package/validation/check_permissions.jsc +0 -0
- package/validation/clustering/configureValidator.jsc +0 -0
- package/validation/common_validators.jsc +0 -0
- package/validation/conditionalDeleteValidator.jsc +0 -0
- package/validation/deleteValidator.jsc +0 -0
- package/validation/fileLoadValidator.jsc +0 -0
- package/validation/insertValidator.jsc +0 -0
- package/validation/nodeSubscriptionValidator.jsc +0 -0
- package/validation/nodeValidator.jsc +0 -0
- package/validation/readLogValidator.jsc +0 -0
- package/validation/registration/license_key_object.jsc +0 -0
- package/validation/role_validation.jsc +0 -0
- package/validation/schemaMetadataValidator.jsc +0 -0
- package/validation/schema_validator.jsc +0 -0
- package/validation/searchValidator.jsc +0 -0
- package/validation/user_validation.jsc +0 -0
- package/validation/validationWrapper.jsc +0 -0
- package/node_modules/lmdb-store/build/Makefile +0 -324
- package/node_modules/lmdb-store/build/Release/.deps/Release/lmdb-store.node.d +0 -1
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.o.d +0 -6
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.o.d +0 -8
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.o.d +0 -8
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lz4/lib/lz4.o.d +0 -5
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/compression.o.d +0 -72
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/cursor.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/dbi.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/env.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/misc.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/node-lmdb.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/ordered-binary.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/txn.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/windows.o.d +0 -3
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store.node.d +0 -1
- package/node_modules/lmdb-store/build/Release/lmdb-store.node +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lz4/lib/lz4.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/compression.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/cursor.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/dbi.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/env.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/misc.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/node-lmdb.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/ordered-binary.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/txn.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/windows.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store.node +0 -0
- package/node_modules/lmdb-store/build/binding.Makefile +0 -6
- package/node_modules/lmdb-store/build/config.gypi +0 -426
- package/node_modules/lmdb-store/build/lmdb-store.target.mk +0 -206
- package/node_modules/lmdb-store/node_modules/node-gyp-build/package.json +0 -60
- package/node_modules/lmdb-store/prebuilds/darwin-x64/electron.abi87.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi72.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi88.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/electron.abi87.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi72.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi88.node +0 -0
- package/node_modules/microtime/prebuilds/darwin-x64/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/darwin-x64/node-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm/node-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/node-napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/node-napi.node +0 -0
- package/node_modules/msgpackr-extract/.circleci/config.yml +0 -19
- package/node_modules/msgpackr-extract/.travis.yml +0 -30
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/LICENSE +0 -21
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/README.md +0 -58
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/bin.js +0 -77
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/build-test.js +0 -19
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/index.js +0 -202
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/optional.js +0 -7
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi88.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi102.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi72.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi72.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi83.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi88.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi93.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi72.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi88.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi93.node +0 -0
- package/node_modules/node-addon-api/.editorconfig +0 -8
- package/node_modules/node-addon-api/.travis.yml +0 -65
- package/node_modules/node-addon-api/CHANGELOG.md +0 -325
- package/node_modules/node-addon-api/CODE_OF_CONDUCT.md +0 -4
- package/node_modules/node-addon-api/CONTRIBUTING.md +0 -66
- package/node_modules/node-addon-api/appveyor.yml +0 -48
- package/node_modules/node-addon-api/doc/Doxyfile +0 -2450
- package/node_modules/node-addon-api/doc/array_buffer.md +0 -129
- package/node_modules/node-addon-api/doc/async_context.md +0 -76
- package/node_modules/node-addon-api/doc/async_operations.md +0 -31
- package/node_modules/node-addon-api/doc/async_worker.md +0 -397
- package/node_modules/node-addon-api/doc/basic_types.md +0 -415
- package/node_modules/node-addon-api/doc/bigint.md +0 -92
- package/node_modules/node-addon-api/doc/boolean.md +0 -64
- package/node_modules/node-addon-api/doc/buffer.md +0 -140
- package/node_modules/node-addon-api/doc/callback_scope.md +0 -54
- package/node_modules/node-addon-api/doc/callbackinfo.md +0 -97
- package/node_modules/node-addon-api/doc/checker-tool.md +0 -32
- package/node_modules/node-addon-api/doc/class_property_descriptor.md +0 -118
- package/node_modules/node-addon-api/doc/cmake-js.md +0 -19
- package/node_modules/node-addon-api/doc/conversion-tool.md +0 -28
- package/node_modules/node-addon-api/doc/creating_a_release.md +0 -62
- package/node_modules/node-addon-api/doc/dataview.md +0 -244
- package/node_modules/node-addon-api/doc/env.md +0 -63
- package/node_modules/node-addon-api/doc/error.md +0 -115
- package/node_modules/node-addon-api/doc/error_handling.md +0 -186
- package/node_modules/node-addon-api/doc/escapable_handle_scope.md +0 -82
- package/node_modules/node-addon-api/doc/external.md +0 -59
- package/node_modules/node-addon-api/doc/function.md +0 -294
- package/node_modules/node-addon-api/doc/function_reference.md +0 -238
- package/node_modules/node-addon-api/doc/generator.md +0 -13
- package/node_modules/node-addon-api/doc/handle_scope.md +0 -65
- package/node_modules/node-addon-api/doc/memory_management.md +0 -27
- package/node_modules/node-addon-api/doc/node-gyp.md +0 -82
- package/node_modules/node-addon-api/doc/number.md +0 -163
- package/node_modules/node-addon-api/doc/object.md +0 -202
- package/node_modules/node-addon-api/doc/object_lifetime_management.md +0 -83
- package/node_modules/node-addon-api/doc/object_reference.md +0 -117
- package/node_modules/node-addon-api/doc/object_wrap.md +0 -546
- package/node_modules/node-addon-api/doc/prebuild_tools.md +0 -16
- package/node_modules/node-addon-api/doc/promises.md +0 -74
- package/node_modules/node-addon-api/doc/property_descriptor.md +0 -231
- package/node_modules/node-addon-api/doc/range_error.md +0 -59
- package/node_modules/node-addon-api/doc/reference.md +0 -111
- package/node_modules/node-addon-api/doc/setup.md +0 -82
- package/node_modules/node-addon-api/doc/string.md +0 -89
- package/node_modules/node-addon-api/doc/symbol.md +0 -44
- package/node_modules/node-addon-api/doc/threadsafe_function.md +0 -303
- package/node_modules/node-addon-api/doc/type_error.md +0 -59
- package/node_modules/node-addon-api/doc/typed_array.md +0 -74
- package/node_modules/node-addon-api/doc/typed_array_of.md +0 -133
- package/node_modules/node-addon-api/doc/value.md +0 -269
- package/node_modules/node-addon-api/doc/version_management.md +0 -43
- package/node_modules/node-addon-api/doc/working_with_javascript_values.md +0 -14
- package/node_modules/node-addon-api/external-napi/node_api.h +0 -7
- package/node_modules/node-addon-api/src/node_api.cc +0 -3655
- package/node_modules/node-addon-api/src/node_api.gyp +0 -21
- package/node_modules/node-addon-api/src/node_api.h +0 -588
- package/node_modules/node-addon-api/src/node_api_types.h +0 -115
- package/node_modules/node-addon-api/src/node_internals.cc +0 -142
- package/node_modules/node-addon-api/src/node_internals.h +0 -157
- package/node_modules/node-addon-api/src/util-inl.h +0 -38
- package/node_modules/node-addon-api/src/util.h +0 -7
|
@@ -1,419 +1,419 @@
|
|
|
1
|
-
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This file provides additional API on top of the default one for making
|
|
7
|
-
* API calls, which come from embedder C++ functions. The functions are being
|
|
8
|
-
* called directly from optimized code, doing all the necessary typechecks
|
|
9
|
-
* in the compiler itself, instead of on the embedder side. Hence the "fast"
|
|
10
|
-
* in the name. Example usage might look like:
|
|
11
|
-
*
|
|
12
|
-
* \code
|
|
13
|
-
* void FastMethod(int param, bool another_param);
|
|
14
|
-
*
|
|
15
|
-
* v8::FunctionTemplate::New(isolate, SlowCallback, data,
|
|
16
|
-
* signature, length, constructor_behavior
|
|
17
|
-
* side_effect_type,
|
|
18
|
-
* &v8::CFunction::Make(FastMethod));
|
|
19
|
-
* \endcode
|
|
20
|
-
*
|
|
21
|
-
* By design, fast calls are limited by the following requirements, which
|
|
22
|
-
* the embedder should enforce themselves:
|
|
23
|
-
* - they should not allocate on the JS heap;
|
|
24
|
-
* - they should not trigger JS execution.
|
|
25
|
-
* To enforce them, the embedder could use the existing
|
|
26
|
-
* v8::Isolate::DisallowJavascriptExecutionScope and a utility similar to
|
|
27
|
-
* Blink's NoAllocationScope:
|
|
28
|
-
* https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/heap/thread_state_scopes.h;l=16
|
|
29
|
-
*
|
|
30
|
-
* Due to these limitations, it's not directly possible to report errors by
|
|
31
|
-
* throwing a JS exception or to otherwise do an allocation. There is an
|
|
32
|
-
* alternative way of creating fast calls that supports falling back to the
|
|
33
|
-
* slow call and then performing the necessary allocation. When one creates
|
|
34
|
-
* the fast method by using CFunction::MakeWithFallbackSupport instead of
|
|
35
|
-
* CFunction::Make, the fast callback gets as last parameter an output variable,
|
|
36
|
-
* through which it can request falling back to the slow call. So one might
|
|
37
|
-
* declare their method like:
|
|
38
|
-
*
|
|
39
|
-
* \code
|
|
40
|
-
* void FastMethodWithFallback(int param, FastApiCallbackOptions& options);
|
|
41
|
-
* \endcode
|
|
42
|
-
*
|
|
43
|
-
* If the callback wants to signal an error condition or to perform an
|
|
44
|
-
* allocation, it must set options.fallback to true and do an early return from
|
|
45
|
-
* the fast method. Then V8 checks the value of options.fallback and if it's
|
|
46
|
-
* true, falls back to executing the SlowCallback, which is capable of reporting
|
|
47
|
-
* the error (either by throwing a JS exception or logging to the console) or
|
|
48
|
-
* doing the allocation. It's the embedder's responsibility to ensure that the
|
|
49
|
-
* fast callback is idempotent up to the point where error and fallback
|
|
50
|
-
* conditions are checked, because otherwise executing the slow callback might
|
|
51
|
-
* produce visible side-effects twice.
|
|
52
|
-
*
|
|
53
|
-
* An example for custom embedder type support might employ a way to wrap/
|
|
54
|
-
* unwrap various C++ types in JSObject instances, e.g:
|
|
55
|
-
*
|
|
56
|
-
* \code
|
|
57
|
-
*
|
|
58
|
-
* // Helper method with a check for field count.
|
|
59
|
-
* template <typename T, int offset>
|
|
60
|
-
* inline T* GetInternalField(v8::Local<v8::Object> wrapper) {
|
|
61
|
-
* assert(offset < wrapper->InternalFieldCount());
|
|
62
|
-
* return reinterpret_cast<T*>(
|
|
63
|
-
* wrapper->GetAlignedPointerFromInternalField(offset));
|
|
64
|
-
* }
|
|
65
|
-
*
|
|
66
|
-
* class CustomEmbedderType {
|
|
67
|
-
* public:
|
|
68
|
-
* // Returns the raw C object from a wrapper JS object.
|
|
69
|
-
* static CustomEmbedderType* Unwrap(v8::Local<v8::Object> wrapper) {
|
|
70
|
-
* return GetInternalField<CustomEmbedderType,
|
|
71
|
-
* kV8EmbedderWrapperObjectIndex>(wrapper);
|
|
72
|
-
* }
|
|
73
|
-
* static void FastMethod(v8::ApiObject receiver_obj, int param) {
|
|
74
|
-
* v8::Object* v8_object = reinterpret_cast<v8::Object*>(&api_object);
|
|
75
|
-
* CustomEmbedderType* receiver = static_cast<CustomEmbedderType*>(
|
|
76
|
-
* receiver_obj->GetAlignedPointerFromInternalField(
|
|
77
|
-
* kV8EmbedderWrapperObjectIndex));
|
|
78
|
-
*
|
|
79
|
-
* // Type checks are already done by the optimized code.
|
|
80
|
-
* // Then call some performance-critical method like:
|
|
81
|
-
* // receiver->Method(param);
|
|
82
|
-
* }
|
|
83
|
-
*
|
|
84
|
-
* static void SlowMethod(
|
|
85
|
-
* const v8::FunctionCallbackInfo<v8::Value>& info) {
|
|
86
|
-
* v8::Local<v8::Object> instance =
|
|
87
|
-
* v8::Local<v8::Object>::Cast(info.Holder());
|
|
88
|
-
* CustomEmbedderType* receiver = Unwrap(instance);
|
|
89
|
-
* // TODO: Do type checks and extract {param}.
|
|
90
|
-
* receiver->Method(param);
|
|
91
|
-
* }
|
|
92
|
-
* };
|
|
93
|
-
*
|
|
94
|
-
* // TODO(mslekova): Clean-up these constants
|
|
95
|
-
* // The constants kV8EmbedderWrapperTypeIndex and
|
|
96
|
-
* // kV8EmbedderWrapperObjectIndex describe the offsets for the type info
|
|
97
|
-
* // struct and the native object, when expressed as internal field indices
|
|
98
|
-
* // within a JSObject. The existance of this helper function assumes that
|
|
99
|
-
* // all embedder objects have their JSObject-side type info at the same
|
|
100
|
-
* // offset, but this is not a limitation of the API itself. For a detailed
|
|
101
|
-
* // use case, see the third example.
|
|
102
|
-
* static constexpr int kV8EmbedderWrapperTypeIndex = 0;
|
|
103
|
-
* static constexpr int kV8EmbedderWrapperObjectIndex = 1;
|
|
104
|
-
*
|
|
105
|
-
* // The following setup function can be templatized based on
|
|
106
|
-
* // the {embedder_object} argument.
|
|
107
|
-
* void SetupCustomEmbedderObject(v8::Isolate* isolate,
|
|
108
|
-
* v8::Local<v8::Context> context,
|
|
109
|
-
* CustomEmbedderType* embedder_object) {
|
|
110
|
-
* isolate->set_embedder_wrapper_type_index(
|
|
111
|
-
* kV8EmbedderWrapperTypeIndex);
|
|
112
|
-
* isolate->set_embedder_wrapper_object_index(
|
|
113
|
-
* kV8EmbedderWrapperObjectIndex);
|
|
114
|
-
*
|
|
115
|
-
* v8::CFunction c_func =
|
|
116
|
-
* MakeV8CFunction(CustomEmbedderType::FastMethod);
|
|
117
|
-
*
|
|
118
|
-
* Local<v8::FunctionTemplate> method_template =
|
|
119
|
-
* v8::FunctionTemplate::New(
|
|
120
|
-
* isolate, CustomEmbedderType::SlowMethod, v8::Local<v8::Value>(),
|
|
121
|
-
* v8::Local<v8::Signature>(), 1, v8::ConstructorBehavior::kAllow,
|
|
122
|
-
* v8::SideEffectType::kHasSideEffect, &c_func);
|
|
123
|
-
*
|
|
124
|
-
* v8::Local<v8::ObjectTemplate> object_template =
|
|
125
|
-
* v8::ObjectTemplate::New(isolate);
|
|
126
|
-
* object_template->SetInternalFieldCount(
|
|
127
|
-
* kV8EmbedderWrapperObjectIndex + 1);
|
|
128
|
-
* object_template->Set(isolate, "method", method_template);
|
|
129
|
-
*
|
|
130
|
-
* // Instantiate the wrapper JS object.
|
|
131
|
-
* v8::Local<v8::Object> object =
|
|
132
|
-
* object_template->NewInstance(context).ToLocalChecked();
|
|
133
|
-
* object->SetAlignedPointerInInternalField(
|
|
134
|
-
* kV8EmbedderWrapperObjectIndex,
|
|
135
|
-
* reinterpret_cast<void*>(embedder_object));
|
|
136
|
-
*
|
|
137
|
-
* // TODO: Expose {object} where it's necessary.
|
|
138
|
-
* }
|
|
139
|
-
* \endcode
|
|
140
|
-
*
|
|
141
|
-
* For instance if {object} is exposed via a global "obj" variable,
|
|
142
|
-
* one could write in JS:
|
|
143
|
-
* function hot_func() {
|
|
144
|
-
* obj.method(42);
|
|
145
|
-
* }
|
|
146
|
-
* and once {hot_func} gets optimized, CustomEmbedderType::FastMethod
|
|
147
|
-
* will be called instead of the slow version, with the following arguments:
|
|
148
|
-
* receiver := the {embedder_object} from above
|
|
149
|
-
* param := 42
|
|
150
|
-
*
|
|
151
|
-
* Currently supported return types:
|
|
152
|
-
* - void
|
|
153
|
-
* - bool
|
|
154
|
-
* - int32_t
|
|
155
|
-
* - uint32_t
|
|
156
|
-
* - float32_t
|
|
157
|
-
* - float64_t
|
|
158
|
-
* Currently supported argument types:
|
|
159
|
-
* - pointer to an embedder type
|
|
160
|
-
* - bool
|
|
161
|
-
* - int32_t
|
|
162
|
-
* - uint32_t
|
|
163
|
-
* - int64_t
|
|
164
|
-
* - uint64_t
|
|
165
|
-
* - float32_t
|
|
166
|
-
* - float64_t
|
|
167
|
-
*
|
|
168
|
-
* The 64-bit integer types currently have the IDL (unsigned) long long
|
|
169
|
-
* semantics: https://heycam.github.io/webidl/#abstract-opdef-converttoint
|
|
170
|
-
* In the future we'll extend the API to also provide conversions from/to
|
|
171
|
-
* BigInt to preserve full precision.
|
|
172
|
-
* The floating point types currently have the IDL (unrestricted) semantics,
|
|
173
|
-
* which is the only one used by WebGL. We plan to add support also for
|
|
174
|
-
* restricted floats/doubles, similarly to the BigInt conversion policies.
|
|
175
|
-
* We also differ from the specific NaN bit pattern that WebIDL prescribes
|
|
176
|
-
* (https://heycam.github.io/webidl/#es-unrestricted-float) in that Blink
|
|
177
|
-
* passes NaN values as-is, i.e. doesn't normalize them.
|
|
178
|
-
*
|
|
179
|
-
* To be supported types:
|
|
180
|
-
* - arrays of C types
|
|
181
|
-
* - arrays of embedder types
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
|
-
#ifndef INCLUDE_V8_FAST_API_CALLS_H_
|
|
185
|
-
#define INCLUDE_V8_FAST_API_CALLS_H_
|
|
186
|
-
|
|
187
|
-
#include <stddef.h>
|
|
188
|
-
#include <stdint.h>
|
|
189
|
-
|
|
190
|
-
#include "v8config.h" // NOLINT(build/include_directory)
|
|
191
|
-
|
|
192
|
-
namespace v8 {
|
|
193
|
-
|
|
194
|
-
class CTypeInfo {
|
|
195
|
-
public:
|
|
196
|
-
enum class Type : uint8_t {
|
|
197
|
-
kVoid,
|
|
198
|
-
kBool,
|
|
199
|
-
kInt32,
|
|
200
|
-
kUint32,
|
|
201
|
-
kInt64,
|
|
202
|
-
kUint64,
|
|
203
|
-
kFloat32,
|
|
204
|
-
kFloat64,
|
|
205
|
-
kV8Value,
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
// kCallbackOptionsType and kInvalidType are not part of the Type enum
|
|
209
|
-
// because they are only used internally. Use values 255 and 254 that
|
|
210
|
-
// are larger than any valid Type enum.
|
|
211
|
-
static constexpr Type kCallbackOptionsType = Type(255);
|
|
212
|
-
static constexpr Type kInvalidType = Type(254);
|
|
213
|
-
|
|
214
|
-
enum class ArgFlags : uint8_t {
|
|
215
|
-
kNone = 0,
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
explicit constexpr CTypeInfo(Type type, ArgFlags flags = ArgFlags::kNone)
|
|
219
|
-
: type_(type), flags_(flags) {}
|
|
220
|
-
|
|
221
|
-
constexpr Type GetType() const { return type_; }
|
|
222
|
-
|
|
223
|
-
constexpr ArgFlags GetFlags() const { return flags_; }
|
|
224
|
-
|
|
225
|
-
static const CTypeInfo& Invalid() {
|
|
226
|
-
static CTypeInfo invalid = CTypeInfo(kInvalidType);
|
|
227
|
-
return invalid;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
private:
|
|
231
|
-
Type type_;
|
|
232
|
-
ArgFlags flags_;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
class CFunctionInfo {
|
|
236
|
-
public:
|
|
237
|
-
virtual const CTypeInfo& ReturnInfo() const = 0;
|
|
238
|
-
virtual unsigned int ArgumentCount() const = 0;
|
|
239
|
-
virtual const CTypeInfo& ArgumentInfo(unsigned int index) const = 0;
|
|
240
|
-
virtual bool HasOptions() const = 0;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
struct ApiObject {
|
|
244
|
-
uintptr_t address;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* A struct which may be passed to a fast call callback, like so:
|
|
249
|
-
* \code
|
|
250
|
-
* void FastMethodWithOptions(int param, FastApiCallbackOptions& options);
|
|
251
|
-
* \endcode
|
|
252
|
-
*/
|
|
253
|
-
struct FastApiCallbackOptions {
|
|
254
|
-
/**
|
|
255
|
-
* If the callback wants to signal an error condition or to perform an
|
|
256
|
-
* allocation, it must set options.fallback to true and do an early return
|
|
257
|
-
* from the fast method. Then V8 checks the value of options.fallback and if
|
|
258
|
-
* it's true, falls back to executing the SlowCallback, which is capable of
|
|
259
|
-
* reporting the error (either by throwing a JS exception or logging to the
|
|
260
|
-
* console) or doing the allocation. It's the embedder's responsibility to
|
|
261
|
-
* ensure that the fast callback is idempotent up to the point where error and
|
|
262
|
-
* fallback conditions are checked, because otherwise executing the slow
|
|
263
|
-
* callback might produce visible side-effects twice.
|
|
264
|
-
*/
|
|
265
|
-
bool fallback;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* The `data` passed to the FunctionTemplate constructor, or `undefined`.
|
|
269
|
-
*/
|
|
270
|
-
const ApiObject data;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
namespace internal {
|
|
274
|
-
|
|
275
|
-
template <typename T>
|
|
276
|
-
struct GetCType;
|
|
277
|
-
|
|
278
|
-
#define SPECIALIZE_GET_C_TYPE_FOR(ctype, ctypeinfo) \
|
|
279
|
-
template <> \
|
|
280
|
-
struct GetCType<ctype> { \
|
|
281
|
-
static constexpr CTypeInfo Get() { \
|
|
282
|
-
return CTypeInfo(CTypeInfo::Type::ctypeinfo); \
|
|
283
|
-
} \
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
#define SUPPORTED_C_TYPES(V) \
|
|
287
|
-
V(void, kVoid) \
|
|
288
|
-
V(bool, kBool) \
|
|
289
|
-
V(int32_t, kInt32) \
|
|
290
|
-
V(uint32_t, kUint32) \
|
|
291
|
-
V(int64_t, kInt64) \
|
|
292
|
-
V(uint64_t, kUint64) \
|
|
293
|
-
V(float, kFloat32) \
|
|
294
|
-
V(double, kFloat64) \
|
|
295
|
-
V(ApiObject, kV8Value)
|
|
296
|
-
|
|
297
|
-
SUPPORTED_C_TYPES(SPECIALIZE_GET_C_TYPE_FOR)
|
|
298
|
-
|
|
299
|
-
template <>
|
|
300
|
-
struct GetCType<FastApiCallbackOptions&> {
|
|
301
|
-
static constexpr CTypeInfo Get() {
|
|
302
|
-
return CTypeInfo(CTypeInfo::kCallbackOptionsType);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
// Helper to count the number of occurances of `T` in `List`
|
|
307
|
-
template <typename T, typename... List>
|
|
308
|
-
struct count : std::integral_constant<int, 0> {};
|
|
309
|
-
template <typename T, typename... Args>
|
|
310
|
-
struct count<T, T, Args...>
|
|
311
|
-
: std::integral_constant<std::size_t, 1 + count<T, Args...>::value> {};
|
|
312
|
-
template <typename T, typename U, typename... Args>
|
|
313
|
-
struct count<T, U, Args...> : count<T, Args...> {};
|
|
314
|
-
|
|
315
|
-
template <typename R, typename... Args>
|
|
316
|
-
class CFunctionInfoImpl : public CFunctionInfo {
|
|
317
|
-
public:
|
|
318
|
-
static constexpr int kOptionsArgCount =
|
|
319
|
-
count<FastApiCallbackOptions&, Args...>();
|
|
320
|
-
static constexpr int kReceiverCount = 1;
|
|
321
|
-
CFunctionInfoImpl()
|
|
322
|
-
: return_info_(internal::GetCType<R>::Get()),
|
|
323
|
-
arg_count_(sizeof...(Args) - kOptionsArgCount),
|
|
324
|
-
arg_info_{internal::GetCType<Args>::Get()...} {
|
|
325
|
-
static_assert(kOptionsArgCount == 0 || kOptionsArgCount == 1,
|
|
326
|
-
"Only one options parameter is supported.");
|
|
327
|
-
static_assert(sizeof...(Args) >= kOptionsArgCount + kReceiverCount,
|
|
328
|
-
"The receiver or the fallback argument is missing.");
|
|
329
|
-
constexpr CTypeInfo::Type type = internal::GetCType<R>::Get().GetType();
|
|
330
|
-
static_assert(type == CTypeInfo::Type::kVoid ||
|
|
331
|
-
type == CTypeInfo::Type::kBool ||
|
|
332
|
-
type == CTypeInfo::Type::kInt32 ||
|
|
333
|
-
type == CTypeInfo::Type::kUint32 ||
|
|
334
|
-
type == CTypeInfo::Type::kFloat32 ||
|
|
335
|
-
type == CTypeInfo::Type::kFloat64,
|
|
336
|
-
"64-bit int and api object values are not currently "
|
|
337
|
-
"supported return types.");
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const CTypeInfo& ReturnInfo() const override { return return_info_; }
|
|
341
|
-
unsigned int ArgumentCount() const override { return arg_count_; }
|
|
342
|
-
const CTypeInfo& ArgumentInfo(unsigned int index) const override {
|
|
343
|
-
if (index >= ArgumentCount()) {
|
|
344
|
-
return CTypeInfo::Invalid();
|
|
345
|
-
}
|
|
346
|
-
return arg_info_[index];
|
|
347
|
-
}
|
|
348
|
-
bool HasOptions() const override { return kOptionsArgCount == 1; }
|
|
349
|
-
|
|
350
|
-
private:
|
|
351
|
-
const CTypeInfo return_info_;
|
|
352
|
-
const unsigned int arg_count_;
|
|
353
|
-
const CTypeInfo arg_info_[sizeof...(Args)];
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
} // namespace internal
|
|
357
|
-
|
|
358
|
-
class V8_EXPORT CFunction {
|
|
359
|
-
public:
|
|
360
|
-
constexpr CFunction() : address_(nullptr), type_info_(nullptr) {}
|
|
361
|
-
|
|
362
|
-
const CTypeInfo& ReturnInfo() const { return type_info_->ReturnInfo(); }
|
|
363
|
-
|
|
364
|
-
const CTypeInfo& ArgumentInfo(unsigned int index) const {
|
|
365
|
-
return type_info_->ArgumentInfo(index);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
unsigned int ArgumentCount() const { return type_info_->ArgumentCount(); }
|
|
369
|
-
|
|
370
|
-
const void* GetAddress() const { return address_; }
|
|
371
|
-
const CFunctionInfo* GetTypeInfo() const { return type_info_; }
|
|
372
|
-
|
|
373
|
-
template <typename F>
|
|
374
|
-
static CFunction Make(F* func) {
|
|
375
|
-
return ArgUnwrap<F*>::Make(func);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
template <typename F>
|
|
379
|
-
V8_DEPRECATED("Use CFunction::Make instead.")
|
|
380
|
-
static CFunction MakeWithFallbackSupport(F* func) {
|
|
381
|
-
return ArgUnwrap<F*>::Make(func);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
template <typename F>
|
|
385
|
-
static CFunction Make(F* func, const CFunctionInfo* type_info) {
|
|
386
|
-
return CFunction(reinterpret_cast<const void*>(func), type_info);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
private:
|
|
390
|
-
const void* address_;
|
|
391
|
-
const CFunctionInfo* type_info_;
|
|
392
|
-
|
|
393
|
-
CFunction(const void* address, const CFunctionInfo* type_info);
|
|
394
|
-
|
|
395
|
-
template <typename R, typename... Args>
|
|
396
|
-
static CFunctionInfo* GetCFunctionInfo() {
|
|
397
|
-
static internal::CFunctionInfoImpl<R, Args...> instance;
|
|
398
|
-
return &instance;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
template <typename F>
|
|
402
|
-
class ArgUnwrap {
|
|
403
|
-
static_assert(sizeof(F) != sizeof(F),
|
|
404
|
-
"CFunction must be created from a function pointer.");
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
template <typename R, typename... Args>
|
|
408
|
-
class ArgUnwrap<R (*)(Args...)> {
|
|
409
|
-
public:
|
|
410
|
-
static CFunction Make(R (*func)(Args...)) {
|
|
411
|
-
return CFunction(reinterpret_cast<const void*>(func),
|
|
412
|
-
GetCFunctionInfo<R, Args...>());
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
} // namespace v8
|
|
418
|
-
|
|
419
|
-
#endif // INCLUDE_V8_FAST_API_CALLS_H_
|
|
1
|
+
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This file provides additional API on top of the default one for making
|
|
7
|
+
* API calls, which come from embedder C++ functions. The functions are being
|
|
8
|
+
* called directly from optimized code, doing all the necessary typechecks
|
|
9
|
+
* in the compiler itself, instead of on the embedder side. Hence the "fast"
|
|
10
|
+
* in the name. Example usage might look like:
|
|
11
|
+
*
|
|
12
|
+
* \code
|
|
13
|
+
* void FastMethod(int param, bool another_param);
|
|
14
|
+
*
|
|
15
|
+
* v8::FunctionTemplate::New(isolate, SlowCallback, data,
|
|
16
|
+
* signature, length, constructor_behavior
|
|
17
|
+
* side_effect_type,
|
|
18
|
+
* &v8::CFunction::Make(FastMethod));
|
|
19
|
+
* \endcode
|
|
20
|
+
*
|
|
21
|
+
* By design, fast calls are limited by the following requirements, which
|
|
22
|
+
* the embedder should enforce themselves:
|
|
23
|
+
* - they should not allocate on the JS heap;
|
|
24
|
+
* - they should not trigger JS execution.
|
|
25
|
+
* To enforce them, the embedder could use the existing
|
|
26
|
+
* v8::Isolate::DisallowJavascriptExecutionScope and a utility similar to
|
|
27
|
+
* Blink's NoAllocationScope:
|
|
28
|
+
* https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/heap/thread_state_scopes.h;l=16
|
|
29
|
+
*
|
|
30
|
+
* Due to these limitations, it's not directly possible to report errors by
|
|
31
|
+
* throwing a JS exception or to otherwise do an allocation. There is an
|
|
32
|
+
* alternative way of creating fast calls that supports falling back to the
|
|
33
|
+
* slow call and then performing the necessary allocation. When one creates
|
|
34
|
+
* the fast method by using CFunction::MakeWithFallbackSupport instead of
|
|
35
|
+
* CFunction::Make, the fast callback gets as last parameter an output variable,
|
|
36
|
+
* through which it can request falling back to the slow call. So one might
|
|
37
|
+
* declare their method like:
|
|
38
|
+
*
|
|
39
|
+
* \code
|
|
40
|
+
* void FastMethodWithFallback(int param, FastApiCallbackOptions& options);
|
|
41
|
+
* \endcode
|
|
42
|
+
*
|
|
43
|
+
* If the callback wants to signal an error condition or to perform an
|
|
44
|
+
* allocation, it must set options.fallback to true and do an early return from
|
|
45
|
+
* the fast method. Then V8 checks the value of options.fallback and if it's
|
|
46
|
+
* true, falls back to executing the SlowCallback, which is capable of reporting
|
|
47
|
+
* the error (either by throwing a JS exception or logging to the console) or
|
|
48
|
+
* doing the allocation. It's the embedder's responsibility to ensure that the
|
|
49
|
+
* fast callback is idempotent up to the point where error and fallback
|
|
50
|
+
* conditions are checked, because otherwise executing the slow callback might
|
|
51
|
+
* produce visible side-effects twice.
|
|
52
|
+
*
|
|
53
|
+
* An example for custom embedder type support might employ a way to wrap/
|
|
54
|
+
* unwrap various C++ types in JSObject instances, e.g:
|
|
55
|
+
*
|
|
56
|
+
* \code
|
|
57
|
+
*
|
|
58
|
+
* // Helper method with a check for field count.
|
|
59
|
+
* template <typename T, int offset>
|
|
60
|
+
* inline T* GetInternalField(v8::Local<v8::Object> wrapper) {
|
|
61
|
+
* assert(offset < wrapper->InternalFieldCount());
|
|
62
|
+
* return reinterpret_cast<T*>(
|
|
63
|
+
* wrapper->GetAlignedPointerFromInternalField(offset));
|
|
64
|
+
* }
|
|
65
|
+
*
|
|
66
|
+
* class CustomEmbedderType {
|
|
67
|
+
* public:
|
|
68
|
+
* // Returns the raw C object from a wrapper JS object.
|
|
69
|
+
* static CustomEmbedderType* Unwrap(v8::Local<v8::Object> wrapper) {
|
|
70
|
+
* return GetInternalField<CustomEmbedderType,
|
|
71
|
+
* kV8EmbedderWrapperObjectIndex>(wrapper);
|
|
72
|
+
* }
|
|
73
|
+
* static void FastMethod(v8::ApiObject receiver_obj, int param) {
|
|
74
|
+
* v8::Object* v8_object = reinterpret_cast<v8::Object*>(&api_object);
|
|
75
|
+
* CustomEmbedderType* receiver = static_cast<CustomEmbedderType*>(
|
|
76
|
+
* receiver_obj->GetAlignedPointerFromInternalField(
|
|
77
|
+
* kV8EmbedderWrapperObjectIndex));
|
|
78
|
+
*
|
|
79
|
+
* // Type checks are already done by the optimized code.
|
|
80
|
+
* // Then call some performance-critical method like:
|
|
81
|
+
* // receiver->Method(param);
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* static void SlowMethod(
|
|
85
|
+
* const v8::FunctionCallbackInfo<v8::Value>& info) {
|
|
86
|
+
* v8::Local<v8::Object> instance =
|
|
87
|
+
* v8::Local<v8::Object>::Cast(info.Holder());
|
|
88
|
+
* CustomEmbedderType* receiver = Unwrap(instance);
|
|
89
|
+
* // TODO: Do type checks and extract {param}.
|
|
90
|
+
* receiver->Method(param);
|
|
91
|
+
* }
|
|
92
|
+
* };
|
|
93
|
+
*
|
|
94
|
+
* // TODO(mslekova): Clean-up these constants
|
|
95
|
+
* // The constants kV8EmbedderWrapperTypeIndex and
|
|
96
|
+
* // kV8EmbedderWrapperObjectIndex describe the offsets for the type info
|
|
97
|
+
* // struct and the native object, when expressed as internal field indices
|
|
98
|
+
* // within a JSObject. The existance of this helper function assumes that
|
|
99
|
+
* // all embedder objects have their JSObject-side type info at the same
|
|
100
|
+
* // offset, but this is not a limitation of the API itself. For a detailed
|
|
101
|
+
* // use case, see the third example.
|
|
102
|
+
* static constexpr int kV8EmbedderWrapperTypeIndex = 0;
|
|
103
|
+
* static constexpr int kV8EmbedderWrapperObjectIndex = 1;
|
|
104
|
+
*
|
|
105
|
+
* // The following setup function can be templatized based on
|
|
106
|
+
* // the {embedder_object} argument.
|
|
107
|
+
* void SetupCustomEmbedderObject(v8::Isolate* isolate,
|
|
108
|
+
* v8::Local<v8::Context> context,
|
|
109
|
+
* CustomEmbedderType* embedder_object) {
|
|
110
|
+
* isolate->set_embedder_wrapper_type_index(
|
|
111
|
+
* kV8EmbedderWrapperTypeIndex);
|
|
112
|
+
* isolate->set_embedder_wrapper_object_index(
|
|
113
|
+
* kV8EmbedderWrapperObjectIndex);
|
|
114
|
+
*
|
|
115
|
+
* v8::CFunction c_func =
|
|
116
|
+
* MakeV8CFunction(CustomEmbedderType::FastMethod);
|
|
117
|
+
*
|
|
118
|
+
* Local<v8::FunctionTemplate> method_template =
|
|
119
|
+
* v8::FunctionTemplate::New(
|
|
120
|
+
* isolate, CustomEmbedderType::SlowMethod, v8::Local<v8::Value>(),
|
|
121
|
+
* v8::Local<v8::Signature>(), 1, v8::ConstructorBehavior::kAllow,
|
|
122
|
+
* v8::SideEffectType::kHasSideEffect, &c_func);
|
|
123
|
+
*
|
|
124
|
+
* v8::Local<v8::ObjectTemplate> object_template =
|
|
125
|
+
* v8::ObjectTemplate::New(isolate);
|
|
126
|
+
* object_template->SetInternalFieldCount(
|
|
127
|
+
* kV8EmbedderWrapperObjectIndex + 1);
|
|
128
|
+
* object_template->Set(isolate, "method", method_template);
|
|
129
|
+
*
|
|
130
|
+
* // Instantiate the wrapper JS object.
|
|
131
|
+
* v8::Local<v8::Object> object =
|
|
132
|
+
* object_template->NewInstance(context).ToLocalChecked();
|
|
133
|
+
* object->SetAlignedPointerInInternalField(
|
|
134
|
+
* kV8EmbedderWrapperObjectIndex,
|
|
135
|
+
* reinterpret_cast<void*>(embedder_object));
|
|
136
|
+
*
|
|
137
|
+
* // TODO: Expose {object} where it's necessary.
|
|
138
|
+
* }
|
|
139
|
+
* \endcode
|
|
140
|
+
*
|
|
141
|
+
* For instance if {object} is exposed via a global "obj" variable,
|
|
142
|
+
* one could write in JS:
|
|
143
|
+
* function hot_func() {
|
|
144
|
+
* obj.method(42);
|
|
145
|
+
* }
|
|
146
|
+
* and once {hot_func} gets optimized, CustomEmbedderType::FastMethod
|
|
147
|
+
* will be called instead of the slow version, with the following arguments:
|
|
148
|
+
* receiver := the {embedder_object} from above
|
|
149
|
+
* param := 42
|
|
150
|
+
*
|
|
151
|
+
* Currently supported return types:
|
|
152
|
+
* - void
|
|
153
|
+
* - bool
|
|
154
|
+
* - int32_t
|
|
155
|
+
* - uint32_t
|
|
156
|
+
* - float32_t
|
|
157
|
+
* - float64_t
|
|
158
|
+
* Currently supported argument types:
|
|
159
|
+
* - pointer to an embedder type
|
|
160
|
+
* - bool
|
|
161
|
+
* - int32_t
|
|
162
|
+
* - uint32_t
|
|
163
|
+
* - int64_t
|
|
164
|
+
* - uint64_t
|
|
165
|
+
* - float32_t
|
|
166
|
+
* - float64_t
|
|
167
|
+
*
|
|
168
|
+
* The 64-bit integer types currently have the IDL (unsigned) long long
|
|
169
|
+
* semantics: https://heycam.github.io/webidl/#abstract-opdef-converttoint
|
|
170
|
+
* In the future we'll extend the API to also provide conversions from/to
|
|
171
|
+
* BigInt to preserve full precision.
|
|
172
|
+
* The floating point types currently have the IDL (unrestricted) semantics,
|
|
173
|
+
* which is the only one used by WebGL. We plan to add support also for
|
|
174
|
+
* restricted floats/doubles, similarly to the BigInt conversion policies.
|
|
175
|
+
* We also differ from the specific NaN bit pattern that WebIDL prescribes
|
|
176
|
+
* (https://heycam.github.io/webidl/#es-unrestricted-float) in that Blink
|
|
177
|
+
* passes NaN values as-is, i.e. doesn't normalize them.
|
|
178
|
+
*
|
|
179
|
+
* To be supported types:
|
|
180
|
+
* - arrays of C types
|
|
181
|
+
* - arrays of embedder types
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
#ifndef INCLUDE_V8_FAST_API_CALLS_H_
|
|
185
|
+
#define INCLUDE_V8_FAST_API_CALLS_H_
|
|
186
|
+
|
|
187
|
+
#include <stddef.h>
|
|
188
|
+
#include <stdint.h>
|
|
189
|
+
|
|
190
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
191
|
+
|
|
192
|
+
namespace v8 {
|
|
193
|
+
|
|
194
|
+
class CTypeInfo {
|
|
195
|
+
public:
|
|
196
|
+
enum class Type : uint8_t {
|
|
197
|
+
kVoid,
|
|
198
|
+
kBool,
|
|
199
|
+
kInt32,
|
|
200
|
+
kUint32,
|
|
201
|
+
kInt64,
|
|
202
|
+
kUint64,
|
|
203
|
+
kFloat32,
|
|
204
|
+
kFloat64,
|
|
205
|
+
kV8Value,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// kCallbackOptionsType and kInvalidType are not part of the Type enum
|
|
209
|
+
// because they are only used internally. Use values 255 and 254 that
|
|
210
|
+
// are larger than any valid Type enum.
|
|
211
|
+
static constexpr Type kCallbackOptionsType = Type(255);
|
|
212
|
+
static constexpr Type kInvalidType = Type(254);
|
|
213
|
+
|
|
214
|
+
enum class ArgFlags : uint8_t {
|
|
215
|
+
kNone = 0,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
explicit constexpr CTypeInfo(Type type, ArgFlags flags = ArgFlags::kNone)
|
|
219
|
+
: type_(type), flags_(flags) {}
|
|
220
|
+
|
|
221
|
+
constexpr Type GetType() const { return type_; }
|
|
222
|
+
|
|
223
|
+
constexpr ArgFlags GetFlags() const { return flags_; }
|
|
224
|
+
|
|
225
|
+
static const CTypeInfo& Invalid() {
|
|
226
|
+
static CTypeInfo invalid = CTypeInfo(kInvalidType);
|
|
227
|
+
return invalid;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private:
|
|
231
|
+
Type type_;
|
|
232
|
+
ArgFlags flags_;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
class CFunctionInfo {
|
|
236
|
+
public:
|
|
237
|
+
virtual const CTypeInfo& ReturnInfo() const = 0;
|
|
238
|
+
virtual unsigned int ArgumentCount() const = 0;
|
|
239
|
+
virtual const CTypeInfo& ArgumentInfo(unsigned int index) const = 0;
|
|
240
|
+
virtual bool HasOptions() const = 0;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
struct ApiObject {
|
|
244
|
+
uintptr_t address;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* A struct which may be passed to a fast call callback, like so:
|
|
249
|
+
* \code
|
|
250
|
+
* void FastMethodWithOptions(int param, FastApiCallbackOptions& options);
|
|
251
|
+
* \endcode
|
|
252
|
+
*/
|
|
253
|
+
struct FastApiCallbackOptions {
|
|
254
|
+
/**
|
|
255
|
+
* If the callback wants to signal an error condition or to perform an
|
|
256
|
+
* allocation, it must set options.fallback to true and do an early return
|
|
257
|
+
* from the fast method. Then V8 checks the value of options.fallback and if
|
|
258
|
+
* it's true, falls back to executing the SlowCallback, which is capable of
|
|
259
|
+
* reporting the error (either by throwing a JS exception or logging to the
|
|
260
|
+
* console) or doing the allocation. It's the embedder's responsibility to
|
|
261
|
+
* ensure that the fast callback is idempotent up to the point where error and
|
|
262
|
+
* fallback conditions are checked, because otherwise executing the slow
|
|
263
|
+
* callback might produce visible side-effects twice.
|
|
264
|
+
*/
|
|
265
|
+
bool fallback;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* The `data` passed to the FunctionTemplate constructor, or `undefined`.
|
|
269
|
+
*/
|
|
270
|
+
const ApiObject data;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
namespace internal {
|
|
274
|
+
|
|
275
|
+
template <typename T>
|
|
276
|
+
struct GetCType;
|
|
277
|
+
|
|
278
|
+
#define SPECIALIZE_GET_C_TYPE_FOR(ctype, ctypeinfo) \
|
|
279
|
+
template <> \
|
|
280
|
+
struct GetCType<ctype> { \
|
|
281
|
+
static constexpr CTypeInfo Get() { \
|
|
282
|
+
return CTypeInfo(CTypeInfo::Type::ctypeinfo); \
|
|
283
|
+
} \
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
#define SUPPORTED_C_TYPES(V) \
|
|
287
|
+
V(void, kVoid) \
|
|
288
|
+
V(bool, kBool) \
|
|
289
|
+
V(int32_t, kInt32) \
|
|
290
|
+
V(uint32_t, kUint32) \
|
|
291
|
+
V(int64_t, kInt64) \
|
|
292
|
+
V(uint64_t, kUint64) \
|
|
293
|
+
V(float, kFloat32) \
|
|
294
|
+
V(double, kFloat64) \
|
|
295
|
+
V(ApiObject, kV8Value)
|
|
296
|
+
|
|
297
|
+
SUPPORTED_C_TYPES(SPECIALIZE_GET_C_TYPE_FOR)
|
|
298
|
+
|
|
299
|
+
template <>
|
|
300
|
+
struct GetCType<FastApiCallbackOptions&> {
|
|
301
|
+
static constexpr CTypeInfo Get() {
|
|
302
|
+
return CTypeInfo(CTypeInfo::kCallbackOptionsType);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// Helper to count the number of occurances of `T` in `List`
|
|
307
|
+
template <typename T, typename... List>
|
|
308
|
+
struct count : std::integral_constant<int, 0> {};
|
|
309
|
+
template <typename T, typename... Args>
|
|
310
|
+
struct count<T, T, Args...>
|
|
311
|
+
: std::integral_constant<std::size_t, 1 + count<T, Args...>::value> {};
|
|
312
|
+
template <typename T, typename U, typename... Args>
|
|
313
|
+
struct count<T, U, Args...> : count<T, Args...> {};
|
|
314
|
+
|
|
315
|
+
template <typename R, typename... Args>
|
|
316
|
+
class CFunctionInfoImpl : public CFunctionInfo {
|
|
317
|
+
public:
|
|
318
|
+
static constexpr int kOptionsArgCount =
|
|
319
|
+
count<FastApiCallbackOptions&, Args...>();
|
|
320
|
+
static constexpr int kReceiverCount = 1;
|
|
321
|
+
CFunctionInfoImpl()
|
|
322
|
+
: return_info_(internal::GetCType<R>::Get()),
|
|
323
|
+
arg_count_(sizeof...(Args) - kOptionsArgCount),
|
|
324
|
+
arg_info_{internal::GetCType<Args>::Get()...} {
|
|
325
|
+
static_assert(kOptionsArgCount == 0 || kOptionsArgCount == 1,
|
|
326
|
+
"Only one options parameter is supported.");
|
|
327
|
+
static_assert(sizeof...(Args) >= kOptionsArgCount + kReceiverCount,
|
|
328
|
+
"The receiver or the fallback argument is missing.");
|
|
329
|
+
constexpr CTypeInfo::Type type = internal::GetCType<R>::Get().GetType();
|
|
330
|
+
static_assert(type == CTypeInfo::Type::kVoid ||
|
|
331
|
+
type == CTypeInfo::Type::kBool ||
|
|
332
|
+
type == CTypeInfo::Type::kInt32 ||
|
|
333
|
+
type == CTypeInfo::Type::kUint32 ||
|
|
334
|
+
type == CTypeInfo::Type::kFloat32 ||
|
|
335
|
+
type == CTypeInfo::Type::kFloat64,
|
|
336
|
+
"64-bit int and api object values are not currently "
|
|
337
|
+
"supported return types.");
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const CTypeInfo& ReturnInfo() const override { return return_info_; }
|
|
341
|
+
unsigned int ArgumentCount() const override { return arg_count_; }
|
|
342
|
+
const CTypeInfo& ArgumentInfo(unsigned int index) const override {
|
|
343
|
+
if (index >= ArgumentCount()) {
|
|
344
|
+
return CTypeInfo::Invalid();
|
|
345
|
+
}
|
|
346
|
+
return arg_info_[index];
|
|
347
|
+
}
|
|
348
|
+
bool HasOptions() const override { return kOptionsArgCount == 1; }
|
|
349
|
+
|
|
350
|
+
private:
|
|
351
|
+
const CTypeInfo return_info_;
|
|
352
|
+
const unsigned int arg_count_;
|
|
353
|
+
const CTypeInfo arg_info_[sizeof...(Args)];
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
} // namespace internal
|
|
357
|
+
|
|
358
|
+
class V8_EXPORT CFunction {
|
|
359
|
+
public:
|
|
360
|
+
constexpr CFunction() : address_(nullptr), type_info_(nullptr) {}
|
|
361
|
+
|
|
362
|
+
const CTypeInfo& ReturnInfo() const { return type_info_->ReturnInfo(); }
|
|
363
|
+
|
|
364
|
+
const CTypeInfo& ArgumentInfo(unsigned int index) const {
|
|
365
|
+
return type_info_->ArgumentInfo(index);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
unsigned int ArgumentCount() const { return type_info_->ArgumentCount(); }
|
|
369
|
+
|
|
370
|
+
const void* GetAddress() const { return address_; }
|
|
371
|
+
const CFunctionInfo* GetTypeInfo() const { return type_info_; }
|
|
372
|
+
|
|
373
|
+
template <typename F>
|
|
374
|
+
static CFunction Make(F* func) {
|
|
375
|
+
return ArgUnwrap<F*>::Make(func);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
template <typename F>
|
|
379
|
+
V8_DEPRECATED("Use CFunction::Make instead.")
|
|
380
|
+
static CFunction MakeWithFallbackSupport(F* func) {
|
|
381
|
+
return ArgUnwrap<F*>::Make(func);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
template <typename F>
|
|
385
|
+
static CFunction Make(F* func, const CFunctionInfo* type_info) {
|
|
386
|
+
return CFunction(reinterpret_cast<const void*>(func), type_info);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
private:
|
|
390
|
+
const void* address_;
|
|
391
|
+
const CFunctionInfo* type_info_;
|
|
392
|
+
|
|
393
|
+
CFunction(const void* address, const CFunctionInfo* type_info);
|
|
394
|
+
|
|
395
|
+
template <typename R, typename... Args>
|
|
396
|
+
static CFunctionInfo* GetCFunctionInfo() {
|
|
397
|
+
static internal::CFunctionInfoImpl<R, Args...> instance;
|
|
398
|
+
return &instance;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
template <typename F>
|
|
402
|
+
class ArgUnwrap {
|
|
403
|
+
static_assert(sizeof(F) != sizeof(F),
|
|
404
|
+
"CFunction must be created from a function pointer.");
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
template <typename R, typename... Args>
|
|
408
|
+
class ArgUnwrap<R (*)(Args...)> {
|
|
409
|
+
public:
|
|
410
|
+
static CFunction Make(R (*func)(Args...)) {
|
|
411
|
+
return CFunction(reinterpret_cast<const void*>(func),
|
|
412
|
+
GetCFunctionInfo<R, Args...>());
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
} // namespace v8
|
|
418
|
+
|
|
419
|
+
#endif // INCLUDE_V8_FAST_API_CALLS_H_
|