Changeset 101298 in webkit
- Timestamp:
- Nov 28, 2011, 3:51:51 PM (15 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGAbstractState.cpp (modified) (1 diff)
-
dfg/DFGOperations.cpp (modified) (7 diffs)
-
dfg/DFGOperations.h (modified) (2 diffs)
-
dfg/DFGSpeculativeJIT.h (modified) (5 diffs)
-
dfg/DFGSpeculativeJIT32_64.cpp (modified) (4 diffs)
-
dfg/DFGSpeculativeJIT64.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r101295 r101298 1 2011-11-28 Filip Pizlo <fpizlo@apple.com> 2 3 GetById should not always speculate cell 4 https://bugs.webkit.org/show_bug.cgi?id=73181 5 6 Reviewed by Gavin Barraclough. 7 8 GetById will now speculate cell if the predictions of the base are cell. 9 Otherwise it will do like the old JIT (and like the old non-speculative 10 DFG JIT): if not cell, go straight to slow-path but otherwise don't OSR 11 out. This is a 1% speed-up on SunSpider. 12 13 * dfg/DFGAbstractState.cpp: 14 (JSC::DFG::AbstractState::execute): 15 * dfg/DFGOperations.cpp: 16 * dfg/DFGOperations.h: 17 * dfg/DFGSpeculativeJIT.h: 18 (JSC::DFG::SpeculativeJIT::setupArgumentsWithExecState): 19 (JSC::DFG::SpeculativeJIT::callOperation): 20 * dfg/DFGSpeculativeJIT32_64.cpp: 21 (JSC::DFG::SpeculativeJIT::cachedGetById): 22 (JSC::DFG::SpeculativeJIT::compile): 23 * dfg/DFGSpeculativeJIT64.cpp: 24 (JSC::DFG::SpeculativeJIT::compile): 25 1 26 2011-11-28 Oliver Hunt <oliver@apple.com> 2 27 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
r101283 r101298 564 564 break; 565 565 } 566 forNode(node.child1()).filter(PredictCell); 566 if (isCellPrediction(m_graph[node.child1()].prediction())) 567 forNode(node.child1()).filter(PredictCell); 567 568 clobberStructures(nodeIndex); 568 569 forNode(nodeIndex).makeTop(); -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r101283 r101298 49 49 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, rsi) 50 50 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, rcx) 51 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, rcx) 51 52 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, r8) 52 53 … … 63 64 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 8) 64 65 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 16) 66 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 20) 65 67 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 24) 66 68 … … 93 95 ); 94 96 97 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) \ 98 asm ( \ 99 ".text" "\n" \ 100 ".align 2" "\n" \ 101 ".globl " SYMBOL_STRING(function) "\n" \ 102 HIDE_SYMBOL(function) "\n" \ 103 ".thumb" "\n" \ 104 ".thumb_func " THUMB_FUNC_PARAM(function) "\n" \ 105 SYMBOL_STRING(function) ":" "\n" \ 106 "str lr, [sp, #0]" "\n" \ 107 "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \ 108 ); 109 95 110 #define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(function) \ 96 111 asm ( \ … … 116 131 FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function) 117 132 133 #define J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) \ 134 EncodedJSValue DFG_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, Identifier*, ReturnAddressPtr); \ 135 FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) 136 118 137 #define V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(function) \ 119 138 void DFG_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, JSCell*, Identifier*, ReturnAddressPtr); \ … … 313 332 } 314 333 315 EncodedJSValue DFG_OPERATION operationGetById(ExecState* exec, JSCell*base, Identifier* propertyName)316 { 317 JSValue baseValue (base);334 EncodedJSValue DFG_OPERATION operationGetById(ExecState* exec, EncodedJSValue base, Identifier* propertyName) 335 { 336 JSValue baseValue = JSValue::decode(base); 318 337 PropertySlot slot(baseValue); 319 338 return JSValue::encode(baseValue.get(exec, *propertyName, slot)); 320 339 } 321 340 322 J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E CI(operationGetByIdBuildList);323 EncodedJSValue DFG_OPERATION operationGetByIdBuildListWithReturnAddress(ExecState* exec, JSCell*base, Identifier* propertyName, ReturnAddressPtr returnAddress)324 { 325 JSValue baseValue (base);341 J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(operationGetByIdBuildList); 342 EncodedJSValue DFG_OPERATION operationGetByIdBuildListWithReturnAddress(ExecState* exec, EncodedJSValue base, Identifier* propertyName, ReturnAddressPtr returnAddress) 343 { 344 JSValue baseValue = JSValue::decode(base); 326 345 PropertySlot slot(baseValue); 327 346 JSValue result = baseValue.get(exec, *propertyName, slot); … … 333 352 } 334 353 335 J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E CI(operationGetByIdProtoBuildList);336 EncodedJSValue DFG_OPERATION operationGetByIdProtoBuildListWithReturnAddress(ExecState* exec, JSCell*base, Identifier* propertyName, ReturnAddressPtr returnAddress)337 { 338 JSValue baseValue (base);354 J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(operationGetByIdProtoBuildList); 355 EncodedJSValue DFG_OPERATION operationGetByIdProtoBuildListWithReturnAddress(ExecState* exec, EncodedJSValue base, Identifier* propertyName, ReturnAddressPtr returnAddress) 356 { 357 JSValue baseValue = JSValue::decode(base); 339 358 PropertySlot slot(baseValue); 340 359 JSValue result = baseValue.get(exec, *propertyName, slot); … … 346 365 } 347 366 348 J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E CI(operationGetByIdOptimize);349 EncodedJSValue DFG_OPERATION operationGetByIdOptimizeWithReturnAddress(ExecState* exec, JSCell*base, Identifier* propertyName, ReturnAddressPtr returnAddress)350 { 351 JSValue baseValue (base);367 J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(operationGetByIdOptimize); 368 EncodedJSValue DFG_OPERATION operationGetByIdOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue base, Identifier* propertyName, ReturnAddressPtr returnAddress) 369 { 370 JSValue baseValue = JSValue::decode(base); 352 371 PropertySlot slot(baseValue); 353 372 JSValue result = baseValue.get(exec, *propertyName, slot); -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r101283 r101298 73 73 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJP)(ExecState*, EncodedJSValue, void*); 74 74 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_ECI)(ExecState*, JSCell*, Identifier*); 75 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJI)(ExecState*, EncodedJSValue, Identifier*); 75 76 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EP)(ExecState*, void*); 76 77 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EPP)(ExecState*, void*, void*); … … 100 101 EncodedJSValue DFG_OPERATION operationGetByVal(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty); 101 102 EncodedJSValue DFG_OPERATION operationGetByValCell(ExecState*, JSCell*, EncodedJSValue encodedProperty); 102 EncodedJSValue DFG_OPERATION operationGetById(ExecState*, JSCell*, Identifier*); 103 EncodedJSValue DFG_OPERATION operationGetByIdBuildList(ExecState*, JSCell*, Identifier*); 104 EncodedJSValue DFG_OPERATION operationGetByIdProtoBuildList(ExecState*, JSCell*, Identifier*); 105 EncodedJSValue DFG_OPERATION operationGetByIdOptimize(ExecState*, JSCell*, Identifier*); 103 EncodedJSValue DFG_OPERATION operationGetById(ExecState*, EncodedJSValue, Identifier*); 104 EncodedJSValue DFG_OPERATION operationGetByIdBuildList(ExecState*, EncodedJSValue, Identifier*); 105 EncodedJSValue DFG_OPERATION operationGetByIdProtoBuildList(ExecState*, EncodedJSValue, Identifier*); 106 EncodedJSValue DFG_OPERATION operationGetByIdOptimize(ExecState*, EncodedJSValue, Identifier*); 107 EncodedJSValue DFG_OPERATION operationGetMethodOptimize(ExecState*, EncodedJSValue, Identifier*); 106 108 EncodedJSValue DFG_OPERATION operationResolve(ExecState*, Identifier*); 107 109 EncodedJSValue DFG_OPERATION operationResolveBase(ExecState*, Identifier*); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r101283 r101298 872 872 void cachedPutById(GPRReg base, GPRReg value, NodeIndex valueIndex, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); 873 873 #elif USE(JSVALUE32_64) 874 JITCompiler::Call cachedGetById(GPRReg base PayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump());874 JITCompiler::Call cachedGetById(GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); 875 875 void cachedPutById(GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, NodeIndex valueIndex, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); 876 876 #endif … … 1143 1143 1144 1144 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3) 1145 { 1146 resetCallArguments(); 1147 addCallArgument(GPRInfo::callFrameRegister); 1148 addCallArgument(arg1); 1149 addCallArgument(arg2); 1150 addCallArgument(arg3); 1151 } 1152 1153 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3) 1145 1154 { 1146 1155 resetCallArguments(); … … 1424 1433 } 1425 1434 1435 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImm32 arg3) 1436 { 1437 m_jit.move(arg1, GPRInfo::argumentGPR1); 1438 m_jit.move(arg2, GPRInfo::argumentGPR2); 1439 m_jit.move(arg3, GPRInfo::argumentGPR3); 1440 m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 1441 } 1442 1426 1443 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3) 1427 1444 { … … 1528 1545 return appendCallWithExceptionCheckSetResult(operation, result); 1529 1546 } 1547 JITCompiler::Call callOperation(J_DFGOperation_EJI operation, GPRReg result, GPRReg arg1, Identifier* identifier) 1548 { 1549 setupArgumentsWithExecState(arg1, TrustedImmPtr(identifier)); 1550 return appendCallWithExceptionCheckSetResult(operation, result); 1551 } 1530 1552 JITCompiler::Call callOperation(J_DFGOperation_EJA operation, GPRReg result, GPRReg arg1, GPRReg arg2) 1531 1553 { … … 1684 1706 { 1685 1707 setupArgumentsWithExecState(arg1, TrustedImmPtr(identifier)); 1708 return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); 1709 } 1710 JITCompiler::Call callOperation(J_DFGOperation_EJI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, Identifier* identifier) 1711 { 1712 setupArgumentsWithExecState(arg1Payload, arg1Tag, TrustedImmPtr(identifier)); 1713 return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); 1714 } 1715 JITCompiler::Call callOperation(J_DFGOperation_EJI operation, GPRReg resultTag, GPRReg resultPayload, int32_t arg1Tag, GPRReg arg1Payload, Identifier* identifier) 1716 { 1717 setupArgumentsWithExecState(arg1Payload, TrustedImm32(arg1Tag), TrustedImmPtr(identifier)); 1686 1718 return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag); 1687 1719 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r101283 r101298 840 840 } 841 841 842 JITCompiler::Call SpeculativeJIT::cachedGetById(GPRReg base PayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget)842 JITCompiler::Call SpeculativeJIT::cachedGetById(GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget) 843 843 { 844 844 m_jit.beginUninterruptedSequence(); … … 861 861 862 862 silentSpillAllRegisters(resultTagGPR, resultPayloadGPR); 863 JITCompiler::Call functionCall = callOperation(operationGetByIdOptimize, resultTagGPR, resultPayloadGPR, basePayloadGPR, identifier(identifierNumber)); 863 JITCompiler::Call functionCall; 864 if (baseTagGPROrNone == InvalidGPRReg) 865 functionCall = callOperation(operationGetByIdOptimize, resultTagGPR, resultPayloadGPR, JSValue::CellTag, basePayloadGPR, identifier(identifierNumber)); 866 else 867 functionCall = callOperation(operationGetByIdOptimize, resultTagGPR, resultPayloadGPR, baseTagGPROrNone, basePayloadGPR, identifier(identifierNumber)); 864 868 silentFillAllRegisters(resultTagGPR, resultPayloadGPR); 865 869 … … 3300 3304 } 3301 3305 3302 SpeculateCellOperand base(this, node.child1()); 3306 if (isCellPrediction(at(node.child1()).prediction())) { 3307 SpeculateCellOperand base(this, node.child1()); 3308 GPRTemporary resultTag(this, base); 3309 GPRTemporary resultPayload(this); 3310 3311 GPRReg baseGPR = base.gpr(); 3312 GPRReg resultTagGPR = resultTag.gpr(); 3313 GPRReg resultPayloadGPR = resultPayload.gpr(); 3314 GPRReg scratchGPR; 3315 3316 if (resultTagGPR == baseGPR) 3317 scratchGPR = resultPayloadGPR; 3318 else 3319 scratchGPR = resultTagGPR; 3320 3321 base.use(); 3322 3323 cachedGetById(InvalidGPRReg, baseGPR, resultTagGPR, resultPayloadGPR, scratchGPR, node.identifierNumber()); 3324 3325 jsValueResult(resultTagGPR, resultPayloadGPR, m_compileIndex, UseChildrenCalledExplicitly); 3326 break; 3327 } 3328 3329 JSValueOperand base(this, node.child1()); 3303 3330 GPRTemporary resultTag(this, base); 3304 3331 GPRTemporary resultPayload(this); 3305 3332 3306 GPRReg baseGPR = base.gpr(); 3333 GPRReg baseTagGPR = base.tagGPR(); 3334 GPRReg basePayloadGPR = base.payloadGPR(); 3307 3335 GPRReg resultTagGPR = resultTag.gpr(); 3308 3336 GPRReg resultPayloadGPR = resultPayload.gpr(); 3309 3337 GPRReg scratchGPR; 3310 3311 if (resultTagGPR == base GPR)3338 3339 if (resultTagGPR == basePayloadGPR) 3312 3340 scratchGPR = resultPayloadGPR; 3313 3341 else … … 3315 3343 3316 3344 base.use(); 3317 3318 cachedGetById(baseGPR, resultTagGPR, resultPayloadGPR, scratchGPR, node.identifierNumber()); 3319 3345 3346 JITCompiler::Jump notCell = m_jit.branch32(JITCompiler::NotEqual, baseTagGPR, TrustedImm32(JSValue::CellTag)); 3347 3348 cachedGetById(baseTagGPR, basePayloadGPR, resultTagGPR, resultPayloadGPR, scratchGPR, node.identifierNumber(), notCell); 3349 3320 3350 jsValueResult(resultTagGPR, resultPayloadGPR, m_compileIndex, UseChildrenCalledExplicitly); 3321 3351 break; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r101283 r101298 3249 3249 } 3250 3250 3251 SpeculateCellOperand base(this, node.child1()); 3251 if (isCellPrediction(at(node.child1()).prediction())) { 3252 SpeculateCellOperand base(this, node.child1()); 3253 GPRTemporary result(this, base); 3254 3255 GPRReg baseGPR = base.gpr(); 3256 GPRReg resultGPR = result.gpr(); 3257 GPRReg scratchGPR; 3258 3259 if (resultGPR == baseGPR) 3260 scratchGPR = tryAllocate(); 3261 else 3262 scratchGPR = resultGPR; 3263 3264 base.use(); 3265 3266 cachedGetById(baseGPR, resultGPR, scratchGPR, node.identifierNumber()); 3267 3268 jsValueResult(resultGPR, m_compileIndex, UseChildrenCalledExplicitly); 3269 break; 3270 } 3271 3272 JSValueOperand base(this, node.child1()); 3252 3273 GPRTemporary result(this, base); 3253 3274 … … 3262 3283 3263 3284 base.use(); 3264 3265 cachedGetById(baseGPR, resultGPR, scratchGPR, node.identifierNumber()); 3266 3285 3286 JITCompiler::Jump notCell = m_jit.branchTestPtr(JITCompiler::NonZero, baseGPR, GPRInfo::tagMaskRegister); 3287 3288 cachedGetById(baseGPR, resultGPR, scratchGPR, node.identifierNumber(), notCell); 3289 3267 3290 jsValueResult(resultGPR, m_compileIndex, UseChildrenCalledExplicitly); 3291 3268 3292 break; 3269 3293 }
Note:
See TracChangeset
for help on using the changeset viewer.