v8-natives-api

1.0.2 • Public • Published

v8-natives-api

Exposes natives functions accessible with the --allow-natives-syntax flag as a Node API:

const api = require('v8-natives-syntax');
 
api.HasHoleyElements([1,,,3]); // true
 
api.OptimizeFunctionOnNextCall(someFunctionToOptimize);

Warning

The API here may break at any moment should V8 choose to change the internal functions.

Current function list

const methodNames = [
  'Abort',
  'AbortJS',
  'AbortCSAAssert',
  'ArraySpeciesProtector',
  'ClearFunctionFeedback',
  'ClearMegamorphicStubCache',
  'CompleteInobjectSlackTracking',
  'ConstructConsString',
  'ConstructDouble',
  'ConstructSlicedString',
  'DebugPrint',
  'DebugPrintPtr',
  'DebugTrace',
  'DebugTrackRetainingPath',
  'DeoptimizeFunction',
  'DeserializeWasmModule',
  'DisallowCodegenFromStrings',
  'DisallowWasmCodegen',
  'DisassembleFunction',
  'DynamicMapChecksEnabled',
  'EnableCodeLoggingForTesting',
  'EnsureFeedbackVectorForFunction',
  'FreezeWasmLazyCompilation',
  'GetCallable',
  'GetInitializerFunction',
  'GetOptimizationStatus',
  'GetUndetectable',
  'GetWasmExceptionId',
  'GetWasmExceptionValues',
  'GetWasmRecoveredTrapCount',
  'GlobalPrint',
  'HasDictionaryElements',
  'HasDoubleElements',
  'HasElementsInALargeObjectSpace',
  'HasFastElements',
  'HasFastProperties',
  'HasFixedBigInt64Elements',
  'HasFixedBigUint64Elements',
  'HasFixedFloat32Elements',
  'HasFixedFloat64Elements',
  'HasFixedInt16Elements',
  'HasFixedInt32Elements',
  'HasFixedInt8Elements',
  'HasFixedUint16Elements',
  'HasFixedUint32Elements',
  'HasFixedUint8ClampedElements',
  'HasFixedUint8Elements',
  'HasHoleyElements',
  'HasObjectElements',
  'HasPackedElements',
  'HasSloppyArgumentsElements',
  'HasSmiElements',
  'HasSmiOrObjectElements',
  'HaveSameMap',
  'HeapObjectVerify',
  'ICsAreEnabled',
  'InYoungGeneration',
  'IsAsmWasmCode',
  'IsBeingInterpreted',
  'IsConcurrentRecompilationSupported',
  'IsLiftoffFunction',
  'IsThreadInWasm',
  'IsWasmCode',
  'IsWasmTrapHandlerEnabled',
  'RegexpHasBytecode',
  'RegexpHasNativeCode',
  'RegexpTypeTag',
  'MapIteratorProtector',
  'NeverOptimizeFunction',
  'NotifyContextDisposed',
  'OptimizeFunctionOnNextCall',
  'OptimizeOsr',
  'NewRegExpWithBacktrackLimit',
  'PrepareFunctionForOptimization',
  'PrintWithNameForAssert',
  'RunningInSimulator',
  'RuntimeEvaluateREPL',
  'SerializeDeserializeNow',
  'SerializeWasmModule',
  'SetAllocationTimeout',
  'SetForceSlowPath',
  'SetIteratorProtector',
  'SetWasmCompileControls',
  'SetWasmInstantiateControls',
  'SetWasmThreadsEnabled',
  'SimulateNewspaceFull',
  'StringIteratorProtector',
  'SystemBreak',
  'TraceEnter',
  'TraceExit',
  'TurbofanStaticAssert',
  'UnblockConcurrentRecompilation',
  'WasmGetNumberOfInstances',
  'WasmNumCodeSpaces',
  'WasmTierDownModule',
  'WasmTierUpFunction',
  'WasmTierUpModule',
  'WasmTraceEnter',
  'WasmTraceExit',
  'WasmTraceMemory',
  'DeoptimizeNow',
  // Strings
  'FlattenString',
  'GetSubstitution',
  'InternalizeString',
  'StringAdd',
  'StringBuilderConcat',
  'StringCharCodeAt',
  'StringEqual',
  'StringEscapeQuotes',
  'StringGreaterThan',
  'StringGreaterThanOrEqual',
  'StringIncludes',
  'StringIndexOf',
  'StringIndexOfUnchecked',
  'StringLastIndexOf',
  'StringLessThan',
  'StringLessThanOrEqual',
  'StringMaxLength',
  'StringReplaceOneCharWithString',
  'StringCompareSequence',
  'StringSubstring',
  'StringToArray',
  'StringTrim',
];

Readme

Keywords

Package Sidebar

Install

npm i v8-natives-api

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

9.78 kB

Total Files

6

Last publish

Collaborators

  • benjamin.gruenbaum