forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_expr.js
166 lines (147 loc) · 7.34 KB
/
update_expr.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
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) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -hermes-parser -dump-ir %s -O0 | %FileCheckOrRegen %s --match-full-lines
// RUN: %hermes -hermes-parser -dump-ir %s -O
function update_field_test0(o) { return o.f++; }
function update_field_test1(o) { return o.f--; }
function update_field_test2(o) { return ++o.f; }
function update_field_test3(o) { return --o.f; }
function update_variable_test0(x) { return x++; }
function update_variable_test1(x) { return x--; }
function update_variable_test2(x) { return ++x; }
function update_variable_test3(x) { return --x; }
// Auto-generated content below. Please do not modify manually.
// CHECK:function global#0()#1
// CHECK-NEXT:globals = [update_field_test0, update_field_test1, update_field_test2, update_field_test3, update_variable_test0, update_variable_test1, update_variable_test2, update_variable_test3]
// CHECK-NEXT:S{global#0()#1} = []
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{global#0()#1}
// CHECK-NEXT: %1 = CreateFunctionInst %update_field_test0#0#1()#2, %0
// CHECK-NEXT: %2 = StorePropertyInst %1 : closure, globalObject : object, "update_field_test0" : string
// CHECK-NEXT: %3 = CreateFunctionInst %update_field_test1#0#1()#3, %0
// CHECK-NEXT: %4 = StorePropertyInst %3 : closure, globalObject : object, "update_field_test1" : string
// CHECK-NEXT: %5 = CreateFunctionInst %update_field_test2#0#1()#4, %0
// CHECK-NEXT: %6 = StorePropertyInst %5 : closure, globalObject : object, "update_field_test2" : string
// CHECK-NEXT: %7 = CreateFunctionInst %update_field_test3#0#1()#5, %0
// CHECK-NEXT: %8 = StorePropertyInst %7 : closure, globalObject : object, "update_field_test3" : string
// CHECK-NEXT: %9 = CreateFunctionInst %update_variable_test0#0#1()#6, %0
// CHECK-NEXT: %10 = StorePropertyInst %9 : closure, globalObject : object, "update_variable_test0" : string
// CHECK-NEXT: %11 = CreateFunctionInst %update_variable_test1#0#1()#7, %0
// CHECK-NEXT: %12 = StorePropertyInst %11 : closure, globalObject : object, "update_variable_test1" : string
// CHECK-NEXT: %13 = CreateFunctionInst %update_variable_test2#0#1()#8, %0
// CHECK-NEXT: %14 = StorePropertyInst %13 : closure, globalObject : object, "update_variable_test2" : string
// CHECK-NEXT: %15 = CreateFunctionInst %update_variable_test3#0#1()#9, %0
// CHECK-NEXT: %16 = StorePropertyInst %15 : closure, globalObject : object, "update_variable_test3" : string
// CHECK-NEXT: %17 = AllocStackInst $?anon_0_ret
// CHECK-NEXT: %18 = StoreStackInst undefined : undefined, %17
// CHECK-NEXT: %19 = LoadStackInst %17
// CHECK-NEXT: %20 = ReturnInst %19
// CHECK-NEXT:function_end
// CHECK:function update_field_test0#0#1(o)#2
// CHECK-NEXT:S{update_field_test0#0#1()#2} = [o#2]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_field_test0#0#1()#2}
// CHECK-NEXT: %1 = StoreFrameInst %o, [o#2], %0
// CHECK-NEXT: %2 = LoadFrameInst [o#2], %0
// CHECK-NEXT: %3 = LoadPropertyInst %2, "f" : string
// CHECK-NEXT: %4 = AsNumericInst %3
// CHECK-NEXT: %5 = UnaryOperatorInst '++', %4 : number|bigint
// CHECK-NEXT: %6 = StorePropertyInst %5, %2, "f" : string
// CHECK-NEXT: %7 = ReturnInst %4 : number|bigint
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %8 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_field_test1#0#1(o)#3
// CHECK-NEXT:S{update_field_test1#0#1()#3} = [o#3]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_field_test1#0#1()#3}
// CHECK-NEXT: %1 = StoreFrameInst %o, [o#3], %0
// CHECK-NEXT: %2 = LoadFrameInst [o#3], %0
// CHECK-NEXT: %3 = LoadPropertyInst %2, "f" : string
// CHECK-NEXT: %4 = AsNumericInst %3
// CHECK-NEXT: %5 = UnaryOperatorInst '--', %4 : number|bigint
// CHECK-NEXT: %6 = StorePropertyInst %5, %2, "f" : string
// CHECK-NEXT: %7 = ReturnInst %4 : number|bigint
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %8 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_field_test2#0#1(o)#4
// CHECK-NEXT:S{update_field_test2#0#1()#4} = [o#4]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_field_test2#0#1()#4}
// CHECK-NEXT: %1 = StoreFrameInst %o, [o#4], %0
// CHECK-NEXT: %2 = LoadFrameInst [o#4], %0
// CHECK-NEXT: %3 = LoadPropertyInst %2, "f" : string
// CHECK-NEXT: %4 = UnaryOperatorInst '++', %3
// CHECK-NEXT: %5 = StorePropertyInst %4, %2, "f" : string
// CHECK-NEXT: %6 = ReturnInst %4
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %7 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_field_test3#0#1(o)#5
// CHECK-NEXT:S{update_field_test3#0#1()#5} = [o#5]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_field_test3#0#1()#5}
// CHECK-NEXT: %1 = StoreFrameInst %o, [o#5], %0
// CHECK-NEXT: %2 = LoadFrameInst [o#5], %0
// CHECK-NEXT: %3 = LoadPropertyInst %2, "f" : string
// CHECK-NEXT: %4 = UnaryOperatorInst '--', %3
// CHECK-NEXT: %5 = StorePropertyInst %4, %2, "f" : string
// CHECK-NEXT: %6 = ReturnInst %4
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %7 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_variable_test0#0#1(x)#6
// CHECK-NEXT:S{update_variable_test0#0#1()#6} = [x#6]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_variable_test0#0#1()#6}
// CHECK-NEXT: %1 = StoreFrameInst %x, [x#6], %0
// CHECK-NEXT: %2 = LoadFrameInst [x#6], %0
// CHECK-NEXT: %3 = AsNumericInst %2
// CHECK-NEXT: %4 = UnaryOperatorInst '++', %3 : number|bigint
// CHECK-NEXT: %5 = StoreFrameInst %4, [x#6], %0
// CHECK-NEXT: %6 = ReturnInst %3 : number|bigint
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %7 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_variable_test1#0#1(x)#7
// CHECK-NEXT:S{update_variable_test1#0#1()#7} = [x#7]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_variable_test1#0#1()#7}
// CHECK-NEXT: %1 = StoreFrameInst %x, [x#7], %0
// CHECK-NEXT: %2 = LoadFrameInst [x#7], %0
// CHECK-NEXT: %3 = AsNumericInst %2
// CHECK-NEXT: %4 = UnaryOperatorInst '--', %3 : number|bigint
// CHECK-NEXT: %5 = StoreFrameInst %4, [x#7], %0
// CHECK-NEXT: %6 = ReturnInst %3 : number|bigint
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %7 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_variable_test2#0#1(x)#8
// CHECK-NEXT:S{update_variable_test2#0#1()#8} = [x#8]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_variable_test2#0#1()#8}
// CHECK-NEXT: %1 = StoreFrameInst %x, [x#8], %0
// CHECK-NEXT: %2 = LoadFrameInst [x#8], %0
// CHECK-NEXT: %3 = UnaryOperatorInst '++', %2
// CHECK-NEXT: %4 = StoreFrameInst %3, [x#8], %0
// CHECK-NEXT: %5 = ReturnInst %3
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %6 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end
// CHECK:function update_variable_test3#0#1(x)#9
// CHECK-NEXT:S{update_variable_test3#0#1()#9} = [x#9]
// CHECK-NEXT:%BB0:
// CHECK-NEXT: %0 = CreateScopeInst %S{update_variable_test3#0#1()#9}
// CHECK-NEXT: %1 = StoreFrameInst %x, [x#9], %0
// CHECK-NEXT: %2 = LoadFrameInst [x#9], %0
// CHECK-NEXT: %3 = UnaryOperatorInst '--', %2
// CHECK-NEXT: %4 = StoreFrameInst %3, [x#9], %0
// CHECK-NEXT: %5 = ReturnInst %3
// CHECK-NEXT:%BB1:
// CHECK-NEXT: %6 = ReturnInst undefined : undefined
// CHECK-NEXT:function_end