Changeset 192896 in webkit
- Timestamp:
- Dec 1, 2015, 11:31:58 AM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r192836 r192896 998 998 ftl/FTLCommonValues.cpp 999 999 ftl/FTLCompile.cpp 1000 ftl/FTLCompileBinaryOp.cpp 1000 1001 ftl/FTLDWARFDebugLineInfo.cpp 1001 1002 ftl/FTLDWARFRegister.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r192882 r192896 1 2015-12-01 Mark Lam <mark.lam@apple.com> 2 3 Refactor FTL sub snippet code to support general binary op snippets. 4 https://bugs.webkit.org/show_bug.cgi?id=151706 5 6 Reviewed by Geoffrey Garen. 7 8 * CMakeLists.txt: 9 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 10 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 11 * JavaScriptCore.xcodeproj/project.pbxproj: 12 13 * ftl/FTLCompile.cpp: 14 - Moved the BinarySnippetRegisterContext to FTLCompileBinaryOp.cpp verbatim. 15 - Generalize generateArithSubICFastPath() to generateBinaryOpICFastPath(). 16 It now uses snippet specific helpers in FTLCompileBinaryOp.cpp to generate 17 the fast paths. 18 19 * ftl/FTLCompileBinaryOp.cpp: Added. 20 (JSC::FTL::BinarySnippetRegisterContext::BinarySnippetRegisterContext): 21 (JSC::FTL::BinarySnippetRegisterContext::initializeRegisters): 22 (JSC::FTL::BinarySnippetRegisterContext::restoreRegisters): 23 - Moved here without changed from FTLCompile.cpp. 24 (JSC::FTL::generateArithSubFastPath): 25 * ftl/FTLCompileBinaryOp.h: Added. 26 27 * ftl/FTLInlineCacheDescriptor.h: 28 (JSC::FTL::BinaryOpDescriptor::nodeType): 29 (JSC::FTL::BinaryOpDescriptor::size): 30 (JSC::FTL::BinaryOpDescriptor::name): 31 (JSC::FTL::BinaryOpDescriptor::fastPathICName): 32 (JSC::FTL::BinaryOpDescriptor::slowPathFunction): 33 (JSC::FTL::BinaryOpDescriptor::leftOperand): 34 (JSC::FTL::BinaryOpDescriptor::rightOperand): 35 (JSC::FTL::BinaryOpDescriptor::BinaryOpDescriptor): 36 (JSC::FTL::ArithSubDescriptor::ArithSubDescriptor): Deleted. 37 (JSC::FTL::ArithSubDescriptor::leftType): Deleted. 38 (JSC::FTL::ArithSubDescriptor::rightType): Deleted. 39 - Refactor ArithSubDescriptor into BinaryOpDescriptor, and re-add a sub-class 40 ArithSubDescriptor as specializations of BinaryOpDescriptor. 41 42 * ftl/FTLInlineCacheDescriptorInlines.h: Added. 43 (JSC::FTL::ArithSubDescriptor::ArithSubDescriptor): 44 (JSC::FTL::ArithSubDescriptor::icSize): 45 46 * ftl/FTLLowerDFGToLLVM.cpp: 47 (JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub): 48 * ftl/FTLOSRExit.cpp: 49 (JSC::FTL::OSRExit::willArriveAtExitFromIndirectExceptionCheck): 50 (JSC::FTL::OSRExit::willArriveAtOSRExitFromCallOperation): 51 * ftl/FTLOSRExit.h: 52 * ftl/FTLState.h: 53 1 54 2015-12-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 55 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r192836 r192896 523 523 <ClCompile Include="..\ftl\FTLCommonValues.cpp" /> 524 524 <ClCompile Include="..\ftl\FTLCompile.cpp" /> 525 <ClCompile Include="..\ftl\FTLCompileBinaryOp.cpp" /> 525 526 <ClCompile Include="..\ftl\FTLDataSection.cpp" /> 526 527 <ClCompile Include="..\ftl\FTLDWARFDebugLineInfo.cpp" /> … … 1291 1292 <ClInclude Include="..\ftl\FTLCommonValues.h" /> 1292 1293 <ClInclude Include="..\ftl\FTLCompile.h" /> 1294 <ClInclude Include="..\ftl\FTLCompileBinaryOp.h" /> 1293 1295 <ClInclude Include="..\ftl\FTLDataSection.h" /> 1294 1296 <ClInclude Include="..\ftl\FTLDWARFDebugLineInfo.h" /> … … 1307 1309 <ClInclude Include="..\ftl\FTLGeneratedFunction.h" /> 1308 1310 <ClInclude Include="..\ftl\FTLInlineCacheDescriptor.h" /> 1311 <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h" /> 1309 1312 <ClInclude Include="..\ftl\FTLInlineCacheSize.h" /> 1310 1313 <ClInclude Include="..\ftl\FTLIntrinsicRepository.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r192836 r192896 1561 1561 <Filter>ftl</Filter> 1562 1562 </ClCompile> 1563 <ClCompile Include="..\ftl\FTLCompileBinaryOp.cpp"> 1564 <Filter>ftl</Filter> 1565 </ClCompile> 1563 1566 <ClCompile Include="..\ftl\FTLDataSection.cpp"> 1564 1567 <Filter>ftl</Filter> … … 4133 4136 <Filter>ftl</Filter> 4134 4137 </ClInclude> 4138 <ClInclude Include="..\ftl\FTLCompileBinaryOp.h"> 4139 <Filter>ftl</Filter> 4140 </ClInclude> 4135 4141 <ClInclude Include="..\ftl\FTLDataSection.h"> 4136 4142 <Filter>ftl</Filter> … … 4173 4179 </ClInclude> 4174 4180 <ClInclude Include="..\ftl\FTLInlineCacheDescriptor.h"> 4181 <Filter>ftl</Filter> 4182 </ClInclude> 4183 <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h"> 4175 4184 <Filter>ftl</Filter> 4176 4185 </ClInclude> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r192863 r192896 1977 1977 FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */; settings = {ASSET_TAGS = (); }; }; 1978 1978 FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; settings = {ASSET_TAGS = (); }; }; 1979 FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */; settings = {ASSET_TAGS = (); }; }; 1980 FE187A191C0E13E30038BBCA /* FTLCompileBinaryOp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */; settings = {ASSET_TAGS = (); }; }; 1981 FE187A1A1C0E13E60038BBCA /* FTLCompileBinaryOp.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */; settings = {ASSET_TAGS = (); }; }; 1979 1982 FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1C0FFC1B193E9800B53FCA /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1980 1983 FE1C0FFF1B194FD100B53FCA /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1C0FFE1B194FD100B53FCA /* Exception.cpp */; }; … … 4121 4124 FE187A0B1C0229230038BBCA /* JITDivGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITDivGenerator.h; sourceTree = "<group>"; }; 4122 4125 FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SnippetOperand.h; sourceTree = "<group>"; }; 4126 FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCompileBinaryOp.cpp; path = ftl/FTLCompileBinaryOp.cpp; sourceTree = "<group>"; }; 4127 FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLCompileBinaryOp.h; path = ftl/FTLCompileBinaryOp.h; sourceTree = "<group>"; }; 4128 FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLInlineCacheDescriptorInlines.h; path = ftl/FTLInlineCacheDescriptorInlines.h; sourceTree = "<group>"; }; 4123 4129 FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; }; 4124 4130 FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; }; … … 4395 4401 0FEA0A00170513DB00BB722C /* FTLCompile.cpp */, 4396 4402 0FEA0A01170513DB00BB722C /* FTLCompile.h */, 4403 FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */, 4404 FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */, 4397 4405 0FE95F7718B5694700B531FB /* FTLDataSection.cpp */, 4398 4406 0FE95F7818B5694700B531FB /* FTLDataSection.h */, … … 4422 4430 A78A977C179738D5009DF744 /* FTLGeneratedFunction.h */, 4423 4431 0F25F1A7181635F300522F39 /* FTLInlineCacheDescriptor.h */, 4432 FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */, 4424 4433 0F25F1A8181635F300522F39 /* FTLInlineCacheSize.cpp */, 4425 4434 0F25F1A9181635F300522F39 /* FTLInlineCacheSize.h */, … … 6660 6669 0FFA549816B8835300B3A982 /* A64DOpcode.h in Headers */, 6661 6670 0F1FE51C1922A3BC006987C5 /* AbortReason.h in Headers */, 6671 FE187A1A1C0E13E60038BBCA /* FTLCompileBinaryOp.h in Headers */, 6662 6672 860161E30F3A83C100F84710 /* AbstractMacroAssembler.h in Headers */, 6663 6673 0F55F0F514D1063C00AC7649 /* AbstractPC.h in Headers */, … … 6855 6865 0F7C11AD1BC3862C00C74CDB /* CopyBarrier.h in Headers */, 6856 6866 0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */, 6867 FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */, 6857 6868 C2239D1816262BDD005AC5FD /* CopyVisitor.h in Headers */, 6858 6869 C2239D1916262BDD005AC5FD /* CopyVisitorInlines.h in Headers */, … … 8534 8545 0F3A1BF91A9ECB7D000DE01A /* DFGPutStackSinkingPhase.cpp in Sources */, 8535 8546 0F2FCCFB18A60070001A27F8 /* DFGSafepoint.cpp in Sources */, 8547 FE187A191C0E13E30038BBCA /* FTLCompileBinaryOp.cpp in Sources */, 8536 8548 86EC9DD21328DF82002B2AD7 /* DFGSpeculativeJIT.cpp in Sources */, 8537 8549 86880F1F14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp in Sources */, -
trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp
r192845 r192896 38 38 #include "DataView.h" 39 39 #include "Disassembler.h" 40 #include "FTLCompileBinaryOp.h" 40 41 #include "FTLExceptionHandlerManager.h" 41 42 #include "FTLExitThunkGenerator.h" 43 #include "FTLInlineCacheDescriptorInlines.h" 42 44 #include "FTLInlineCacheSize.h" 43 45 #include "FTLJITCode.h" 44 46 #include "FTLThunks.h" 45 47 #include "FTLUnwindInfo.h" 46 #include "JITSubGenerator.h"47 48 #include "LLVMAPI.h" 48 49 #include "LinkBuffer.h" … … 308 309 } 309 310 310 class BinarySnippetRegisterContext { 311 // The purpose of this class is to shuffle registers to get them into the state 312 // that baseline code expects so that we can use the baseline snippet generators i.e. 313 // 1. Ensure that the inputs and output are not in reserved registers (which 314 // include the tag registers). The snippet will use these reserved registers. 315 // Hence, we need to put the inputs and output in other scratch registers. 316 // 2. Tag registers are loaded with the expected values. 317 // 318 // When the snippet is done: 319 // 1. If we had re-assigned the result register to a scratch, we need to copy the 320 // result back from the scratch. 321 // 2. Restore the input and tag registers to the values that LLVM put there originally. 322 // That is unless when one of them is also the result register. In that case, we 323 // don't want to trash the result, and hence, should not restore into it. 324 325 public: 326 BinarySnippetRegisterContext(ScratchRegisterAllocator& allocator, GPRReg& result, GPRReg& left, GPRReg& right) 327 : m_allocator(allocator) 328 , m_result(result) 329 , m_left(left) 330 , m_right(right) 331 , m_origResult(result) 332 , m_origLeft(left) 333 , m_origRight(right) 334 { 335 m_allocator.lock(m_result); 336 m_allocator.lock(m_left); 337 m_allocator.lock(m_right); 338 339 RegisterSet inputAndOutputRegisters = RegisterSet(m_left, m_right, m_result); 340 RegisterSet reservedRegisters; 341 for (GPRReg reg : GPRInfo::reservedRegisters()) 342 reservedRegisters.set(reg); 343 344 if (reservedRegisters.get(m_left)) 345 m_left = m_allocator.allocateScratchGPR(); 346 if (reservedRegisters.get(m_right)) { 347 if (m_origRight == m_origLeft) 348 m_right = m_left; 349 else 350 m_right = m_allocator.allocateScratchGPR(); 351 } 352 if (reservedRegisters.get(m_result)) { 353 if (m_origResult == m_origLeft) 354 m_result = m_left; 355 else if (m_origResult == m_origRight) 356 m_result = m_right; 357 else 358 m_result = m_allocator.allocateScratchGPR(); 359 } 360 361 if (!inputAndOutputRegisters.get(GPRInfo::tagMaskRegister)) 362 m_savedTagMaskRegister = m_allocator.allocateScratchGPR(); 363 if (!inputAndOutputRegisters.get(GPRInfo::tagTypeNumberRegister)) 364 m_savedTagTypeNumberRegister = m_allocator.allocateScratchGPR(); 365 } 366 367 void initializeRegisters(CCallHelpers& jit) 368 { 369 if (m_left != m_origLeft) 370 jit.move(m_origLeft, m_left); 371 if (m_right != m_origRight && m_origRight != m_origLeft) 372 jit.move(m_origRight, m_right); 373 374 if (m_savedTagMaskRegister != InvalidGPRReg) 375 jit.move(GPRInfo::tagMaskRegister, m_savedTagMaskRegister); 376 if (m_savedTagTypeNumberRegister != InvalidGPRReg) 377 jit.move(GPRInfo::tagTypeNumberRegister, m_savedTagTypeNumberRegister); 378 379 jit.emitMaterializeTagCheckRegisters(); 380 } 381 382 void restoreRegisters(CCallHelpers& jit) 383 { 384 if (m_origResult != m_result) 385 jit.move(m_result, m_origResult); 386 if (m_origLeft != m_left && m_origLeft != m_origResult) 387 jit.move(m_left, m_origLeft); 388 if (m_origRight != m_right && m_origRight != m_origResult && m_origRight != m_origLeft) 389 jit.move(m_right, m_origRight); 390 391 // We are guaranteed that the tag registers are not the same as the original input 392 // or output registers. Otherwise, we would not have allocated a scratch for them. 393 // Hence, we don't need to need to check for overlap like we do for the input registers. 394 if (m_savedTagMaskRegister != InvalidGPRReg) { 395 ASSERT(GPRInfo::tagMaskRegister != m_origLeft); 396 ASSERT(GPRInfo::tagMaskRegister != m_origRight); 397 ASSERT(GPRInfo::tagMaskRegister != m_origResult); 398 jit.move(m_savedTagMaskRegister, GPRInfo::tagMaskRegister); 399 } 400 if (m_savedTagTypeNumberRegister != InvalidGPRReg) { 401 ASSERT(GPRInfo::tagTypeNumberRegister != m_origLeft); 402 ASSERT(GPRInfo::tagTypeNumberRegister != m_origRight); 403 ASSERT(GPRInfo::tagTypeNumberRegister != m_origResult); 404 jit.move(m_savedTagTypeNumberRegister, GPRInfo::tagTypeNumberRegister); 405 } 406 } 407 408 private: 409 ScratchRegisterAllocator& m_allocator; 410 411 GPRReg& m_result; 412 GPRReg& m_left; 413 GPRReg& m_right; 414 415 GPRReg m_origResult; 416 GPRReg m_origLeft; 417 GPRReg m_origRight; 418 419 GPRReg m_savedTagMaskRegister { InvalidGPRReg }; 420 GPRReg m_savedTagTypeNumberRegister { InvalidGPRReg }; 421 }; 422 423 static void generateArithSubICFastPath( 311 static void generateBinaryOpICFastPath( 424 312 State& state, CodeBlock* codeBlock, GeneratedFunction generatedFunction, 425 StackMaps::RecordMap& recordMap, ArithSubDescriptor& ic)313 StackMaps::RecordMap& recordMap, BinaryOpDescriptor& ic) 426 314 { 427 315 VM& vm = state.graph.m_vm; 428 size_t sizeOfIC = sizeOfArithSub();316 size_t sizeOfIC = ic.size(); 429 317 430 318 StackMaps::RecordMap::iterator iter = recordMap.find(ic.stackmapID()); … … 441 329 CCallHelpers fastPathJIT(&vm, codeBlock); 442 330 443 SnippetOperand leftOperand(ic.leftType());444 SnippetOperand rightOperand(ic.rightType());445 446 331 GPRReg result = record.locations[0].directGPR(); 447 332 GPRReg left = record.locations[1].directGPR(); 448 333 GPRReg right = record.locations[2].directGPR(); 449 450 334 RegisterSet usedRegisters = usedRegistersFor(record); 451 ScratchRegisterAllocator allocator(usedRegisters); 452 453 BinarySnippetRegisterContext context(allocator, result, left, right); 454 455 GPRReg scratchGPR = allocator.allocateScratchGPR(); 456 FPRReg leftFPR = allocator.allocateScratchFPR(); 457 FPRReg rightFPR = allocator.allocateScratchFPR(); 458 FPRReg scratchFPR = InvalidFPRReg; 459 460 JITSubGenerator gen(leftOperand, rightOperand, JSValueRegs(result), JSValueRegs(left), JSValueRegs(right), leftFPR, rightFPR, scratchGPR, scratchFPR); 461 462 auto numberOfBytesUsedToPreserveReusedRegisters = 463 allocator.preserveReusedRegistersByPushing(fastPathJIT, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace); 464 465 context.initializeRegisters(fastPathJIT); 466 gen.generateFastPath(fastPathJIT); 467 468 ASSERT(gen.didEmitFastPath()); 469 gen.endJumpList().link(&fastPathJIT); 470 context.restoreRegisters(fastPathJIT); 471 allocator.restoreReusedRegistersByPopping(fastPathJIT, numberOfBytesUsedToPreserveReusedRegisters, 472 ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall); 473 CCallHelpers::Jump done = fastPathJIT.jump(); 474 475 gen.slowPathJumpList().link(&fastPathJIT); 476 context.restoreRegisters(fastPathJIT); 477 allocator.restoreReusedRegistersByPopping(fastPathJIT, numberOfBytesUsedToPreserveReusedRegisters, 478 ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall); 479 CCallHelpers::Jump slowPathStart = fastPathJIT.jump(); 335 336 CCallHelpers::Jump done; 337 CCallHelpers::Jump slowPathStart; 338 339 switch (ic.nodeType()) { 340 case ArithSub: 341 generateArithSubFastPath(ic, fastPathJIT, result, left, right, usedRegisters, done, slowPathStart); 342 break; 343 default: 344 RELEASE_ASSERT_NOT_REACHED(); 345 } 480 346 481 347 char* startOfIC = bitwise_cast<char*>(generatedFunction) + record.instructionOffset; 482 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "ArithSub inline cache fast path", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 348 const char* fastPathICName = ic.fastPathICName(); 349 generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, fastPathICName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) { 483 350 linkBuffer.link(done, CodeLocationLabel(startOfIC + sizeOfIC)); 484 351 state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i], CodeLocationLabel(startOfIC + sizeOfIC)); … … 651 518 652 519 OSRExit* callOperationExit = nullptr; 653 if (exitDescriptor.m_exceptionType == ExceptionType:: SubGenerator) {520 if (exitDescriptor.m_exceptionType == ExceptionType::BinaryOpGenerator) { 654 521 exceptionHandlerManager.addNewCallOperationExit(iter->value[j].index, state.jitCode->osrExit.size() - 1); 655 522 callOperationExit = &exit; … … 695 562 if (base == result) 696 563 callOperationExit->registersToPreserveForCallThatMightThrow.set(base); 697 } else if (exitDescriptor.m_exceptionType == ExceptionType:: SubGenerator) {564 } else if (exitDescriptor.m_exceptionType == ExceptionType::BinaryOpGenerator) { 698 565 GPRReg result = record.locations[0].directGPR(); 699 566 GPRReg left = record.locations[1].directGPR(); … … 756 623 || !state.putByIds.isEmpty() 757 624 || !state.checkIns.isEmpty() 758 || !state. arithSubs.isEmpty()625 || !state.binaryOps.isEmpty() 759 626 || !state.lazySlowPaths.isEmpty()) { 760 627 CCallHelpers slowPathJIT(&vm, codeBlock); … … 904 771 } 905 772 906 for (size_t i = state. arithSubs.size(); i--;) {907 ArithSubDescriptor& arithSub = state.arithSubs[i];773 for (size_t i = state.binaryOps.size(); i--;) { 774 BinaryOpDescriptor& binaryOp = state.binaryOps[i]; 908 775 909 776 if (verboseCompilationEnabled()) 910 dataLog("Handling ArithSub stackmap #", arithSub.stackmapID(), "\n");911 912 auto iter = recordMap.find( arithSub.stackmapID());777 dataLog("Handling ", binaryOp.name(), " stackmap #", binaryOp.stackmapID(), "\n"); 778 779 auto iter = recordMap.find(binaryOp.stackmapID()); 913 780 if (iter == recordMap.end()) 914 781 continue; // It was optimized out. 915 782 916 CodeOrigin codeOrigin = arithSub.codeOrigin();783 CodeOrigin codeOrigin = binaryOp.codeOrigin(); 917 784 for (unsigned i = 0; i < iter->value.size(); ++i) { 918 785 StackMaps::Record& record = iter->value[i].record; … … 923 790 GPRReg right = record.locations[2].directGPR(); 924 791 925 arithSub.m_slowPathStarts.append(slowPathJIT.label());792 binaryOp.m_slowPathStarts.append(slowPathJIT.label()); 926 793 bool addedUniqueExceptionJump = addNewExceptionJumpIfNecessary(iter->value[i].index); 927 794 if (result == left || result == right) { … … 933 800 934 801 callOperation(state, usedRegisters, slowPathJIT, codeOrigin, addedUniqueExceptionJump ? &exceptionJumpsToLink.last().first : &exceptionTarget, 935 operationValueSub, result, left, right).call();936 937 arithSub.m_slowPathDone.append(slowPathJIT.jump());802 binaryOp.slowPathFunction(), result, left, right).call(); 803 804 binaryOp.m_slowPathDone.append(slowPathJIT.jump()); 938 805 } 939 806 } … … 1023 890 sizeOfIn()); 1024 891 } 1025 for (unsigned i = state. arithSubs.size(); i--;) {1026 ArithSubDescriptor& arithSub = state.arithSubs[i];1027 generate ArithSubICFastPath(state, codeBlock, generatedFunction, recordMap, arithSub);892 for (unsigned i = state.binaryOps.size(); i--;) { 893 BinaryOpDescriptor& binaryOp = state.binaryOps[i]; 894 generateBinaryOpICFastPath(state, codeBlock, generatedFunction, recordMap, binaryOp); 1028 895 } 1029 896 for (unsigned i = state.lazySlowPaths.size(); i--;) { -
trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h
r192334 r192896 30 30 31 31 #include "CodeOrigin.h" 32 #include "DFGAbstractValue.h" 32 33 #include "FTLLazySlowPath.h" 33 34 #include "JITInlineCacheGenerator.h" 34 35 #include "MacroAssembler.h" 36 #include "SnippetOperand.h" 35 37 #include <wtf/text/UniquedStringImpl.h> 36 38 … … 124 126 }; 125 127 126 class ArithSubDescriptor : public InlineCacheDescriptor { 127 public: 128 ArithSubDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, ResultType leftType, ResultType rightType) 128 class BinaryOpDescriptor : public InlineCacheDescriptor { 129 public: 130 typedef EncodedJSValue (*SlowPathFunction)(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2); 131 132 unsigned nodeType() const { return m_nodeType; } 133 size_t size() const { return m_size; } 134 const char* name() const { return m_name; } 135 const char* fastPathICName() const { return m_fastPathICName; } 136 SlowPathFunction slowPathFunction() const { return m_slowPathFunction; } 137 138 SnippetOperand leftOperand() { return m_leftOperand; } 139 SnippetOperand rightOperand() { return m_rightOperand; } 140 141 Vector<MacroAssembler::Label> m_slowPathStarts; 142 143 protected: 144 BinaryOpDescriptor(unsigned nodeType, unsigned stackmapID, CodeOrigin codeOrigin, 145 size_t size, const char* name, const char* fastPathICName, 146 SlowPathFunction slowPathFunction, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand) 129 147 : InlineCacheDescriptor(stackmapID, codeOrigin, nullptr) 130 , m_leftType(leftType) 131 , m_rightType(rightType) 132 { 133 } 134 135 ResultType leftType() const { return m_leftType; } 136 ResultType rightType() const { return m_rightType; } 137 138 Vector<MacroAssembler::Label> m_slowPathStarts; 139 140 private: 141 ResultType m_leftType; 142 ResultType m_rightType; 148 , m_nodeType(nodeType) 149 , m_size(size) 150 , m_name(name) 151 , m_fastPathICName(fastPathICName) 152 , m_slowPathFunction(slowPathFunction) 153 , m_leftOperand(leftOperand) 154 , m_rightOperand(rightOperand) 155 { 156 } 157 158 unsigned m_nodeType; 159 size_t m_size; 160 const char* m_name; 161 const char* m_fastPathICName; 162 SlowPathFunction m_slowPathFunction; 163 164 SnippetOperand m_leftOperand; 165 SnippetOperand m_rightOperand; 166 }; 167 168 class ArithSubDescriptor : public BinaryOpDescriptor { 169 public: 170 ArithSubDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand); 171 static size_t icSize(); 143 172 }; 144 173 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r192882 r192896 1656 1656 StackmapArgumentList arguments; 1657 1657 arguments.append(m_out.constInt64(stackmapID)); 1658 arguments.append(m_out.constInt32( sizeOfArithSub()));1658 arguments.append(m_out.constInt32(ArithSubDescriptor::icSize())); 1659 1659 arguments.append(constNull(m_out.ref8)); 1660 1660 arguments.append(m_out.constInt32(2)); … … 1662 1662 arguments.append(right); 1663 1663 1664 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, ExceptionType::SubGenerator, 3); // left, right, and result show up in the stackmap locations. 1664 appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments, 1665 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations. 1665 1666 1666 1667 LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments); 1667 1668 setInstructionCallingConvention(call, LLVMAnyRegCallConv); 1668 1669 1669 m_ftlState.arithSubs.append(ArithSubDescriptor(stackmapID, m_node->origin.semantic,1670 abstractValue(m_node->child1()).resultType(),1671 abstractValue(m_node->child2()).resultType()));1670 SnippetOperand leftOperand(abstractValue(m_node->child1()).resultType()); 1671 SnippetOperand rightOperand(abstractValue(m_node->child2()).resultType()); 1672 m_ftlState.binaryOps.append(ArithSubDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand)); 1672 1673 1673 1674 setJSValue(call); -
trunk/Source/JavaScriptCore/ftl/FTLOSRExit.cpp
r192845 r192896 173 173 case ExceptionType::PutById: 174 174 case ExceptionType::LazySlowPath: 175 case ExceptionType:: SubGenerator:175 case ExceptionType::BinaryOpGenerator: 176 176 case ExceptionType::GetByIdCallOperation: 177 177 case ExceptionType::PutByIdCallOperation: … … 201 201 case ExceptionType::GetByIdCallOperation: 202 202 case ExceptionType::PutByIdCallOperation: 203 case ExceptionType:: SubGenerator:203 case ExceptionType::BinaryOpGenerator: 204 204 return true; 205 205 default: -
trunk/Source/JavaScriptCore/ftl/FTLOSRExit.h
r192845 r192896 146 146 PutByIdCallOperation, 147 147 LazySlowPath, 148 SubGenerator,148 BinaryOpGenerator, 149 149 }; 150 150 -
trunk/Source/JavaScriptCore/ftl/FTLState.h
r192605 r192896 92 92 SegmentedVector<PutByIdDescriptor> putByIds; 93 93 SegmentedVector<CheckInDescriptor> checkIns; 94 SegmentedVector< ArithSubDescriptor> arithSubs;94 SegmentedVector<BinaryOpDescriptor> binaryOps; 95 95 SegmentedVector<LazySlowPathDescriptor> lazySlowPaths; 96 96 #if ENABLE(MASM_PROBE)
Note:
See TracChangeset
for help on using the changeset viewer.