blob: 0f7eeba0d38417e87599351744ce7d1a6106b559 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 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 --block-concurrent-recompilation
Ben Murdochb8a8cc12014-11-26 15:28:44 +00006
7function Ctor() {
8 this.a = 1;
9}
10
11function get_closure() {
12 return function add_field(obj, osr) {
13 obj.c = 3;
14 var x = 0;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000015 if (osr) %OptimizeOsr();
Ben Murdochb8a8cc12014-11-26 15:28:44 +000016 for (var i = 0; i < 10; i++) {
17 x = i + 1;
18 }
19 return x;
20 }
21}
22
23var f1 = get_closure();
24f1(new Ctor(), false);
25f1(new Ctor(), false);
26
27%OptimizeFunctionOnNextCall(f1, "concurrent");
28
29// Kick off concurrent recompilation and OSR.
30var o = new Ctor();
31f1(o, true);
32assertOptimized(f1, "no sync");
33
34// Flush the optimizing compiler's queue.
35%NotifyContextDisposed();
36assertUnoptimized(f1, "no sync");
37
38// Trigger deopt.
39o.c = 2.2;
40
41var f2 = get_closure();
42f2(new Ctor(), true);