Changeset 42976 in webkit
- Timestamp:
- Apr 28, 2009, 5:38:23 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r42970 r42976 4 4 5 5 * GNUmakefile.am: 6 7 2009-04-28 Oliver Hunt <[email protected]> 8 9 Reviewed by Geoff Garen. 10 11 Improve performance of string indexing 12 13 Add a cti_get_by_val_string function to specialise indexing into a string object. 14 This gives us a slight performance win on a number of string tests. 15 16 * jit/JITStubs.cpp: 17 (JSC::JITStubs::cti_op_get_by_val): 18 (JSC::JITStubs::cti_op_get_by_val_string): 19 * jit/JITStubs.h: 6 20 7 21 2009-04-28 Oliver Hunt <[email protected]> -
trunk/JavaScriptCore/jit/JITStubs.cpp
r42337 r42976 1127 1127 else 1128 1128 result = jsArray->JSArray::get(callFrame, i); 1129 } else if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i)) 1129 } else if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i)) { 1130 // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks. 1131 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_val_string)); 1130 1132 result = asString(baseValue)->getIndex(ARG_globalData, i); 1131 else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {1133 } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) { 1132 1134 // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks. 1133 1135 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_val_byte_array)); … … 1143 1145 return JSValuePtr::encode(result); 1144 1146 } 1147 1148 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_val_string(STUB_ARGS) 1149 { 1150 BEGIN_STUB_FUNCTION(); 1151 1152 CallFrame* callFrame = ARG_callFrame; 1153 JSGlobalData* globalData = ARG_globalData; 1154 1155 JSValuePtr baseValue = ARG_src1; 1156 JSValuePtr subscript = ARG_src2; 1157 1158 JSValuePtr result; 1159 1160 if (LIKELY(subscript.isUInt32Fast())) { 1161 uint32_t i = subscript.getUInt32Fast(); 1162 if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i)) 1163 result = asString(baseValue)->getIndex(ARG_globalData, i); 1164 else { 1165 result = baseValue.get(callFrame, i); 1166 if (!isJSString(globalData, baseValue)) 1167 ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_val)); 1168 } 1169 } else { 1170 Identifier property(callFrame, subscript.toString(callFrame)); 1171 result = baseValue.get(callFrame, property); 1172 } 1173 1174 CHECK_FOR_EXCEPTION_AT_END(); 1175 return JSValuePtr::encode(result); 1176 } 1177 1145 1178 1146 1179 JSValueEncodedAsPointer* JITStubs::cti_op_get_by_val_byte_array(STUB_ARGS) -
trunk/JavaScriptCore/jit/JITStubs.h
r42337 r42976 129 129 static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_val(STUB_ARGS); 130 130 static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_val_byte_array(STUB_ARGS); 131 static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_val_string(STUB_ARGS); 131 132 static JSValueEncodedAsPointer* JIT_STUB cti_op_in(STUB_ARGS); 132 133 static JSValueEncodedAsPointer* JIT_STUB cti_op_instanceof(STUB_ARGS);
Note:
See TracChangeset
for help on using the changeset viewer.