Changeset 228728 in webkit
- Timestamp:
- Feb 19, 2018 9:01:57 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r228727 r228728 1 2018-02-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [FTL] Support ArrayPush for ArrayStorage 4 https://bugs.webkit.org/show_bug.cgi?id=182782 5 6 Reviewed by Saam Barati. 7 8 Existing array-push-multiple-storage.js covers ArrayPush(ArrayStorage) multiple arguments case. 9 10 * stress/array-push-array-storage-beyond-int32.js: Added. 11 (shouldBe): 12 (test): 13 * stress/array-push-array-storage.js: Added. 14 (shouldBe): 15 (test): 16 * stress/array-push-multiple-array-storage-beyond-int32.js: Added. 17 (shouldBe): 18 (test): 19 * stress/array-push-multiple-storage-continuous.js: Added. 20 (shouldBe): 21 (test): 22 1 23 2018-02-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 24 -
trunk/Source/JavaScriptCore/ChangeLog
r228727 r228728 1 2018-02-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [FTL] Support ArrayPush for ArrayStorage 4 https://bugs.webkit.org/show_bug.cgi?id=182782 5 6 Reviewed by Saam Barati. 7 8 This patch adds support for ArrayPush(ArrayStorage). We just port ArrayPush(ArrayStorage) in DFG to FTL. 9 10 * ftl/FTLAbstractHeapRepository.h: 11 * ftl/FTLCapabilities.cpp: 12 (JSC::FTL::canCompile): 13 * ftl/FTLLowerDFGToB3.cpp: 14 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPush): 15 1 16 2018-02-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 17 -
trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp
r228727 r228728 320 320 case ArrayIndexOf: 321 321 case ArrayPop: 322 case ArrayPush: 322 323 case ParseInt: 323 324 case AtomicsAdd: … … 437 438 break; 438 439 case PutByValWithThis: 439 break;440 case ArrayPush:441 switch (node->arrayMode().type()) {442 case Array::Int32:443 case Array::Contiguous:444 case Array::Double:445 break;446 default:447 return CannotCompile;448 }449 440 break; 450 441 default: -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r228727 r228728 4468 4468 operation = m_out.operation(operationArrayPushDoubleMultiple); 4469 4469 ValueFromBlock slowResult = m_out.anchor(vmCall(Int64, operation, m_callFrame, base, buffer, m_out.constInt32(elementCount))); 4470 m_out.storePtr(m_out.constIntPtr(0), m_out.absolute(scratchBuffer->addressOfActiveLength())); 4471 m_out.jump(continuation); 4472 4473 m_out.appendTo(continuation, lastNext); 4474 setJSValue(m_out.phi(Int64, fastResult, slowResult)); 4475 return; 4476 } 4477 4478 case Array::ArrayStorage: { 4479 // This ensures that the result of ArrayPush is Int32 in AI. 4480 int32_t largestPositiveInt32Length = 0x7fffffff - elementCount; 4481 4482 LValue prevLength = m_out.load32(storage, m_heaps.Butterfly_publicLength); 4483 // Refuse to handle bizarre lengths. 4484 speculate(Uncountable, noValue(), nullptr, m_out.above(prevLength, m_out.constInt32(largestPositiveInt32Length))); 4485 4486 if (elementCount == 1) { 4487 Edge& element = m_graph.varArgChild(m_node, elementOffset); 4488 4489 LValue value = lowJSValue(element); 4490 4491 LBasicBlock fastPath = m_out.newBlock(); 4492 LBasicBlock slowPath = m_out.newBlock(); 4493 LBasicBlock continuation = m_out.newBlock(); 4494 4495 m_out.branch( 4496 m_out.aboveOrEqual( 4497 prevLength, m_out.load32(storage, m_heaps.Butterfly_vectorLength)), 4498 rarely(slowPath), usually(fastPath)); 4499 4500 LBasicBlock lastNext = m_out.appendTo(fastPath, slowPath); 4501 m_out.store64( 4502 value, m_out.baseIndex(m_heaps.ArrayStorage_vector, storage, m_out.zeroExtPtr(prevLength))); 4503 LValue newLength = m_out.add(prevLength, m_out.int32One); 4504 m_out.store32(newLength, storage, m_heaps.Butterfly_publicLength); 4505 m_out.store32( 4506 m_out.add(m_out.load32(storage, m_heaps.ArrayStorage_numValuesInVector), m_out.int32One), 4507 storage, m_heaps.ArrayStorage_numValuesInVector); 4508 4509 ValueFromBlock fastResult = m_out.anchor(boxInt32(newLength)); 4510 m_out.jump(continuation); 4511 4512 m_out.appendTo(slowPath, continuation); 4513 ValueFromBlock slowResult = m_out.anchor( 4514 vmCall(Int64, m_out.operation(operationArrayPush), m_callFrame, value, base)); 4515 m_out.jump(continuation); 4516 4517 m_out.appendTo(continuation, lastNext); 4518 setJSValue(m_out.phi(Int64, fastResult, slowResult)); 4519 return; 4520 } 4521 4522 LValue newLength = m_out.add(prevLength, m_out.constInt32(elementCount)); 4523 4524 LBasicBlock fastPath = m_out.newBlock(); 4525 LBasicBlock slowPath = m_out.newBlock(); 4526 LBasicBlock setup = m_out.newBlock(); 4527 LBasicBlock slowCallPath = m_out.newBlock(); 4528 LBasicBlock continuation = m_out.newBlock(); 4529 4530 LValue beyondVectorLength = m_out.above(newLength, m_out.load32(storage, m_heaps.Butterfly_vectorLength)); 4531 4532 m_out.branch(beyondVectorLength, rarely(slowPath), usually(fastPath)); 4533 4534 LBasicBlock lastNext = m_out.appendTo(fastPath, slowPath); 4535 m_out.store32(newLength, storage, m_heaps.Butterfly_publicLength); 4536 m_out.store32( 4537 m_out.add(m_out.load32(storage, m_heaps.ArrayStorage_numValuesInVector), m_out.constInt32(elementCount)), 4538 storage, m_heaps.ArrayStorage_numValuesInVector); 4539 ValueFromBlock fastBufferResult = m_out.anchor(m_out.baseIndex(storage, m_out.zeroExtPtr(prevLength), ScaleEight, ArrayStorage::vectorOffset())); 4540 m_out.jump(setup); 4541 4542 m_out.appendTo(slowPath, setup); 4543 size_t scratchSize = sizeof(EncodedJSValue) * elementCount; 4544 ASSERT(scratchSize); 4545 ScratchBuffer* scratchBuffer = vm().scratchBufferForSize(scratchSize); 4546 m_out.storePtr(m_out.constIntPtr(scratchSize), m_out.absolute(scratchBuffer->addressOfActiveLength())); 4547 ValueFromBlock slowBufferResult = m_out.anchor(m_out.constIntPtr(static_cast<EncodedJSValue*>(scratchBuffer->dataBuffer()))); 4548 m_out.jump(setup); 4549 4550 m_out.appendTo(setup, slowCallPath); 4551 LValue buffer = m_out.phi(pointerType(), fastBufferResult, slowBufferResult); 4552 for (unsigned elementIndex = 0; elementIndex < elementCount; ++elementIndex) { 4553 Edge& element = m_graph.varArgChild(m_node, elementIndex + elementOffset); 4554 4555 LValue value = lowJSValue(element); 4556 m_out.store64(value, m_out.baseIndex(m_heaps.variables, buffer, m_out.constInt32(elementIndex), jsNumber(elementIndex))); 4557 } 4558 ValueFromBlock fastResult = m_out.anchor(boxInt32(newLength)); 4559 4560 m_out.branch(beyondVectorLength, rarely(slowCallPath), usually(continuation)); 4561 4562 m_out.appendTo(slowCallPath, continuation); 4563 ValueFromBlock slowResult = m_out.anchor(vmCall(Int64, m_out.operation(operationArrayPushMultiple), m_callFrame, base, buffer, m_out.constInt32(elementCount))); 4470 4564 m_out.storePtr(m_out.constIntPtr(0), m_out.absolute(scratchBuffer->addressOfActiveLength())); 4471 4565 m_out.jump(continuation); … … 14636 14730 m_out.constInt32(ArrayStorageShape)), 14637 14731 m_out.constInt32(SlowPutArrayStorageShape - ArrayStorageShape)); 14638 m_out.branch(isAnArrayStorageShape, u sually(checkCase), usually(continuation));14732 m_out.branch(isAnArrayStorageShape, unsure(checkCase), unsure(continuation)); 14639 14733 14640 14734 LBasicBlock lastNext = m_out.appendTo(checkCase, trueCase); … … 14647 14741 m_out.branch( 14648 14742 m_out.testNonZero32(indexingType, m_out.constInt32(IsArray)), 14649 u sually(trueCase), usually(continuation));14743 unsure(trueCase), unsure(continuation)); 14650 14744 break; 14651 14745 … … 14654 14748 m_out.branch( 14655 14749 m_out.testIsZero32(indexingType, m_out.constInt32(IsArray)), 14656 u sually(trueCase), usually(continuation));14750 unsure(trueCase), unsure(continuation)); 14657 14751 break; 14658 14752
Note: See TracChangeset
for help on using the changeset viewer.