Introduce non-copyable JSBigString for managing large strings efficiently

Reviewed By: astreet

Differential Revision: D3234836

fbshipit-source-id: 2b95b585dc1215988b88cf0d609c778a95b362a1
This commit is contained in:
Marc Horowitz
2016-05-13 17:15:06 -07:00
committed by Facebook Github Bot 8
parent f433ed716c
commit 9e9dfd2ac9
12 changed files with 180 additions and 72 deletions

View File

@@ -32,6 +32,14 @@ JSValueRef makeJSCException(
return JSValueToObject(ctx, exceptionString, NULL);
}
String jsStringFromBigString(const JSBigString& bigstr) {
if (bigstr.isAscii()) {
return String::createExpectingAscii(bigstr.c_str(), bigstr.size());
} else {
return String(bigstr.c_str());
}
}
JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef source) {
JSValueRef exn, result;
result = JSEvaluateScript(context, script, NULL, source, 0, &exn);