Changeset 191763 in webkit
- Timestamp:
- Oct 29, 2015 4:43:42 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r191762 r191763 1 2015-10-29 Filip Pizlo <fpizlo@apple.com> 2 3 B3::LowerToAir::imm() should work for both 32-bit and 64-bit immediates 4 https://bugs.webkit.org/show_bug.cgi?id=150685 5 6 Reviewed by Geoffrey Garen. 7 8 In B3, a constant must match the type of its use. In Air, immediates don't have type, they 9 only have representation. A 32-bit immediate (i.e. Arg::imm) can be used either for 32-bit 10 operations or for 64-bit operations. The only difference from a Arg::imm64 is that it 11 requires fewer bits. 12 13 In the B3->Air lowering, we have a lot of code that is effectively polymorphic over integer 14 type. That code should still be able to use Arg::imm, and it should work even for 64-bit 15 immediates - so long as they are representable as 32-bit immediates. Therefore, the imm() 16 helper should happily accept either Const32Value or Const64Value. 17 18 We already sort of had this with immAnyType(), but it just turns out that anyone using 19 immAnyType() should really be using imm(). 20 21 * b3/B3LowerToAir.cpp: 22 (JSC::B3::Air::LowerToAir::imm): 23 (JSC::B3::Air::LowerToAir::tryStore): 24 (JSC::B3::Air::LowerToAir::tryConst64): 25 (JSC::B3::Air::LowerToAir::immAnyInt): Deleted. 26 * b3/testb3.cpp: 27 (JSC::B3::testAdd1): 28 (JSC::B3::testAdd1Ptr): 29 (JSC::B3::testStoreAddLoad): 30 (JSC::B3::run): 31 1 32 2015-10-29 Filip Pizlo <fpizlo@apple.com> 2 33 -
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r191762 r191763 218 218 Arg imm(Value* value) 219 219 { 220 if (value->hasInt32())221 return Arg::imm(value->asInt32());222 return Arg();223 }224 225 Arg immAnyInt(Value* value)226 {227 220 if (value->hasInt()) { 228 221 int64_t fullValue = value->asInt(); … … 601 594 Arg destination = effectiveAddr(address); 602 595 603 Arg imm = immAnyInt(value); 604 if (imm && isValidForm(move, Arg::Imm, destination.kind())) { 605 append(moveForType(value->type()), imm, effectiveAddr(address, currentValue)); 596 if (imm(value) && isValidForm(move, Arg::Imm, destination.kind())) { 597 append(moveForType(value->type()), imm(value), effectiveAddr(address, currentValue)); 606 598 return true; 607 599 } … … 643 635 bool tryConst64() 644 636 { 637 if (imm(currentValue)) { 638 append(Move, imm(currentValue), tmp(currentValue)); 639 return true; 640 } 645 641 append(Move, Arg::imm64(currentValue->asInt64()), tmp(currentValue)); 646 642 return true; -
trunk/Source/JavaScriptCore/b3/testb3.cpp
r191762 r191763 215 215 } 216 216 217 void testAdd1Ptr(intptr_t value) 218 { 219 Procedure proc; 220 BasicBlock* root = proc.addBlock(); 221 root->appendNew<ControlValue>( 222 proc, Return, Origin(), 223 root->appendNew<Value>( 224 proc, Add, Origin(), 225 root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0), 226 root->appendNew<ConstPtrValue>(proc, Origin(), 1))); 227 228 CHECK(compileAndRun<intptr_t>(proc, value) == value + 1); 229 } 230 217 231 void testStoreAddLoad(int amount) 218 232 { … … 503 517 RUN(testTrunc((static_cast<int64_t>(1) << 40) + 42)); 504 518 RUN(testAdd1(45)); 519 RUN(testAdd1Ptr(51)); 520 RUN(testAdd1Ptr(bitwise_cast<intptr_t>(vm))); 505 521 RUN(testStoreAddLoad(46)); 506 522 RUN(testStoreAddLoadInterference(52));
Note: See TracChangeset
for help on using the changeset viewer.