blob: dd1ba8d969b5f28b8239aeb65e183511120fcd98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
var f1 = function() { while (1) { } }
function g1() {
var s = "hey";
f1 = function() { return true; }
if (f1()) { return s; }
}
%OptimizeFunctionOnNextCall(g1);
assertEquals("hey", g1());
var f2 = function() { do { } while (1); }
function g2() {
var s = "hey";
f2 = function() { return true; }
if (f2()) { return s; }
}
%OptimizeFunctionOnNextCall(g2);
assertEquals("hey", g2());
var f3 = function() { for (;;); }
function g3() {
var s = "hey";
f3 = function() { return true; }
if (f3()) { return s; }
}
%OptimizeFunctionOnNextCall(g3);
assertEquals("hey", g3());
var f4 = function() { for (;;); }
function g4() {
var s = "hey";
f4 = function() { return true; }
while (f4()) { return s; }
}
%OptimizeFunctionOnNextCall(g4);
assertEquals("hey", g4());
|