16 const char* method_name) {
18 if (IsUndefined(*options, isolate)) {
20 return isolate->factory()->NewJSObjectWithNullProto();
23 if (IsJSReceiver(*options)) {
28 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kInvalidArgument));
35 if (IsUndefined(*options, isolate)) {
37 return isolate->factory()->NewJSObjectWithNullProto();
47 const std::vector<const char*>& values,
48 const char* method_name,
49 std::unique_ptr<
char[]>*
result) {
51 isolate->factory()->NewStringFromAsciiChecked(property);
60 if (IsUndefined(*value, isolate)) {
68 std::unique_ptr<char[]> value_cstr = value_str->ToCString();
71 if (!values.empty()) {
74 for (
size_t i = 0;
i < values.
size();
i++) {
75 if (strcmp(values.at(
i), value_cstr.get()) == 0) {
77 *
result = std::move(value_cstr);
83 isolate->factory()->NewStringFromAsciiChecked(method_name);
86 NewRangeError(MessageTemplate::kValueOutOfRange, value, method_str,
92 *
result = std::move(value_cstr);
98 const char* method_name,
bool*
result) {
100 isolate->factory()->NewStringFromAsciiChecked(property);
110 if (!IsUndefined(*value, isolate)) {
123 int min,
int max,
int fallback,
126 if (IsUndefined(*value))
return Just(fallback);
141 NewRangeError(MessageTemplate::kPropertyValueOutOfRange, property),
171 double default_value) {
178 if (IsUndefined(*value)) {
180 return Just(default_value);
188 if (
IsNaN(*value_num)) {
191 NewRangeError(MessageTemplate::kPropertyValueOutOfRange, property),
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(Isolate *isolate, DirectHandle< JSReceiver > receiver, const char *key)
static V8_WARN_UNUSED_RESULT HandleType< String >::MaybeType ToString(Isolate *isolate, HandleType< T > input)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetPropertyOrElement(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ToNumber(Isolate *isolate, HandleType< T > input)
static V8_EXPORT_PRIVATE bool BooleanValue(Tagged< Object > obj, IsolateT *isolate)
static V8_WARN_UNUSED_RESULT HandleType< JSReceiver >::MaybeType ToObject(Isolate *isolate, HandleType< T > object, const char *method_name=nullptr)
static double NumberValue(Tagged< Number > obj)
#define THROW_NEW_ERROR_RETURN_VALUE(isolate, call, value)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define THROW_NEW_ERROR(isolate, call)
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
ZoneVector< RpoNumber > & result
bool IsNaN(Tagged< Object > obj)
bool IsNumber(Tagged< Object > obj)
Maybe< double > GetNumberOptionAsDouble(Isolate *isolate, DirectHandle< JSReceiver > options, DirectHandle< String > property, double default_value)
Maybe< int > DefaultNumberOption(Isolate *isolate, DirectHandle< Object > value, int min, int max, int fallback, DirectHandle< String > property)
MaybeDirectHandle< JSReceiver > GetOptionsObject(Isolate *isolate, DirectHandle< Object > options, const char *method_name)
V8_WARN_UNUSED_RESULT Maybe< bool > GetBoolOption(Isolate *isolate, DirectHandle< JSReceiver > options, const char *property, const char *method_name, bool *result)
Maybe< int > GetNumberOption(Isolate *isolate, DirectHandle< JSReceiver > options, DirectHandle< String > property, int min, int max, int fallback)
MaybeDirectHandle< JSReceiver > CoerceOptionsToObject(Isolate *isolate, DirectHandle< Object > options, const char *method_name)
Maybe< bool > GetStringOption(Isolate *isolate, DirectHandle< JSReceiver > options, const char *property, const std::vector< const char * > &values, const char *method_name, std::unique_ptr< char[]> *result)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Maybe< T > Just(const T &t)
#define DCHECK(condition)
#define V8_WARN_UNUSED_RESULT