Changeset 58902 in webkit for trunk/JavaScriptCore/jit/JITArithmetic32_64.cpp
- Timestamp:
- May 6, 2010, 12:39:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITArithmetic32_64.cpp
r58562 r58902 95 95 JumpList notInt32Op2; 96 96 97 // Int32 less. 97 // Character less. 98 if (isOperandConstantImmediateChar(op1)) { 99 emitLoad(op2, regT1, regT0); 100 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 101 JumpList failures; 102 emitLoadCharacterString(regT0, regT0, failures); 103 addSlowCase(failures); 104 addJump(branch32(LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target); 105 return; 106 } 107 if (isOperandConstantImmediateChar(op2)) { 108 emitLoad(op1, regT1, regT0); 109 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 110 JumpList failures; 111 emitLoadCharacterString(regT0, regT0, failures); 112 addSlowCase(failures); 113 addJump(branch32(GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target); 114 return; 115 } 98 116 if (isOperandConstantImmediateInt(op1)) { 117 // Int32 less. 99 118 emitLoad(op2, regT3, regT2); 100 119 notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag))); … … 129 148 unsigned target = currentInstruction[3].u.operand; 130 149 131 if (!supportsFloatingPoint()) { 132 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2)) 150 if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) { 151 linkSlowCase(iter); 152 linkSlowCase(iter); 153 linkSlowCase(iter); 154 linkSlowCase(iter); 155 } else { 156 if (!supportsFloatingPoint()) { 157 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2)) 158 linkSlowCase(iter); // int32 check 133 159 linkSlowCase(iter); // int32 check 134 linkSlowCase(iter); // int32 check 135 } else { 136 if (!isOperandConstantImmediateInt(op1)) { 137 linkSlowCase(iter); // double check 138 linkSlowCase(iter); // int32 check 160 } else { 161 if (!isOperandConstantImmediateInt(op1)) { 162 linkSlowCase(iter); // double check 163 linkSlowCase(iter); // int32 check 164 } 165 if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2)) 166 linkSlowCase(iter); // double check 139 167 } 140 if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2))141 linkSlowCase(iter); // double check142 168 } 143 169 … … 158 184 JumpList notInt32Op2; 159 185 160 // Int32 less. 186 // Character less. 187 if (isOperandConstantImmediateChar(op1)) { 188 emitLoad(op2, regT1, regT0); 189 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 190 JumpList failures; 191 emitLoadCharacterString(regT0, regT0, failures); 192 addSlowCase(failures); 193 addJump(branch32(GreaterThan, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target); 194 return; 195 } 196 if (isOperandConstantImmediateChar(op2)) { 197 emitLoad(op1, regT1, regT0); 198 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 199 JumpList failures; 200 emitLoadCharacterString(regT0, regT0, failures); 201 addSlowCase(failures); 202 addJump(branch32(LessThan, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target); 203 return; 204 } 161 205 if (isOperandConstantImmediateInt(op1)) { 162 206 emitLoad(op2, regT3, regT2); … … 191 235 unsigned op2 = currentInstruction[2].u.operand; 192 236 unsigned target = currentInstruction[3].u.operand; 193 194 if (!supportsFloatingPoint()) { 195 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2)) 237 238 if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) { 239 linkSlowCase(iter); 240 linkSlowCase(iter); 241 linkSlowCase(iter); 242 linkSlowCase(iter); 243 } else { 244 if (!supportsFloatingPoint()) { 245 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2)) 246 linkSlowCase(iter); // int32 check 196 247 linkSlowCase(iter); // int32 check 197 linkSlowCase(iter); // int32 check 198 } else { 199 if (!isOperandConstantImmediateInt(op1)) { 200 linkSlowCase(iter); // double check 201 linkSlowCase(iter); // int32 check 248 } else { 249 if (!isOperandConstantImmediateInt(op1)) { 250 linkSlowCase(iter); // double check 251 linkSlowCase(iter); // int32 check 252 } 253 if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2)) 254 linkSlowCase(iter); // double check 202 255 } 203 if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2)) 204 linkSlowCase(iter); // double check 205 } 206 256 } 207 257 JITStubCall stubCall(this, cti_op_jless); 208 258 stubCall.addArgument(op1); … … 212 262 } 213 263 214 void JIT::emit_op_j nlesseq(Instruction* currentInstruction)264 void JIT::emit_op_jlesseq(Instruction* currentInstruction, bool invert) 215 265 { 216 266 unsigned op1 = currentInstruction[1].u.operand; … … 221 271 JumpList notInt32Op2; 222 272 223 // Int32 less. 273 // Character less. 274 if (isOperandConstantImmediateChar(op1)) { 275 emitLoad(op2, regT1, regT0); 276 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 277 JumpList failures; 278 emitLoadCharacterString(regT0, regT0, failures); 279 addSlowCase(failures); 280 addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target); 281 return; 282 } 283 if (isOperandConstantImmediateChar(op2)) { 284 emitLoad(op1, regT1, regT0); 285 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag))); 286 JumpList failures; 287 emitLoadCharacterString(regT0, regT0, failures); 288 addSlowCase(failures); 289 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target); 290 return; 291 } 224 292 if (isOperandConstantImmediateInt(op1)) { 225 293 emitLoad(op2, regT3, regT2); 226 294 notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag))); 227 addJump(branch32( LessThan, regT2, Imm32(getConstantOperand(op1).asInt32())), target);295 addJump(branch32(invert ? LessThan : GreaterThan, regT2, Imm32(getConstantOperand(op1).asInt32())), target); 228 296 } else if (isOperandConstantImmediateInt(op2)) { 229 297 emitLoad(op1, regT1, regT0); 230 298 notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag))); 231 addJump(branch32( GreaterThan, regT0, Imm32(getConstantOperand(op2).asInt32())), target);299 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(getConstantOperand(op2).asInt32())), target); 232 300 } else { 233 301 emitLoad2(op1, regT1, regT0, op2, regT3, regT2); 234 302 notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag))); 235 303 notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag))); 236 addJump(branch32( GreaterThan, regT0, regT2), target);304 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, regT2), target); 237 305 } 238 306 … … 245 313 246 314 // Double less. 247 emitBinaryDoubleOp( op_jnlesseq, target, op1, op2, OperandTypes(), notInt32Op1, notInt32Op2, !isOperandConstantImmediateInt(op1), isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2));315 emitBinaryDoubleOp(invert ? op_jnlesseq : op_jlesseq, target, op1, op2, OperandTypes(), notInt32Op1, notInt32Op2, !isOperandConstantImmediateInt(op1), isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2)); 248 316 end.link(this); 249 317 } 250 318 251 void JIT::emitSlow_op_j nlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)319 void JIT::emitSlow_op_jlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter, bool invert) 252 320 { 253 321 unsigned op1 = currentInstruction[1].u.operand; … … 255 323 unsigned target = currentInstruction[3].u.operand; 256 324 257 if (!supportsFloatingPoint()) { 258 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2)) 325 if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) { 326 linkSlowCase(iter); 327 linkSlowCase(iter); 328 linkSlowCase(iter); 329 linkSlowCase(iter); 330 } else { 331 if (!supportsFloatingPoint()) { 332 if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2)) 333 linkSlowCase(iter); // int32 check 259 334 linkSlowCase(iter); // int32 check 260 linkSlowCase(iter); // int32 check 261 } else { 262 if (!isOperandConstantImmediateInt(op1)) { 263 linkSlowCase(iter); // double check 264 linkSlowCase(iter); // int32 check 335 } else { 336 if (!isOperandConstantImmediateInt(op1)) { 337 linkSlowCase(iter); // double check 338 linkSlowCase(iter); // int32 check 339 } 340 if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2)) 341 linkSlowCase(iter); // double check 265 342 } 266 if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2))267 linkSlowCase(iter); // double check268 343 } 269 344 … … 272 347 stubCall.addArgument(op2); 273 348 stubCall.call(); 274 emitJumpSlowToHot(branchTest32(Zero, regT0), target); 349 emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target); 350 } 351 352 void JIT::emit_op_jnlesseq(Instruction* currentInstruction) 353 { 354 emit_op_jlesseq(currentInstruction, true); 355 } 356 357 void JIT::emitSlow_op_jnlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 358 { 359 emitSlow_op_jlesseq(currentInstruction, iter, true); 275 360 } 276 361 … … 984 1069 addJump(branchDouble(DoubleLessThan, fpRegT2, fpRegT0), dst); 985 1070 break; 1071 case op_jlesseq: 1072 emitLoadDouble(op1, fpRegT2); 1073 addJump(branchDouble(DoubleLessThanOrEqual, fpRegT2, fpRegT0), dst); 1074 break; 986 1075 case op_jnlesseq: 987 1076 emitLoadDouble(op1, fpRegT2); … … 1044 1133 emitLoadDouble(op2, fpRegT1); 1045 1134 addJump(branchDouble(DoubleLessThanOrUnordered, fpRegT1, fpRegT0), dst); 1135 break; 1136 case op_jlesseq: 1137 emitLoadDouble(op2, fpRegT1); 1138 addJump(branchDouble(DoubleLessThanOrEqual, fpRegT1, fpRegT0), dst); 1046 1139 break; 1047 1140 default:
Note:
See TracChangeset
for help on using the changeset viewer.