Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: test/mjsunit/es6/classes.js

Issue 1425293007: [crankshaft] Do not optimize ClassConstructor calls and apply. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: hope my magic works Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | test/mjsunit/es6/debug-break-default-constructor.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « src/parser.cc ('k') | test/mjsunit/es6/debug-break-default-constructor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698