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

Method newStringUTF16

valdi/src/valdi/v8/V8JavaScriptContext.cpp:382–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380 if (decimal.size() > static_cast<size_t>(v8::String::kMaxLength)) {
381 exceptionTracker.onError("BigInt decimal exceeds V8's string capacity");
382 return {};
383 }
384
385 v8::TryCatch catcher(_isolate);
386 auto context = _context.Get(_isolate);
387 v8::Context::Scope contextScope(context);
388 v8::Local<v8::String> string;
389 if (!v8::String::NewFromUtf8(_isolate, decimal.data(), v8::NewStringType::kNormal, static_cast<int>(decimal.size()))
390 .ToLocal(&string)) {
391 storeCaughtException(catcher, "Cannot create BigInt decimal string", exceptionTracker);
392 return {};
393 }
394 v8::Local<v8::Value> argument = string;
395 v8::Local<v8::Value> result;
396 if (!_bigIntConstructor.Get(_isolate)->Call(context, v8::Undefined(_isolate), 1, &argument).ToLocal(&result)) {

Callers 1

unmarshallMethod · 0.45

Calls 5

ToLocalCheckedMethod · 0.80
onErrorMethod · 0.65
dataMethod · 0.45
lengthMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected