From a7d22de460715df97b2b0f4838a505fe3f45ac46 Mon Sep 17 00:00:00 2001 From: bmeurer Date: Wed, 12 Aug 2015 04:11:32 -0700 Subject: [PATCH] [runtime] Simplify CHECK_OBJECT_COERCIBLE. Don't use IS_NULL_OR_UNDEFINED() for CHECK_OBJECT_COERCIBLE() because it will also return true for undetectable objects, but use IS_NULL() and IS_UNDEFINED() directly, which will only return true for null or undefined (which matches the semantics of the abstract operation CheckObjectCoercible). R=yangguo@chromium.org Review URL: https://codereview.chromium.org/1287033002 Cr-Commit-Position: refs/heads/master@{#30129} --- src/macros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macros.py b/src/macros.py index 124b1e7..ee0770b 100644 --- a/src/macros.py +++ b/src/macros.py @@ -136,7 +136,7 @@ macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(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_OR_UNDEFINED(arg) && !IS_UNDETECTABLE(arg)) throw MakeTypeError(kCalledOnNullOrUndefined, functionName); +macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL(%IS_VAR(arg)) || IS_UNDEFINED(arg)) throw MakeTypeError(kCalledOnNullOrUndefined, functionName); # Indices in bound function info retrieved by %BoundFunctionGetBindings(...). define kBoundFunctionIndex = 0; -- 2.7.4