Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions ecmascript/js_runtime_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define ECMASCRIPT_JS_RUNTIME_OPTIONS_H_

#include <optional>
#include <charconv>
#include <string>
#include <string_view>
#include <vector>
Expand Down Expand Up @@ -2102,8 +2103,22 @@ class PUBLIC_API JSRuntimeOptions {

void SetCompilerMethodsRange(arg_list_t* argListStr)
{
compileMethodsRange_.first = std::stoull((*argListStr)[0]);
compileMethodsRange_.second = std::stoull((*argListStr)[1]);
if (argListStr == nullptr || argListStr->size() < 2) {
compileMethodsRange_ = {0, UINT32_MAX};
return;
}
uint32_t beginValue = 0;
uint32_t endValue = 0;
const std::string &beginText = (*argListStr)[0];
const std::string &endText = (*argListStr)[1];
auto beginParsed = std::from_chars(beginText.data(), beginText.data() + beginText.size(), beginValue);
auto endParsed = std::from_chars(endText.data(), endText.data() + endText.size(), endValue);
if (beginParsed.ec != std::errc{} || beginParsed.ptr != beginText.data() + beginText.size() ||
endParsed.ec != std::errc{} || endParsed.ptr != endText.data() + endText.size()) {
compileMethodsRange_ = {0, UINT32_MAX};
return;
}
compileMethodsRange_ = {beginValue, endValue};
}

const std::pair<uint32_t, uint32_t>& GetCompilerMethodsRange() const
Expand Down