Changeset 161126 in webkit for trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
- Timestamp:
- Dec 29, 2013, 1:50:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r161072 r161126 229 229 bool shouldExecuteEffects = m_interpreter.startExecuting(m_node); 230 230 231 m_direction = (m_node->flags() & NodeExitsForward) ? ForwardSpeculation : BackwardSpeculation;232 233 231 switch (m_node->op()) { 234 232 case Upsilon: … … 260 258 case ZombieHint: 261 259 compileZombieHint(); 262 break;263 case MovHintAndCheck:264 compileMovHintAndCheck();265 260 break; 266 261 case Phantom: … … 658 653 switch (useKindFor(variable->flushFormat())) { 659 654 case Int32Use: 660 speculate Backward(BadType, jsValueValue(jsValue), m_node, isNotInt32(jsValue));655 speculate(BadType, jsValueValue(jsValue), m_node, isNotInt32(jsValue)); 661 656 setInt32(unboxInt32(jsValue)); 662 657 break; 663 658 case CellUse: 664 speculate Backward(BadType, jsValueValue(jsValue), m_node, isNotCell(jsValue));659 speculate(BadType, jsValueValue(jsValue), m_node, isNotCell(jsValue)); 665 660 setJSValue(jsValue); 666 661 break; 667 662 case BooleanUse: 668 speculate Backward(BadType, jsValueValue(jsValue), m_node, isNotBoolean(jsValue));663 speculate(BadType, jsValueValue(jsValue), m_node, isNotBoolean(jsValue)); 669 664 setBoolean(unboxBoolean(jsValue)); 670 665 break; … … 702 697 void compileSetLocal() 703 698 { 704 observeMovHint(m_node);705 706 699 VariableAccessData* variable = m_node->variableAccessData(); 707 700 switch (variable->flushFormat()) { … … 754 747 void compileMovHint() 755 748 { 756 observeMovHint(m_node); 749 ASSERT(m_node->containsMovHint()); 750 ASSERT(m_node->op() != ZombieHint); 751 752 VirtualRegister operand = m_node->unlinkedLocal(); 753 m_availability.operand(operand) = Availability(m_node->child1().node()); 757 754 } 758 755 759 756 void compileZombieHint() 760 757 { 761 VariableAccessData* data = m_node->variableAccessData(); 762 m_availability.operand(data->local()) = Availability::unavailable(); 763 } 764 765 void compileMovHintAndCheck() 766 { 767 observeMovHint(m_node); 768 speculate(m_node->child1()); 758 m_availability.operand(m_node->unlinkedLocal()) = Availability::unavailable(); 769 759 } 770 760 … … 1178 1168 void compileInt32ToDouble() 1179 1169 { 1180 if (!m_interpreter.needsTypeCheck(m_node->child1(), SpecFullNumber) 1181 || m_node->speculationDirection() == BackwardSpeculation) { 1182 setDouble(lowDouble(m_node->child1())); 1183 return; 1184 } 1185 1186 LValue boxedValue = lowJSValue(m_node->child1(), ManualOperandSpeculation); 1187 1188 LBasicBlock intCase = FTL_NEW_BLOCK(m_out, ("Double unboxing int case")); 1189 LBasicBlock doubleCase = FTL_NEW_BLOCK(m_out, ("Double unboxing double case")); 1190 LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("Double unboxing continuation")); 1191 1192 m_out.branch(isNotInt32(boxedValue), doubleCase, intCase); 1193 1194 LBasicBlock lastNext = m_out.appendTo(intCase, doubleCase); 1195 1196 ValueFromBlock intToDouble = m_out.anchor( 1197 m_out.intToDouble(unboxInt32(boxedValue))); 1198 m_out.jump(continuation); 1199 1200 m_out.appendTo(doubleCase, continuation); 1201 1202 forwardTypeCheck( 1203 jsValueValue(boxedValue), m_node->child1(), SpecFullNumber, 1204 isCellOrMisc(boxedValue), jsValueValue(boxedValue)); 1205 1206 ValueFromBlock unboxedDouble = m_out.anchor(unboxDouble(boxedValue)); 1207 m_out.jump(continuation); 1208 1209 m_out.appendTo(continuation, lastNext); 1210 1211 LValue result = m_out.phi(m_out.doubleType, intToDouble, unboxedDouble); 1212 1213 setDouble(result); 1170 setDouble(lowDouble(m_node->child1())); 1214 1171 } 1215 1172 … … 3197 3154 } 3198 3155 3199 void speculateBackward(3200 ExitKind kind, FormattedValue lowValue, Node* highValue, LValue failCondition)3201 {3202 appendOSRExit(3203 kind, lowValue, highValue, failCondition, BackwardSpeculation, FormattedValue());3204 }3205 3206 void speculateForward(3207 ExitKind kind, FormattedValue lowValue, Node* highValue, LValue failCondition,3208 const FormattedValue& recovery)3209 {3210 appendOSRExit(3211 kind, lowValue, highValue, failCondition, ForwardSpeculation, recovery);3212 }3213 3214 3156 void speculate( 3215 3157 ExitKind kind, FormattedValue lowValue, Node* highValue, LValue failCondition) 3216 3158 { 3217 appendOSRExit( 3218 kind, lowValue, highValue, failCondition, m_direction, FormattedValue()); 3159 appendOSRExit(kind, lowValue, highValue, failCondition); 3219 3160 } 3220 3161 … … 3222 3163 { 3223 3164 speculate(kind, noValue(), 0, m_out.booleanTrue); 3224 }3225 3226 void backwardTypeCheck(3227 FormattedValue lowValue, Edge highValue, SpeculatedType typesPassedThrough,3228 LValue failCondition)3229 {3230 appendTypeCheck(3231 lowValue, highValue, typesPassedThrough, failCondition, BackwardSpeculation,3232 FormattedValue());3233 }3234 3235 void forwardTypeCheck(3236 FormattedValue lowValue, Edge highValue, SpeculatedType typesPassedThrough,3237 LValue failCondition, const FormattedValue& recovery)3238 {3239 appendTypeCheck(3240 lowValue, highValue, typesPassedThrough, failCondition, ForwardSpeculation,3241 recovery);3242 3165 } 3243 3166 … … 3246 3169 LValue failCondition) 3247 3170 { 3248 appendTypeCheck( 3249 lowValue, highValue, typesPassedThrough, failCondition, m_direction, 3250 FormattedValue()); 3171 appendTypeCheck(lowValue, highValue, typesPassedThrough, failCondition); 3251 3172 } 3252 3173 3253 3174 void appendTypeCheck( 3254 3175 FormattedValue lowValue, Edge highValue, SpeculatedType typesPassedThrough, 3255 LValue failCondition , SpeculationDirection direction, FormattedValue recovery)3176 LValue failCondition) 3256 3177 { 3257 3178 if (!m_interpreter.needsTypeCheck(highValue, typesPassedThrough)) 3258 3179 return; 3259 3180 ASSERT(mayHaveTypeCheck(highValue.useKind())); 3260 appendOSRExit(BadType, lowValue, highValue.node(), failCondition , direction, recovery);3181 appendOSRExit(BadType, lowValue, highValue.node(), failCondition); 3261 3182 m_interpreter.filter(highValue, typesPassedThrough); 3262 3183 } … … 4093 4014 4094 4015 void appendOSRExit( 4095 ExitKind kind, FormattedValue lowValue, Node* highValue, LValue failCondition, 4096 SpeculationDirection direction, FormattedValue recovery) 4016 ExitKind kind, FormattedValue lowValue, Node* highValue, LValue failCondition) 4097 4017 { 4098 4018 if (verboseCompilationEnabled()) … … 4119 4039 lastNext = m_out.appendTo(failCase, continuation); 4120 4040 4121 emitOSRExitCall(exit, lowValue , direction, recovery);4041 emitOSRExitCall(exit, lowValue); 4122 4042 4123 4043 m_out.unreachable(); … … 4126 4046 } 4127 4047 4128 void emitOSRExitCall( 4129 OSRExit& exit, FormattedValue lowValue, SpeculationDirection direction, 4130 FormattedValue recovery) 4048 void emitOSRExitCall(OSRExit& exit, FormattedValue lowValue) 4131 4049 { 4132 4050 ExitArgumentList arguments; … … 4134 4052 CodeOrigin codeOrigin = exit.m_codeOrigin; 4135 4053 4136 if (direction == BackwardSpeculation) 4137 buildExitArguments(exit, arguments, lowValue, codeOrigin); 4138 else { 4139 ASSERT(direction == ForwardSpeculation); 4140 if (!recovery) { 4141 for (unsigned nodeIndex = m_nodeIndex; nodeIndex < m_highBlock->size(); ++nodeIndex) { 4142 Node* node = m_highBlock->at(nodeIndex); 4143 if (node->codeOriginForExitTarget == codeOrigin) 4144 continue; 4145 codeOrigin = node->codeOriginForExitTarget; 4146 break; 4147 } 4148 } 4149 4150 buildExitArguments(exit, arguments, lowValue, codeOrigin); 4151 exit.convertToForward(m_highBlock, m_node, m_nodeIndex, recovery, arguments); 4152 } 4054 buildExitArguments(exit, arguments, lowValue, codeOrigin); 4153 4055 4154 4056 callStackmap(exit, arguments); … … 4310 4212 } 4311 4213 4312 void observeMovHint(Node* node)4313 {4314 ASSERT(node->containsMovHint());4315 ASSERT(node->op() != ZombieHint);4316 4317 VirtualRegister operand = node->local();4318 4319 m_availability.operand(operand) = Availability(node->child1().node());4320 }4321 4322 4214 void setInt32(Node* node, LValue value) 4323 4215 { … … 4490 4382 unsigned m_nodeIndex; 4491 4383 Node* m_node; 4492 SpeculationDirection m_direction;4493 4384 4494 4385 uint32_t m_stackmapIDs;
Note:
See TracChangeset
for help on using the changeset viewer.