Changeset 58283 in webkit
- Timestamp:
- Apr 26, 2010 8:45:47 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r58268 r58283 1 2010-04-26 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Gavin Barraclough. 4 5 Factor some basic JS interface logic out of JIT and into a superclass 6 https://bugs.webkit.org/show_bug.cgi?id=38163 7 8 Create JSInterfaceJIT to hold some common low level functions for 9 interacting with the JS RegisterFile. Doing this separately from 10 https://bugs.webkit.org/show_bug.cgi?id=38155 to ease reviewing. 11 12 * JavaScriptCore.xcodeproj/project.pbxproj: 13 * jit/JIT.h: 14 * jit/JITInlineMethods.h: 15 (JSC::JIT::emitJumpSlowCaseIfNotJSCell): 16 * jit/JSInterfaceJIT.h: Added. 17 (JSC::JSInterfaceJIT::emitLoadJSCell): 18 (JSC::JSInterfaceJIT::emitJumpIfNotJSCell): 19 (JSC::JSInterfaceJIT::emitLoadInt32): 20 (JSC::JSInterfaceJIT::tagFor): 21 (JSC::JSInterfaceJIT::payloadFor): 22 (JSC::JSInterfaceJIT::addressFor): 23 1 24 2010-04-26 Sam Weinig <sam@webkit.org> 2 25 -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r58266 r58283 292 292 A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */; }; 293 293 A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 294 A73161FE118692FF00BB280D /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A73161FD118692FF00BB280D /* JSInterfaceJIT.h */; }; 294 295 A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 295 296 A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */; }; … … 872 873 A727FF650DA3053B00E548D7 /* JSPropertyNameIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPropertyNameIterator.h; sourceTree = "<group>"; }; 873 874 A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPropertyNameIterator.cpp; sourceTree = "<group>"; }; 875 A73161FD118692FF00BB280D /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = "<group>"; }; 874 876 A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefPrivate.h; sourceTree = "<group>"; }; 875 877 A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakObjectMapRefPrivate.cpp; sourceTree = "<group>"; }; … … 1222 1224 14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */, 1223 1225 14A6581A0F4E36F4000150FD /* JITStubs.h */, 1226 A73161FD118692FF00BB280D /* JSInterfaceJIT.h */, 1224 1227 ); 1225 1228 path = jit; … … 2113 2116 BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */, 2114 2117 BC5F7BC011823B590052C02C /* ThreadSafeShared.h in Headers */, 2118 A73161FE118692FF00BB280D /* JSInterfaceJIT.h in Headers */, 2115 2119 ); 2116 2120 runOnlyForDeploymentPostprocessing = 0; -
trunk/JavaScriptCore/jit/JIT.h
r57955 r58283 41 41 #include "CodeBlock.h" 42 42 #include "Interpreter.h" 43 #include "JITCode.h" 44 #include "JITStubs.h" 43 #include "JSInterfaceJIT.h" 45 44 #include "Opcode.h" 46 #include "RegisterFile.h"47 #include "MacroAssembler.h"48 45 #include "Profiler.h" 49 46 #include <bytecode/SamplingTool.h> 50 #include <wtf/AlwaysInline.h>51 #include <wtf/Vector.h>52 47 53 48 namespace JSC { … … 171 166 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction); 172 167 173 class JIT : private MacroAssembler{168 class JIT : private JSInterfaceJIT { 174 169 friend class JITStubCall; 175 170 … … 177 172 using MacroAssembler::JumpList; 178 173 using MacroAssembler::Label; 179 180 // NOTES:181 //182 // regT0 has two special meanings. The return value from a stub183 // call will always be in regT0, and by default (unless184 // a register is specified) emitPutVirtualRegister() will store185 // the value from regT0.186 //187 // regT3 is required to be callee-preserved.188 //189 // tempRegister2 is has no such dependencies. It is important that190 // on x86/x86-64 it is ecx for performance reasons, since the191 // MacroAssembler will need to plant register swaps if it is not -192 // however the code will still function correctly.193 #if CPU(X86_64)194 static const RegisterID returnValueRegister = X86Registers::eax;195 static const RegisterID cachedResultRegister = X86Registers::eax;196 static const RegisterID firstArgumentRegister = X86Registers::edi;197 198 static const RegisterID timeoutCheckRegister = X86Registers::r12;199 static const RegisterID callFrameRegister = X86Registers::r13;200 static const RegisterID tagTypeNumberRegister = X86Registers::r14;201 static const RegisterID tagMaskRegister = X86Registers::r15;202 203 static const RegisterID regT0 = X86Registers::eax;204 static const RegisterID regT1 = X86Registers::edx;205 static const RegisterID regT2 = X86Registers::ecx;206 static const RegisterID regT3 = X86Registers::ebx;207 208 static const FPRegisterID fpRegT0 = X86Registers::xmm0;209 static const FPRegisterID fpRegT1 = X86Registers::xmm1;210 static const FPRegisterID fpRegT2 = X86Registers::xmm2;211 #elif CPU(X86)212 static const RegisterID returnValueRegister = X86Registers::eax;213 static const RegisterID cachedResultRegister = X86Registers::eax;214 // On x86 we always use fastcall conventions = but on215 // OS X if might make more sense to just use regparm.216 static const RegisterID firstArgumentRegister = X86Registers::ecx;217 218 static const RegisterID timeoutCheckRegister = X86Registers::esi;219 static const RegisterID callFrameRegister = X86Registers::edi;220 221 static const RegisterID regT0 = X86Registers::eax;222 static const RegisterID regT1 = X86Registers::edx;223 static const RegisterID regT2 = X86Registers::ecx;224 static const RegisterID regT3 = X86Registers::ebx;225 226 static const FPRegisterID fpRegT0 = X86Registers::xmm0;227 static const FPRegisterID fpRegT1 = X86Registers::xmm1;228 static const FPRegisterID fpRegT2 = X86Registers::xmm2;229 #elif CPU(ARM_THUMB2)230 static const RegisterID returnValueRegister = ARMRegisters::r0;231 static const RegisterID cachedResultRegister = ARMRegisters::r0;232 static const RegisterID firstArgumentRegister = ARMRegisters::r0;233 234 static const RegisterID regT0 = ARMRegisters::r0;235 static const RegisterID regT1 = ARMRegisters::r1;236 static const RegisterID regT2 = ARMRegisters::r2;237 static const RegisterID regT3 = ARMRegisters::r4;238 239 static const RegisterID callFrameRegister = ARMRegisters::r5;240 static const RegisterID timeoutCheckRegister = ARMRegisters::r6;241 242 static const FPRegisterID fpRegT0 = ARMRegisters::d0;243 static const FPRegisterID fpRegT1 = ARMRegisters::d1;244 static const FPRegisterID fpRegT2 = ARMRegisters::d2;245 #elif CPU(ARM_TRADITIONAL)246 static const RegisterID returnValueRegister = ARMRegisters::r0;247 static const RegisterID cachedResultRegister = ARMRegisters::r0;248 static const RegisterID firstArgumentRegister = ARMRegisters::r0;249 250 static const RegisterID timeoutCheckRegister = ARMRegisters::r5;251 static const RegisterID callFrameRegister = ARMRegisters::r4;252 253 static const RegisterID regT0 = ARMRegisters::r0;254 static const RegisterID regT1 = ARMRegisters::r1;255 static const RegisterID regT2 = ARMRegisters::r2;256 // Callee preserved257 static const RegisterID regT3 = ARMRegisters::r7;258 259 static const RegisterID regS0 = ARMRegisters::S0;260 // Callee preserved261 static const RegisterID regS1 = ARMRegisters::S1;262 263 static const RegisterID regStackPtr = ARMRegisters::sp;264 static const RegisterID regLink = ARMRegisters::lr;265 266 static const FPRegisterID fpRegT0 = ARMRegisters::d0;267 static const FPRegisterID fpRegT1 = ARMRegisters::d1;268 static const FPRegisterID fpRegT2 = ARMRegisters::d2;269 #elif CPU(MIPS)270 static const RegisterID returnValueRegister = MIPSRegisters::v0;271 static const RegisterID cachedResultRegister = MIPSRegisters::v0;272 static const RegisterID firstArgumentRegister = MIPSRegisters::a0;273 274 // regT0 must be v0 for returning a 32-bit value.275 static const RegisterID regT0 = MIPSRegisters::v0;276 277 // regT1 must be v1 for returning a pair of 32-bit value.278 static const RegisterID regT1 = MIPSRegisters::v1;279 280 static const RegisterID regT2 = MIPSRegisters::t4;281 282 // regT3 must be saved in the callee, so use an S register.283 static const RegisterID regT3 = MIPSRegisters::s2;284 285 static const RegisterID callFrameRegister = MIPSRegisters::s0;286 static const RegisterID timeoutCheckRegister = MIPSRegisters::s1;287 288 static const FPRegisterID fpRegT0 = MIPSRegisters::f4;289 static const FPRegisterID fpRegT1 = MIPSRegisters::f6;290 static const FPRegisterID fpRegT2 = MIPSRegisters::f8;291 #else292 #error "JIT not supported on this platform."293 #endif294 174 295 175 static const int patchGetByIdDefaultStructure = -1; … … 406 286 void emitLoadInt32ToDouble(unsigned index, FPRegisterID value); 407 287 408 Address addressFor(unsigned index, RegisterID base = callFrameRegister);409 410 288 void testPrototype(Structure*, JumpList& failureCases); 411 289 412 290 #if USE(JSVALUE32_64) 413 Address tagFor(unsigned index, RegisterID base = callFrameRegister);414 Address payloadFor(unsigned index, RegisterID base = callFrameRegister);415 416 291 bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant); 417 292 -
trunk/JavaScriptCore/jit/JITInlineMethods.h
r56759 r58283 324 324 #endif 325 325 326 inline JIT::Address JIT::addressFor(unsigned index, RegisterID base)327 {328 return Address(base, (index * sizeof(Register)));329 }330 331 326 #if USE(JSVALUE32_64) 332 333 inline JIT::Address JIT::tagFor(unsigned index, RegisterID base)334 {335 return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));336 }337 338 inline JIT::Address JIT::payloadFor(unsigned index, RegisterID base)339 {340 return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));341 }342 327 343 328 inline void JIT::emitLoadTag(unsigned index, RegisterID tag) … … 561 546 { 562 547 if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) 563 addSlowCase( branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::CellTag)));548 addSlowCase(emitJumpIfNotJSCell(virtualRegisterIndex)); 564 549 } 565 550
Note: See TracChangeset
for help on using the changeset viewer.