| 291 | exceptionTracker.onError("Hermes not compiled with compilation enabled"); |
| 292 | return JSValueRef(); |
| 293 | #else |
| 294 | hermes::vm::GCScope gcScope(*_runtime); |
| 295 | |
| 296 | auto compiledBytecode = HermesJavaScriptCompiler::get()->compile(script, sourceFilename, exceptionTracker); |
| 297 | if (!exceptionTracker) { |
| 298 | return newUndefined(); |
| 299 | } |
| 300 | |
| 301 | auto jsSourceURL = llvh::StringRef(reinterpret_cast<const char*>(sourceFilename.data()), sourceFilename.size()); |
| 302 | |
| 303 | hermes::vm::RuntimeModuleFlags runtimeModuleFlags; |
| 304 | auto evaluateResult = _runtime->runBytecode(std::shared_ptr<hermes::hbc::BCProvider>(std::move(compiledBytecode)), |
| 305 | runtimeModuleFlags, |
| 306 | jsSourceURL, |
| 307 | hermes::vm::Runtime::makeNullHandle<hermes::vm::Environment>(), |
| 308 | hermes::vm::Handle<>(&_runtime->global_)); |
| 309 | |
| 310 | return checkCallAndGetValue(evaluateResult, exceptionTracker); |
| 311 | #endif |
| 312 | } |
| 313 | |
| 314 | hermes::vm::Handle<hermes::vm::SymbolID> HermesJavaScriptContext::newSymbolIDFromString(const std::string_view& str) { |
| 315 | auto result = hermes::vm::StringPrimitive::createEfficient( |
| 316 | *_runtime, |
| 317 | llvh::makeArrayRef(reinterpret_cast<const uint8_t*>(str.data()), str.size()), |
| 318 | /* ignoreInputErrors */ true); |
| 319 | |
| 320 | auto symbolId = |
| 321 | hermes::vm::stringToSymbolID(*_runtime, hermes::vm::createPseudoHandle(result.getValue().getString())); |