Changeset 220118 in webkit for trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
- Timestamp:
- Aug 1, 2017, 6:50:16 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r219981 r220118 88 88 #include <unordered_set> 89 89 #include <wtf/Box.h> 90 #include <wtf/Gigacage.h> 90 91 91 92 namespace JSC { namespace FTL { … … 665 666 break; 666 667 case GetButterfly: 668 case GetButterflyWithoutCaging: 667 669 compileGetButterfly(); 668 670 break; … … 3232 3234 void compileGetButterfly() 3233 3235 { 3234 setStorage(m_out.loadPtr(lowCell(m_node->child1()), m_heaps.JSObject_butterfly)); 3236 LValue butterfly = m_out.loadPtr(lowCell(m_node->child1()), m_heaps.JSObject_butterfly); 3237 if (m_node->op() != GetButterflyWithoutCaging) 3238 butterfly = caged(butterfly); 3239 setStorage(butterfly); 3235 3240 } 3236 3241 … … 3268 3273 3269 3274 DFG_ASSERT(m_graph, m_node, isTypedView(m_node->arrayMode().typedArrayType())); 3270 setStorage( m_out.loadPtr(cell, m_heaps.JSArrayBufferView_vector));3275 setStorage(caged(m_out.loadPtr(cell, m_heaps.JSArrayBufferView_vector))); 3271 3276 } 3272 3277 … … 3510 3515 m_out.load32NonNegative(base, m_heaps.DirectArguments_length))); 3511 3516 3517 // FIXME: I guess we need to cage DirectArguments? 3518 // https://bugs.webkit.org/show_bug.cgi?id=174920 3512 3519 TypedPointer address = m_out.baseIndex( 3513 3520 m_heaps.DirectArguments_storage, base, m_out.zeroExtPtr(index)); … … 3541 3548 LValue arguments = m_out.loadPtr(table, m_heaps.ScopedArgumentsTable_arguments); 3542 3549 3550 // FIXME: I guess we need to cage ScopedArguments? 3551 // https://bugs.webkit.org/show_bug.cgi?id=174921 3543 3552 TypedPointer address = m_out.baseIndex( 3544 3553 m_heaps.scopedArgumentsTableArguments, arguments, m_out.zeroExtPtr(index)); … … 3549 3558 m_out.equal(scopeOffset, m_out.constInt32(ScopeOffset::invalidOffset))); 3550 3559 3560 // FIXME: I guess we need to cage JSEnvironmentRecord? 3561 // https://bugs.webkit.org/show_bug.cgi?id=174922 3551 3562 address = m_out.baseIndex( 3552 3563 m_heaps.JSEnvironmentRecord_variables, scope, m_out.zeroExtPtr(scopeOffset)); … … 3556 3567 m_out.appendTo(overflowCase, continuation); 3557 3568 3569 // FIXME: I guess we need to cage overflow storage? 3570 // https://bugs.webkit.org/show_bug.cgi?id=174923 3558 3571 address = m_out.baseIndex( 3559 3572 m_heaps.ScopedArguments_overflowStorage, base, … … 5379 5392 m_out.appendTo(is8Bit, is16Bit); 5380 5393 5394 // FIXME: Need to cage strings! 5395 // https://bugs.webkit.org/show_bug.cgi?id=174924 5381 5396 ValueFromBlock char8Bit = m_out.anchor( 5382 5397 m_out.load8ZeroExt32(m_out.baseIndex( … … 5480 5495 LBasicBlock lastNext = m_out.appendTo(is8Bit, is16Bit); 5481 5496 5497 // FIXME: need to cage strings! 5498 // https://bugs.webkit.org/show_bug.cgi?id=174924 5482 5499 ValueFromBlock char8Bit = m_out.anchor( 5483 5500 m_out.load8ZeroExt32(m_out.baseIndex( … … 8076 8093 LValue unmaskedIndex = m_out.phi(Int32, indexStart); 8077 8094 LValue index = m_out.bitAnd(mask, unmaskedIndex); 8095 // FIXME: I think these buffers are caged? 8096 // https://bugs.webkit.org/show_bug.cgi?id=174925 8078 8097 LValue hashMapBucket = m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), buffer, m_out.zeroExt(index, Int64), ScaleEight)); 8079 8098 ValueFromBlock bucketResult = m_out.anchor(hashMapBucket); … … 8851 8870 int32_t offsetOfFirstProperty = static_cast<int32_t>(offsetInButterfly(firstOutOfLineOffset)) * sizeof(EncodedJSValue); 8852 8871 ValueFromBlock outOfLineResult = m_out.anchor( 8853 m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), storage, realIndex, ScaleEight, offsetOfFirstProperty)));8872 m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), caged(storage), realIndex, ScaleEight, offsetOfFirstProperty))); 8854 8873 m_out.jump(continuation); 8855 8874 … … 10269 10288 m_out.appendTo(loopBody, slowPath); 10270 10289 10290 // FIXME: Strings needs to be caged. 10291 // https://bugs.webkit.org/show_bug.cgi?id=174924 10271 10292 LValue byte = m_out.load8ZeroExt32(m_out.baseIndex(m_heaps.characters8, buffer, m_out.zeroExtPtr(index))); 10272 10293 LValue isInvalidAsciiRange = m_out.bitAnd(byte, m_out.constInt32(~0x7F)); … … 11592 11613 m_out.appendTo(performStore, lastNext); 11593 11614 } 11615 } 11616 11617 LValue caged(LValue ptr) 11618 { 11619 if (vm().gigacageEnabled().isStillValid()) { 11620 m_graph.watchpoints().addLazily(vm().gigacageEnabled()); 11621 11622 LValue basePtr = m_out.constIntPtr(g_gigacageBasePtr); 11623 LValue mask = m_out.constIntPtr(GIGACAGE_MASK); 11624 11625 // We don't have to worry about B3 messing up the bitAnd. Also, we want to get B3's excellent 11626 // codegen for 2-operand andq on x86-64. 11627 LValue masked = m_out.bitAnd(ptr, mask); 11628 11629 // But B3 will currently mess up the code generation of this add. Basically, any offset from what we 11630 // compute here will get reassociated and folded with g_gigacageBasePtr. There's a world in which 11631 // moveConstants() observes that it needs to reassociate in order to hoist the big constants. But 11632 // it's much easier to just block B3's badness here. That's what we do for now. 11633 PatchpointValue* patchpoint = m_out.patchpoint(pointerType()); 11634 patchpoint->appendSomeRegister(basePtr); 11635 patchpoint->appendSomeRegister(masked); 11636 patchpoint->setGenerator( 11637 [] (CCallHelpers& jit, const StackmapGenerationParams& params) { 11638 jit.addPtr(params[1].gpr(), params[2].gpr(), params[0].gpr()); 11639 }); 11640 patchpoint->effects = Effects::none(); 11641 return patchpoint; 11642 } 11643 11644 return ptr; 11594 11645 } 11595 11646
Note:
See TracChangeset
for help on using the changeset viewer.