Changeset 252231 in webkit
- Timestamp:
- Nov 7, 2019 7:55:47 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r252229 r252231 1 2019-11-07 Tadeu Zagallo <tzagallo@apple.com> 2 3 Use fewer virtual registers in Wasm LLInt 4 https://bugs.webkit.org/show_bug.cgi?id=203861 5 6 Reviewed by Saam Barati. 7 8 Reduce the number of virtual registers in two ways: 9 - Re-use arguments for result values (e.g. the result of add lhs, rhs should go in lhs, not a new virtual register) 10 - Re-use the argument register space for return values that should be placed in registers 11 12 * bytecode/BytecodeList.rb: 13 * generator/Wasm.rb: 14 * llint/WebAssembly.asm: 15 * wasm/WasmLLIntGenerator.cpp: 16 (JSC::Wasm::LLIntGenerator::callInformationFor): 17 (JSC::Wasm::LLIntGenerator::addReturn): 18 (JSC::Wasm::LLIntGenerator::addRefIsNull): 19 (JSC::Wasm::LLIntGenerator::addTableGet): 20 (JSC::Wasm::LLIntGenerator::addTableGrow): 21 (JSC::Wasm::LLIntGenerator::addGrowMemory): 22 (JSC::Wasm::LLIntGenerator::addSelect): 23 (JSC::Wasm::LLIntGenerator::load): 24 1 25 2019-11-07 Robin Morisset <rmorisset@apple.com> 2 26 -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.rb
r252229 r252231 1288 1288 } 1289 1289 1290 op :ret, 1291 args: { 1292 stackOffset: unsigned, 1293 } 1290 op :ret 1294 1291 1295 1292 op :switch, -
trunk/Source/JavaScriptCore/generator/Wasm.rb
r251886 r252231 59 59 auto LLIntGenerator::addOp<#{op_type(op)}>(ExpressionType lhs, ExpressionType rhs, ExpressionType& result) -> PartialResult 60 60 { 61 result = newTemporary();61 result = lhs; 62 62 #{op.capitalized_name}::emit(this, result, lhs, rhs); 63 63 return { }; … … 71 71 auto LLIntGenerator::addOp<#{op_type(op)}>(ExpressionType operand, ExpressionType& result) -> PartialResult 72 72 { 73 result = newTemporary();73 result = operand; 74 74 #{op.capitalized_name}::emit(this, result, operand); 75 75 return { }; -
trunk/Source/JavaScriptCore/llint/WebAssembly.asm
r251886 r252231 605 605 unprefixedWasmOp(wasm_ret, WasmRet, macro(ctx) 606 606 checkSwitchToJITForEpilogue() 607 wgetu(ctx, m_stackOffset, ws1)608 lshifti 3, ws1609 negi ws1610 sxi2q ws1, ws1611 addp cfr, ws1612 607 forEachArgumentGPR(macro (offset, gpr) 613 loadq offset[ws1], gpr608 loadq -offset - 8 - CalleeSaveSpaceAsVirtualRegisters * 8[cfr], gpr 614 609 end) 615 610 forEachArgumentFPR(macro (offset, fpr) 616 loadd offset[ws1], fpr611 loadd -offset - 8 - CalleeSaveSpaceAsVirtualRegisters * 8[cfr], fpr 617 612 end) 618 613 doReturn() -
trunk/Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
r251978 r252231 353 353 354 354 355 for (uint32_t i = 0; i < gprCount; i++) 356 registers.append(newTemporary()); 357 for (uint32_t i = 0; i < fprCount; i++) 358 registers.append(newTemporary()); 359 360 if (role == CallRole::Caller) { 355 if (role == CallRole::Callee) { 356 // Reuse the slots we allocated to spill the registers in addArguments 357 for (uint32_t i = gprCount + fprCount; i--;) 358 registers.append(new RegisterID(::JSC::virtualRegisterForLocal(numberOfLLIntCalleeSaveRegisters + i))); 359 } else { 360 for (uint32_t i = 0; i < gprCount; i++) 361 registers.append(newTemporary()); 362 for (uint32_t i = 0; i < fprCount; i++) 363 registers.append(newTemporary()); 364 361 365 for (uint32_t i = 0; i < signature.argumentCount(); i++) 362 366 allocateStackRegister(signature.argument(i)); … … 630 634 LLIntCallInformation info = callInformationFor(*data.m_signature, CallRole::Callee); 631 635 unifyValuesWithBlock(info.results, returnValues); 632 WasmRet::emit(this , info.stackOffset);636 WasmRet::emit(this); 633 637 634 638 return { }; … … 748 752 auto LLIntGenerator::addRefIsNull(ExpressionType value, ExpressionType& result) -> PartialResult 749 753 { 750 result = newTemporary();754 result = value; 751 755 WasmRefIsNull::emit(this, result, value); 752 756 … … 764 768 auto LLIntGenerator::addTableGet(unsigned tableIndex, ExpressionType index, ExpressionType& result) -> PartialResult 765 769 { 766 result = newTemporary();770 result = index; 767 771 WasmTableGet::emit(this, result, index, tableIndex); 768 772 … … 787 791 auto LLIntGenerator::addTableGrow(unsigned tableIndex, ExpressionType fill, ExpressionType delta, ExpressionType& result) -> PartialResult 788 792 { 789 result = newTemporary();793 result = fill; 790 794 WasmTableGrow::emit(this, result, fill, delta, tableIndex); 791 795 … … 817 821 auto LLIntGenerator::addGrowMemory(ExpressionType delta, ExpressionType& result) -> PartialResult 818 822 { 819 result = newTemporary();823 result = delta; 820 824 WasmGrowMemory::emit(this, result, delta); 821 825 … … 825 829 auto LLIntGenerator::addSelect(ExpressionType condition, ExpressionType nonZero, ExpressionType zero, ExpressionType& result) -> PartialResult 826 830 { 827 result = newTemporary();831 result = condition; 828 832 WasmSelect::emit(this, result, condition, nonZero, zero); 829 833 … … 833 837 auto LLIntGenerator::load(LoadOpType op, ExpressionType pointer, ExpressionType& result, uint32_t offset) -> PartialResult 834 838 { 835 result = newTemporary();839 result = pointer; 836 840 switch (op) { 837 841 case LoadOpType::I32Load8S:
Note: See TracChangeset
for help on using the changeset viewer.