Changeset 46247 in webkit for trunk/JavaScriptCore/jit/JITStubs.cpp
- Timestamp:
- Jul 22, 2009, 3:17:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITStubs.cpp
r45039 r46247 359 359 // Uncacheable: give up. 360 360 if (!slot.isCacheable()) { 361 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic));361 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic)); 362 362 return; 363 363 } … … 367 367 368 368 if (structure->isDictionary()) { 369 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic));369 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic)); 370 370 return; 371 371 } … … 373 373 // If baseCell != base, then baseCell must be a proxy for another object. 374 374 if (baseCell != slot.base()) { 375 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic));375 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic)); 376 376 return; 377 377 } … … 385 385 StructureChain* prototypeChain = structure->prototypeChain(callFrame); 386 386 if (!prototypeChain->isCacheable()) { 387 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic));387 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic)); 388 388 return; 389 389 } … … 395 395 stubInfo->initPutByIdReplace(structure); 396 396 397 JIT::patchPutByIdReplace( stubInfo, structure, slot.cachedOffset(), returnAddress);397 JIT::patchPutByIdReplace(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress); 398 398 } 399 399 … … 405 405 // FIXME: Cache property access for immediates. 406 406 if (!baseValue.isCell()) { 407 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic));407 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic)); 408 408 return; 409 409 } … … 419 419 // The tradeoff of compiling an patched inline string length access routine does not seem 420 420 // to pay off, so we currently only do this for arrays. 421 ctiPatchCallByReturnAddress( returnAddress, globalData->jitStubs.ctiStringLengthTrampoline());421 ctiPatchCallByReturnAddress(codeBlock, returnAddress, globalData->jitStubs.ctiStringLengthTrampoline()); 422 422 return; 423 423 } … … 425 425 // Uncacheable: give up. 426 426 if (!slot.isCacheable()) { 427 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic));427 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic)); 428 428 return; 429 429 } … … 433 433 434 434 if (structure->isDictionary()) { 435 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic));435 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic)); 436 436 return; 437 437 } … … 448 448 stubInfo->initGetByIdSelf(structure); 449 449 450 JIT::patchGetByIdSelf( stubInfo, structure, slot.cachedOffset(), returnAddress);450 JIT::patchGetByIdSelf(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress); 451 451 return; 452 452 } … … 476 476 StructureChain* prototypeChain = structure->prototypeChain(callFrame); 477 477 if (!prototypeChain->isCacheable()) { 478 ctiPatchCallByReturnAddress( returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic));478 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_generic)); 479 479 return; 480 480 } … … 778 778 stackFrame.args[0].jsValue().put(callFrame, ident, stackFrame.args[2].jsValue(), slot); 779 779 780 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_id_second));780 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_id_second)); 781 781 782 782 CHECK_FOR_EXCEPTION_AT_END(); … … 832 832 JSValue result = baseValue.get(callFrame, ident, slot); 833 833 834 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_second));834 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_second)); 835 835 836 836 CHECK_FOR_EXCEPTION_AT_END(); … … 849 849 JSValue result = baseValue.get(callFrame, ident, slot); 850 850 851 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_method_check_second));851 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_method_check_second)); 852 852 853 853 CHECK_FOR_EXCEPTION_AT_END(); … … 901 901 // Check to see if the function is on the object's prototype. Patch up the code to optimize. 902 902 if (slot.slotBase() == structure->prototypeForLookup(callFrame)) 903 JIT::patchMethodCallProto( methodCallLinkInfo, callee, structure, slotBaseObject);903 JIT::patchMethodCallProto(callFrame->codeBlock(), methodCallLinkInfo, callee, structure, slotBaseObject); 904 904 // Check to see if the function is on the object itself. 905 905 // Since we generate the method-check to check both the structure and a prototype-structure (since this … … 909 909 // purpose. The object is in no way exposed, and as such the check will always pass. 910 910 else if (slot.slotBase() == baseValue) 911 JIT::patchMethodCallProto( methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject()->methodCallDummy());911 JIT::patchMethodCallProto(callFrame->codeBlock(), methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject()->methodCallDummy()); 912 912 913 913 // For now let any other case be cached as a normal get_by_id. … … 915 915 916 916 // Revert the get_by_id op back to being a regular get_by_id - allow it to cache like normal, if it needs to. 917 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id));917 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id)); 918 918 919 919 return JSValue::encode(result); … … 976 976 977 977 if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) 978 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); 979 } else { 980 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); 981 } 978 ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); 979 } else 980 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic)); 982 981 return JSValue::encode(result); 983 982 } … … 1025 1024 1026 1025 if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) { 1027 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));1026 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); 1028 1027 return JSValue::encode(result); 1029 1028 } … … 1037 1036 1038 1037 if (slot.slotBase() == baseValue) 1039 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));1038 ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); 1040 1039 else if (slot.slotBase() == asCell(baseValue)->structure()->prototypeForLookup(callFrame)) { 1041 1040 // Since we're accessing a prototype in a loop, it's a good bet that it … … 1050 1049 1051 1050 if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) 1052 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));1051 ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); 1053 1052 } else if (size_t count = countPrototypeChainEntriesAndCheckForProxies(callFrame, baseValue, slot)) { 1054 1053 StructureChain* protoChain = structure->prototypeChain(callFrame); 1055 1054 if (!protoChain->isCacheable()) { 1056 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));1055 ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); 1057 1056 return JSValue::encode(result); 1058 1057 } … … 1063 1062 1064 1063 if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1)) 1065 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));1064 ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full)); 1066 1065 } else 1067 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));1066 ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail)); 1068 1067 1069 1068 return JSValue::encode(result); … … 1272 1271 JSFunction* callee = asFunction(stackFrame.args[0].jsValue()); 1273 1272 1274 ctiPatchNearCallByReturnAddress(stackFrame. args[1].returnAddress(), globalData->jitStubs.ctiVirtualCallLink());1273 ctiPatchNearCallByReturnAddress(stackFrame.callFrame->callerFrame()->codeBlock(), stackFrame.args[1].returnAddress(), globalData->jitStubs.ctiVirtualCallLink()); 1275 1274 1276 1275 return callee->body()->generatedJITCode().addressForCall().executableAddress(); … … 1291 1290 1292 1291 CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(stackFrame.args[1].returnAddress()); 1293 JIT::linkCall(callee, codeBlock, jitCode, callLinkInfo, stackFrame.args[2].int32(), stackFrame.globalData);1292 JIT::linkCall(callee, stackFrame.callFrame->callerFrame()->codeBlock(), codeBlock, jitCode, callLinkInfo, stackFrame.args[2].int32(), stackFrame.globalData); 1294 1293 1295 1294 return jitCode.addressForCall().executableAddress(); … … 1531 1530 } else if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i)) { 1532 1531 // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks. 1533 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val_string));1532 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val_string)); 1534 1533 result = asString(baseValue)->getIndex(stackFrame.globalData, i); 1535 1534 } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) { 1536 1535 // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks. 1537 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val_byte_array));1536 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val_byte_array)); 1538 1537 return JSValue::encode(asByteArray(baseValue)->getIndex(callFrame, i)); 1539 1538 } else … … 1567 1566 result = baseValue.get(callFrame, i); 1568 1567 if (!isJSString(globalData, baseValue)) 1569 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val));1568 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val)); 1570 1569 } 1571 1570 } else { … … 1600 1599 result = baseValue.get(callFrame, i); 1601 1600 if (!isJSByteArray(globalData, baseValue)) 1602 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val));1601 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val)); 1603 1602 } else { 1604 1603 Identifier property(callFrame, subscript.toString(callFrame)); … … 1693 1692 } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) { 1694 1693 JSByteArray* jsByteArray = asByteArray(baseValue); 1695 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val_byte_array));1694 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val_byte_array)); 1696 1695 // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks. 1697 1696 if (value.isInt32Fast()) { … … 1777 1776 1778 1777 if (!isJSByteArray(globalData, baseValue)) 1779 ctiPatchCallByReturnAddress( STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val));1778 ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val)); 1780 1779 baseValue.put(callFrame, i, value); 1781 1780 } else {
Note:
See TracChangeset
for help on using the changeset viewer.