MCPcopy Create free account
hub / github.com/Snapchat/Valdi / evaluatePreCompiled

Method evaluatePreCompiled

valdi/src/valdi/quickjs/QuickJSJavaScriptContext.cpp:304–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302 return Valdi::BytesView();
303 }
304
305 size_t objectSize = 0;
306
307 auto* buffer = JS_WriteObject(_context, &objectSize, fromValdiJSValue(evalResult.get()), JS_WRITE_OBJ_BYTECODE);
308 if (buffer == nullptr) {
309 checkCallAndGetValue(exceptionTracker, JS_ThrowInternalError(_context, "Could not write object"));
310 return Valdi::BytesView();
311 }
312
313 auto jsModule = Valdi::makePreCompiledJsModule(reinterpret_cast<const Valdi::Byte*>(buffer), objectSize);
314
315 js_free(_context, buffer);
316
317 return jsModule;
318}
319
320Valdi::JSValueRef QuickJSJavaScriptContext::evaluatePreCompiled(const Valdi::BytesView& script,
321 const std::string_view& /*sourceFilename*/,
322 Valdi::JSExceptionTracker& exceptionTracker) {

Callers

nothing calls this directly

Calls 6

JS_DupValueFunction · 0.85
guardMethod · 0.80
fromValdiJSValueFunction · 0.70
getMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected