199 auto context = Parameter<Context>(Descriptor::kContext);
200 auto receiver = Parameter<Object>(Descriptor::kReceiver);
201 auto hint = Parameter<Object>(Descriptor::kHint);
204 Label receiver_is_invalid(
this, Label::kDeferred);
205 GotoIf(TaggedIsSmi(
receiver), &receiver_is_invalid);
206 GotoIfNot(JSAnyIsNotPrimitive(
CAST(
receiver)), &receiver_is_invalid);
209 Label hint_is_number(
this), hint_is_string(
this),
210 hint_is_invalid(
this, Label::kDeferred);
214 GotoIf(TaggedEqual(hint, number_string), &hint_is_number);
216 GotoIf(TaggedEqual(hint, default_string), &hint_is_string);
218 GotoIf(TaggedEqual(hint, string_string), &hint_is_string);
221 GotoIf(TaggedIsSmi(hint), &hint_is_invalid);
222 GotoIfNot(IsString(
CAST(hint)), &hint_is_invalid);
225 GotoIfStringEqual(
CAST(hint), hint_length, number_string, &hint_is_number);
226 GotoIfStringEqual(
CAST(hint), hint_length, default_string, &hint_is_string);
227 GotoIfStringEqual(
CAST(hint), hint_length, string_string, &hint_is_string);
228 Goto(&hint_is_invalid);
231 BIND(&hint_is_number);
240 BIND(&hint_is_string);
249 BIND(&hint_is_invalid);
250 { ThrowTypeError(context, MessageTemplate::kInvalidHint, hint); }
253 BIND(&receiver_is_invalid);
255 ThrowTypeError(context, MessageTemplate::kIncompatibleMethodReceiver,
256 StringConstant(
"Date.prototype [ @@toPrimitive ]"),