blob: a644f87c6714b77c2d7b9ed4e9b370523f788c22 (
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
|
// Copyright 2020 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
try {
throw 42
} catch (e) {
function foo() { return e };
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
var e = "expected";
}
assertEquals("expected", foo());
try {
throw 42
} catch (f) {
function foo2() { return f };
%PrepareFunctionForOptimization(foo2);
%OptimizeFunctionOnNextCall(foo2);
foo2();
with ({}) {
var f = "expected";
}
}
assertEquals("expected", foo2());
(function () {
function foo3() { return g };
%PrepareFunctionForOptimization(foo3);
%OptimizeFunctionOnNextCall(foo3);
foo3();
with ({}) {
var g = "expected";
}
assertEquals("expected", foo3());
})()
|