@@ -15,6 +15,7 @@ class IRBuilderAsmJs;
15
15
class FlowGraph ;
16
16
class GlobOpt ;
17
17
class BailOutInfo ;
18
+ class GeneratorBailInInfo ;
18
19
class SCCLiveness ;
19
20
20
21
struct LazyBailOutRecord ;
@@ -53,7 +54,7 @@ struct CapturedValues
53
54
refCount++;
54
55
}
55
56
56
- void CopyTo (JitArenaAllocator *allocator, CapturedValues *other)
57
+ void CopyTo (JitArenaAllocator *allocator, CapturedValues *other) const
57
58
{
58
59
Assert (other != nullptr );
59
60
this ->constantValues .CopyTo (allocator, other->constantValues );
@@ -117,6 +118,7 @@ class ProfiledLabelInstr;
117
118
class MultiBranchInstr ;
118
119
class PragmaInstr ;
119
120
class ByteCodeUsesInstr ;
121
+ class GeneratorBailInInstr ;
120
122
121
123
class Opnd ;
122
124
class RegOpnd ;
@@ -154,8 +156,8 @@ const int32 InvalidInstrLayout = -1;
154
156
// / ExitInstr
155
157
// / PragmaInstr
156
158
// / BailoutInstr
157
- // / ByteCoteUsesInstr
158
- // /
159
+ // / ByteCodeUsesInstr
160
+ // / GeneratorBailInInstr
159
161
// /---------------------------------------------------------------------------
160
162
161
163
class Instr
@@ -220,6 +222,9 @@ class Instr
220
222
BranchInstr * AsBranchInstr ();
221
223
bool IsLabelInstr () const ;
222
224
LabelInstr * AsLabelInstr ();
225
+ bool IsGeneratorBailInInstr () const ;
226
+ GeneratorBailInInstr * AsGeneratorBailInInstr ();
227
+
223
228
bool IsJitProfilingInstr () const ;
224
229
JitProfilingInstr * AsJitProfilingInstr ();
225
230
bool IsProfiledInstr () const ;
@@ -1109,6 +1114,58 @@ class PragmaInstr : public Instr
1109
1114
PragmaInstr * CopyPragma ();
1110
1115
};
1111
1116
1117
+ class GeneratorBailInInstr : public LabelInstr
1118
+ {
1119
+ private:
1120
+ GeneratorBailInInstr (JitArenaAllocator* allocator, IR::Instr* yieldInstr):
1121
+ LabelInstr (allocator), allocator(allocator), yieldInstr(yieldInstr), upwardExposedUses(allocator)
1122
+ {
1123
+ Assert (yieldInstr != nullptr && yieldInstr->m_opcode == Js::OpCode::Yield);
1124
+ this ->usedCapturedValues = JitAnew (allocator, CapturedValues);
1125
+ }
1126
+
1127
+ JitArenaAllocator* const allocator;
1128
+ IR::Instr* const yieldInstr;
1129
+ CapturedValues* usedCapturedValues;
1130
+ BVSparse<JitArenaAllocator> upwardExposedUses;
1131
+
1132
+ public:
1133
+ static GeneratorBailInInstr* New (IR::Instr* yieldInstr, Func* func);
1134
+
1135
+ IR::Instr* GetYieldInstr () const
1136
+ {
1137
+ return this ->yieldInstr ;
1138
+ }
1139
+
1140
+ const CapturedValues& GetCapturedValues () const
1141
+ {
1142
+ return *this ->usedCapturedValues ;
1143
+ }
1144
+
1145
+ const BVSparse<JitArenaAllocator>& GetUpwardExposedUses () const
1146
+ {
1147
+ return this ->upwardExposedUses ;
1148
+ }
1149
+
1150
+ void SetCopyPropSyms (const SListBase<CopyPropSyms>& copyPropSyms)
1151
+ {
1152
+ this ->usedCapturedValues ->copyPropSyms .Clear (this ->allocator );
1153
+ copyPropSyms.CopyTo (this ->allocator , this ->usedCapturedValues ->copyPropSyms );
1154
+ }
1155
+
1156
+ void SetConstantValues (const SListBase<ConstantStackSymValue>& constantValues)
1157
+ {
1158
+ this ->usedCapturedValues ->constantValues .Clear (this ->allocator );
1159
+ constantValues.CopyTo (this ->allocator , this ->usedCapturedValues ->constantValues );
1160
+ }
1161
+
1162
+ void SetUpwardExposedUses (const BVSparse<JitArenaAllocator>& other)
1163
+ {
1164
+ this ->upwardExposedUses .ClearAll ();
1165
+ this ->upwardExposedUses .Or (&other);
1166
+ }
1167
+ };
1168
+
1112
1169
template <typename InstrType>
1113
1170
class BailOutInstrTemplate : public InstrType
1114
1171
{
0 commit comments