Changeset 175509 in webkit
- Timestamp:
- Nov 3, 2014 7:53:18 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r175508 r175509 1 2014-11-03 Michael Saboff <msaboff@apple.com> 2 3 Update scope related slow path code to use scope register added to opcodes 4 https://bugs.webkit.org/show_bug.cgi?id=138254 5 6 Reviewed by Mark Lam. 7 8 Updated slow paths for op_pop_scope, op_push_name_scope and op_push_with_scope. 9 Added scope register index parameter to the front of the relevant argument lists of the 10 slow functions. In the case of op_push_name_scope for x86 (32 bit), there aren't enough 11 registers to accomodate all the parameters. Therefore, added two new JSVALUE32_64 slow 12 paths called operationPushCatchScope() and operationPushFunctionNameScope() to eliminate 13 the last "type" argument. 14 15 16 * assembler/MacroAssemblerCodeRef.h: 17 (JSC::FunctionPtr::FunctionPtr): Added a new template to take 6 arguments. 18 19 * jit/CCallHelpers.h: 20 (JSC::CCallHelpers::setupArgumentsWithExecState): 21 * jit/JIT.h: 22 * jit/JITInlines.h: 23 (JSC::JIT::callOperation): 24 New variants of setupArgumentsWithExecState() and callOperation() to handle the new 25 combinations of argument types and counts. 26 27 * jit/JITOpcodes.cpp: 28 (JSC::JIT::emit_op_push_with_scope): 29 (JSC::JIT::emit_op_pop_scope): 30 (JSC::JIT::emit_op_push_name_scope): 31 * jit/JITOpcodes32_64.cpp: 32 (JSC::JIT::emit_op_push_with_scope): 33 (JSC::JIT::emit_op_pop_scope): 34 (JSC::JIT::emit_op_push_name_scope): 35 Use the new slow paths. 36 37 * jit/JITOperations.cpp: 38 * jit/JITOperations.h: 39 Updates to set the scope result using the scope register index. Added operationPushCatchScope() 40 and operationPushFunctionNameScope(). 41 42 * llint/LLIntSlowPaths.cpp: 43 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 44 Updated the scope slow paths to use the scope register index in the instruction to read and 45 write the register instead of using CallFrame::scope() and CallFrame::setScope(). 46 1 47 2014-11-03 Michael Saboff <msaboff@apple.com> 2 48 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
r170147 r175509 133 133 } 134 134 135 template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4, typename argType5, typename argType6> 136 FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4, argType5, argType6)) 137 : m_value((void*)value) 138 { 139 ASSERT_VALID_CODE_POINTER(m_value); 140 } 135 141 // MSVC doesn't seem to treat functions with different calling conventions as 136 142 // different types; these methods already defined for fastcall, below. -
trunk/Source/JavaScriptCore/jit/CCallHelpers.h
r174360 r175509 290 290 } 291 291 292 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3) 293 { 294 resetCallArguments(); 295 addCallArgument(GPRInfo::callFrameRegister); 296 addCallArgument(arg1); 297 addCallArgument(arg2); 298 addCallArgument(arg3); 299 } 300 292 301 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3) 293 302 { … … 386 395 387 396 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) 397 { 398 resetCallArguments(); 399 addCallArgument(GPRInfo::callFrameRegister); 400 addCallArgument(arg1); 401 addCallArgument(arg2); 402 addCallArgument(arg3); 403 addCallArgument(arg4); 404 addCallArgument(arg5); 405 } 406 407 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) 388 408 { 389 409 resetCallArguments(); … … 1382 1402 } 1383 1403 1404 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) 1405 { 1406 poke(arg5, POKE_ARGUMENT_OFFSET + 1); 1407 poke(arg4, POKE_ARGUMENT_OFFSET); 1408 setupArgumentsWithExecState(arg1, arg2, arg3); 1409 } 1410 1384 1411 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) 1385 1412 { … … 1514 1541 1515 1542 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) 1543 { 1544 poke(arg5, POKE_ARGUMENT_OFFSET + 1); 1545 poke(arg4, POKE_ARGUMENT_OFFSET); 1546 setupArgumentsWithExecState(arg1, arg2, arg3); 1547 } 1548 1549 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) 1516 1550 { 1517 1551 poke(arg5, POKE_ARGUMENT_OFFSET + 1); … … 1676 1710 move(arg3, GPRInfo::argumentGPR3); 1677 1711 move(arg4, GPRInfo::argumentGPR4); 1712 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 1713 } 1714 1715 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) 1716 { 1717 move(arg3, GPRInfo::argumentGPR3); 1718 move(arg1, GPRInfo::argumentGPR1); 1719 move(arg2, GPRInfo::argumentGPR2); 1720 move(arg4, GPRInfo::argumentGPR4); 1721 move(arg5, GPRInfo::argumentGPR5); 1678 1722 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 1679 1723 } -
trunk/Source/JavaScriptCore/jit/JIT.h
r175508 r175509 717 717 MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID); 718 718 MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID); 719 MacroAssembler::Call callOperation(V_JITOperation_EIdJZZ, const Identifier*, RegisterID, int32_t, int32_t); 719 #if USE(JSVALUE64) 720 MacroAssembler::Call callOperation(V_JITOperation_EZIdJZZ, int, const Identifier*, RegisterID, int32_t, int32_t); 721 #else 722 MacroAssembler::Call callOperation(V_JITOperation_EZIdJZ, int, const Identifier*, RegisterID, int32_t); 723 #endif 720 724 MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID); 721 725 #if USE(JSVALUE64) … … 736 740 MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*); 737 741 MacroAssembler::Call callOperation(V_JITOperation_EZ, int32_t); 742 MacroAssembler::Call callOperation(V_JITOperation_EZJ, int, GPRReg); 738 743 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E); 739 744 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*); … … 749 754 MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID); 750 755 MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID); 751 MacroAssembler::Call callOperation(V_JITOperation_E IdJZZ, const Identifier*, RegisterID, RegisterID, int32_t, int32_t);756 MacroAssembler::Call callOperation(V_JITOperation_EZIdJZ, int, const Identifier*, RegisterID, RegisterID, int32_t); 752 757 MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID, RegisterID); 753 758 MacroAssembler::Call callOperation(V_JITOperation_EJJJ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID); 754 759 MacroAssembler::Call callOperation(V_JITOperation_EJZ, RegisterID, RegisterID, int32_t); 755 760 MacroAssembler::Call callOperation(V_JITOperation_EJZJ, RegisterID, RegisterID, int32_t, RegisterID, RegisterID); 761 MacroAssembler::Call callOperation(V_JITOperation_EZJ, int32_t, RegisterID, RegisterID); 756 762 #endif 757 763 -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r174216 r175509 381 381 } 382 382 383 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZJ operation, int dst, GPRReg arg) 384 { 385 setupArgumentsWithExecState(TrustedImm32(dst), arg); 386 return appendCallWithExceptionCheck(operation); 387 } 388 383 389 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(JIT::WithProfileTag, J_JITOperation_ESsiJI operation, int dst, StructureStubInfo* stubInfo, GPRReg arg1, StringImpl* uid) 384 390 { … … 442 448 } 443 449 444 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_E IdJZZ operation, const Identifier* identOp1, RegisterID regOp2, int32_t op3, int32_t op4)445 { 446 setupArgumentsWithExecState(TrustedImm Ptr(identOp1), regOp2, TrustedImm32(op3), TrustedImm32(op4));450 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZIdJZZ operation, int op1, const Identifier* identOp2, RegisterID regOp3, int32_t op4, int32_t op5) 451 { 452 setupArgumentsWithExecState(TrustedImm32(op1), TrustedImmPtr(identOp2), regOp3, TrustedImm32(op4), TrustedImm32(op5)); 447 453 return appendCallWithExceptionCheck(operation); 448 454 } … … 576 582 } 577 583 578 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_E IdJZZ operation, const Identifier* identOp1, RegisterID regOp2Tag, RegisterID regOp2Payload, int32_t op3, int32_t op4)579 { 580 setupArgumentsWithExecState(TrustedImm Ptr(identOp1), regOp2Payload, regOp2Tag, TrustedImm32(op3), TrustedImm32(op4));584 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZIdJZ operation, int32_t op1, const Identifier* identOp2, RegisterID regOp3Tag, RegisterID regOp3Payload, int32_t op4) 585 { 586 setupArgumentsWithExecState(TrustedImm32(op1), TrustedImmPtr(identOp2), regOp3Payload, regOp3Tag, TrustedImm32(op4)); 581 587 return appendCallWithExceptionCheck(operation); 582 588 } … … 591 597 { 592 598 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG regOp1Payload, regOp1Tag, SH4_32BIT_DUMMY_ARG regOp2Payload, regOp2Tag, regOp3Payload, regOp3Tag); 599 return appendCallWithExceptionCheck(operation); 600 } 601 602 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EZJ operation, int dst, RegisterID regOp1Tag, RegisterID regOp1Payload) 603 { 604 setupArgumentsWithExecState(TrustedImm32(dst), regOp1Payload, regOp1Tag); 593 605 return appendCallWithExceptionCheck(operation); 594 606 } -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r175508 r175509 445 445 void JIT::emit_op_push_with_scope(Instruction* currentInstruction) 446 446 { 447 int dst = currentInstruction[1].u.operand; 447 448 emitGetVirtualRegister(currentInstruction[2].u.operand, regT0); 448 callOperation(operationPushWithScope, regT0); 449 } 450 451 void JIT::emit_op_pop_scope(Instruction*) 452 { 453 callOperation(operationPopScope); 449 callOperation(operationPushWithScope, dst, regT0); 450 } 451 452 void JIT::emit_op_pop_scope(Instruction* currentInstruction) 453 { 454 int scope = currentInstruction[1].u.operand; 455 456 callOperation(operationPopScope, scope); 454 457 } 455 458 … … 507 510 void JIT::emit_op_push_name_scope(Instruction* currentInstruction) 508 511 { 512 int dst = currentInstruction[1].u.operand; 509 513 emitGetVirtualRegister(currentInstruction[3].u.operand, regT0); 510 callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT0, currentInstruction[4].u.operand, currentInstruction[5].u.operand);514 callOperation(operationPushNameScope, dst, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT0, currentInstruction[4].u.operand, currentInstruction[5].u.operand); 511 515 } 512 516 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r175508 r175509 38 38 #include "JSEnvironmentRecord.h" 39 39 #include "JSFunction.h" 40 #include "JSNameScope.h" 40 41 #include "JSPropertyNameEnumerator.h" 41 42 #include "LinkBuffer.h" … … 753 754 void JIT::emit_op_push_with_scope(Instruction* currentInstruction) 754 755 { 756 int dst = currentInstruction[1].u.operand; 755 757 emitLoad(currentInstruction[2].u.operand, regT1, regT0); 756 callOperation(operationPushWithScope, regT1, regT0); 757 } 758 759 void JIT::emit_op_pop_scope(Instruction*) 760 { 761 callOperation(operationPopScope); 758 callOperation(operationPushWithScope, dst, regT1, regT0); 759 } 760 761 void JIT::emit_op_pop_scope(Instruction* currentInstruction) 762 { 763 int scope = currentInstruction[1].u.operand; 764 callOperation(operationPopScope, scope); 762 765 } 763 766 … … 787 790 void JIT::emit_op_push_name_scope(Instruction* currentInstruction) 788 791 { 792 int dst = currentInstruction[1].u.operand; 789 793 emitLoad(currentInstruction[3].u.operand, regT1, regT0); 790 callOperation(operationPushNameScope, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1, regT0, currentInstruction[4].u.operand, currentInstruction[5].u.operand); 794 if (currentInstruction[5].u.operand == JSNameScope::CatchScope) { 795 callOperation(operationPushCatchScope, dst, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1, regT0, currentInstruction[4].u.operand); 796 return; 797 } 798 799 RELEASE_ASSERT(currentInstruction[5].u.operand == JSNameScope::FunctionNameScope); 800 callOperation(operationPushFunctionNameScope, dst, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1, regT0, currentInstruction[4].u.operand); 791 801 } 792 802 -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r174359 r175509 1309 1309 #endif 1310 1310 1311 void JIT_OPERATION operationPushNameScope(ExecState* exec, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes, int32_t type)1311 void JIT_OPERATION operationPushNameScope(ExecState* exec, int32_t dst, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes, int32_t type) 1312 1312 { 1313 1313 VM& vm = exec->vm(); … … 1317 1317 JSNameScope* scope = JSNameScope::create(exec, *identifier, JSValue::decode(encodedValue), attibutes, scopeType); 1318 1318 1319 exec->setScope(scope); 1320 } 1321 1322 void JIT_OPERATION operationPushWithScope(ExecState* exec, EncodedJSValue encodedValue) 1319 exec->uncheckedR(dst) = scope; 1320 } 1321 1322 #if USE(JSVALUE32_64) 1323 void JIT_OPERATION operationPushCatchScope(ExecState* exec, int32_t dst, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes) 1324 { 1325 operationPushNameScope(exec, dst, identifier, encodedValue, attibutes, JSNameScope::CatchScope); 1326 } 1327 1328 void JIT_OPERATION operationPushFunctionNameScope(ExecState* exec, int32_t dst, Identifier* identifier, EncodedJSValue encodedValue, int32_t attibutes) 1329 { 1330 operationPushNameScope(exec, dst, identifier, encodedValue, attibutes, JSNameScope::FunctionNameScope); 1331 } 1332 #endif 1333 1334 void JIT_OPERATION operationPushWithScope(ExecState* exec, int32_t dst, EncodedJSValue encodedValue) 1323 1335 { 1324 1336 VM& vm = exec->vm(); … … 1329 1341 return; 1330 1342 1331 exec->setScope(JSWithScope::create(exec, o)); 1332 } 1333 1334 void JIT_OPERATION operationPopScope(ExecState* exec) 1335 { 1336 VM& vm = exec->vm(); 1337 NativeCallFrameTracer tracer(&vm, exec); 1338 1339 exec->setScope(exec->scope()->next()); 1343 exec->uncheckedR(dst) = JSWithScope::create(exec, o); 1344 } 1345 1346 void JIT_OPERATION operationPopScope(ExecState* exec, int32_t scopeReg) 1347 { 1348 VM& vm = exec->vm(); 1349 NativeCallFrameTracer tracer(&vm, exec); 1350 1351 JSScope* scope = exec->uncheckedR(scopeReg).Register::scope(); 1352 exec->uncheckedR(scopeReg) = scope->next(); 1340 1353 } 1341 1354 -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r174226 r175509 165 165 typedef void JIT_OPERATION (*V_JITOperation_ECZ)(ExecState*, JSCell*, int32_t); 166 166 typedef void JIT_OPERATION (*V_JITOperation_ECC)(ExecState*, JSCell*, JSCell*); 167 typedef void JIT_OPERATION (*V_JITOperation_EIdJZZ)(ExecState*, Identifier*, EncodedJSValue, int32_t, int32_t); 167 #if USE(JSVALUE64) 168 typedef void JIT_OPERATION (*V_JITOperation_EZIdJZZ)(ExecState*, int, Identifier*, EncodedJSValue, int32_t, int32_t); 169 #else 170 typedef void JIT_OPERATION (*V_JITOperation_EZIdJZ)(ExecState*, int, Identifier*, EncodedJSValue, int32_t); 171 #endif 168 172 typedef void JIT_OPERATION (*V_JITOperation_EJ)(ExecState*, EncodedJSValue); 169 173 typedef void JIT_OPERATION (*V_JITOperation_EJCI)(ExecState*, EncodedJSValue, JSCell*, StringImpl*); … … 180 184 typedef void JIT_OPERATION (*V_JITOperation_EVwsJ)(ExecState*, VariableWatchpointSet*, EncodedJSValue); 181 185 typedef void JIT_OPERATION (*V_JITOperation_EZ)(ExecState*, int32_t); 186 typedef void JIT_OPERATION (*V_JITOperation_EZJ)(ExecState*, int32_t, EncodedJSValue); 182 187 typedef void JIT_OPERATION (*V_JITOperation_EVm)(ExecState*, VM*); 183 188 typedef void JIT_OPERATION (*V_JITOperation_J)(EncodedJSValue); … … 277 282 #else 278 283 void JIT_OPERATION operationPutGetterSetter(ExecState*, JSCell*, Identifier*, JSCell*, JSCell*) WTF_INTERNAL; 284 void JIT_OPERATION operationPushCatchScope(ExecState*, int32_t, Identifier*, EncodedJSValue, int32_t) WTF_INTERNAL; 285 void JIT_OPERATION operationPushFunctionNameScope(ExecState*, int32_t, Identifier*, EncodedJSValue, int32_t) WTF_INTERNAL; 279 286 #endif 280 void JIT_OPERATION operationPushNameScope(ExecState*, Identifier*, EncodedJSValue, int32_t, int32_t) WTF_INTERNAL;281 void JIT_OPERATION operationPushWithScope(ExecState*, EncodedJSValue) WTF_INTERNAL;282 void JIT_OPERATION operationPopScope(ExecState* ) WTF_INTERNAL;287 void JIT_OPERATION operationPushNameScope(ExecState*, int32_t, Identifier*, EncodedJSValue, int32_t, int32_t) WTF_INTERNAL; 288 void JIT_OPERATION operationPushWithScope(ExecState*, int32_t, EncodedJSValue) WTF_INTERNAL; 289 void JIT_OPERATION operationPopScope(ExecState*, int32_t) WTF_INTERNAL; 283 290 void JIT_OPERATION operationProfileDidCall(ExecState*, EncodedJSValue) WTF_INTERNAL; 284 291 void JIT_OPERATION operationProfileWillCall(ExecState*, EncodedJSValue) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r175471 r175509 1274 1274 LLINT_CHECK_EXCEPTION(); 1275 1275 1276 exec-> setScope(JSWithScope::create(exec, o));1276 exec->uncheckedR(pc[1].u.operand) = JSWithScope::create(exec, o); 1277 1277 1278 1278 LLINT_END(); … … 1282 1282 { 1283 1283 LLINT_BEGIN(); 1284 exec->setScope(exec->scope()->next()); 1284 int scopeReg = pc[1].u.operand; 1285 JSScope* scope = exec->uncheckedR(scopeReg).Register::scope(); 1286 exec->uncheckedR(scopeReg) = scope->next(); 1285 1287 LLINT_END(); 1286 1288 } … … 1292 1294 JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[5].u.operand); 1293 1295 JSNameScope* scope = JSNameScope::create(exec, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), pc[4].u.operand, type); 1294 exec-> setScope(scope);1296 exec->uncheckedR(pc[1].u.operand) = scope; 1295 1297 LLINT_END(); 1296 1298 }
Note: See TracChangeset
for help on using the changeset viewer.