| Index: test/mjsunit/es6/classes.js
|
| diff --git a/test/mjsunit/es6/classes.js b/test/mjsunit/es6/classes.js
|
| index 54cd1651566c3094f86f09d297f611d2c9e11ed2..ac10f0e033e81a24f837974d5f90e1cc975152b7 100644
|
| --- a/test/mjsunit/es6/classes.js
|
| +++ b/test/mjsunit/es6/classes.js
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Flags: --harmony-sloppy
|
| +// Flags: --harmony-sloppy --allow-natives-syntax
|
|
|
| (function TestBasics() {
|
| var C = class C {}
|
| @@ -625,6 +625,7 @@ function assertAccessorDescriptor(object, name) {
|
| assertTrue(new C(1) instanceof C);
|
| })();
|
|
|
| +
|
| (function TestConstructorCall(){
|
| var realmIndex = Realm.create();
|
| var otherTypeError = Realm.eval(realmIndex, "TypeError");
|
| @@ -651,6 +652,30 @@ function assertAccessorDescriptor(object, name) {
|
| assertThrows(function() { A.call() }, otherTypeError);
|
| })();
|
|
|
| +
|
| +(function TestConstructorCallOptimized() {
|
| + class A { };
|
| +
|
| + function invoke_constructor() { A() }
|
| + function call_constructor() { A.call() }
|
| + function apply_constructor() { A.apply() }
|
| +
|
| + for (var i=0; i<3; i++) {
|
| + assertThrows(invoke_constructor);
|
| + assertThrows(call_constructor);
|
| + assertThrows(apply_constructor);
|
| + }
|
| + // Make sure we still check for class constructors when calling optimized
|
| + // code.
|
| + %OptimizeFunctionOnNextCall(invoke_constructor);
|
| + assertThrows(invoke_constructor);
|
| + %OptimizeFunctionOnNextCall(call_constructor);
|
| + assertThrows(call_constructor);
|
| + %OptimizeFunctionOnNextCall(apply_constructor);
|
| + assertThrows(apply_constructor);
|
| +})();
|
| +
|
| +
|
| (function TestDefaultConstructor() {
|
| var calls = 0;
|
| class Base {
|
|
|