Changeset 121925 in webkit for trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- Jul 5, 2012, 3:55:51 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r120786 r121925 152 152 } 153 153 154 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch) 155 { 156 loadPtr(Address(base, JSObject::offsetOfPropertyStorage()), scratch); 157 loadPtr(BaseIndex(scratch, offset, ScalePtr, 0), result); 154 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch, FinalObjectMode finalObjectMode) 155 { 156 ASSERT(sizeof(JSValue) == 8); 157 158 if (finalObjectMode == MayBeFinal) { 159 Jump isInline = branch32(LessThan, offset, TrustedImm32(inlineStorageCapacity)); 160 loadPtr(Address(base, JSObject::offsetOfOutOfLineStorage()), scratch); 161 Jump done = jump(); 162 isInline.link(this); 163 addPtr(TrustedImm32(JSObject::offsetOfInlineStorage() + inlineStorageCapacity * sizeof(EncodedJSValue)), base, scratch); 164 done.link(this); 165 } else { 166 #if !ASSERT_DISABLED 167 Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(inlineStorageCapacity)); 168 breakpoint(); 169 isOutOfLine.link(this); 170 #endif 171 loadPtr(Address(base, JSObject::offsetOfOutOfLineStorage()), scratch); 172 } 173 loadPtr(BaseIndex(scratch, offset, ScalePtr, -inlineStorageCapacity * static_cast<ptrdiff_t>(sizeof(JSValue))), result); 158 174 } 159 175 … … 284 300 { 285 301 // Assert that the following instruction is a get_by_id. 286 ASSERT(m_interpreter->getOpcodeID((currentInstruction + OPCODE_LENGTH(op_method_check))->u.opcode) == op_get_by_id); 302 ASSERT(m_interpreter->getOpcodeID((currentInstruction + OPCODE_LENGTH(op_method_check))->u.opcode) == op_get_by_id 303 || m_interpreter->getOpcodeID((currentInstruction + OPCODE_LENGTH(op_method_check))->u.opcode) == op_get_by_id_out_of_line); 287 304 288 305 currentInstruction += OPCODE_LENGTH(op_method_check); … … 374 391 addSlowCase(structureCheck); 375 392 376 loadPtr(Address(regT0, JSObject::offsetOfPropertyStorage()), regT0);393 ConvertibleLoadLabel propertyStorageLoad = convertibleLoadPtr(Address(regT0, JSObject::offsetOfOutOfLineStorage()), regT0); 377 394 DataLabelCompact displacementLabel = loadPtrWithCompactAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); 378 395 … … 381 398 END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath); 382 399 383 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubGetById, m_bytecodeOffset, hotPathBegin, structureToCompare, structureCheck, displacementLabel, putResult));400 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubGetById, m_bytecodeOffset, hotPathBegin, structureToCompare, structureCheck, propertyStorageLoad, displacementLabel, putResult)); 384 401 } 385 402 … … 441 458 addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)))); 442 459 443 loadPtr(Address(regT0, JSObject::offsetOfPropertyStorage()), regT2);460 ConvertibleLoadLabel propertyStorageLoad = convertibleLoadPtr(Address(regT0, JSObject::offsetOfOutOfLineStorage()), regT2); 444 461 DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT2, patchPutByIdDefaultOffset)); 445 462 … … 448 465 emitWriteBarrier(regT0, regT1, regT2, regT3, ShouldFilterImmediates, WriteBarrierForPropertyAccess); 449 466 450 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubPutById, m_bytecodeOffset, hotPathBegin, structureToCompare, displacementLabel));467 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubPutById, m_bytecodeOffset, hotPathBegin, structureToCompare, propertyStorageLoad, displacementLabel)); 451 468 } 452 469 … … 472 489 // Compile a store into an object's property storage. May overwrite the 473 490 // value in objectReg. 474 void JIT::compilePutDirectOffset(RegisterID base, RegisterID value, size_t cachedOffset) 475 { 476 int offset = cachedOffset * sizeof(JSValue); 477 loadPtr(Address(base, JSObject::offsetOfPropertyStorage()), base); 478 storePtr(value, Address(base, offset)); 491 void JIT::compilePutDirectOffset(RegisterID base, RegisterID value, PropertyOffset cachedOffset) 492 { 493 if (isInlineOffset(cachedOffset)) { 494 storePtr(value, Address(base, JSObject::offsetOfInlineStorage() + sizeof(JSValue) * offsetInInlineStorage(cachedOffset))); 495 return; 496 } 497 498 loadPtr(Address(base, JSObject::offsetOfOutOfLineStorage()), base); 499 storePtr(value, Address(base, sizeof(JSValue) * offsetInOutOfLineStorage(cachedOffset))); 479 500 } 480 501 481 502 // Compile a load from an object's property storage. May overwrite base. 482 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, size_t cachedOffset) 483 { 484 int offset = cachedOffset * sizeof(JSValue); 485 loadPtr(Address(base, JSObject::offsetOfPropertyStorage()), result); 486 loadPtr(Address(result, offset), result); 487 } 488 489 void JIT::compileGetDirectOffset(JSObject* base, RegisterID result, size_t cachedOffset) 490 { 491 loadPtr(base->addressOfPropertyStorage(), result); 492 loadPtr(Address(result, cachedOffset * sizeof(WriteBarrier<Unknown>)), result); 493 } 494 495 void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct) 503 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, PropertyOffset cachedOffset) 504 { 505 if (isInlineOffset(cachedOffset)) { 506 loadPtr(Address(base, JSObject::offsetOfInlineStorage() + sizeof(JSValue) * offsetInInlineStorage(cachedOffset)), result); 507 return; 508 } 509 510 loadPtr(Address(base, JSObject::offsetOfOutOfLineStorage()), result); 511 loadPtr(Address(result, sizeof(JSValue) * offsetInOutOfLineStorage(cachedOffset)), result); 512 } 513 514 void JIT::compileGetDirectOffset(JSObject* base, RegisterID result, PropertyOffset cachedOffset) 515 { 516 if (isInlineOffset(cachedOffset)) { 517 loadPtr(base->locationForOffset(cachedOffset), result); 518 return; 519 } 520 521 loadPtr(base->addressOfOutOfLineStorage(), result); 522 loadPtr(Address(result, offsetInOutOfLineStorage(cachedOffset) * sizeof(WriteBarrier<Unknown>)), result); 523 } 524 525 void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, PropertyOffset cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct) 496 526 { 497 527 JumpList failureCases; … … 523 553 524 554 // emit a call only if storage realloc is needed 525 bool willNeedStorageRealloc = oldStructure-> propertyStorageCapacity() != newStructure->propertyStorageCapacity();555 bool willNeedStorageRealloc = oldStructure->outOfLineCapacity() != newStructure->outOfLineCapacity(); 526 556 if (willNeedStorageRealloc) { 527 557 // This trampoline was called to like a JIT stub; before we can can call again we need to … … 533 563 stubCall.skipArgument(); // ident 534 564 stubCall.skipArgument(); // value 535 stubCall.addArgument(TrustedImm32(oldStructure-> propertyStorageCapacity()));565 stubCall.addArgument(TrustedImm32(oldStructure->outOfLineCapacity())); 536 566 stubCall.addArgument(TrustedImmPtr(newStructure)); 537 567 stubCall.call(regT0); … … 573 603 } 574 604 575 void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress)605 void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress) 576 606 { 577 607 RepatchBuffer repatchBuffer(codeBlock); … … 581 611 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_self_fail)); 582 612 583 int offset = sizeof(JSValue) * cachedOffset;584 585 613 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 586 614 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(stubInfo->patch.baseline.u.get.structureToCompare), structure); 587 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelCompactAtOffset(stubInfo->patch.baseline.u.get.displacementLabel), offset); 588 } 589 590 void JIT::patchPutByIdReplace(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress, bool direct) 615 repatchBuffer.setLoadInstructionIsActive(stubInfo->hotPathBegin.convertibleLoadAtOffset(stubInfo->patch.baseline.u.get.propertyStorageLoad), isOutOfLineOffset(cachedOffset)); 616 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelCompactAtOffset(stubInfo->patch.baseline.u.get.displacementLabel), offsetRelativeToPatchedStorage(cachedOffset)); 617 } 618 619 void JIT::patchPutByIdReplace(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress, bool direct) 591 620 { 592 621 RepatchBuffer repatchBuffer(codeBlock); … … 596 625 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic)); 597 626 598 int offset = sizeof(JSValue) * cachedOffset;599 600 627 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 601 628 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(stubInfo->patch.baseline.u.put.structureToCompare), structure); 602 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel), offset); 629 repatchBuffer.setLoadInstructionIsActive(stubInfo->hotPathBegin.convertibleLoadAtOffset(stubInfo->patch.baseline.u.put.propertyStorageLoad), isOutOfLineOffset(cachedOffset)); 630 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel), offsetRelativeToPatchedStorage(cachedOffset)); 603 631 } 604 632 … … 644 672 } 645 673 646 void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)674 void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame) 647 675 { 648 676 // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is … … 711 739 } 712 740 713 void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset)741 void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, const Identifier& ident, const PropertySlot& slot, PropertyOffset cachedOffset) 714 742 { 715 743 Jump failureCase = checkStructure(regT0, structure); … … 771 799 } 772 800 773 void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, CallFrame* callFrame)801 void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, PropertyOffset cachedOffset, CallFrame* callFrame) 774 802 { 775 803 // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is … … 840 868 } 841 869 842 void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, CallFrame* callFrame)870 void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, PropertyOffset cachedOffset, CallFrame* callFrame) 843 871 { 844 872 ASSERT(count); … … 915 943 } 916 944 917 void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)945 void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame) 918 946 { 919 947 ASSERT(count);
Note:
See TracChangeset
for help on using the changeset viewer.