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) { ...@@ -1810,7 +1810,7 @@ function formatDate(formatter, dateValue) {
DEFINE_METHOD( DEFINE_METHOD(
GlobalIntlDateTimeFormat.prototype, GlobalIntlDateTimeFormat.prototype,
formatToParts(dateValue) { formatToParts(dateValue) {
CHECK_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts"); REQUIRE_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts");
if (!IS_OBJECT(this)) { if (!IS_OBJECT(this)) {
throw %make_type_error(kCalledOnNonObject, this); throw %make_type_error(kCalledOnNonObject, this);
} }
...@@ -2111,12 +2111,12 @@ DEFINE_METHODS_LEN( ...@@ -2111,12 +2111,12 @@ DEFINE_METHODS_LEN(
GlobalString.prototype, GlobalString.prototype,
{ {
toLocaleLowerCase(locales) { toLocaleLowerCase(locales) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase"); REQUIRE_OBJECT_COERCIBLE(this, "String.prototype.toLocaleLowerCase");
return LocaleConvertCase(TO_STRING(this), locales, false); return LocaleConvertCase(TO_STRING(this), locales, false);
} }
toLocaleUpperCase(locales) { toLocaleUpperCase(locales) {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase"); REQUIRE_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase");
return LocaleConvertCase(TO_STRING(this), locales, true); return LocaleConvertCase(TO_STRING(this), locales, true);
} }
}, },
......
...@@ -61,9 +61,10 @@ macro IS_RECEIVER(arg) = (%_IsJSReceiver(arg)); ...@@ -61,9 +61,10 @@ macro IS_RECEIVER(arg) = (%_IsJSReceiver(arg));
# Macro for ES queries of the type: "IsCallable(O)" # Macro for ES queries of the type: "IsCallable(O)"
macro IS_CALLABLE(arg) = (typeof(arg) === 'function'); macro IS_CALLABLE(arg) = (typeof(arg) === 'function');
# Macro for ES6 CheckObjectCoercible # Macro for ES RequireObjectCoercible
# Will throw a TypeError of the form "[functionName] called on null or undefined". # https://tc39.github.io/ecma262/#sec-requireobjectcoercible
macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL(%IS_VAR(arg)) || IS_UNDEFINED(arg)) throw %make_type_error(kCalledOnNullOrUndefined, functionName); # 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. # Inline macros. Use %IS_VAR to make sure arg is evaluated only once.
macro TO_BOOLEAN(arg) = (!!(arg)); macro TO_BOOLEAN(arg) = (!!(arg));
......
...@@ -22,7 +22,7 @@ DEFINE_METHOD( ...@@ -22,7 +22,7 @@ DEFINE_METHOD(
GlobalObject.prototype, GlobalObject.prototype,
// ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]]) // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]])
toLocaleString() { toLocaleString() {
CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString"); REQUIRE_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString");
return this.toString(); 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