forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixedFieldsTypeSystem.js
More file actions
166 lines (158 loc) · 4.18 KB
/
FixedFieldsTypeSystem.js
File metadata and controls
166 lines (158 loc) · 4.18 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
WScript.Echo("Testing final type constructor with SimpleDictionaryTypeHandler:");
var callFunctionOnObject = function(o) {
WScript.Echo(o.theFunction());
}
var LargeObject = function(f) {
this.p0 = 0;
this.p1 = 1;
this.p2 = 2;
this.p3 = 3;
this.p4 = 4;
this.p5 = 5;
this.p6 = 6;
this.p7 = 7;
this.p8 = 8;
this.p9 = 9;
this.p10 = 10;
this.p11 = 11;
this.p12 = 12;
this.p13 = 13;
this.p14 = 14;
this.p15 = 15;
this.p16 = 16;
this.p17 = 17;
this.p18 = 18;
this.p19 = 19;
this.p20 = 20;
this.p21 = 21;
this.p22 = 22;
this.p23 = 23;
this.p24 = 24;
this.p25 = 25;
this.p26 = 26;
this.p27 = 27;
this.p28 = 28;
this.p29 = 29;
this.p30 = 30;
this.p31 = 31;
this.p32 = 32;
this.p33 = 33;
this.p34 = 34;
this.p35 = 35;
this.p36 = 36;
this.p37 = 37;
this.p38 = 38;
this.p39 = 39;
this.p40 = 40;
this.p41 = 41;
this.p42 = 42;
this.p43 = 43;
this.p44 = 44;
this.p45 = 45;
this.p46 = 46;
this.p47 = 47;
this.p48 = 48;
this.p49 = 49;
this.p50 = 50;
this.p51 = 51;
this.p52 = 52;
this.p53 = 53;
this.p54 = 54;
this.p55 = 55;
this.p56 = 56;
this.p57 = 57;
this.p58 = 58;
this.p59 = 59;
this.p60 = 60;
this.p61 = 61;
this.p62 = 62;
this.p63 = 63;
this.p64 = 64;
this.p65 = 65;
this.p66 = 66;
this.p67 = 67;
this.p68 = 68;
this.p69 = 69;
this.p70 = 70;
this.p71 = 71;
this.p72 = 72;
this.p73 = 73;
this.p74 = 74;
this.p75 = 75;
this.p76 = 76;
this.p77 = 77;
this.p78 = 78;
this.p79 = 79;
this.p80 = 80;
this.p81 = 81;
this.p82 = 82;
this.p83 = 83;
this.p84 = 84;
this.p85 = 85;
this.p86 = 86;
this.p87 = 87;
this.p88 = 88;
this.p89 = 89;
this.p90 = 90;
this.p91 = 91;
this.p92 = 92;
this.p93 = 93;
this.p94 = 94;
this.p95 = 95;
this.p96 = 96;
this.p97 = 97;
this.p98 = 98;
this.p99 = 99;
this.p100 = 100;
this.p101 = 101;
this.p102 = 102;
this.p103 = 103;
this.p104 = 104;
this.p105 = 105;
this.p106 = 106;
this.p107 = 107;
this.p108 = 108;
this.p109 = 109;
this.p110 = 110;
this.p111 = 111;
this.p112 = 112;
this.p113 = 113;
this.p114 = 114;
this.p115 = 115;
this.p116 = 116;
this.p117 = 117;
this.p118 = 118;
this.p119 = 119;
this.p120 = 120;
this.p121 = 121;
this.p122 = 122;
this.p123 = 123;
this.p124 = 124;
this.p125 = 125;
this.p126 = 126;
this.p127 = 127;
// Adding this property should switch the object to SimpleDictionaryTypeHandler
this.p128 = 128;
this.theFunction = f;
}
function testLargeObjectConstructorWithFinalType() {
// Let's create the first (singleton) instance of LargeObject...
var largeObject1 = new LargeObject(function() { return "function on the first object"; });
callFunctionOnObject(largeObject1);
// Let's JIT the function now...
callFunctionOnObject(largeObject1);
// Now let's create the second one, which should first clear the singleton instance (if any),
// by which we should stop reporting any existing fixed fields as such. Then each remaining
// fixed field (if any) should get cleared and invalidated as individual properties are added
// in constructor.
var largeObject2 = new LargeObject(function() { return "function on the second object"; });
// Now let's make sure we still call the right functions...
callFunctionOnObject(largeObject1);
callFunctionOnObject(largeObject2);
}
testLargeObjectConstructorWithFinalType();
WScript.Echo();