Changeset 38286 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 10, 2008, 9:09:46 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r38285 r38286 1 2008-11-10 Gavin Barraclough <[email protected]> 2 3 Reviewed by Camron Zwarich. 4 5 Batch compile the set of static trampolines at the point Machine is constructed, using a single allocation. 6 Refactor out m_callFrame from CTI, since this is only needed to access the global data (instead store a 7 pointer to the global data directly, since this is available at the point the Machine is constructed). 8 Add a method to align the code buffer, to allow JIT generation for multiple trampolines in one block. 9 10 * VM/CTI.cpp: 11 (JSC::CTI::getConstant): 12 (JSC::CTI::emitGetArg): 13 (JSC::CTI::emitGetPutArg): 14 (JSC::CTI::getConstantImmediateNumericArg): 15 (JSC::CTI::printOpcodeOperandTypes): 16 (JSC::CTI::CTI): 17 (JSC::CTI::compileBinaryArithOp): 18 (JSC::CTI::privateCompileMainPass): 19 (JSC::CTI::privateCompileGetByIdProto): 20 (JSC::CTI::privateCompileGetByIdChain): 21 (JSC::CTI::privateCompileCTIMachineTrampolines): 22 (JSC::CTI::freeCTIMachineTrampolines): 23 * VM/CTI.h: 24 (JSC::CTI::compile): 25 (JSC::CTI::compileGetByIdSelf): 26 (JSC::CTI::compileGetByIdProto): 27 (JSC::CTI::compileGetByIdChain): 28 (JSC::CTI::compilePutByIdReplace): 29 (JSC::CTI::compilePutByIdTransition): 30 (JSC::CTI::compileCTIMachineTrampolines): 31 (JSC::CTI::compilePatchGetArrayLength): 32 * VM/Machine.cpp: 33 (JSC::Machine::initialize): 34 (JSC::Machine::~Machine): 35 (JSC::Machine::execute): 36 (JSC::Machine::tryCTICachePutByID): 37 (JSC::Machine::tryCTICacheGetByID): 38 (JSC::Machine::cti_op_call_JSFunction): 39 (JSC::Machine::cti_vm_lazyLinkCall): 40 * VM/Machine.h: 41 * masm/X86Assembler.h: 42 (JSC::JITCodeBuffer::isAligned): 43 (JSC::X86Assembler::): 44 (JSC::X86Assembler::align): 45 * runtime/JSGlobalData.cpp: 46 (JSC::JSGlobalData::JSGlobalData): 47 1 48 2008-11-10 Maciej Stachowiak <[email protected]> 2 49 -
trunk/JavaScriptCore/VM/CTI.cpp
r38284 r38286 169 169 #endif 170 170 171 ALWAYS_INLINE JSValue* CTI::getConstant( CallFrame* callFrame,int src)172 { 173 return m_codeBlock->constantRegisters[src - m_codeBlock->numVars]. jsValue(callFrame);171 ALWAYS_INLINE JSValue* CTI::getConstant(int src) 172 { 173 return m_codeBlock->constantRegisters[src - m_codeBlock->numVars].getJSValue(); 174 174 } 175 175 … … 184 184 // TODO: we want to reuse values that are already in registers if we can - add a register allocator! 185 185 if (m_codeBlock->isConstant(src)) { 186 JSValue* js = getConstant( m_callFrame,src);186 JSValue* js = getConstant(src); 187 187 m_jit.movl_i32r(asInteger(js), dst); 188 188 } else … … 194 194 { 195 195 if (m_codeBlock->isConstant(src)) { 196 JSValue* js = getConstant( m_callFrame,src);196 JSValue* js = getConstant(src); 197 197 m_jit.movl_i32m(asInteger(js), offset + sizeof(void*), X86::esp); 198 198 } else { … … 216 216 { 217 217 if (m_codeBlock->isConstant(src)) { 218 JSValue* js = getConstant( m_callFrame,src);218 JSValue* js = getConstant(src); 219 219 return JSImmediate::isNumber(js) ? js : noValue(); 220 220 } … … 275 275 char which1 = '*'; 276 276 if (m_codeBlock->isConstant(src1)) { 277 JSValue* js = getConstant( m_callFrame,src1);277 JSValue* js = getConstant(src1); 278 278 which1 = 279 279 JSImmediate::isImmediate(js) ? … … 289 289 char which2 = '*'; 290 290 if (m_codeBlock->isConstant(src2)) { 291 JSValue* js = getConstant( m_callFrame,src2);291 JSValue* js = getConstant(src2); 292 292 which2 = 293 293 JSImmediate::isImmediate(js) ? … … 547 547 } 548 548 549 CTI::CTI( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock)550 : m_jit( machine->jitCodeBuffer())551 , m_machine( machine)552 , m_ callFrame(callFrame)549 CTI::CTI(JSGlobalData* globalData, CodeBlock* codeBlock) 550 : m_jit(globalData->machine->jitCodeBuffer()) 551 , m_machine(globalData->machine) 552 , m_globalData(globalData) 553 553 , m_codeBlock(codeBlock) 554 554 , m_labels(codeBlock ? codeBlock->instructions.size() : 0) … … 792 792 void CTI::compileBinaryArithOp(OpcodeID opcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes types, unsigned i) 793 793 { 794 StructureID* numberStructureID = m_ callFrame->globalData().numberStructureID.get();794 StructureID* numberStructureID = m_globalData->numberStructureID.get(); 795 795 X86Assembler::JmpSrc wasJSNumberCell1; 796 796 X86Assembler::JmpSrc wasJSNumberCell1b; … … 1006 1006 unsigned src = instruction[i + 2].u.operand; 1007 1007 if (m_codeBlock->isConstant(src)) 1008 m_jit.movl_i32r(asInteger(getConstant( m_callFrame,src)), X86::eax);1008 m_jit.movl_i32r(asInteger(getConstant(src)), X86::eax); 1009 1009 else 1010 1010 emitGetArg(src, X86::eax); … … 1531 1531 if (!resultType.definitelyIsNumber()) { 1532 1532 emitJumpSlowCaseIfNotJSCell(X86::eax, i); 1533 StructureID* numberStructureID = m_ callFrame->globalData().numberStructureID.get();1533 StructureID* numberStructureID = m_globalData->numberStructureID.get(); 1534 1534 m_jit.cmpl_i32m(reinterpret_cast<unsigned>(numberStructureID), OBJECT_OFFSET(JSCell, m_structureID), X86::eax); 1535 1535 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJne(), i)); … … 1541 1541 X86Assembler::JmpSrc wasCell; 1542 1542 if (!resultType.isReusableNumber()) 1543 emitAllocateNumber( &m_callFrame->globalData(), i);1543 emitAllocateNumber(m_globalData, i); 1544 1544 1545 1545 putDoubleResultToJSNumberCellOrJSImmediate(X86::xmm0, X86::eax, instruction[i + 1].u.operand, &wasCell, … … 3051 3051 } 3052 3052 3053 void CTI::privateCompileGetByIdProto(StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress )3053 void CTI::privateCompileGetByIdProto(StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress, CallFrame* callFrame) 3054 3054 { 3055 3055 #if USE(CTI_REPATCH_PIC) … … 3061 3061 // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a StructureID that is 3062 3062 // referencing the prototype object - let's speculatively load it's table nice and early!) 3063 JSObject* protoObject = asObject(structureID->prototypeForLookup( m_callFrame));3063 JSObject* protoObject = asObject(structureID->prototypeForLookup(callFrame)); 3064 3064 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 3065 3065 m_jit.movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx); … … 3104 3104 // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a StructureID that is 3105 3105 // referencing the prototype object - let's speculatively load it's table nice and early!) 3106 JSObject* protoObject = asObject(structureID->prototypeForLookup( m_callFrame));3106 JSObject* protoObject = asObject(structureID->prototypeForLookup(callFrame)); 3107 3107 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 3108 3108 m_jit.movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx); … … 3137 3137 } 3138 3138 3139 void CTI::privateCompileGetByIdChain(StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset, void* returnAddress )3139 void CTI::privateCompileGetByIdChain(StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame) 3140 3140 { 3141 3141 ASSERT(count); … … 3153 3153 JSObject* protoObject = 0; 3154 3154 for (unsigned i = 0; i<count; ++i) { 3155 protoObject = asObject(currStructureID->prototypeForLookup( m_callFrame));3155 protoObject = asObject(currStructureID->prototypeForLookup(callFrame)); 3156 3156 currStructureID = chainEntries[i].get(); 3157 3157 … … 3329 3329 } 3330 3330 3331 void* CTI::privateCompileArrayLengthTrampoline() 3332 { 3331 void CTI::privateCompileCTIMachineTrampolines() 3332 { 3333 // (1) The first function provides fast property access for array length 3334 3333 3335 // Check eax is an array 3334 3336 m_jit.testl_i32r(JSImmediate::TagMask, X86::eax); 3335 X86Assembler::JmpSrc failureCases1 = m_jit.emitUnlinkedJne();3337 X86Assembler::JmpSrc array_failureCases1 = m_jit.emitUnlinkedJne(); 3336 3338 m_jit.cmpl_i32m(reinterpret_cast<unsigned>(m_machine->m_jsArrayVptr), X86::eax); 3337 X86Assembler::JmpSrc failureCases2 = m_jit.emitUnlinkedJne();3339 X86Assembler::JmpSrc array_failureCases2 = m_jit.emitUnlinkedJne(); 3338 3340 3339 3341 // Checks out okay! - get the length from the storage … … 3342 3344 3343 3345 m_jit.addl_rr(X86::eax, X86::eax); 3344 X86Assembler::JmpSrc failureCases3 = m_jit.emitUnlinkedJo();3346 X86Assembler::JmpSrc array_failureCases3 = m_jit.emitUnlinkedJo(); 3345 3347 m_jit.addl_i8r(1, X86::eax); 3346 3348 3347 3349 m_jit.ret(); 3348 3350 3349 void* code = m_jit.copy(); 3350 ASSERT(code); 3351 3352 X86Assembler::link(code, failureCases1, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3353 X86Assembler::link(code, failureCases2, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3354 X86Assembler::link(code, failureCases3, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3351 // (2) The second function provides fast property access for string length 3355 3352 3356 return code; 3357 } 3358 3359 void* CTI::privateCompileStringLengthTrampoline() 3360 { 3353 X86Assembler::JmpDst stringLengthBegin = m_jit.align(16); 3354 3361 3355 // Check eax is a string 3362 3356 m_jit.testl_i32r(JSImmediate::TagMask, X86::eax); 3363 X86Assembler::JmpSrc failureCases1 = m_jit.emitUnlinkedJne();3357 X86Assembler::JmpSrc string_failureCases1 = m_jit.emitUnlinkedJne(); 3364 3358 m_jit.cmpl_i32m(reinterpret_cast<unsigned>(m_machine->m_jsStringVptr), X86::eax); 3365 X86Assembler::JmpSrc failureCases2 = m_jit.emitUnlinkedJne();3359 X86Assembler::JmpSrc string_failureCases2 = m_jit.emitUnlinkedJne(); 3366 3360 3367 3361 // Checks out okay! - get the length from the Ustring. … … 3370 3364 3371 3365 m_jit.addl_rr(X86::eax, X86::eax); 3372 X86Assembler::JmpSrc failureCases3 = m_jit.emitUnlinkedJo();3366 X86Assembler::JmpSrc string_failureCases3 = m_jit.emitUnlinkedJo(); 3373 3367 m_jit.addl_i8r(1, X86::eax); 3374 3368 3375 3369 m_jit.ret(); 3376 3370 3371 // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object. 3372 3377 3373 void* code = m_jit.copy(); 3378 3374 ASSERT(code); 3379 3375 3380 X86Assembler::link(code, failureCases1, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3381 X86Assembler::link(code, failureCases2, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3382 X86Assembler::link(code, failureCases3, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3383 3384 return code; 3376 X86Assembler::link(code, array_failureCases1, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3377 X86Assembler::link(code, array_failureCases2, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3378 X86Assembler::link(code, array_failureCases3, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3379 X86Assembler::link(code, string_failureCases1, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3380 X86Assembler::link(code, string_failureCases2, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3381 X86Assembler::link(code, string_failureCases3, reinterpret_cast<void*>(Machine::cti_op_get_by_id_fail)); 3382 3383 m_machine->m_ctiArrayLengthTrampoline = code; 3384 m_machine->m_ctiStringLengthTrampoline = X86Assembler::getRelocatedAddress(code, stringLengthBegin); 3385 } 3386 3387 void CTI::freeCTIMachineTrampolines(Machine* machine) 3388 { 3389 WTF::fastFreeExecutable(machine->m_ctiArrayLengthTrampoline); 3385 3390 } 3386 3391 -
trunk/JavaScriptCore/VM/CTI.h
r38229 r38286 284 284 285 285 public: 286 static void compile( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock)287 { 288 CTI cti( machine, callFrame, codeBlock);286 static void compile(JSGlobalData* globalData, CodeBlock* codeBlock) 287 { 288 CTI cti(globalData, codeBlock); 289 289 cti.privateCompile(); 290 290 } … … 294 294 #endif 295 295 296 static void compileGetByIdSelf( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress)297 { 298 CTI cti( machine, callFrame, codeBlock);296 static void compileGetByIdSelf(JSGlobalData* globalData, CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress) 297 { 298 CTI cti(globalData, codeBlock); 299 299 cti.privateCompileGetByIdSelf(structureID, cachedOffset, returnAddress); 300 300 } 301 301 302 static void compileGetByIdProto( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress)303 { 304 CTI cti( machine, callFrame, codeBlock);305 cti.privateCompileGetByIdProto(structureID, prototypeStructureID, cachedOffset, returnAddress );306 } 307 308 static void compileGetByIdChain( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset, void* returnAddress)309 { 310 CTI cti( machine, callFrame, codeBlock);311 cti.privateCompileGetByIdChain(structureID, chain, count, cachedOffset, returnAddress );312 } 313 314 static void compilePutByIdReplace( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress)315 { 316 CTI cti( machine, callFrame, codeBlock);302 static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress) 303 { 304 CTI cti(globalData, codeBlock); 305 cti.privateCompileGetByIdProto(structureID, prototypeStructureID, cachedOffset, returnAddress, callFrame); 306 } 307 308 static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset, void* returnAddress) 309 { 310 CTI cti(globalData, codeBlock); 311 cti.privateCompileGetByIdChain(structureID, chain, count, cachedOffset, returnAddress, callFrame); 312 } 313 314 static void compilePutByIdReplace(JSGlobalData* globalData, CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress) 315 { 316 CTI cti(globalData, codeBlock); 317 317 cti.privateCompilePutByIdReplace(structureID, cachedOffset, returnAddress); 318 318 } 319 319 320 static void compilePutByIdTransition( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, StructureID* oldStructureID, StructureID* newStructureID, size_t cachedOffset, StructureIDChain* sIDC, void* returnAddress)321 { 322 CTI cti( machine, callFrame, codeBlock);320 static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureID* oldStructureID, StructureID* newStructureID, size_t cachedOffset, StructureIDChain* sIDC, void* returnAddress) 321 { 322 CTI cti(globalData, codeBlock); 323 323 cti.privateCompilePutByIdTransition(oldStructureID, newStructureID, cachedOffset, sIDC, returnAddress); 324 324 } 325 325 326 static void* compileArrayLengthTrampoline(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock) 327 { 328 CTI cti(machine, callFrame, codeBlock); 329 return cti.privateCompileArrayLengthTrampoline(); 330 } 331 332 static void* compileStringLengthTrampoline(Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock) 333 { 334 CTI cti(machine, callFrame, codeBlock); 335 return cti.privateCompileStringLengthTrampoline(); 336 } 326 static void compileCTIMachineTrampolines(JSGlobalData* globalData) 327 { 328 CTI cti(globalData); 329 cti.privateCompileCTIMachineTrampolines(); 330 } 331 static void freeCTIMachineTrampolines(Machine*); 337 332 338 333 static void patchGetByIdSelf(CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress); 339 334 static void patchPutByIdReplace(CodeBlock* codeBlock, StructureID* structureID, size_t cachedOffset, void* returnAddress); 340 335 341 static void compilePatchGetArrayLength( Machine* machine, CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress)342 { 343 CTI cti( machine, callFrame, codeBlock);336 static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, void* returnAddress) 337 { 338 CTI cti(globalData, codeBlock); 344 339 return cti.privateCompilePatchGetArrayLength(returnAddress); 345 340 } … … 354 349 355 350 private: 356 CTI( Machine*, CallFrame*, CodeBlock*);351 CTI(JSGlobalData*, CodeBlock* = 0); 357 352 358 353 static uintptr_t asInteger(JSValue*); 359 354 360 JSValue* getConstant( CallFrame*,int src);355 JSValue* getConstant(int src); 361 356 362 357 void privateCompileMainPass(); … … 365 360 void privateCompile(); 366 361 void privateCompileGetByIdSelf(StructureID*, size_t cachedOffset, void* returnAddress); 367 void privateCompileGetByIdProto(StructureID*, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress );368 void privateCompileGetByIdChain(StructureID*, StructureIDChain*, size_t count, size_t cachedOffset, void* returnAddress );362 void privateCompileGetByIdProto(StructureID*, StructureID* prototypeStructureID, size_t cachedOffset, void* returnAddress, CallFrame* callFrame); 363 void privateCompileGetByIdChain(StructureID*, StructureIDChain*, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame); 369 364 void privateCompilePutByIdReplace(StructureID*, size_t cachedOffset, void* returnAddress); 370 365 void privateCompilePutByIdTransition(StructureID*, StructureID*, size_t cachedOffset, StructureIDChain*, void* returnAddress); 371 366 372 void* privateCompileArrayLengthTrampoline(); 373 void* privateCompileStringLengthTrampoline(); 367 void privateCompileCTIMachineTrampolines(); 374 368 void privateCompilePatchGetArrayLength(void* returnAddress); 375 369 … … 441 435 X86Assembler m_jit; 442 436 Machine* m_machine; 437 JSGlobalData* m_globalData; 443 438 CallFrame* m_callFrame; 444 439 CodeBlock* m_codeBlock; -
trunk/JavaScriptCore/VM/Machine.cpp
r38249 r38286 637 637 } 638 638 639 void Machine::initialize(JSGlobalData* globalData) 640 { 641 CTI::compileCTIMachineTrampolines(globalData); 642 } 643 639 644 Machine::~Machine() 640 645 { 641 646 #if ENABLE(CTI) 642 if (m_ctiArrayLengthTrampoline) 643 fastFree(m_ctiArrayLengthTrampoline); 644 if (m_ctiStringLengthTrampoline) 645 fastFree(m_ctiStringLengthTrampoline); 647 CTI::freeCTIMachineTrampolines(this); 646 648 #endif 647 649 } … … 931 933 #if ENABLE(CTI) 932 934 if (!codeBlock->ctiCode) 933 CTI::compile( this, newCallFrame, codeBlock);935 CTI::compile(scopeChain->globalData, codeBlock); 934 936 result = CTI::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception); 935 937 #else … … 997 999 #if ENABLE(CTI) 998 1000 if (!codeBlock->ctiCode) 999 CTI::compile( this, newCallFrame, codeBlock);1001 CTI::compile(scopeChain->globalData, codeBlock); 1000 1002 result = CTI::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception); 1001 1003 #else … … 1089 1091 #if ENABLE(CTI) 1090 1092 if (!codeBlock->ctiCode) 1091 CTI::compile( this, newCallFrame, codeBlock);1093 CTI::compile(scopeChain->globalData, codeBlock); 1092 1094 result = CTI::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception); 1093 1095 #else … … 4130 4132 vPC[7] = slot.cachedOffset(); 4131 4133 codeBlock->refStructureIDs(vPC); 4132 CTI::compilePutByIdTransition( this, callFrame, codeBlock, structureID->previousID(), structureID, slot.cachedOffset(), chain, returnAddress);4134 CTI::compilePutByIdTransition(callFrame->scopeChain()->globalData, codeBlock, structureID->previousID(), structureID, slot.cachedOffset(), chain, returnAddress); 4133 4135 return; 4134 4136 } … … 4143 4145 CTI::patchPutByIdReplace(codeBlock, structureID, slot.cachedOffset(), returnAddress); 4144 4146 #else 4145 CTI::compilePutByIdReplace( this, callFrame, codeBlock, structureID, slot.cachedOffset(), returnAddress);4147 CTI::compilePutByIdReplace(callFrame->scopeChain()->globalData, callFrame, codeBlock, structureID, slot.cachedOffset(), returnAddress); 4146 4148 #endif 4147 }4148 4149 void* Machine::getCTIArrayLengthTrampoline(CallFrame* callFrame, CodeBlock* codeBlock)4150 {4151 if (!m_ctiArrayLengthTrampoline)4152 m_ctiArrayLengthTrampoline = CTI::compileArrayLengthTrampoline(this, callFrame, codeBlock);4153 4154 return m_ctiArrayLengthTrampoline;4155 }4156 4157 void* Machine::getCTIStringLengthTrampoline(CallFrame* callFrame, CodeBlock* codeBlock)4158 {4159 if (!m_ctiStringLengthTrampoline)4160 m_ctiStringLengthTrampoline = CTI::compileStringLengthTrampoline(this, callFrame, codeBlock);4161 4162 return m_ctiStringLengthTrampoline;4163 4149 } 4164 4150 … … 4176 4162 if (isJSArray(baseValue) && propertyName == callFrame->propertyNames().length) { 4177 4163 #if USE(CTI_REPATCH_PIC) 4178 CTI::compilePatchGetArrayLength( this, callFrame, codeBlock, returnAddress);4164 CTI::compilePatchGetArrayLength(callFrame->scopeChain()->globalData, codeBlock, returnAddress); 4179 4165 #else 4180 ctiRepatchCallByReturnAddress(returnAddress, getCTIArrayLengthTrampoline(callFrame, codeBlock));4166 ctiRepatchCallByReturnAddress(returnAddress, m_ctiArrayLengthTrampoline); 4181 4167 #endif 4182 4168 return; … … 4185 4171 // The tradeoff of compiling an repatched inline string length access routine does not seem 4186 4172 // to pay off, so we currently only do this for arrays. 4187 ctiRepatchCallByReturnAddress(returnAddress, getCTIStringLengthTrampoline(callFrame, codeBlock));4173 ctiRepatchCallByReturnAddress(returnAddress, m_ctiStringLengthTrampoline); 4188 4174 return; 4189 4175 } … … 4221 4207 CTI::patchGetByIdSelf(codeBlock, structureID, slot.cachedOffset(), returnAddress); 4222 4208 #else 4223 CTI::compileGetByIdSelf( this, callFrame, codeBlock, structureID, slot.cachedOffset(), returnAddress);4209 CTI::compileGetByIdSelf(callFrame->scopeChain()->globalData, callFrame, codeBlock, structureID, slot.cachedOffset(), returnAddress); 4224 4210 #endif 4225 4211 return; … … 4245 4231 codeBlock->refStructureIDs(vPC); 4246 4232 4247 CTI::compileGetByIdProto( this, callFrame, codeBlock, structureID, slotBaseObject->structureID(), slot.cachedOffset(), returnAddress);4233 CTI::compileGetByIdProto(callFrame->scopeChain()->globalData, callFrame, codeBlock, structureID, slotBaseObject->structureID(), slot.cachedOffset(), returnAddress); 4248 4234 return; 4249 4235 } … … 4287 4273 codeBlock->refStructureIDs(vPC); 4288 4274 4289 CTI::compileGetByIdChain( this, callFrame, codeBlock, structureID, chain, count, slot.cachedOffset(), returnAddress);4275 CTI::compileGetByIdChain(callFrame->scopeChain()->globalData, callFrame, codeBlock, structureID, chain, count, slot.cachedOffset(), returnAddress); 4290 4276 } 4291 4277 … … 4722 4708 4723 4709 if (!newCodeBlock->ctiCode) 4724 CTI::compile(ARG_globalData ->machine, ARG_callFrame, newCodeBlock);4710 CTI::compile(ARG_globalData, newCodeBlock); 4725 4711 4726 4712 return newCodeBlock; … … 4774 4760 CTI_STACK_HACK(); 4775 4761 4776 Machine* machine = ARG_globalData->machine;4777 CallFrame* callFrame = CallFrame::create(ARG_callFrame);4778 4779 4762 JSFunction* callee = asFunction(ARG_src1); 4780 4763 CodeBlock* codeBlock = &callee->m_body->byteCode(callee->m_scopeChain.node()); 4781 4764 if (!codeBlock->ctiCode) 4782 CTI::compile( machine, callFrame, codeBlock);4765 CTI::compile(ARG_globalData, codeBlock); 4783 4766 4784 4767 CTI::linkCall(callee, codeBlock, codeBlock->ctiCode, ARG_linkInfo2, ARG_int3); -
trunk/JavaScriptCore/VM/Machine.h
r38209 r38286 107 107 Machine(); 108 108 ~Machine(); 109 110 void initialize(JSGlobalData*); 109 111 110 112 RegisterFile& registerFile() { return m_registerFile; } … … 324 326 void tryCTICachePutByID(CallFrame*, CodeBlock*, void* returnAddress, JSValue* baseValue, const PutPropertySlot&); 325 327 326 void* getCTIArrayLengthTrampoline(CallFrame*, CodeBlock*);327 void* getCTIStringLengthTrampoline(CallFrame*, CodeBlock*);328 329 328 JITCodeBuffer* jitCodeBuffer() const { return m_jitCodeBuffer.get(); } 330 329 #endif -
trunk/JavaScriptCore/masm/X86Assembler.h
r37991 r38286 61 61 } 62 62 63 bool isAligned(int alignment) 64 { 65 return !(m_index & (alignment - 1)); 66 } 67 63 68 void putByteUnchecked(int value) 64 69 { … … 220 225 OP_JMP_rel32 = 0xE9, 221 226 PRE_SSE_F2 = 0xF2, 227 OP_HLT = 0xF4, 222 228 OP_GROUP3_Ev = 0xF7, 223 229 OP_GROUP3_EvIz = 0xF7, // OP_GROUP3_Ev has an immediate, when instruction is a test. … … 911 917 } 912 918 919 JmpDst align(int alignment) 920 { 921 while (!m_buffer->isAligned(alignment)) 922 m_buffer->putByte(OP_HLT); 923 924 return label(); 925 } 926 913 927 JmpSrc emitUnlinkedJmp() 914 928 { -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r38205 r38286 97 97 startProfilerServerIfNeeded(); 98 98 #endif 99 machine->initialize(this); 99 100 } 100 101
Note:
See TracChangeset
for help on using the changeset viewer.