blob: b962dc07ca04b11fd09881f33174461b42cac24e [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --allow-natives-syntax
6
7function receiver() {
8 return this;
9}
10
11function construct(f) {
12 "use strict";
13 class B {}
14 class C extends B {
15 bar() { return super.foo() }
16 }
17 B.prototype.foo = f;
18 return new C();
19}
20
21function check(x, value, type) {
22 assertEquals("object", typeof x);
23 assertInstanceof(x, type);
24 assertEquals(value, x);
25}
26
27var o = construct(receiver);
28check(o.bar.call(123), Object(123), Number);
29check(o.bar.call("a"), Object("a"), String);
30check(o.bar.call(undefined), this, Object);
31check(o.bar.call(null), this, Object);
32
33%OptimizeFunctionOnNextCall(o.bar);
34check(o.bar.call(456), Object(456), Number);
35check(o.bar.call("b"), Object("b"), String);
36check(o.bar.call(undefined), this, Object);
37check(o.bar.call(null), this, Object);