Changeset 83447 in webkit
- Timestamp:
- Apr 11, 2011 10:11:38 AM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r83418 r83447 1 2011-04-11 Thouraya ANDOLSI <thouraya.andolsi@st.com> 2 3 Reviewed by Oliver Hunt. 4 5 SH4 JIT SUPPORT. 6 https://bugs.webkit.org/show_bug.cgi?id=44329 7 8 Add JIT remaining part for SH4 platforms. 9 10 * assembler/MacroAssemblerSH4.h: 11 * jit/JIT.h: 12 * jit/JITInlineMethods.h: 13 * jit/JITOpcodes32_64.cpp: 14 * jit/JITPropertyAccess32_64.cpp: 15 * jit/JITStubs.cpp: 16 * jit/JITStubs.h: 17 * jit/JSInterfaceJIT.h: 18 1 19 2011-04-10 Geoffrey Garen <ggaren@apple.com> 2 20 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h
r82617 r83447 1652 1652 } 1653 1653 1654 void call(Address address, RegisterID target) 1655 { 1656 load32(address.base, address.offset, target); 1657 m_assembler.ensureSpace(m_assembler.maxInstructionSize + 2); 1658 m_assembler.branch(JSR_OPCODE, target); 1659 m_assembler.nop(); 1660 } 1661 1654 1662 void breakpoint() 1655 1663 { -
trunk/Source/JavaScriptCore/jit/JIT.h
r83230 r83447 474 474 static const int patchOffsetMethodCheckPutFunction = 84; 475 475 #endif 476 #elif CPU(SH4) 477 // These architecture specific value are used to enable patching - see comment on op_put_by_id. 478 static const int patchOffsetGetByIdStructure = 6; 479 static const int patchOffsetPutByIdPropertyMapOffset = 24; 480 static const int patchOffsetPutByIdStructure = 6; 481 // These architecture specific value are used to enable patching - see comment on op_get_by_id. 482 static const int patchOffsetGetByIdBranchToSlowCase = 10; 483 static const int patchOffsetGetByIdPropertyMapOffset = 24; 484 static const int patchOffsetGetByIdPutResult = 32; 485 486 // sequenceOpCall 487 static const int sequenceOpCallInstructionSpace = 12; 488 static const int sequenceOpCallConstantSpace = 2; 489 // sequenceMethodCheck 490 static const int sequenceMethodCheckInstructionSpace = 40; 491 static const int sequenceMethodCheckConstantSpace = 6; 492 // sequenceGetByIdHotPath 493 static const int sequenceGetByIdHotPathInstructionSpace = 36; 494 static const int sequenceGetByIdHotPathConstantSpace = 5; 495 // sequenceGetByIdSlowCase 496 static const int sequenceGetByIdSlowCaseInstructionSpace = 26; 497 static const int sequenceGetByIdSlowCaseConstantSpace = 2; 498 // sequencePutById 499 static const int sequencePutByIdInstructionSpace = 36; 500 static const int sequencePutByIdConstantSpace = 5; 501 502 static const int patchOffsetGetByIdPropertyMapOffset1 = 20; 503 static const int patchOffsetGetByIdPropertyMapOffset2 = 26; 504 505 static const int patchOffsetPutByIdPropertyMapOffset1 = 20; 506 static const int patchOffsetPutByIdPropertyMapOffset2 = 26; 507 508 #if ENABLE(OPCODE_SAMPLING) 509 static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE 510 #else 511 static const int patchOffsetGetByIdSlowCaseCall = 22; 512 #endif 513 static const int patchOffsetOpCallCompareToJump = 4; 514 515 static const int patchOffsetMethodCheckProtoObj = 12; 516 static const int patchOffsetMethodCheckProtoStruct = 20; 517 static const int patchOffsetMethodCheckPutFunction = 32; 476 518 #else 477 519 #error "JSVALUE32_64 not supported on this platform." … … 666 708 #if (defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL) 667 709 #define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace); } while (false) 668 #define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace); } while (false) 710 #define END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, dst) do { endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace, dst); } while (false) 711 #define END_UNINTERRUPTED_SEQUENCE(name) END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, 0) 669 712 670 713 void beginUninterruptedSequence(int, int); 671 void endUninterruptedSequence(int, int );714 void endUninterruptedSequence(int, int, int); 672 715 673 716 #else 674 717 #define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(); } while (false) 675 718 #define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(); } while (false) 719 #define END_UNINTERRUPTED_SEQUENCE_FOR_PUT(name, dst) do { endUninterruptedSequence(); } while (false) 676 720 #endif 677 721 -
trunk/Source/JavaScriptCore/jit/JITInlineMethods.h
r83230 r83447 124 124 ensureSpace(insnSpace, constSpace); 125 125 126 #elif CPU(SH4) 127 #ifndef NDEBUG 128 insnSpace += sizeof(SH4Word); 129 constSpace += sizeof(uint64_t); 130 #endif 131 132 m_assembler.ensureSpace(insnSpace + m_assembler.maxInstructionSize + 2, constSpace + 8); 126 133 #endif 127 134 … … 134 141 } 135 142 136 ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) 137 { 143 ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace, int dst) 144 { 145 UNUSED_PARAM(dst); 138 146 #if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL 139 147 /* There are several cases when the uninterrupted sequence is larger than … … 144 152 * constSpace should be upper limit instead of hard limit. 145 153 */ 154 #if CPU(SH4) 155 if ((dst > 15) || (dst < -16)) { 156 insnSpace += 8; 157 constSpace += 2; 158 } 159 160 if (((dst >= -16) && (dst < 0)) || ((dst > 7) && (dst <= 15))) 161 insnSpace += 8; 162 #endif 146 163 ASSERT(differenceBetween(m_uninterruptedInstructionSequenceBegin, label()) <= insnSpace); 147 164 ASSERT(sizeOfConstantPool() - m_uninterruptedConstantSequenceBegin <= constSpace); … … 167 184 { 168 185 loadPtr(address, linkRegister); 186 } 187 #elif CPU(SH4) 188 189 ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) 190 { 191 m_assembler.stspr(reg); 192 } 193 194 ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg) 195 { 196 m_assembler.ldspr(reg); 197 } 198 199 ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) 200 { 201 loadPtrLinkReg(address); 169 202 } 170 203 … … 217 250 addPtr(TrustedImm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister); 218 251 #elif CPU(ARM) 252 move(stackPointerRegister, firstArgumentRegister); 253 #elif CPU(SH4) 219 254 move(stackPointerRegister, firstArgumentRegister); 220 255 #endif -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r83230 r83447 246 246 247 247 restoreReturnAddressBeforeReturn(regT3); 248 248 #elif CPU(SH4) 249 // Load caller frame's scope chain into this callframe so that whatever we call can 250 // get to its global data. 251 emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2); 252 emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2); 253 emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain); 254 255 preserveReturnAddressAfterCall(regT3); // Callee preserved 256 emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC); 257 258 // Calling convention: f(r0 == regT4, r1 == regT5, ...); 259 // Host function signature: f(ExecState*); 260 move(callFrameRegister, regT4); 261 262 emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT5); 263 move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack. 264 loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); 265 266 call(Address(regT2, executableOffsetToFunction), regT0); 267 restoreReturnAddressBeforeReturn(regT3); 249 268 #elif CPU(MIPS) 250 269 // Load caller frame's scope chain into this callframe so that whatever we call can … … 395 414 396 415 restoreReturnAddressBeforeReturn(regT3); 397 416 #elif CPU(SH4) 417 // Load caller frame's scope chain into this callframe so that whatever we call can 418 // get to its global data. 419 emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2); 420 emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2); 421 emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain); 422 423 preserveReturnAddressAfterCall(regT3); // Callee preserved 424 emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC); 425 426 // Calling convention: f(r0 == regT4, r1 == regT5, ...); 427 // Host function signature: f(ExecState*); 428 move(callFrameRegister, regT4); 429 430 emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT5); 431 move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack. 432 loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); 433 434 // call the function 435 nativeCall = call(); 436 437 restoreReturnAddressBeforeReturn(regT3); 398 438 #elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL) 399 439 #error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform." -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r82849 r83447 476 476 Call call = stubCall.call(dst); 477 477 478 END_UNINTERRUPTED_SEQUENCE (sequenceGetByIdSlowCase);478 END_UNINTERRUPTED_SEQUENCE_FOR_PUT(sequenceGetByIdSlowCase, dst); 479 479 480 480 ASSERT_JIT_OFFSET(differenceBetween(coldPathBegin, call), patchOffsetGetByIdSlowCaseCall); … … 625 625 storePtr(TrustedImmPtr(newStructure), Address(regT0, JSCell::structureOffset())); 626 626 627 #if CPU(MIPS) 627 #if CPU(MIPS) || CPU(SH4) 628 628 // For MIPS, we don't add sizeof(void*) to the stack offset. 629 629 load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT3); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r83385 r83447 315 315 #define GLOBAL_DATA_OFFSET 100 316 316 #define STACK_LENGTH 104 317 317 #elif CPU(SH4) 318 #define SYMBOL_STRING(name) #name 319 /* code (r4), RegisterFile* (r5), CallFrame* (r6), JSValue* exception (r7), Profiler**(sp), JSGlobalData (sp)*/ 320 321 asm volatile ( 322 ".text\n" 323 ".globl " SYMBOL_STRING(ctiTrampoline) "\n" 324 HIDE_SYMBOL(ctiTrampoline) "\n" 325 SYMBOL_STRING(ctiTrampoline) ":" "\n" 326 "mov.l r7, @-r15" "\n" 327 "mov.l r6, @-r15" "\n" 328 "mov.l r5, @-r15" "\n" 329 "mov.l r8, @-r15" "\n" 330 "mov #127, r8" "\n" 331 "mov.l r14, @-r15" "\n" 332 "sts.l pr, @-r15" "\n" 333 "mov.l r13, @-r15" "\n" 334 "mov.l r11, @-r15" "\n" 335 "mov.l r10, @-r15" "\n" 336 "add #-60, r15" "\n" 337 "mov r6, r14" "\n" 338 "jsr @r4" "\n" 339 "nop" "\n" 340 "add #60, r15" "\n" 341 "mov.l @r15+,r10" "\n" 342 "mov.l @r15+,r11" "\n" 343 "mov.l @r15+,r13" "\n" 344 "lds.l @r15+,pr" "\n" 345 "mov.l @r15+,r14" "\n" 346 "mov.l @r15+,r8" "\n" 347 "add #12, r15" "\n" 348 "rts" "\n" 349 "nop" "\n" 350 ); 351 352 asm volatile ( 353 ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" 354 HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" 355 SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" 356 "mov.l .L2"SYMBOL_STRING(cti_vm_throw)",r0" "\n" 357 "mov r15, r4" "\n" 358 "mov.l @(r0,r12),r11" "\n" 359 "jsr @r11" "\n" 360 "nop" "\n" 361 "add #60, r15" "\n" 362 "mov.l @r15+,r10" "\n" 363 "mov.l @r15+,r11" "\n" 364 "mov.l @r15+,r13" "\n" 365 "lds.l @r15+,pr" "\n" 366 "mov.l @r15+,r14" "\n" 367 "mov.l @r15+,r8" "\n" 368 "add #12, r15" "\n" 369 "rts" "\n" 370 "nop" "\n" 371 ".align 2" "\n" 372 ".L2"SYMBOL_STRING(cti_vm_throw)":.long " SYMBOL_STRING(cti_vm_throw)"@GOT \n" 373 ); 374 375 asm volatile ( 376 ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" 377 HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" 378 SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" 379 "add #60, r15" "\n" 380 "mov.l @r15+,r10" "\n" 381 "mov.l @r15+,r11" "\n" 382 "mov.l @r15+,r13" "\n" 383 "lds.l @r15+,pr" "\n" 384 "mov.l @r15+,r14" "\n" 385 "mov.l @r15+,r8" "\n" 386 "add #12, r15" "\n" 387 "rts" "\n" 388 "nop" "\n" 389 ); 318 390 #else 319 391 #error "JIT not supported on this platform." … … 1157 1229 */ 1158 1230 1231 #elif CPU(SH4) 1232 #define DEFINE_STUB_FUNCTION(rtype, op) \ 1233 extern "C" { \ 1234 rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \ 1235 }; \ 1236 asm volatile( \ 1237 ".align 2" "\n" \ 1238 ".globl " SYMBOL_STRING(cti_##op) "\n" \ 1239 SYMBOL_STRING(cti_##op) ":" "\n" \ 1240 "sts pr, r11" "\n" \ 1241 "mov.l r11, @(0x38, r15)" "\n" \ 1242 "mov.l .L2"SYMBOL_STRING(JITStubThunked_##op)",r0" "\n" \ 1243 "mov.l @(r0,r12),r11" "\n" \ 1244 "jsr @r11" "\n" \ 1245 "nop" "\n" \ 1246 "mov.l @(0x38, r15), r11 " "\n" \ 1247 "lds r11, pr " "\n" \ 1248 "rts" "\n" \ 1249 "nop" "\n" \ 1250 ".align 2" "\n" \ 1251 ".L2"SYMBOL_STRING(JITStubThunked_##op)":.long " SYMBOL_STRING(JITStubThunked_##op)"@GOT \n" \ 1252 ); \ 1253 rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) 1159 1254 #else 1160 1255 #define DEFINE_STUB_FUNCTION(rtype, op) rtype JIT_STUB cti_##op(STUB_ARGS_DECLARATION) -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r83385 r83447 225 225 226 226 // These arguments passed on the stack. 227 Profiler** enabledProfilerReference; 228 JSGlobalData* globalData; 229 230 ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } 231 }; 232 #elif CPU(SH4) 233 struct JITStackFrame { 234 JITStubArg padding; // Unused 235 JITStubArg args[6]; 236 237 ReturnAddressPtr thunkReturnAddress; 238 void* savedR10; 239 void* savedR11; 240 void* savedR13; 241 void* savedRPR; 242 void* savedR14; 243 void* savedTimeoutReg; 244 245 RegisterFile* registerFile; 246 CallFrame* callFrame; 247 JSValue* exception; 227 248 Profiler** enabledProfilerReference; 228 249 JSGlobalData* globalData; -
trunk/Source/JavaScriptCore/jit/JSInterfaceJIT.h
r83230 r83447 155 155 static const FPRegisterID fpRegT2 = MIPSRegisters::f8; 156 156 static const FPRegisterID fpRegT3 = MIPSRegisters::f10; 157 #elif CPU(SH4) 158 static const RegisterID timeoutCheckRegister = SH4Registers::r8; 159 static const RegisterID callFrameRegister = SH4Registers::fp; 160 161 static const RegisterID regT0 = SH4Registers::r0; 162 static const RegisterID regT1 = SH4Registers::r1; 163 static const RegisterID regT2 = SH4Registers::r2; 164 static const RegisterID regT3 = SH4Registers::r10; 165 static const RegisterID regT4 = SH4Registers::r4; 166 static const RegisterID regT5 = SH4Registers::r5; 167 static const RegisterID regT6 = SH4Registers::r6; 168 static const RegisterID regT7 = SH4Registers::r7; 169 static const RegisterID firstArgumentRegister =regT4; 170 171 static const RegisterID returnValueRegister = SH4Registers::r0; 172 static const RegisterID cachedResultRegister = SH4Registers::r0; 173 174 static const FPRegisterID fpRegT0 = SH4Registers::fr0; 175 static const FPRegisterID fpRegT1 = SH4Registers::fr2; 176 static const FPRegisterID fpRegT2 = SH4Registers::fr4; 177 static const FPRegisterID fpRegT3 = SH4Registers::fr6; 178 static const FPRegisterID fpRegT4 = SH4Registers::fr8; 179 static const FPRegisterID fpRegT5 = SH4Registers::fr10; 180 static const FPRegisterID fpRegT6 = SH4Registers::fr12; 181 static const FPRegisterID fpRegT7 = SH4Registers::fr14; 157 182 #else 158 183 #error "JIT not supported on this platform."
Note: See TracChangeset
for help on using the changeset viewer.