Changeset 157411 in webkit
- Timestamp:
- Oct 14, 2013 11:39:45 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r157407 r157411 1 2013-10-14 Filip Pizlo <fpizlo@apple.com> 2 3 Baseline JIT should use the DFG's PutById IC 4 https://bugs.webkit.org/show_bug.cgi?id=122704 5 6 Reviewed by Mark Hahnenberg. 7 8 * js/regress/put-by-id-expected.txt: Added. 9 * js/regress/put-by-id.html: Added. 10 * js/regress/script-tests/put-by-id.js: Added. 11 (foo): 12 (bar): 13 1 14 2013-10-14 Mihnea Ovidenie <mihnea@adobe.com> 2 15 -
trunk/Source/JavaScriptCore/ChangeLog
r157409 r157411 1 2013-10-14 Filip Pizlo <fpizlo@apple.com> 2 3 Baseline JIT should use the DFG's PutById IC 4 https://bugs.webkit.org/show_bug.cgi?id=122704 5 6 Reviewed by Mark Hahnenberg. 7 8 Mostly no big deal, just removing the old Baseline JIT's put_by_id IC support and forcing 9 that JIT to use the DFG's (i.e. JITOperations) PutById IC. 10 11 The only complicated part was that the PutById operations assumed that we first did a 12 cell speculation, which the baseline JIT obviously won't do. So I changed all of those 13 slow paths to deal with EncodedJSValue's. 14 15 * bytecode/CodeBlock.cpp: 16 (JSC::CodeBlock::resetStubInternal): 17 * bytecode/PutByIdStatus.cpp: 18 (JSC::PutByIdStatus::computeFor): 19 * dfg/DFGSpeculativeJIT.h: 20 (JSC::DFG::SpeculativeJIT::callOperation): 21 * dfg/DFGSpeculativeJIT32_64.cpp: 22 (JSC::DFG::SpeculativeJIT::cachedPutById): 23 * dfg/DFGSpeculativeJIT64.cpp: 24 (JSC::DFG::SpeculativeJIT::cachedPutById): 25 * jit/CCallHelpers.h: 26 (JSC::CCallHelpers::setupArgumentsWithExecState): 27 * jit/JIT.cpp: 28 (JSC::PropertyStubCompilationInfo::copyToStubInfo): 29 * jit/JIT.h: 30 (JSC::PropertyStubCompilationInfo::PropertyStubCompilationInfo): 31 (JSC::PropertyStubCompilationInfo::slowCaseInfo): 32 * jit/JITInlines.h: 33 (JSC::JIT::callOperation): 34 * jit/JITOperationWrappers.h: 35 * jit/JITOperations.cpp: 36 * jit/JITOperations.h: 37 * jit/JITPropertyAccess.cpp: 38 (JSC::JIT::compileGetByIdHotPath): 39 (JSC::JIT::compileGetByIdSlowCase): 40 (JSC::JIT::emit_op_put_by_id): 41 (JSC::JIT::emitSlow_op_put_by_id): 42 * jit/JITPropertyAccess32_64.cpp: 43 (JSC::JIT::compileGetByIdSlowCase): 44 (JSC::JIT::emit_op_put_by_id): 45 (JSC::JIT::emitSlow_op_put_by_id): 46 * jit/JITStubs.cpp: 47 * jit/JITStubs.h: 48 * jit/Repatch.cpp: 49 (JSC::appropriateGenericPutByIdFunction): 50 (JSC::appropriateListBuildingPutByIdFunction): 51 (JSC::resetPutByID): 52 1 53 2013-10-13 Filip Pizlo <fpizlo@apple.com> 2 54 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r156984 r157411 2383 2383 else { 2384 2384 RELEASE_ASSERT(isPutByIdAccess(accessType)); 2385 JIT::resetPatchPutById(repatchBuffer, &stubInfo);2385 resetPutByID(repatchBuffer, stubInfo); 2386 2386 } 2387 2387 break; -
trunk/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp
r153221 r157411 142 142 143 143 default: 144 // FIXME: We should handle polymorphic PutById. We probably have some interesting things 145 // we could do about it. 144 146 return PutByIdStatus(TakesSlowPath, 0, 0, 0, invalidOffset); 145 147 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r157329 r157411 1364 1364 return appendCallWithExceptionCheck(operation); 1365 1365 } 1366 JITCompiler::Call callOperation(V_JITOperation_EJ CI operation, GPRReg arg1, GPRReg arg2, StringImpl* uid)1366 JITCompiler::Call callOperation(V_JITOperation_EJJI operation, GPRReg arg1, GPRReg arg2, StringImpl* uid) 1367 1367 { 1368 1368 m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(uid)); … … 1621 1621 return appendCallWithExceptionCheck(operation); 1622 1622 } 1623 JITCompiler::Call callOperation(V_JITOperation_EJ CI operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2, StringImpl* uid)1624 { 1625 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2 , TrustedImmPtr(uid));1623 JITCompiler::Call callOperation(V_JITOperation_EJJI operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Payload, StringImpl* uid) 1624 { 1625 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, arg2Payload, TrustedImm32(JSValue::CellTag), TrustedImmPtr(uid)); 1626 1626 return appendCallWithExceptionCheck(operation); 1627 1627 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r157409 r157411 263 263 264 264 JITCompiler::Label doneLabel = m_jit.label(); 265 V_JITOperation_EJ CI optimizedCall;265 V_JITOperation_EJJI optimizedCall; 266 266 if (m_jit.strictModeFor(m_currentNode->codeOrigin)) { 267 267 if (putKind == Direct) -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r157409 r157411 255 255 JITCompiler::Label doneLabel = m_jit.label(); 256 256 257 V_JITOperation_EJ CI optimizedCall;257 V_JITOperation_EJJI optimizedCall; 258 258 if (m_jit.strictModeFor(m_currentNode->codeOrigin)) { 259 259 if (putKind == Direct) -
trunk/Source/JavaScriptCore/jit/CCallHelpers.h
r157404 r157411 353 353 } 354 354 355 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4) 356 { 357 resetCallArguments(); 358 addCallArgument(GPRInfo::callFrameRegister); 359 addCallArgument(arg1); 360 addCallArgument(arg2); 361 addCallArgument(arg3); 362 addCallArgument(arg4); 363 } 364 355 365 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, GPRReg arg3, GPRReg arg4) 356 366 { … … 364 374 365 375 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) 376 { 377 resetCallArguments(); 378 addCallArgument(GPRInfo::callFrameRegister); 379 addCallArgument(arg1); 380 addCallArgument(arg2); 381 addCallArgument(arg3); 382 addCallArgument(arg4); 383 addCallArgument(arg5); 384 } 385 386 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) 387 { 388 resetCallArguments(); 389 addCallArgument(GPRInfo::callFrameRegister); 390 addCallArgument(arg1); 391 addCallArgument(arg2); 392 addCallArgument(arg3); 393 addCallArgument(arg4); 394 addCallArgument(arg5); 395 } 396 397 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5) 366 398 { 367 399 resetCallArguments(); -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r157164 r157411 490 490 info.codeOrigin = CodeOrigin(bytecodeIndex); 491 491 info.callReturnLocation = linkBuffer.locationOf(callReturnLocation); 492 info.hotPathBegin = linkBuffer.locationOf(hotPathBegin);493 492 494 493 switch (m_type) { 495 494 case GetById: { 496 495 CodeLocationLabel hotPathBeginLocation = linkBuffer.locationOf(hotPathBegin); 497 info.patch.baseline.u.get.structureToCompare = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(getStructureToCompare)); 498 info.patch.baseline.u.get.structureCheck = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(getStructureCheck)); 496 info.hotPathBegin = hotPathBeginLocation; 497 info.patch.baseline.u.get.structureToCompare = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(structureToCompare)); 498 info.patch.baseline.u.get.structureCheck = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(structureCheck)); 499 499 info.patch.baseline.u.get.propertyStorageLoad = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(propertyStorageLoad)); 500 500 #if USE(JSVALUE64) … … 504 504 info.patch.baseline.u.get.displacementLabel2 = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(getDisplacementLabel2)); 505 505 #endif 506 info.patch.baseline.u.get.putResult = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf( getPutResult));507 info.patch.baseline.u.get.coldPathBegin = MacroAssembler::differenceBetweenCodePtr(linkBuffer.locationOf( getColdPathBegin), linkBuffer.locationOf(callReturnLocation));506 info.patch.baseline.u.get.putResult = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(done)); 507 info.patch.baseline.u.get.coldPathBegin = MacroAssembler::differenceBetweenCodePtr(linkBuffer.locationOf(coldPathBegin), linkBuffer.locationOf(callReturnLocation)); 508 508 break; 509 509 } 510 510 case PutById: 511 CodeLocationLabel hotPathBeginLocation = linkBuffer.locationOf(hotPathBegin); 512 info.patch.baseline.u.put.structureToCompare = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(putStructureToCompare)); 513 info.patch.baseline.u.put.propertyStorageLoad = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(propertyStorageLoad)); 511 info.patch.dfg.deltaCheckImmToCall = MacroAssembler::differenceBetweenCodePtr(linkBuffer.locationOf(structureToCompare), info.callReturnLocation); 512 info.patch.dfg.deltaCallToStructCheck = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(structureCheck)); 514 513 #if USE(JSVALUE64) 515 info.patch. baseline.u.put.displacementLabel = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(putDisplacementLabel));514 info.patch.dfg.deltaCallToLoadOrStore = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(putDisplacementLabel)); 516 515 #else 517 info.patch.baseline.u.put.displacementLabel1 = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(putDisplacementLabel1)); 518 info.patch.baseline.u.put.displacementLabel2 = MacroAssembler::differenceBetweenCodePtr(hotPathBeginLocation, linkBuffer.locationOf(putDisplacementLabel2)); 519 #endif 516 info.patch.dfg.deltaCallToTagLoadOrStore = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(putDisplacementLabel2)); 517 info.patch.dfg.deltaCallToPayloadLoadOrStore = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(putDisplacementLabel1)); 518 #endif 519 info.patch.dfg.deltaCallToSlowCase = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(coldPathBegin)); 520 info.patch.dfg.deltaCallToDone = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(done)); 521 info.patch.dfg.deltaCallToStorageLoad = MacroAssembler::differenceBetweenCodePtr(info.callReturnLocation, linkBuffer.locationOf(propertyStorageLoad)); 522 #if USE(JSVALUE64) 523 info.patch.dfg.baseGPR = GPRInfo::regT0; 524 info.patch.dfg.valueGPR = GPRInfo::regT1; 525 RegisterSet usedRegisters; 526 usedRegisters.set(GPRInfo::regT0); 527 usedRegisters.set(GPRInfo::regT1); 528 usedRegisters.copyInfo(info.patch.dfg.usedRegisters); 529 #else 530 info.patch.dfg.baseGPR = GPRInfo::regT0; 531 info.patch.dfg.valueGPR = GPRInfo::regT2; 532 info.patch.dfg.valueTagGPR = GPRInfo::regT3; 533 RegisterSet usedRegisters; 534 usedRegisters.set(GPRInfo::regT0); 535 usedRegisters.set(GPRInfo::regT2); 536 usedRegisters.set(GPRInfo::regT3); 537 usedRegisters.copyInfo(info.patch.dfg.usedRegisters); 538 #endif 539 info.patch.dfg.registersFlushed = true; 520 540 break; 521 541 } -
trunk/Source/JavaScriptCore/jit/JIT.h
r157404 r157411 157 157 MacroAssembler::Call callReturnLocation; 158 158 MacroAssembler::Label hotPathBegin; 159 MacroAssembler::DataLabelPtr getStructureToCompare;160 MacroAssembler::PatchableJump getStructureCheck;159 MacroAssembler::DataLabelPtr structureToCompare; 160 MacroAssembler::PatchableJump structureCheck; 161 161 MacroAssembler::ConvertibleLoadLabel propertyStorageLoad; 162 162 #if USE(JSVALUE64) … … 166 166 MacroAssembler::DataLabelCompact getDisplacementLabel2; 167 167 #endif 168 MacroAssembler::Label getPutResult; 169 MacroAssembler::Label getColdPathBegin; 170 MacroAssembler::DataLabelPtr putStructureToCompare; 168 MacroAssembler::Label done; 169 MacroAssembler::Label coldPathBegin; 171 170 #if USE(JSVALUE64) 172 171 MacroAssembler::DataLabel32 putDisplacementLabel; … … 195 194 MacroAssembler::DataLabelCompact displacementLabel2, 196 195 #endif 197 MacroAssembler::Label putResult)196 MacroAssembler::Label done) 198 197 : m_type(GetById) 199 198 , bytecodeIndex(bytecodeIndex) 200 199 , hotPathBegin(hotPathBegin) 201 , getStructureToCompare(structureToCompare)202 , getStructureCheck(structureCheck)200 , structureToCompare(structureToCompare) 201 , structureCheck(structureCheck) 203 202 , propertyStorageLoad(propertyStorageLoad) 204 203 #if USE(JSVALUE64) … … 208 207 , getDisplacementLabel2(displacementLabel2) 209 208 #endif 210 , getPutResult(putResult)209 , done(done) 211 210 { 212 211 } 213 212 214 213 PropertyStubCompilationInfo( 215 PropertyStubPutById_T, unsigned bytecodeIndex, MacroAssembler::Label hotPathBegin,214 PropertyStubPutById_T, unsigned bytecodeIndex, 216 215 MacroAssembler::DataLabelPtr structureToCompare, 216 MacroAssembler::PatchableJump structureCheck, 217 217 MacroAssembler::ConvertibleLoadLabel propertyStorageLoad, 218 218 #if USE(JSVALUE64) 219 MacroAssembler::DataLabel32 displacementLabel 219 MacroAssembler::DataLabel32 displacementLabel, 220 220 #else 221 221 MacroAssembler::DataLabel32 displacementLabel1, 222 MacroAssembler::DataLabel32 displacementLabel2 223 #endif 224 )222 MacroAssembler::DataLabel32 displacementLabel2, 223 #endif 224 MacroAssembler::Label done) 225 225 : m_type(PutById) 226 226 , bytecodeIndex(bytecodeIndex) 227 , hotPathBegin(hotPathBegin) 227 , structureToCompare(structureToCompare) 228 , structureCheck(structureCheck) 228 229 , propertyStorageLoad(propertyStorageLoad) 229 , putStructureToCompare(structureToCompare)230 , done(done) 230 231 #if USE(JSVALUE64) 231 232 , putDisplacementLabel(displacementLabel) … … 237 238 } 238 239 239 void slowCaseInfo(PropertyStubGetById_T, MacroAssembler::Label coldPathBegin, MacroAssembler::Call call) 240 { 241 ASSERT(m_type == GetById); 240 void slowCaseInfo(MacroAssembler::Label coldPathBegin, MacroAssembler::Call call) 241 { 242 242 callReturnLocation = call; 243 getColdPathBegin = coldPathBegin; 244 } 245 246 void slowCaseInfo(PropertyStubPutById_T, MacroAssembler::Call call) 247 { 248 ASSERT(m_type == PutById); 243 this->coldPathBegin = coldPathBegin; 244 } 245 246 void slowCaseInfo(MacroAssembler::Call call) 247 { 249 248 callReturnLocation = call; 250 249 } … … 346 345 } 347 346 348 static void compilePutByIdTransition(VM* vm, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, PropertyOffset cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct)349 {350 JIT jit(vm, codeBlock);351 jit.m_bytecodeOffset = stubInfo->codeOrigin.bytecodeIndex;352 jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress, direct);353 }354 355 347 static void compileGetByVal(VM* vm, CodeBlock* codeBlock, ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode) 356 348 { … … 381 373 382 374 static void resetPatchGetById(RepatchBuffer&, StructureStubInfo*); 383 static void resetPatchPutById(RepatchBuffer&, StructureStubInfo*);384 375 static void patchGetByIdSelf(CodeBlock*, StructureStubInfo*, Structure*, PropertyOffset cachedOffset, ReturnAddressPtr); 385 static void patchPutByIdReplace(CodeBlock*, StructureStubInfo*, Structure*, PropertyOffset cachedOffset, ReturnAddressPtr, bool direct);386 376 387 377 static void compilePatchGetArrayLength(VM* vm, CodeBlock* codeBlock, ReturnAddressPtr returnAddress) … … 415 405 void privateCompileGetByIdChainList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, StructureChain*, size_t count, const Identifier&, const PropertySlot&, PropertyOffset cachedOffset, CallFrame*); 416 406 void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, const Identifier&, const PropertySlot&, PropertyOffset cachedOffset, ReturnAddressPtr, CallFrame*); 417 void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, PropertyOffset cachedOffset, StructureChain*, ReturnAddressPtr, bool direct);418 407 419 408 void privateCompileGetByVal(ByValInfo*, ReturnAddressPtr, JITArrayMode); … … 448 437 449 438 void privateCompileExceptionHandlers(); 450 451 static bool isDirectPutById(StructureStubInfo*);452 439 453 440 void addSlowCase(Jump); … … 588 575 static const int sequenceGetByIdSlowCaseInstructionSpace = 80; 589 576 static const int sequenceGetByIdSlowCaseConstantSpace = 4; 590 // sequencePutById591 static const int sequencePutByIdInstructionSpace = 36;592 static const int sequencePutByIdConstantSpace = 4;593 577 #elif CPU(SH4) 594 578 // sequenceOpCall … … 601 585 static const int sequenceGetByIdSlowCaseInstructionSpace = 38; 602 586 static const int sequenceGetByIdSlowCaseConstantSpace = 4; 603 // sequencePutById604 static const int sequencePutByIdInstructionSpace = 36;605 static const int sequencePutByIdConstantSpace = 5;606 587 #endif 607 588 … … 891 872 MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID); 892 873 MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID); 874 #if USE(JSVALUE64) 875 MacroAssembler::Call callOperation(V_JITOperation_EJJI, RegisterID, RegisterID, StringImpl*); 876 #else 877 MacroAssembler::Call callOperation(V_JITOperation_EJJI, RegisterID, RegisterID, RegisterID, RegisterID, StringImpl*); 878 #endif 893 879 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E); 894 880 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*); -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r157404 r157411 263 263 return appendCallWithExceptionCheck(operation); 264 264 } 265 266 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJJI operation, RegisterID regOp1, RegisterID regOp2, StringImpl* uid) 267 { 268 setupArgumentsWithExecState(regOp1, regOp2, TrustedImmPtr(uid)); 269 return appendCallWithExceptionCheck(operation); 270 } 265 271 #endif 266 272 … … 418 424 { 419 425 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag); 426 return appendCallWithExceptionCheck(operation); 427 } 428 429 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJJI operation, RegisterID regOp1Tag, RegisterID regOp1Payload, RegisterID regOp2Tag, RegisterID regOp2Payload, StringImpl* uid) 430 { 431 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG regOp1Payload, regOp1Tag, regOp2Payload, regOp2Tag, TrustedImmPtr(uid)); 420 432 return appendCallWithExceptionCheck(operation); 421 433 } -
trunk/Source/JavaScriptCore/jit/JITOperationWrappers.h
r156654 r157411 63 63 #define _J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, rcx) 64 64 #define _J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, rcx) 65 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, r8)65 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, r8) 66 66 67 67 #elif COMPILER(GCC) && CPU(X86) … … 81 81 #define _J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 16) 82 82 #define _J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 20) 83 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 24)83 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 28) 84 84 85 85 #elif COMPILER(GCC) && CPU(ARM_THUMB2) … … 118 118 #if COMPILER_SUPPORTS(EABI) && CPU(ARM) 119 119 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJI "str lr, [sp, #4]" 120 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJ CI "str lr, [sp, #8]"120 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJJI "str lr, [sp, #12]" 121 121 #else 122 122 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJI "str lr, [sp, #0]" 123 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJ CI "str lr, [sp, #4]"123 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJJI "str lr, [sp, #8]" 124 124 #endif 125 125 … … 137 137 ); 138 138 139 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) \139 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) \ 140 140 asm ( \ 141 141 ".text" "\n" \ … … 146 146 ".thumb_func " THUMB_FUNC_PARAM(function) "\n" \ 147 147 SYMBOL_STRING(function) ":" "\n" \ 148 INSTRUCTION_STORE_RETURN_ADDRESS_EJ CI "\n" \148 INSTRUCTION_STORE_RETURN_ADDRESS_EJJI "\n" \ 149 149 "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \ 150 150 ); … … 181 181 #if COMPILER_SUPPORTS(EABI) && CPU(ARM) 182 182 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJI "str lr, [sp, #4]" 183 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJ CI "str lr, [sp, #8]"183 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJJI "str lr, [sp, #12]" 184 184 #else 185 185 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJI "str lr, [sp, #0]" 186 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJ CI "str lr, [sp, #4]"186 #define INSTRUCTION_STORE_RETURN_ADDRESS_EJJI "str lr, [sp, #8]" 187 187 #endif 188 188 … … 198 198 ); 199 199 200 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) \200 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) \ 201 201 asm ( \ 202 202 ".text" "\n" \ … … 205 205 INLINE_ARM_FUNCTION(function) \ 206 206 SYMBOL_STRING(function) ":" "\n" \ 207 INSTRUCTION_STORE_RETURN_ADDRESS_EJ CI "\n" \207 INSTRUCTION_STORE_RETURN_ADDRESS_EJJI "\n" \ 208 208 "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \ 209 209 ); … … 247 247 ); 248 248 249 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) \249 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) \ 250 250 asm( \ 251 251 ".text" "\n" \ … … 254 254 SYMBOL_STRING(function) ":" "\n" \ 255 255 LOAD_FUNCTION_TO_T9(function##WithReturnAddress) \ 256 "sw $ra, 2 4($sp)" "\n" \256 "sw $ra, 28($sp)" "\n" \ 257 257 "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \ 258 258 ); … … 306 306 307 307 #define _J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 0, SH4_SCRATCH_REGISTER) 308 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 4, SH4_SCRATCH_REGISTER)308 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 8, SH4_SCRATCH_REGISTER) 309 309 310 310 #elif COMPILER(MSVC) … … 322 322 EncodedJSValue JIT_OPERATION function(ExecState* exec, EncodedJSValue value, StringImpl* string) { return function##WithReturnAddress(exec, value, string, ReturnAddressPtr(*(void**)_AddressOfReturnAddress())); } 323 323 324 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) \325 void JIT_OPERATION function(ExecState* exec, EncodedJSValue value, JSCell* cell, StringImpl* string) { return function##WithReturnAddress(exec, value, cell, string, ReturnAddressPtr(*(void**)_AddressOfReturnAddress())); }324 #define _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) \ 325 void JIT_OPERATION function(ExecState* exec, EncodedJSValue value, EncodedJSValue baseValue, StringImpl* string) { return function##WithReturnAddress(exec, value, baseValue, string, ReturnAddressPtr(*(void**)_AddressOfReturnAddress())); } 326 326 327 327 #endif … … 343 343 _J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) 344 344 345 #define V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function) \346 void JIT_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, JSCell*, StringImpl*, ReturnAddressPtr) REFERENCED_FROM_ASM WTF_INTERNAL; \347 _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(function)345 #define V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) \ 346 void JIT_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, EncodedJSValue, StringImpl*, ReturnAddressPtr) REFERENCED_FROM_ASM WTF_INTERNAL; \ 347 _V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(function) 348 348 349 349 } // namespace JSC -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r157404 r157411 226 226 } 227 227 228 void JIT_OPERATION operationPutByIdStrict(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid)228 void JIT_OPERATION operationPutByIdStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid) 229 229 { 230 230 VM* vm = &exec->vm(); … … 233 233 Identifier ident(vm, uid); 234 234 PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); 235 base->methodTable()->put(base,exec, ident, JSValue::decode(encodedValue), slot);236 } 237 238 void JIT_OPERATION operationPutByIdNonStrict(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid)235 JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot); 236 } 237 238 void JIT_OPERATION operationPutByIdNonStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid) 239 239 { 240 240 VM* vm = &exec->vm(); … … 243 243 Identifier ident(vm, uid); 244 244 PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); 245 base->methodTable()->put(base,exec, ident, JSValue::decode(encodedValue), slot);246 } 247 248 void JIT_OPERATION operationPutByIdDirectStrict(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid)245 JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot); 246 } 247 248 void JIT_OPERATION operationPutByIdDirectStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid) 249 249 { 250 250 VM* vm = &exec->vm(); … … 253 253 Identifier ident(vm, uid); 254 254 PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); 255 ASSERT(base->isObject()); 256 asObject(base)->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); 257 } 258 259 void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid) 255 asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); 256 } 257 258 void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid) 260 259 { 261 260 VM* vm = &exec->vm(); … … 264 263 Identifier ident(vm, uid); 265 264 PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); 266 ASSERT(base->isObject()); 267 asObject(base)->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); 268 } 269 270 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(operationPutByIdStrictOptimize); 271 void JIT_OPERATION operationPutByIdStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress) 265 asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); 266 } 267 268 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdStrictOptimize); 269 void JIT_OPERATION operationPutByIdStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 272 270 { 273 271 VM* vm = &exec->vm(); … … 279 277 280 278 JSValue value = JSValue::decode(encodedValue); 281 JSValue baseValue (base);279 JSValue baseValue = JSValue::decode(encodedBase); 282 280 PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); 283 281 … … 293 291 } 294 292 295 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdNonStrictOptimize);296 void JIT_OPERATION operationPutByIdNonStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)293 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdNonStrictOptimize); 294 void JIT_OPERATION operationPutByIdNonStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 297 295 { 298 296 VM* vm = &exec->vm(); … … 304 302 305 303 JSValue value = JSValue::decode(encodedValue); 306 JSValue baseValue (base);304 JSValue baseValue = JSValue::decode(encodedBase); 307 305 PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); 308 306 … … 318 316 } 319 317 320 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdDirectStrictOptimize);321 void JIT_OPERATION operationPutByIdDirectStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)318 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdDirectStrictOptimize); 319 void JIT_OPERATION operationPutByIdDirectStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 322 320 { 323 321 VM* vm = &exec->vm(); … … 329 327 330 328 JSValue value = JSValue::decode(encodedValue); 329 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 331 330 PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); 332 331 333 ASSERT(base->isObject()); 334 asObject(base)->putDirect(exec->vm(), ident, value, slot); 332 baseObject->putDirect(exec->vm(), ident, value, slot); 335 333 336 334 if (accessType != static_cast<AccessType>(stubInfo.accessType)) … … 338 336 339 337 if (stubInfo.seen) 340 repatchPutByID(exec, base , ident, slot, stubInfo, Direct);338 repatchPutByID(exec, baseObject, ident, slot, stubInfo, Direct); 341 339 else 342 340 stubInfo.seen = true; 343 341 } 344 342 345 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdDirectNonStrictOptimize);346 void JIT_OPERATION operationPutByIdDirectNonStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)343 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdDirectNonStrictOptimize); 344 void JIT_OPERATION operationPutByIdDirectNonStrictOptimizeWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 347 345 { 348 346 VM* vm = &exec->vm(); … … 354 352 355 353 JSValue value = JSValue::decode(encodedValue); 354 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 356 355 PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); 357 356 358 ASSERT(base->isObject()); 359 asObject(base)->putDirect(exec->vm(), ident, value, slot); 357 baseObject->putDirect(exec->vm(), ident, value, slot); 360 358 361 359 if (accessType != static_cast<AccessType>(stubInfo.accessType)) … … 363 361 364 362 if (stubInfo.seen) 365 repatchPutByID(exec, base , ident, slot, stubInfo, Direct);363 repatchPutByID(exec, baseObject, ident, slot, stubInfo, Direct); 366 364 else 367 365 stubInfo.seen = true; 368 366 } 369 367 370 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdStrictBuildList);371 void JIT_OPERATION operationPutByIdStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)368 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdStrictBuildList); 369 void JIT_OPERATION operationPutByIdStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 372 370 { 373 371 VM* vm = &exec->vm(); … … 379 377 380 378 JSValue value = JSValue::decode(encodedValue); 381 JSValue baseValue (base);379 JSValue baseValue = JSValue::decode(encodedBase); 382 380 PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); 383 381 … … 390 388 } 391 389 392 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdNonStrictBuildList);393 void JIT_OPERATION operationPutByIdNonStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)390 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdNonStrictBuildList); 391 void JIT_OPERATION operationPutByIdNonStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 394 392 { 395 393 VM* vm = &exec->vm(); … … 401 399 402 400 JSValue value = JSValue::decode(encodedValue); 403 JSValue baseValue (base);401 JSValue baseValue = JSValue::decode(encodedBase); 404 402 PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); 405 403 … … 412 410 } 413 411 414 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdDirectStrictBuildList);415 void JIT_OPERATION operationPutByIdDirectStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)412 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdDirectStrictBuildList); 413 void JIT_OPERATION operationPutByIdDirectStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 416 414 { 417 415 VM* vm = &exec->vm(); … … 423 421 424 422 JSValue value = JSValue::decode(encodedValue); 423 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 425 424 PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); 426 425 427 ASSERT(base->isObject()); 428 asObject(base)->putDirect(exec->vm(), ident, value, slot); 426 baseObject->putDirect(exec->vm(), ident, value, slot); 429 427 430 428 if (accessType != static_cast<AccessType>(stubInfo.accessType)) 431 429 return; 432 430 433 buildPutByIdList(exec, base , ident, slot, stubInfo, Direct);434 } 435 436 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJ CI(operationPutByIdDirectNonStrictBuildList);437 void JIT_OPERATION operationPutByIdDirectNonStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, JSCell* base, StringImpl* uid, ReturnAddressPtr returnAddress)431 buildPutByIdList(exec, baseObject, ident, slot, stubInfo, Direct); 432 } 433 434 V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJJI(operationPutByIdDirectNonStrictBuildList); 435 void JIT_OPERATION operationPutByIdDirectNonStrictBuildListWithReturnAddress(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl* uid, ReturnAddressPtr returnAddress) 438 436 { 439 437 VM* vm = &exec->vm(); … … 445 443 446 444 JSValue value = JSValue::decode(encodedValue); 445 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 447 446 PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); 448 447 449 ASSERT(base->isObject()); 450 asObject(base)->putDirect(exec->vm(), ident, value, slot); 448 baseObject ->putDirect(exec->vm(), ident, value, slot); 451 449 452 450 if (accessType != static_cast<AccessType>(stubInfo.accessType)) 453 451 return; 454 452 455 buildPutByIdList(exec, base , ident, slot, stubInfo, Direct);453 buildPutByIdList(exec, baseObject, ident, slot, stubInfo, Direct); 456 454 } 457 455 -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r157404 r157411 128 128 typedef void JIT_OPERATION (*V_JITOperation_ECZ)(ExecState*, JSCell*, int32_t); 129 129 typedef void JIT_OPERATION (*V_JITOperation_ECC)(ExecState*, JSCell*, JSCell*); 130 typedef void JIT_OPERATION (*V_JITOperation_EJ CI)(ExecState*, EncodedJSValue, JSCell*, StringImpl*);130 typedef void JIT_OPERATION (*V_JITOperation_EJJI)(ExecState*, EncodedJSValue, EncodedJSValue, StringImpl*); 131 131 typedef void JIT_OPERATION (*V_JITOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue); 132 132 typedef void JIT_OPERATION (*V_JITOperation_EJPP)(ExecState*, EncodedJSValue, void*, void*); … … 204 204 EncodedJSValue JIT_OPERATION operationCallCustomGetter(ExecState*, JSCell*, PropertySlot::GetValueFunc, StringImpl*) WTF_INTERNAL; 205 205 EncodedJSValue JIT_OPERATION operationCallGetter(ExecState*, JSCell*, JSCell*) WTF_INTERNAL; 206 void JIT_OPERATION operationPutByIdStrict(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;207 void JIT_OPERATION operationPutByIdNonStrict(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;208 void JIT_OPERATION operationPutByIdDirectStrict(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;209 void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;210 void JIT_OPERATION operationPutByIdStrictOptimize(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;211 void JIT_OPERATION operationPutByIdNonStrictOptimize(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;212 void JIT_OPERATION operationPutByIdDirectStrictOptimize(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;213 void JIT_OPERATION operationPutByIdDirectNonStrictOptimize(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;214 void JIT_OPERATION operationPutByIdStrictBuildList(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;215 void JIT_OPERATION operationPutByIdNonStrictBuildList(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;216 void JIT_OPERATION operationPutByIdDirectStrictBuildList(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;217 void JIT_OPERATION operationPutByIdDirectNonStrictBuildList(ExecState*, EncodedJSValue encodedValue, JSCell* base, StringImpl*) WTF_INTERNAL;206 void JIT_OPERATION operationPutByIdStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 207 void JIT_OPERATION operationPutByIdNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 208 void JIT_OPERATION operationPutByIdDirectStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 209 void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 210 void JIT_OPERATION operationPutByIdStrictOptimize(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 211 void JIT_OPERATION operationPutByIdNonStrictOptimize(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 212 void JIT_OPERATION operationPutByIdDirectStrictOptimize(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 213 void JIT_OPERATION operationPutByIdDirectNonStrictOptimize(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 214 void JIT_OPERATION operationPutByIdStrictBuildList(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 215 void JIT_OPERATION operationPutByIdNonStrictBuildList(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 216 void JIT_OPERATION operationPutByIdDirectStrictBuildList(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 217 void JIT_OPERATION operationPutByIdDirectNonStrictBuildList(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, StringImpl*) WTF_INTERNAL; 218 218 void JIT_OPERATION operationReallocateStorageAndFinishPut(ExecState*, JSObject*, Structure*, PropertyOffset, EncodedJSValue) WTF_INTERNAL; 219 219 EncodedJSValue JIT_OPERATION operationCallEval(ExecState*) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r157404 r157411 553 553 DataLabelCompact displacementLabel = load64WithCompactAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); 554 554 555 Label putResult(this);555 Label done(this); 556 556 557 557 END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath); 558 558 559 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubGetById, m_bytecodeOffset, hotPathBegin, structureToCompare, structureCheck, propertyStorageLoad, displacementLabel, putResult));559 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubGetById, m_bytecodeOffset, hotPathBegin, structureToCompare, structureCheck, propertyStorageLoad, displacementLabel, done)); 560 560 } 561 561 … … 592 592 593 593 // Track the location of the call; this will be used to recover patch information. 594 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo( PropertyStubGetById,coldPathBegin, call);594 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo(coldPathBegin, call); 595 595 } 596 596 … … 609 609 emitJumpSlowCaseIfNotJSCell(regT0, baseVReg); 610 610 611 BEGIN_UNINTERRUPTED_SEQUENCE(sequencePutById);612 613 Label hotPathBegin(this);614 615 // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over.616 611 DataLabelPtr structureToCompare; 617 addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)))); 618 619 ConvertibleLoadLabel propertyStorageLoad = convertibleLoadPtr(Address(regT0, JSObject::butterflyOffset()), regT2); 620 DataLabel32 displacementLabel = store64WithAddressOffsetPatch(regT1, Address(regT2, patchPutByIdDefaultOffset)); 621 622 END_UNINTERRUPTED_SEQUENCE(sequencePutById); 623 612 PatchableJump structureCheck = patchableBranchPtrWithPatch( 613 NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, 614 TrustedImmPtr(reinterpret_cast<void*>(unusedPointer))); 615 616 addSlowCase(structureCheck); 617 624 618 emitWriteBarrier(regT0, regT1, regT2, regT3, ShouldFilterImmediates, WriteBarrierForPropertyAccess); 625 619 626 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubPutById, m_bytecodeOffset, hotPathBegin, structureToCompare, propertyStorageLoad, displacementLabel)); 620 ConvertibleLoadLabel propertyStorageLoad = 621 convertibleLoadPtr(Address(regT0, JSObject::butterflyOffset()), regT2); 622 623 DataLabel32 storeWithPatch = 624 store64WithAddressOffsetPatch(regT1, Address(regT2, patchPutByIdDefaultOffset)); 625 626 Label done = label(); 627 628 m_propertyAccessCompilationInfo.append( 629 PropertyStubCompilationInfo( 630 PropertyStubPutById, m_bytecodeOffset, structureToCompare, structureCheck, 631 propertyStorageLoad, storeWithPatch, done)); 627 632 } 628 633 … … 636 641 linkSlowCase(iter); 637 642 638 JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct : cti_op_put_by_id); 639 stubCall.addArgument(regT0); 640 stubCall.addArgument(TrustedImmPtr(ident)); 641 stubCall.addArgument(regT1); 642 move(regT0, nonArgGPR1); 643 Call call = stubCall.call(); 643 Label coldPathBegin(this); 644 645 V_JITOperation_EJJI optimizedCall; 646 if (m_codeBlock->isStrictMode()) { 647 if (direct) 648 optimizedCall = operationPutByIdDirectStrictOptimize; 649 else 650 optimizedCall = operationPutByIdStrictOptimize; 651 } else { 652 if (direct) 653 optimizedCall = operationPutByIdDirectNonStrictOptimize; 654 else 655 optimizedCall = operationPutByIdNonStrictOptimize; 656 } 657 658 Call call = callOperation(optimizedCall, regT1, regT0, ident->impl()); 644 659 645 660 // Track the location of the call; this will be used to recover patch information. 646 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo( PropertyStubPutById, call);661 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo(coldPathBegin, call); 647 662 } 648 663 … … 681 696 loadPtr(base->butterflyAddress(), result); 682 697 load64(Address(result, offsetInButterfly(cachedOffset) * sizeof(WriteBarrier<Unknown>)), result); 683 }684 685 void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, PropertyOffset cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct)686 {687 move(nonArgGPR1, regT0);688 689 JumpList failureCases;690 // Check eax is an object of the right Structure.691 failureCases.append(emitJumpIfNotJSCell(regT0));692 failureCases.append(branchPtr(NotEqual, Address(regT0, JSCell::structureOffset()), TrustedImmPtr(oldStructure)));693 694 testPrototype(oldStructure->storedPrototype(), failureCases, stubInfo);695 696 ASSERT(oldStructure->storedPrototype().isNull() || oldStructure->storedPrototype().asCell()->structure() == chain->head()->get());697 698 // ecx = baseObject->m_structure699 if (!direct) {700 for (WriteBarrier<Structure>* it = chain->head(); *it; ++it) {701 ASSERT((*it)->storedPrototype().isNull() || (*it)->storedPrototype().asCell()->structure() == it[1].get());702 testPrototype((*it)->storedPrototype(), failureCases, stubInfo);703 }704 }705 706 // If we succeed in all of our checks, and the code was optimizable, then make sure we707 // decrement the rare case counter.708 #if ENABLE(VALUE_PROFILER)709 if (m_codeBlock->capabilityLevelState() != DFG::CannotCompile) {710 sub32(711 TrustedImm32(1),712 AbsoluteAddress(&m_codeBlock->rareCaseProfileForBytecodeOffset(stubInfo->codeOrigin.bytecodeIndex)->m_counter));713 }714 #endif715 716 // emit a call only if storage realloc is needed717 bool willNeedStorageRealloc = oldStructure->outOfLineCapacity() != newStructure->outOfLineCapacity();718 if (willNeedStorageRealloc) {719 // This trampoline was called to like a JIT stub; before we can can call again we need to720 // remove the return address from the stack, to prevent the stack from becoming misaligned.721 preserveReturnAddressAfterCall(regT3);722 723 JITStubCall stubCall(this, cti_op_put_by_id_transition_realloc);724 stubCall.skipArgument(); // base725 stubCall.skipArgument(); // ident726 stubCall.skipArgument(); // value727 stubCall.addArgument(TrustedImm32(oldStructure->outOfLineCapacity()));728 stubCall.addArgument(TrustedImmPtr(newStructure));729 stubCall.call(regT0);730 emitGetJITStubArg(2, regT1);731 732 restoreReturnAddressBeforeReturn(regT3);733 }734 735 // Planting the new structure triggers the write barrier so we need736 // an unconditional barrier here.737 emitWriteBarrier(regT0, regT1, regT2, regT3, UnconditionalWriteBarrier, WriteBarrierForPropertyAccess);738 739 ASSERT(newStructure->classInfo() == oldStructure->classInfo());740 storePtr(TrustedImmPtr(newStructure), Address(regT0, JSCell::structureOffset()));741 compilePutDirectOffset(regT0, regT1, cachedOffset);742 743 ret();744 745 ASSERT(!failureCases.empty());746 failureCases.link(this);747 restoreArgumentReferenceForTrampoline();748 Call failureCall = tailRecursiveCall();749 750 LinkBuffer patchBuffer(*m_vm, this, m_codeBlock);751 752 patchBuffer.link(failureCall, FunctionPtr(direct ? cti_op_put_by_id_direct_fail : cti_op_put_by_id_fail));753 754 if (willNeedStorageRealloc) {755 ASSERT(m_calls.size() == 1);756 patchBuffer.link(m_calls[0].from, FunctionPtr(cti_op_put_by_id_transition_realloc));757 }758 759 stubInfo->stubRoutine = createJITStubRoutine(760 FINALIZE_CODE(761 patchBuffer,762 ("Baseline put_by_id transition for %s, return point %p",763 toCString(*m_codeBlock).data(), returnAddress.value())),764 *m_vm,765 m_codeBlock->ownerExecutable(),766 willNeedStorageRealloc,767 newStructure);768 RepatchBuffer repatchBuffer(m_codeBlock);769 repatchBuffer.relinkCallerToTrampoline(returnAddress, CodeLocationLabel(stubInfo->stubRoutine->code().code()));770 698 } 771 699 … … 782 710 repatchBuffer.setLoadInstructionIsActive(stubInfo->hotPathBegin.convertibleLoadAtOffset(stubInfo->patch.baseline.u.get.propertyStorageLoad), isOutOfLineOffset(cachedOffset)); 783 711 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelCompactAtOffset(stubInfo->patch.baseline.u.get.displacementLabel), offsetRelativeToPatchedStorage(cachedOffset)); 784 }785 786 void JIT::patchPutByIdReplace(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress, bool direct)787 {788 RepatchBuffer repatchBuffer(codeBlock);789 790 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.791 // Should probably go to cti_op_put_by_id_fail, but that doesn't do anything interesting right now.792 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));793 794 // Patch the offset into the propoerty map to load from, then patch the Structure to look for.795 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(stubInfo->patch.baseline.u.put.structureToCompare), structure);796 repatchBuffer.setLoadInstructionIsActive(stubInfo->hotPathBegin.convertibleLoadAtOffset(stubInfo->patch.baseline.u.put.propertyStorageLoad), isOutOfLineOffset(cachedOffset));797 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel), offsetRelativeToPatchedStorage(cachedOffset));798 712 } 799 713 … … 1429 1343 } 1430 1344 1431 void JIT::resetPatchPutById(RepatchBuffer& repatchBuffer, StructureStubInfo* stubInfo)1432 {1433 if (isDirectPutById(stubInfo))1434 repatchBuffer.relink(stubInfo->callReturnLocation, cti_op_put_by_id_direct);1435 else1436 repatchBuffer.relink(stubInfo->callReturnLocation, cti_op_put_by_id);1437 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(stubInfo->patch.baseline.u.put.structureToCompare), reinterpret_cast<void*>(unusedPointer));1438 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel), 0);1439 }1440 1441 1345 #endif // USE(JSVALUE64) 1442 1346 … … 1504 1408 ASSERT(prototype.isCell()); 1505 1409 addStructureTransitionCheck(prototype.asCell(), prototype.asCell()->structure(), stubInfo, failureCases, regT3); 1506 }1507 1508 bool JIT::isDirectPutById(StructureStubInfo* stubInfo)1509 {1510 switch (stubInfo->accessType) {1511 case access_put_by_id_transition_normal:1512 return false;1513 case access_put_by_id_transition_direct:1514 return true;1515 case access_put_by_id_replace:1516 case access_put_by_id_generic: {1517 void* oldCall = MacroAssembler::readCallTarget(stubInfo->callReturnLocation).executableAddress();1518 if (oldCall == bitwise_cast<void*>(cti_op_put_by_id_direct)1519 || oldCall == bitwise_cast<void*>(cti_op_put_by_id_direct_generic)1520 || oldCall == bitwise_cast<void*>(cti_op_put_by_id_direct_fail))1521 return true;1522 ASSERT(oldCall == bitwise_cast<void*>(cti_op_put_by_id)1523 || oldCall == bitwise_cast<void*>(cti_op_put_by_id_generic)1524 || oldCall == bitwise_cast<void*>(cti_op_put_by_id_fail));1525 return false;1526 }1527 default:1528 RELEASE_ASSERT_NOT_REACHED();1529 return false;1530 }1531 1410 } 1532 1411 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r157404 r157411 530 530 531 531 // Track the location of the call; this will be used to recover patch information. 532 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo( PropertyStubGetById,coldPathBegin, call);532 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo(coldPathBegin, call); 533 533 } 534 534 … … 546 546 emitJumpSlowCaseIfNotJSCell(base, regT1); 547 547 548 DataLabelPtr structureToCompare; 549 PatchableJump structureCheck = patchableBranchPtrWithPatch( 550 NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, 551 TrustedImmPtr(reinterpret_cast<void*>(unusedPointer))); 552 553 addSlowCase(structureCheck); 554 555 emitWriteBarrier(regT0, regT2, regT1, regT2, ShouldFilterImmediates, WriteBarrierForPropertyAccess); 556 557 ConvertibleLoadLabel propertyStorageLoad = 558 convertibleLoadPtr(Address(regT0, JSObject::butterflyOffset()), regT1); 559 560 // Payload. 561 DataLabel32 storeWithPatch1 = 562 store32WithAddressOffsetPatch(regT2, Address(regT1, patchPutByIdDefaultOffset)); 563 // Tag. 564 DataLabel32 storeWithPatch2 = 565 store32WithAddressOffsetPatch(regT3, Address(regT1, patchPutByIdDefaultOffset)); 566 567 Label done = label(); 568 569 m_propertyAccessCompilationInfo.append( 570 PropertyStubCompilationInfo( 571 PropertyStubPutById, m_bytecodeOffset, structureToCompare, structureCheck, 572 propertyStorageLoad, storeWithPatch1, storeWithPatch2, done)); 548 573 BEGIN_UNINTERRUPTED_SEQUENCE(sequencePutById); 549 550 Label hotPathBegin(this);551 552 // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over.553 DataLabelPtr structureToCompare;554 addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, JSCell::structureOffset()), structureToCompare, TrustedImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));555 556 ConvertibleLoadLabel propertyStorageLoad = convertibleLoadPtr(Address(regT0, JSObject::butterflyOffset()), regT1);557 DataLabel32 displacementLabel1 = storePtrWithAddressOffsetPatch(regT2, Address(regT1, patchPutByIdDefaultOffset)); // payload558 DataLabel32 displacementLabel2 = storePtrWithAddressOffsetPatch(regT3, Address(regT1, patchPutByIdDefaultOffset)); // tag559 560 END_UNINTERRUPTED_SEQUENCE(sequencePutById);561 562 emitWriteBarrier(regT0, regT2, regT1, regT2, ShouldFilterImmediates, WriteBarrierForPropertyAccess);563 564 m_propertyAccessCompilationInfo.append(PropertyStubCompilationInfo(PropertyStubPutById, m_bytecodeOffset, hotPathBegin, structureToCompare, propertyStorageLoad, displacementLabel1, displacementLabel2));565 574 } 566 575 … … 568 577 { 569 578 int base = currentInstruction[1].u.operand; 570 int ident = currentInstruction[2].u.operand;579 const Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand)); 571 580 int direct = currentInstruction[8].u.operand; 572 581 … … 574 583 linkSlowCase(iter); 575 584 576 JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct : cti_op_put_by_id); 577 stubCall.addArgument(base); 578 stubCall.addArgument(TrustedImmPtr(&(m_codeBlock->identifier(ident)))); 579 stubCall.addArgument(regT3, regT2); 580 Call call = stubCall.call(); 581 585 Label coldPathBegin(this); 586 587 V_JITOperation_EJJI optimizedCall; 588 if (m_codeBlock->isStrictMode()) { 589 if (direct) 590 optimizedCall = operationPutByIdDirectStrictOptimize; 591 else 592 optimizedCall = operationPutByIdStrictOptimize; 593 } else { 594 if (direct) 595 optimizedCall = operationPutByIdDirectNonStrictOptimize; 596 else 597 optimizedCall = operationPutByIdNonStrictOptimize; 598 } 599 600 Call call = callOperation(optimizedCall, regT3, regT2, regT1, regT0, ident->impl()); 601 582 602 // Track the location of the call; this will be used to recover patch information. 583 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo( PropertyStubPutById, call);603 m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex++].slowCaseInfo(coldPathBegin, call); 584 604 } 585 605 … … 619 639 } 620 640 621 void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, PropertyOffset cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct)622 {623 // The code below assumes that regT0 contains the basePayload and regT1 contains the baseTag. Restore them from the stack.624 #if CPU(MIPS) || CPU(SH4) || CPU(ARM)625 // For MIPS, we don't add sizeof(void*) to the stack offset.626 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);627 // For MIPS, we don't add sizeof(void*) to the stack offset.628 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);629 #else630 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);631 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);632 #endif633 634 JumpList failureCases;635 failureCases.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)));636 failureCases.append(branchPtr(NotEqual, Address(regT0, JSCell::structureOffset()), TrustedImmPtr(oldStructure)));637 testPrototype(oldStructure->storedPrototype(), failureCases, stubInfo);638 639 if (!direct) {640 // Verify that nothing in the prototype chain has a setter for this property.641 for (WriteBarrier<Structure>* it = chain->head(); *it; ++it)642 testPrototype((*it)->storedPrototype(), failureCases, stubInfo);643 }644 645 // If we succeed in all of our checks, and the code was optimizable, then make sure we646 // decrement the rare case counter.647 #if ENABLE(VALUE_PROFILER)648 if (m_codeBlock->capabilityLevelState() != DFG::CannotCompile) {649 sub32(650 TrustedImm32(1),651 AbsoluteAddress(&m_codeBlock->rareCaseProfileForBytecodeOffset(stubInfo->codeOrigin.bytecodeIndex)->m_counter));652 }653 #endif654 655 // Reallocate property storage if needed.656 Call callTarget;657 bool willNeedStorageRealloc = oldStructure->outOfLineCapacity() != newStructure->outOfLineCapacity();658 if (willNeedStorageRealloc) {659 // This trampoline was called to like a JIT stub; before we can can call again we need to660 // remove the return address from the stack, to prevent the stack from becoming misaligned.661 preserveReturnAddressAfterCall(regT3);662 663 JITStubCall stubCall(this, cti_op_put_by_id_transition_realloc);664 stubCall.skipArgument(); // base665 stubCall.skipArgument(); // ident666 stubCall.skipArgument(); // value667 stubCall.addArgument(TrustedImm32(oldStructure->outOfLineCapacity()));668 stubCall.addArgument(TrustedImmPtr(newStructure));669 stubCall.call(regT0);670 671 restoreReturnAddressBeforeReturn(regT3);672 673 #if CPU(MIPS) || CPU(SH4) || CPU(ARM)674 // For MIPS, we don't add sizeof(void*) to the stack offset.675 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);676 // For MIPS, we don't add sizeof(void*) to the stack offset.677 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);678 #else679 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);680 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[0]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);681 #endif682 }683 684 emitWriteBarrier(regT0, regT1, regT1, regT3, UnconditionalWriteBarrier, WriteBarrierForPropertyAccess);685 686 storePtr(TrustedImmPtr(newStructure), Address(regT0, JSCell::structureOffset()));687 #if CPU(MIPS) || CPU(SH4) || CPU(ARM)688 // For MIPS, we don't add sizeof(void*) to the stack offset.689 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT3);690 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT2);691 #else692 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT3);693 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT2);694 #endif695 compilePutDirectOffset(regT0, regT2, regT3, cachedOffset);696 697 ret();698 699 ASSERT(!failureCases.empty());700 failureCases.link(this);701 restoreArgumentReferenceForTrampoline();702 Call failureCall = tailRecursiveCall();703 704 LinkBuffer patchBuffer(*m_vm, this, m_codeBlock);705 706 patchBuffer.link(failureCall, FunctionPtr(direct ? cti_op_put_by_id_direct_fail : cti_op_put_by_id_fail));707 708 if (willNeedStorageRealloc) {709 ASSERT(m_calls.size() == 1);710 patchBuffer.link(m_calls[0].from, FunctionPtr(cti_op_put_by_id_transition_realloc));711 }712 713 stubInfo->stubRoutine = createJITStubRoutine(714 FINALIZE_CODE(715 patchBuffer,716 ("Baseline put_by_id transition stub for %s, return point %p",717 toCString(*m_codeBlock).data(), returnAddress.value())),718 *m_vm,719 m_codeBlock->ownerExecutable(),720 willNeedStorageRealloc,721 newStructure);722 RepatchBuffer repatchBuffer(m_codeBlock);723 repatchBuffer.relinkCallerToTrampoline(returnAddress, CodeLocationLabel(stubInfo->stubRoutine->code().code()));724 }725 726 641 void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress) 727 642 { … … 737 652 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelCompactAtOffset(stubInfo->patch.baseline.u.get.displacementLabel1), offsetRelativeToPatchedStorage(cachedOffset) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)); // payload 738 653 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelCompactAtOffset(stubInfo->patch.baseline.u.get.displacementLabel2), offsetRelativeToPatchedStorage(cachedOffset) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)); // tag 739 }740 741 void JIT::patchPutByIdReplace(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, PropertyOffset cachedOffset, ReturnAddressPtr returnAddress, bool direct)742 {743 RepatchBuffer repatchBuffer(codeBlock);744 745 // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.746 // Should probably go to cti_op_put_by_id_fail, but that doesn't do anything interesting right now.747 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));748 749 // Patch the offset into the propoerty map to load from, then patch the Structure to look for.750 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(stubInfo->patch.baseline.u.put.structureToCompare), structure);751 repatchBuffer.setLoadInstructionIsActive(stubInfo->hotPathBegin.convertibleLoadAtOffset(stubInfo->patch.baseline.u.put.propertyStorageLoad), isOutOfLineOffset(cachedOffset));752 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel1), offsetRelativeToPatchedStorage(cachedOffset) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)); // payload753 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel2), offsetRelativeToPatchedStorage(cachedOffset) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)); // tag754 654 } 755 655 … … 1484 1384 } 1485 1385 1486 void JIT::resetPatchPutById(RepatchBuffer& repatchBuffer, StructureStubInfo* stubInfo)1487 {1488 if (isDirectPutById(stubInfo))1489 repatchBuffer.relink(stubInfo->callReturnLocation, cti_op_put_by_id_direct);1490 else1491 repatchBuffer.relink(stubInfo->callReturnLocation, cti_op_put_by_id);1492 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(stubInfo->patch.baseline.u.put.structureToCompare), reinterpret_cast<void*>(unusedPointer));1493 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel1), 0);1494 repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(stubInfo->patch.baseline.u.put.displacementLabel2), 0);1495 }1496 1497 1386 } // namespace JSC 1498 1387 -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r157404 r157411 124 124 } 125 125 126 NEVER_INLINE static void tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot& slot, StructureStubInfo* stubInfo, bool direct)127 {128 ConcurrentJITLocker locker(codeBlock->m_lock);129 130 // The interpreter checks for recursion here; I do not believe this can occur in CTI.131 132 if (!baseValue.isCell())133 return;134 135 // Uncacheable: give up.136 if (!slot.isCacheable()) {137 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));138 return;139 }140 141 JSCell* baseCell = baseValue.asCell();142 Structure* structure = baseCell->structure();143 144 if (structure->isUncacheableDictionary() || structure->typeInfo().prohibitsPropertyCaching()) {145 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));146 return;147 }148 149 // If baseCell != base, then baseCell must be a proxy for another object.150 if (baseCell != slot.base()) {151 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));152 return;153 }154 155 // Cache hit: Specialize instruction and ref Structures.156 157 // Structure transition, cache transition info158 if (slot.type() == PutPropertySlot::NewProperty) {159 if (structure->isDictionary()) {160 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));161 return;162 }163 164 // put_by_id_transition checks the prototype chain for setters.165 if (normalizePrototypeChain(callFrame, baseCell) == InvalidPrototypeChain) {166 ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));167 return;168 }169 170 StructureChain* prototypeChain = structure->prototypeChain(callFrame);171 ASSERT(structure->previousID()->transitionWatchpointSetHasBeenInvalidated());172 stubInfo->initPutByIdTransition(callFrame->vm(), codeBlock->ownerExecutable(), structure->previousID(), structure, prototypeChain, direct);173 JIT::compilePutByIdTransition(callFrame->scope()->vm(), codeBlock, stubInfo, structure->previousID(), structure, slot.cachedOffset(), prototypeChain, returnAddress, direct);174 return;175 }176 177 stubInfo->initPutByIdReplace(callFrame->vm(), codeBlock->ownerExecutable(), structure);178 179 JIT::patchPutByIdReplace(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress, direct);180 }181 182 126 NEVER_INLINE static void tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo* stubInfo) 183 127 { … … 437 381 } 438 382 439 DEFINE_STUB_FUNCTION(void, op_put_by_id_generic)440 {441 STUB_INIT_STACK_FRAME(stackFrame);442 443 PutPropertySlot slot(444 stackFrame.callFrame->codeBlock()->isStrictMode(),445 stackFrame.callFrame->codeBlock()->putByIdContext());446 stackFrame.args[0].jsValue().put(stackFrame.callFrame, stackFrame.args[1].identifier(), stackFrame.args[2].jsValue(), slot);447 CHECK_FOR_EXCEPTION_AT_END();448 }449 450 DEFINE_STUB_FUNCTION(void, op_put_by_id_direct_generic)451 {452 STUB_INIT_STACK_FRAME(stackFrame);453 454 PutPropertySlot slot(455 stackFrame.callFrame->codeBlock()->isStrictMode(),456 stackFrame.callFrame->codeBlock()->putByIdContext());457 JSValue baseValue = stackFrame.args[0].jsValue();458 ASSERT(baseValue.isObject());459 asObject(baseValue)->putDirect(stackFrame.callFrame->vm(), stackFrame.args[1].identifier(), stackFrame.args[2].jsValue(), slot);460 CHECK_FOR_EXCEPTION_AT_END();461 }462 463 383 DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_generic) 464 384 { … … 474 394 CHECK_FOR_EXCEPTION_AT_END(); 475 395 return JSValue::encode(result); 476 }477 478 DEFINE_STUB_FUNCTION(void, op_put_by_id)479 {480 STUB_INIT_STACK_FRAME(stackFrame);481 CallFrame* callFrame = stackFrame.callFrame;482 Identifier& ident = stackFrame.args[1].identifier();483 484 CodeBlock* codeBlock = stackFrame.callFrame->codeBlock();485 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);486 AccessType accessType = static_cast<AccessType>(stubInfo->accessType);487 488 PutPropertySlot slot(489 callFrame->codeBlock()->isStrictMode(),490 callFrame->codeBlock()->putByIdContext());491 stackFrame.args[0].jsValue().put(callFrame, ident, stackFrame.args[2].jsValue(), slot);492 493 if (accessType == static_cast<AccessType>(stubInfo->accessType)) {494 stubInfo->setSeen();495 tryCachePutByID(callFrame, codeBlock, STUB_RETURN_ADDRESS, stackFrame.args[0].jsValue(), slot, stubInfo, false);496 }497 498 CHECK_FOR_EXCEPTION_AT_END();499 }500 501 DEFINE_STUB_FUNCTION(void, op_put_by_id_direct)502 {503 STUB_INIT_STACK_FRAME(stackFrame);504 CallFrame* callFrame = stackFrame.callFrame;505 Identifier& ident = stackFrame.args[1].identifier();506 507 CodeBlock* codeBlock = stackFrame.callFrame->codeBlock();508 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);509 AccessType accessType = static_cast<AccessType>(stubInfo->accessType);510 511 PutPropertySlot slot(512 callFrame->codeBlock()->isStrictMode(),513 callFrame->codeBlock()->putByIdContext());514 JSValue baseValue = stackFrame.args[0].jsValue();515 ASSERT(baseValue.isObject());516 517 asObject(baseValue)->putDirect(callFrame->vm(), ident, stackFrame.args[2].jsValue(), slot);518 519 if (accessType == static_cast<AccessType>(stubInfo->accessType)) {520 stubInfo->setSeen();521 tryCachePutByID(callFrame, codeBlock, STUB_RETURN_ADDRESS, stackFrame.args[0].jsValue(), slot, stubInfo, true);522 }523 524 CHECK_FOR_EXCEPTION_AT_END();525 }526 527 DEFINE_STUB_FUNCTION(void, op_put_by_id_fail)528 {529 STUB_INIT_STACK_FRAME(stackFrame);530 531 CallFrame* callFrame = stackFrame.callFrame;532 Identifier& ident = stackFrame.args[1].identifier();533 534 PutPropertySlot slot(535 callFrame->codeBlock()->isStrictMode(),536 callFrame->codeBlock()->putByIdContext());537 stackFrame.args[0].jsValue().put(callFrame, ident, stackFrame.args[2].jsValue(), slot);538 539 CHECK_FOR_EXCEPTION_AT_END();540 }541 542 DEFINE_STUB_FUNCTION(void, op_put_by_id_direct_fail)543 {544 STUB_INIT_STACK_FRAME(stackFrame);545 546 CallFrame* callFrame = stackFrame.callFrame;547 Identifier& ident = stackFrame.args[1].identifier();548 549 PutPropertySlot slot(550 callFrame->codeBlock()->isStrictMode(),551 callFrame->codeBlock()->putByIdContext());552 JSValue baseValue = stackFrame.args[0].jsValue();553 ASSERT(baseValue.isObject());554 asObject(baseValue)->putDirect(callFrame->vm(), ident, stackFrame.args[2].jsValue(), slot);555 556 CHECK_FOR_EXCEPTION_AT_END();557 }558 559 DEFINE_STUB_FUNCTION(JSObject*, op_put_by_id_transition_realloc)560 {561 STUB_INIT_STACK_FRAME(stackFrame);562 563 JSValue baseValue = stackFrame.args[0].jsValue();564 int32_t oldSize = stackFrame.args[3].int32();565 Structure* newStructure = stackFrame.args[4].structure();566 int32_t newSize = newStructure->outOfLineCapacity();567 568 ASSERT(oldSize >= 0);569 ASSERT(newSize > oldSize);570 571 ASSERT(baseValue.isObject());572 JSObject* base = asObject(baseValue);573 VM& vm = *stackFrame.vm;574 Butterfly* butterfly = base->growOutOfLineStorage(vm, oldSize, newSize);575 base->setStructureAndButterfly(vm, newStructure, butterfly);576 577 return base;578 396 } 579 397 -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r157404 r157411 346 346 void JIT_STUB cti_op_push_name_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL; 347 347 void JIT_STUB cti_op_push_with_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL; 348 JSObject* JIT_STUB cti_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION) WTF_INTERNAL;349 348 void JIT_STUB cti_handle_watchdog_timer(STUB_ARGS_DECLARATION) WTF_INTERNAL; 350 349 void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION) WTF_INTERNAL; … … 352 351 void JIT_STUB cti_op_profile_did_call(STUB_ARGS_DECLARATION) WTF_INTERNAL; 353 352 void JIT_STUB cti_op_profile_will_call(STUB_ARGS_DECLARATION) WTF_INTERNAL; 354 void JIT_STUB cti_op_put_by_id(STUB_ARGS_DECLARATION) WTF_INTERNAL;355 void JIT_STUB cti_op_put_by_id_fail(STUB_ARGS_DECLARATION) WTF_INTERNAL;356 void JIT_STUB cti_op_put_by_id_generic(STUB_ARGS_DECLARATION) WTF_INTERNAL;357 void JIT_STUB cti_op_put_by_id_direct(STUB_ARGS_DECLARATION) WTF_INTERNAL;358 void JIT_STUB cti_op_put_by_id_direct_fail(STUB_ARGS_DECLARATION) WTF_INTERNAL;359 void JIT_STUB cti_op_put_by_id_direct_generic(STUB_ARGS_DECLARATION) WTF_INTERNAL;360 353 void JIT_STUB cti_op_put_by_index(STUB_ARGS_DECLARATION) WTF_INTERNAL; 361 354 void JIT_STUB cti_op_put_by_val(STUB_ARGS_DECLARATION) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r156490 r157411 605 605 } 606 606 607 static V_JITOperation_EJ CI appropriateGenericPutByIdFunction(const PutPropertySlot &slot, PutKind putKind)607 static V_JITOperation_EJJI appropriateGenericPutByIdFunction(const PutPropertySlot &slot, PutKind putKind) 608 608 { 609 609 if (slot.isStrictMode()) { … … 617 617 } 618 618 619 static V_JITOperation_EJ CI appropriateListBuildingPutByIdFunction(const PutPropertySlot &slot, PutKind putKind)619 static V_JITOperation_EJJI appropriateListBuildingPutByIdFunction(const PutPropertySlot &slot, PutKind putKind) 620 620 { 621 621 if (slot.isStrictMode()) { … … 1376 1376 void resetPutByID(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo) 1377 1377 { 1378 V_JITOperation_EJ CI unoptimizedFunction = bitwise_cast<V_JITOperation_EJCI>(MacroAssembler::readCallTarget(stubInfo.callReturnLocation).executableAddress());1379 V_JITOperation_EJ CI optimizedFunction;1378 V_JITOperation_EJJI unoptimizedFunction = bitwise_cast<V_JITOperation_EJJI>(MacroAssembler::readCallTarget(stubInfo.callReturnLocation).executableAddress()); 1379 V_JITOperation_EJJI optimizedFunction; 1380 1380 if (unoptimizedFunction == operationPutByIdStrict || unoptimizedFunction == operationPutByIdStrictBuildList) 1381 1381 optimizedFunction = operationPutByIdStrictOptimize;
Note: See TracChangeset
for help on using the changeset viewer.