Changeset 43432 in webkit for trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
- Timestamp:
- May 9, 2009, 1:35:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r43409 r43432 109 109 ASSERT(differenceBetween(hotPathBegin, structureCheck) == patchOffsetGetByIdBranchToSlowCase); 110 110 111 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 111 Label externalLoad(this); 112 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_externalStorage)), regT0); 113 Label externalLoadComplete(this); 114 ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetGetByIdExternalLoad); 115 ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthGetByIdExternalLoad); 116 112 117 DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); 113 118 ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetGetByIdPropertyMapOffset); … … 164 169 165 170 // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used. 166 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 171 Label externalLoad(this); 172 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_externalStorage)), regT0); 173 Label externalLoadComplete(this); 174 ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetPutByIdExternalLoad); 175 ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad); 176 167 177 DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset)); 168 178 ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetPutByIdPropertyMapOffset); … … 182 192 // Track the location of the call; this will be used to recover patch information. 183 193 m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call; 194 } 195 196 // Compile a store into an object's property storage. May overwrite the 197 // value in objectReg. 198 void JIT::compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset) 199 { 200 int offset = cachedOffset * sizeof(JSValue); 201 if (structure->isUsingInlineStorage()) 202 offset += FIELD_OFFSET(JSObject, m_inlineStorage); 203 else 204 loadPtr(Address(base, FIELD_OFFSET(JSObject, m_externalStorage)), base); 205 storePtr(value, Address(base, offset)); 206 } 207 208 // Compile a load from an object's property storage. May overwrite base. 209 void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset) 210 { 211 int offset = cachedOffset * sizeof(JSValue); 212 if (structure->isUsingInlineStorage()) 213 offset += FIELD_OFFSET(JSObject, m_inlineStorage); 214 else 215 loadPtr(Address(base, FIELD_OFFSET(JSObject, m_externalStorage)), base); 216 loadPtr(Address(base, offset), result); 217 } 218 219 void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset) 220 { 221 if (base->isUsingInlineStorage()) 222 loadPtr(static_cast<void*>(&base->m_inlineStorage[cachedOffset]), result); 223 else { 224 PropertyStorage* protoPropertyStorage = &base->m_externalStorage; 225 loadPtr(static_cast<void*>(protoPropertyStorage), temp); 226 loadPtr(Address(temp, cachedOffset * sizeof(JSValue)), result); 227 } 184 228 } 185 229 … … 254 298 255 299 // write the value 256 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 257 storePtr(regT1, Address(regT0, cachedOffset * sizeof(JSValue))); 300 compilePutDirectOffset(regT0, regT1, newStructure, cachedOffset); 258 301 259 302 ret(); … … 283 326 returnAddress.relinkCallerToFunction(JITStubs::cti_op_get_by_id_self_fail); 284 327 328 int offset = sizeof(JSValue) * cachedOffset; 329 330 // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load 331 // and makes the subsequent load's offset automatically correct 332 if (structure->isUsingInlineStorage()) 333 stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad).patchLoadToLEA(); 334 285 335 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 286 336 stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure).repatch(structure); 287 stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset).repatch( cachedOffset * sizeof(JSValue));337 stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset).repatch(offset); 288 338 } 289 339 … … 294 344 returnAddress.relinkCallerToFunction(JITStubs::cti_op_put_by_id_generic); 295 345 346 int offset = sizeof(JSValue) * cachedOffset; 347 348 // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load 349 // and makes the subsequent load's offset automatically correct 350 if (structure->isUsingInlineStorage()) 351 stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad).patchLoadToLEA(); 352 296 353 // Patch the offset into the propoerty map to load from, then patch the Structure to look for. 297 354 stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure).repatch(structure); 298 stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset).repatch( cachedOffset * sizeof(JSValue));355 stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset).repatch(offset); 299 356 } 300 357 … … 345 402 346 403 // Checks out okay! - getDirectOffset 347 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 348 loadPtr(Address(regT0, cachedOffset * sizeof(JSValue)), regT0); 404 compileGetDirectOffset(regT0, regT0, structure, cachedOffset); 349 405 ret(); 350 406 … … 386 442 387 443 // Checks out okay! - getDirectOffset 388 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 389 loadPtr(static_cast<void*>(protoPropertyStorage), regT1); 390 loadPtr(Address(regT1, cachedOffset * sizeof(JSValue)), regT0); 444 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 391 445 392 446 Jump success = jump(); … … 424 478 425 479 // Checks out okay! - getDirectOffset 426 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 427 loadPtr(protoPropertyStorage, regT1); 428 loadPtr(Address(regT1, cachedOffset * sizeof(JSValue)), regT0); 480 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 429 481 430 482 ret(); … … 447 499 { 448 500 Jump failureCase = checkStructure(regT0, structure); 449 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 450 loadPtr(Address(regT0, cachedOffset * sizeof(JSValue)), regT0); 501 compileGetDirectOffset(regT0, regT0, structure, cachedOffset); 451 502 Jump success = jump(); 452 503 … … 494 545 495 546 // Checks out okay! - getDirectOffset 496 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 497 loadPtr(protoPropertyStorage, regT1); 498 loadPtr(Address(regT1, cachedOffset * sizeof(JSValue)), regT0); 547 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 499 548 500 549 Jump success = jump(); … … 550 599 ASSERT(protoObject); 551 600 552 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 553 loadPtr(protoPropertyStorage, regT1); 554 loadPtr(Address(regT1, cachedOffset * sizeof(JSValue)), regT0); 601 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 555 602 Jump success = jump(); 556 603 … … 610 657 ASSERT(protoObject); 611 658 612 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 613 loadPtr(protoPropertyStorage, regT1); 614 loadPtr(Address(regT1, cachedOffset * sizeof(JSValue)), regT0); 659 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 615 660 Jump success = jump(); 616 661 … … 658 703 ASSERT(protoObject); 659 704 660 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 661 loadPtr(protoPropertyStorage, regT1); 662 loadPtr(Address(regT1, cachedOffset * sizeof(JSValue)), regT0); 705 compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset); 706 compilePutDirectOffset(regT0, regT1, structure, cachedOffset); 663 707 ret(); 664 708 … … 680 724 681 725 // checks out okay! - putDirectOffset 682 loadPtr(Address(regT0, FIELD_OFFSET(JSObject, m_propertyStorage)), regT0); 683 storePtr(regT1, Address(regT0, cachedOffset * sizeof(JSValue))); 726 compilePutDirectOffset(regT0, regT1, structure, cachedOffset); 684 727 ret(); 685 728
Note:
See TracChangeset
for help on using the changeset viewer.