diff --git a/src/js/arraybuffer.js b/src/js/arraybuffer.js index 1159488160..1e405638d5 100644 --- a/src/js/arraybuffer.js +++ b/src/js/arraybuffer.js @@ -29,7 +29,7 @@ utils.Import(function(from) { // ------------------------------------------------------------------- function ArrayBufferConstructor(length) { // length = 1 - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); %ArrayBufferInitialize(this, byteLength, kNotShared); } else { diff --git a/src/js/i18n.js b/src/js/i18n.js index f2b9dd4445..b2eef6f18d 100644 --- a/src/js/i18n.js +++ b/src/js/i18n.js @@ -197,21 +197,21 @@ function addBoundMethod(obj, methodName, implementation, length) { var boundMethod; if (IS_UNDEFINED(length) || length === 2) { boundMethod = function(x, y) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } return implementation(that, x, y); } } else if (length === 1) { boundMethod = function(x) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } return implementation(that, x); } } else { boundMethod = function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } // DateTimeFormat.format needs to be 0 arg method, but can stil @@ -966,7 +966,7 @@ function initializeCollator(collator, locales, options) { * Collator resolvedOptions method. */ %AddNamedProperty(Intl.Collator.prototype, 'resolvedOptions', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1002,7 +1002,7 @@ function initializeCollator(collator, locales, options) { * Options are optional parameter. */ %AddNamedProperty(Intl.Collator, 'supportedLocalesOf', function(locales) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1208,7 +1208,7 @@ function initializeNumberFormat(numberFormat, locales, options) { * NumberFormat resolvedOptions method. */ %AddNamedProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1263,7 +1263,7 @@ function initializeNumberFormat(numberFormat, locales, options) { * Options are optional parameter. */ %AddNamedProperty(Intl.NumberFormat, 'supportedLocalesOf', function(locales) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1610,7 +1610,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { * DateTimeFormat resolvedOptions method. */ %AddNamedProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1684,7 +1684,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { * Options are optional parameter. */ %AddNamedProperty(Intl.DateTimeFormat, 'supportedLocalesOf', function(locales) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1831,7 +1831,7 @@ function initializeBreakIterator(iterator, locales, options) { */ %AddNamedProperty(Intl.v8BreakIterator.prototype, 'resolvedOptions', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1864,7 +1864,7 @@ function initializeBreakIterator(iterator, locales, options) { */ %AddNamedProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -1978,7 +1978,7 @@ function OverrideFunction(object, name, f) { * Overrides the built-in method. */ OverrideFunction(GlobalString.prototype, 'localeCompare', function(that) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -2003,7 +2003,7 @@ OverrideFunction(GlobalString.prototype, 'localeCompare', function(that) { */ OverrideFunction(GlobalString.prototype, 'normalize', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -2031,7 +2031,7 @@ OverrideFunction(GlobalString.prototype, 'normalize', function() { * If locale or options are omitted, defaults are used. */ OverrideFunction(GlobalNumber.prototype, 'toLocaleString', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -2072,7 +2072,7 @@ function toLocaleDateTime(date, locales, options, required, defaults, service) { * present in the output. */ OverrideFunction(GlobalDate.prototype, 'toLocaleString', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -2090,7 +2090,7 @@ OverrideFunction(GlobalDate.prototype, 'toLocaleString', function() { * in the output. */ OverrideFunction(GlobalDate.prototype, 'toLocaleDateString', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } @@ -2108,7 +2108,7 @@ OverrideFunction(GlobalDate.prototype, 'toLocaleDateString', function() { * in the output. */ OverrideFunction(GlobalDate.prototype, 'toLocaleTimeString', function() { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); } diff --git a/src/js/typedarray.js b/src/js/typedarray.js index c25966ce99..2c0fc126f6 100644 --- a/src/js/typedarray.js +++ b/src/js/typedarray.js @@ -203,7 +203,7 @@ function NAMEConstructByIterable(obj, iterable, iteratorFn) { } function NAMEConstructor(arg1, arg2, arg3) { - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); } else if (IS_NUMBER(arg1) || IS_STRING(arg1) || diff --git a/src/js/v8natives.js b/src/js/v8natives.js index fa9ebb4c98..711a22fe64 100644 --- a/src/js/v8natives.js +++ b/src/js/v8natives.js @@ -1290,7 +1290,7 @@ utils.InstallFunctions(GlobalObject, DONT_ENUM, [ function BooleanConstructor(x) { // TODO(bmeurer): Move this to toplevel. "use strict"; - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { %_SetValueOf(this, TO_BOOLEAN(x)); } else { return TO_BOOLEAN(x); @@ -1616,7 +1616,7 @@ function FunctionBind(this_arg) { // Length is 1. "use strict"; // This function must not use any object literals (Object, Array, RegExp), // since the literals-array is being used to store the bound data. - if (%_IsConstructCall()) { + if (!IS_UNDEFINED(new.target)) { return %NewObjectFromBound(boundFunction); } var bindings = %BoundFunctionGetBindings(boundFunction); diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index 16d0d833dd..456d20e490 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -898,6 +898,7 @@ 'regress/regress-4388': [SKIP], 'regress/regress-444805': [SKIP], 'regress/regress-446389': [SKIP], + 'regress/regress-447756': [SKIP], 'regress/regress-4515': [SKIP], 'regress/regress-4521': [SKIP], 'regress/regress-4525': [SKIP],