Commit 73109dd9 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[js] Rename CHECK_OBJECT_COERCIBLE to REQUIRE_OBJECT_COERCIBLE

The CheckObjectCoercible abstract operation was renamed to
RequireObjectCoercible a while ago.
https://tc39.github.io/ecma262/#sec-requireobjectcoercible

This patch updates our macro name accordingly.

BUG=v8:3577,v8:6921

Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I1301b650aba67fda46bb2167d9ebd0c63840466c
Reviewed-on: https://chromium-review.googlesource.com/730495
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48803}
parent e7f92768
......@@ -1810,7 +1810,7 @@ function formatDate(formatter, dateValue) {
DEFINE_METHOD(
GlobalIntlDateTimeFormat.prototype,
formatToParts(dateValue) {
CHECK_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts");
REQUIRE_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts");
if (!IS_OBJECT(this)) {
throw %make_type_error(kCalledOnNonObject, this);
}
......@@ -2111,12 +2111,12 @@ DEFINE_METHODS_LEN(
GlobalString.prototype,
{
toLocaleLowerCase(locales) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase");
REQUIRE_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase");
return LocaleConvertCase(TO_STRING(this), locales, false);
}
toLocaleUpperCase(locales) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase");
REQUIRE_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase");
return LocaleConvertCase(TO_STRING(this), locales, true);
}
},
......
......@@ -61,9 +61,10 @@ macro IS_RECEIVER(arg) = (%_IsJSReceiver(arg));
# Macro for ES queries of the type: "IsCallable(O)"
macro IS_CALLABLE(arg) = (typeof(arg) === 'function');
# Macro for ES6 CheckObjectCoercible
# Will throw a TypeError of the form "[functionName] called on null or undefined".
macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL(%IS_VAR(arg)) || IS_UNDEFINED(arg)) throw %make_type_error(kCalledOnNullOrUndefined, functionName);
# Macro for ES RequireObjectCoercible
# https://tc39.github.io/ecma262/#sec-requireobjectcoercible
# Throws a TypeError of the form "[functionName] called on null or undefined".
macro REQUIRE_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL(%IS_VAR(arg)) || IS_UNDEFINED(arg)) throw %make_type_error(kCalledOnNullOrUndefined, functionName);
# Inline macros. Use %IS_VAR to make sure arg is evaluated only once.
macro TO_BOOLEAN(arg) = (!!(arg));
......
......@@ -22,7 +22,7 @@ DEFINE_METHOD(
GlobalObject.prototype,
// ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]])
toLocaleString() {
CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString");
REQUIRE_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString");
return this.toString();
}
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment