-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathInlineCallbackCallBailout.js
57 lines (45 loc) · 1.33 KB
/
InlineCallbackCallBailout.js
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
50
51
52
53
54
55
56
57
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
// test bailout from inlined callback.call
function BailOut(ary)
{
ary[0] = 1;
}
function DispatchCallWithThis(callback, arg)
{
callback.call(this, arg);
}
function DispatchBailout(arg)
{
DispatchCallWithThis(BailOut, arg);
}
DispatchBailout([1]);
DispatchBailout([1]);
DispatchBailout([1.1]);
// test bail out from having a different callback function
function foo()
{
WScript.Echo("foo");
};
function Dispatch(callback)
{
callback.call(undefined);
}
function CallDispatch(callback)
{
Dispatch(callback);
}
CallDispatch(foo);
CallDispatch(foo);
CallDispatch(foo);
// BailOutOnInlineFunction
CallDispatch(function() { WScript.Echo("bar"); });
CallDispatch(foo);
// tautological statement makes function.call a non-fixed method. Test CheckFixedFld bailout.
Function.prototype.call = Function.prototype.call;
CallDispatch(foo)
CallDispatch(foo)
// rejit, not inlining callback.call
CallDispatch(foo)