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}
303
304Valdi::JSValueRef QuickJSJavaScriptContext::evaluatePreCompiled(const Valdi::BytesView& script,
305 const std::string_view& /*sourceFilename*/,
306 Valdi::JSExceptionTracker& exceptionTracker) {
307 auto guard = _threadAccessChecker.guard();
308 auto result = checkCallAndGetValue(
309 exceptionTracker,
310 JS_ReadObject(_context, reinterpret_cast<const uint8_t*>(script.data()), script.size(), JS_READ_OBJ_BYTECODE));
311
312 if (!exceptionTracker) {
313 return Valdi::JSValueRef();
314 }
315
316 auto retainedResult = JS_DupValue(_context, fromValdiJSValue(result.get()));
317
318 return checkCallAndGetValue(exceptionTracker, JS_EvalFunction(_context, retainedResult));
319}
320
321Valdi::JSValueRef QuickJSJavaScriptContext::evaluate(const std::string& script,
322 const std::string_view& sourceFilename,

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