Changeset 82130 in webkit for trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- Mar 28, 2011, 10:14:57 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r80969 r82130 55 55 JSInterfaceJIT jit; 56 56 JumpList failures; 57 failures.append(jit.branchPtr(NotEqual, Address(regT0), ImmPtr(globalData->jsStringVPtr)));57 failures.append(jit.branchPtr(NotEqual, Address(regT0), TrustedImmPtr(globalData->jsStringVPtr))); 58 58 failures.append(jit.branchTest32(NonZero, Address(regT0, OBJECT_OFFSETOF(JSString, m_fiberCount)))); 59 59 … … 69 69 jit.load16(BaseIndex(regT0, regT1, TimesTwo, 0), regT0); 70 70 71 failures.append(jit.branch32(AboveOrEqual, regT0, Imm32(0x100)));72 jit.move( ImmPtr(globalData->smallStrings.singleCharacterStrings()), regT1);71 failures.append(jit.branch32(AboveOrEqual, regT0, TrustedImm32(0x100))); 72 jit.move(TrustedImmPtr(globalData->smallStrings.singleCharacterStrings()), regT1); 73 73 jit.loadPtr(BaseIndex(regT1, regT0, ScalePtr, 0), regT0); 74 74 jit.ret(); 75 75 76 76 failures.link(&jit); 77 jit.move( Imm32(0), regT0);77 jit.move(TrustedImm32(0), regT0); 78 78 jit.ret(); 79 79 … … 100 100 101 101 emitJumpSlowCaseIfNotJSCell(regT0, base); 102 addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));102 addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsArrayVPtr))); 103 103 104 104 loadPtr(Address(regT0, JSArray::storageOffset()), regT2); … … 121 121 Jump nonCell = jump(); 122 122 linkSlowCase(iter); // base array check 123 Jump notString = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));123 Jump notString = branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsStringVPtr)); 124 124 emitNakedCall(m_globalData->getCTIStub(stringGetByValStubGenerator)); 125 125 Jump failed = branchTestPtr(Zero, regT0); … … 163 163 addSlowCase(branchPtr(NotEqual, regT2, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))); 164 164 load32(addressFor(i), regT3); 165 sub32( Imm32(1), regT3);165 sub32(TrustedImm32(1), regT3); 166 166 addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); 167 167 compileGetDirectOffset(regT0, regT0, regT3, regT1); … … 198 198 zeroExtend32ToPtr(regT1, regT1); 199 199 emitJumpSlowCaseIfNotJSCell(regT0, base); 200 addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));200 addSlowCase(branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsArrayVPtr))); 201 201 addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, JSArray::vectorLengthOffset()))); 202 202 … … 210 210 211 211 empty.link(this); 212 add32( Imm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));212 add32(TrustedImm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector))); 213 213 branch32(Below, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this); 214 214 215 215 move(regT1, regT0); 216 add32( Imm32(1), regT0);216 add32(TrustedImm32(1), regT0); 217 217 store32(regT0, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))); 218 218 jump().linkTo(storeResult, this); … … 225 225 JITStubCall stubCall(this, cti_op_put_by_index); 226 226 stubCall.addArgument(currentInstruction[1].u.operand, regT2); 227 stubCall.addArgument( Imm32(currentInstruction[2].u.operand));227 stubCall.addArgument(TrustedImm32(currentInstruction[2].u.operand)); 228 228 stubCall.addArgument(currentInstruction[3].u.operand, regT2); 229 229 stubCall.call(); … … 234 234 JITStubCall stubCall(this, cti_op_put_getter); 235 235 stubCall.addArgument(currentInstruction[1].u.operand, regT2); 236 stubCall.addArgument( ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));236 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 237 237 stubCall.addArgument(currentInstruction[3].u.operand, regT2); 238 238 stubCall.call(); … … 243 243 JITStubCall stubCall(this, cti_op_put_setter); 244 244 stubCall.addArgument(currentInstruction[1].u.operand, regT2); 245 stubCall.addArgument( ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));245 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand))); 246 246 stubCall.addArgument(currentInstruction[3].u.operand, regT2); 247 247 stubCall.call(); … … 252 252 JITStubCall stubCall(this, cti_op_del_by_id); 253 253 stubCall.addArgument(currentInstruction[2].u.operand, regT2); 254 stubCall.addArgument( ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));254 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 255 255 stubCall.call(currentInstruction[1].u.operand); 256 256 } … … 277 277 JITStubCall stubCall(this, cti_op_get_by_id_generic); 278 278 stubCall.addArgument(regT0); 279 stubCall.addArgument( ImmPtr(ident));279 stubCall.addArgument(TrustedImmPtr(ident)); 280 280 stubCall.call(resultVReg); 281 281 … … 299 299 JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct_generic, cti_op_put_by_id_generic); 300 300 stubCall.addArgument(regT0); 301 stubCall.addArgument( ImmPtr(ident));301 stubCall.addArgument(TrustedImmPtr(ident)); 302 302 stubCall.addArgument(regT1); 303 303 stubCall.call(); … … 337 337 BEGIN_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck); 338 338 339 Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), info.structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));340 DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch( ImmPtr(0), regT1);341 Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT1, JSCell::structureOffset()), protoStructureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));339 Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), info.structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); 340 DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(TrustedImmPtr(0), regT1); 341 Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT1, JSCell::structureOffset()), protoStructureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); 342 342 343 343 // This will be relinked to load the function without doing a load. 344 DataLabelPtr putFunction = moveWithPatch( ImmPtr(0), regT0);344 DataLabelPtr putFunction = moveWithPatch(TrustedImmPtr(0), regT0); 345 345 346 346 END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck); … … 415 415 416 416 DataLabelPtr structureToCompare; 417 Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));417 Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); 418 418 addSlowCase(structureCheck); 419 419 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetGetByIdStructure); … … 458 458 JITStubCall stubCall(this, isMethodCheck ? cti_op_get_by_id_method_check : cti_op_get_by_id); 459 459 stubCall.addArgument(regT0); 460 stubCall.addArgument( ImmPtr(ident));460 stubCall.addArgument(TrustedImmPtr(ident)); 461 461 Call call = stubCall.call(resultVReg); 462 462 … … 493 493 // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over. 494 494 DataLabelPtr structureToCompare; 495 addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));495 addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)))); 496 496 ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure); 497 497 … … 517 517 JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct : cti_op_put_by_id); 518 518 stubCall.addArgument(regT0); 519 stubCall.addArgument( ImmPtr(ident));519 stubCall.addArgument(TrustedImmPtr(ident)); 520 520 stubCall.addArgument(regT1); 521 521 Call call = stubCall.call(); … … 565 565 // two less instructions and doesn't require any scratch registers. 566 566 #if CPU(X86_64) 567 move( ImmPtr(prototype.asCell()->structure()), regT3);567 move(TrustedImmPtr(prototype.asCell()->structure()), regT3); 568 568 failureCases.append(branchPtr(NotEqual, AbsoluteAddress(prototype.asCell()->addressOfStructure()), regT3)); 569 569 #else 570 failureCases.append(branchPtr(NotEqual, AbsoluteAddress(prototype.asCell()->addressOfStructure()), ImmPtr(prototype.asCell()->structure())));570 failureCases.append(branchPtr(NotEqual, AbsoluteAddress(prototype.asCell()->addressOfStructure()), TrustedImmPtr(prototype.asCell()->structure()))); 571 571 #endif 572 572 } … … 577 577 // Check eax is an object of the right Structure. 578 578 failureCases.append(emitJumpIfNotJSCell(regT0)); 579 failureCases.append(branchPtr(NotEqual, Address(regT0, JSCell::structureOffset()), ImmPtr(oldStructure)));579 failureCases.append(branchPtr(NotEqual, Address(regT0, JSCell::structureOffset()), TrustedImmPtr(oldStructure))); 580 580 testPrototype(oldStructure->storedPrototype(), failureCases); 581 581 … … 599 599 stubCall.skipArgument(); // ident 600 600 stubCall.skipArgument(); // value 601 stubCall.addArgument( Imm32(oldStructure->propertyStorageCapacity()));602 stubCall.addArgument( Imm32(newStructure->propertyStorageCapacity()));601 stubCall.addArgument(TrustedImm32(oldStructure->propertyStorageCapacity())); 602 stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity())); 603 603 stubCall.call(regT0); 604 604 emitGetJITStubArg(2, regT1); … … 609 609 // Assumes m_refCount can be decremented easily, refcount decrement is safe as 610 610 // codeblock should ensure oldStructure->m_refCount > 0 611 sub32( Imm32(1), AbsoluteAddress(oldStructure->addressOfCount()));612 add32( Imm32(1), AbsoluteAddress(newStructure->addressOfCount()));613 storePtr( ImmPtr(newStructure), Address(regT0, JSCell::structureOffset()));611 sub32(TrustedImm32(1), AbsoluteAddress(oldStructure->addressOfCount())); 612 add32(TrustedImm32(1), AbsoluteAddress(newStructure->addressOfCount())); 613 storePtr(TrustedImmPtr(newStructure), Address(regT0, JSCell::structureOffset())); 614 614 615 615 // write the value … … 693 693 694 694 // Check eax is an array 695 Jump failureCases1 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr));695 Jump failureCases1 = branchPtr(NotEqual, Address(regT0), TrustedImmPtr(m_globalData->jsArrayVPtr)); 696 696 697 697 // Checks out okay! - get the length from the storage 698 698 loadPtr(Address(regT0, JSArray::storageOffset()), regT3); 699 699 load32(Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2); 700 Jump failureCases2 = branch32(Above, regT2, Imm32(JSImmediate::maxImmediateInt));700 Jump failureCases2 = branch32(Above, regT2, TrustedImm32(JSImmediate::maxImmediateInt)); 701 701 702 702 emitFastArithIntToImmNoCheck(regT2, regT0); … … 738 738 Structure* const * prototypeStructureAddress = protoObject->addressOfStructure(); 739 739 #if CPU(X86_64) 740 move( ImmPtr(prototypeStructure), regT3);740 move(TrustedImmPtr(prototypeStructure), regT3); 741 741 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); 742 742 #else 743 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure));743 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), TrustedImmPtr(prototypeStructure)); 744 744 #endif 745 745 … … 753 753 stubCall.addArgument(regT1); 754 754 stubCall.addArgument(regT0); 755 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));755 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 756 756 stubCall.call(); 757 757 } else if (slot.cachedPropertyType() == PropertySlot::Custom) { 758 758 needsStubLink = true; 759 759 JITStubCall stubCall(this, cti_op_get_by_id_custom_stub); 760 stubCall.addArgument( ImmPtr(protoObject));761 stubCall.addArgument( ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));762 stubCall.addArgument( ImmPtr(const_cast<Identifier*>(&ident)));763 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));760 stubCall.addArgument(TrustedImmPtr(protoObject)); 761 stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress())); 762 stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident))); 763 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 764 764 stubCall.call(); 765 765 } else … … 805 805 stubCall.addArgument(regT1); 806 806 stubCall.addArgument(regT0); 807 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));807 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 808 808 stubCall.call(); 809 809 } else if (slot.cachedPropertyType() == PropertySlot::Custom) { … … 811 811 JITStubCall stubCall(this, cti_op_get_by_id_custom_stub); 812 812 stubCall.addArgument(regT0); 813 stubCall.addArgument( ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));814 stubCall.addArgument( ImmPtr(const_cast<Identifier*>(&ident)));815 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));813 stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress())); 814 stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident))); 815 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 816 816 stubCall.call(); 817 817 } else … … 861 861 Structure* const * prototypeStructureAddress = protoObject->addressOfStructure(); 862 862 #if CPU(X86_64) 863 move( ImmPtr(prototypeStructure), regT3);863 move(TrustedImmPtr(prototypeStructure), regT3); 864 864 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3); 865 865 #else 866 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure));866 Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), TrustedImmPtr(prototypeStructure)); 867 867 #endif 868 868 … … 875 875 stubCall.addArgument(regT1); 876 876 stubCall.addArgument(regT0); 877 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));877 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 878 878 stubCall.call(); 879 879 } else if (slot.cachedPropertyType() == PropertySlot::Custom) { 880 880 needsStubLink = true; 881 881 JITStubCall stubCall(this, cti_op_get_by_id_custom_stub); 882 stubCall.addArgument( ImmPtr(protoObject));883 stubCall.addArgument( ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));884 stubCall.addArgument( ImmPtr(const_cast<Identifier*>(&ident)));885 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));882 stubCall.addArgument(TrustedImmPtr(protoObject)); 883 stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress())); 884 stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident))); 885 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 886 886 stubCall.call(); 887 887 } else … … 945 945 stubCall.addArgument(regT1); 946 946 stubCall.addArgument(regT0); 947 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));947 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 948 948 stubCall.call(); 949 949 } else if (slot.cachedPropertyType() == PropertySlot::Custom) { 950 950 needsStubLink = true; 951 951 JITStubCall stubCall(this, cti_op_get_by_id_custom_stub); 952 stubCall.addArgument( ImmPtr(protoObject));953 stubCall.addArgument( ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));954 stubCall.addArgument( ImmPtr(const_cast<Identifier*>(&ident)));955 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));952 stubCall.addArgument(TrustedImmPtr(protoObject)); 953 stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress())); 954 stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident))); 955 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 956 956 stubCall.call(); 957 957 } else … … 980 980 // Track the stub we have created so that it will be deleted later. 981 981 structure->ref(); 982 chain->ref();983 982 prototypeStructures->list[currentIndex].set(entryLabel, structure, chain); 984 983 … … 1015 1014 stubCall.addArgument(regT1); 1016 1015 stubCall.addArgument(regT0); 1017 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));1016 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 1018 1017 stubCall.call(); 1019 1018 } else if (slot.cachedPropertyType() == PropertySlot::Custom) { 1020 1019 needsStubLink = true; 1021 1020 JITStubCall stubCall(this, cti_op_get_by_id_custom_stub); 1022 stubCall.addArgument( ImmPtr(protoObject));1023 stubCall.addArgument( ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));1024 stubCall.addArgument( ImmPtr(const_cast<Identifier*>(&ident)));1025 stubCall.addArgument( ImmPtr(stubInfo->callReturnLocation.executableAddress()));1021 stubCall.addArgument(TrustedImmPtr(protoObject)); 1022 stubCall.addArgument(TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress())); 1023 stubCall.addArgument(TrustedImmPtr(const_cast<Identifier*>(&ident))); 1024 stubCall.addArgument(TrustedImmPtr(stubInfo->callReturnLocation.executableAddress())); 1026 1025 stubCall.call(); 1027 1026 } else
Note:
See TracChangeset
for help on using the changeset viewer.