Changeset 38763 in webkit for trunk/JavaScriptCore/jit/JIT.cpp
- Timestamp:
- Nov 25, 2008, 3:07:30 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r38700 r38763 3156 3156 3157 3157 // Check eax is an object of the right Structure. 3158 __ testl_i32r(JSImmediate::TagMask, X86::eax); 3159 JmpSrc failureCases1 = __ jne(); 3160 JmpSrc failureCases2 = checkStructure(X86::eax, structure); 3158 JmpSrc failureCases1 = checkStructure(X86::eax, structure); 3161 3159 3162 3160 // Check the prototype object's Structure had not changed. 3163 3161 Structure** prototypeStructureAddress = &(protoObject->m_structure); 3164 3162 __ cmpl_i32m(reinterpret_cast<uint32_t>(prototypeStructure), prototypeStructureAddress); 3165 JmpSrc failureCases 3= __ jne();3163 JmpSrc failureCases2 = __ jne(); 3166 3164 3167 3165 // Checks out okay! - getDirectOffset … … 3176 3174 X86Assembler::link(code, failureCases1, slowCaseBegin); 3177 3175 X86Assembler::link(code, failureCases2, slowCaseBegin); 3178 X86Assembler::link(code, failureCases3, slowCaseBegin);3179 3176 3180 3177 // On success return back to the hot patch code, at a point it will perform the store to dest for us. … … 3245 3242 3246 3243 structure->ref(); 3247 polymorphicStructures->list[currentIndex].set( structure, 0, cachedOffset, 0/*code*/);3244 polymorphicStructures->list[currentIndex].set(cachedOffset, code, structure); 3248 3245 3249 3246 // Finally repatch the jump to slow case back in the hot path to jump here instead. … … 3261 3258 3262 3259 // Check eax is an object of the right Structure. 3263 __ testl_i32r(JSImmediate::TagMask, X86::eax); 3264 JmpSrc failureCases1 = __ jne(); 3265 JmpSrc failureCases2 = checkStructure(X86::eax, structure); 3260 JmpSrc failureCases1 = checkStructure(X86::eax, structure); 3266 3261 3267 3262 // Check the prototype object's Structure had not changed. 3268 3263 Structure** prototypeStructureAddress = &(protoObject->m_structure); 3269 __ cmpl_i32m(reinterpret_cast<uint32_t>(prototypeStructure), static_cast<void*>(prototypeStructureAddress));3270 JmpSrc failureCases 3= __ jne();3264 __ cmpl_i32m(reinterpret_cast<uint32_t>(prototypeStructure), prototypeStructureAddress); 3265 JmpSrc failureCases2 = __ jne(); 3271 3266 3272 3267 // Checks out okay! - getDirectOffset … … 3281 3276 X86Assembler::link(code, failureCases1, lastProtoBegin); 3282 3277 X86Assembler::link(code, failureCases2, lastProtoBegin); 3283 X86Assembler::link(code, failureCases3, lastProtoBegin);3284 3278 3285 3279 // On success return back to the hot patch code, at a point it will perform the store to dest for us. … … 3289 3283 structure->ref(); 3290 3284 prototypeStructure->ref(); 3291 prototypeStructures->list[currentIndex].set( structure, prototypeStructure, cachedOffset, code);3285 prototypeStructures->list[currentIndex].set(cachedOffset, code, structure, prototypeStructure); 3292 3286 3293 3287 // Finally repatch the jump to slow case back in the hot path to jump here instead. … … 3295 3289 X86Assembler::repatchBranchOffset(jmpLocation, code); 3296 3290 } 3297 #endif 3298 3299 void JIT::privateCompileGetByIdChain(Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame) 3300 { 3301 #if USE(CTI_REPATCH_PIC) 3302 StructureStubInfo& info = m_codeBlock->getStubInfo(returnAddress); 3303 3304 // We don't want to repatch more than once - in future go to cti_op_put_by_id_generic. 3305 ctiRepatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_generic)); 3306 3291 3292 void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, CallFrame* callFrame) 3293 { 3307 3294 ASSERT(count); 3308 3295 … … 3310 3297 3311 3298 // Check eax is an object of the right Structure. 3312 __ testl_i32r(JSImmediate::TagMask, X86::eax);3313 bucketsOfFail.append(__ jne());3314 3299 bucketsOfFail.append(checkStructure(X86::eax, structure)); 3315 3300 … … 3323 3308 // Check the prototype object's Structure had not changed. 3324 3309 Structure** prototypeStructureAddress = &(protoObject->m_structure); 3325 __ cmpl_i32m(reinterpret_cast<uint32_t>(currStructure), static_cast<void*>(prototypeStructureAddress)); 3310 __ cmpl_i32m(reinterpret_cast<uint32_t>(currStructure), prototypeStructureAddress); 3311 bucketsOfFail.append(__ jne()); 3312 } 3313 ASSERT(protoObject); 3314 3315 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 3316 __ movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx); 3317 __ movl_mr(cachedOffset * sizeof(JSValue*), X86::edx, X86::eax); 3318 JmpSrc success = __ jmp(); 3319 3320 void* code = __ executableCopy(); 3321 3322 // Use the repatch information to link the failure cases back to the original slow case routine. 3323 void* lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine; 3324 3325 for (unsigned i = 0; i < bucketsOfFail.size(); ++i) 3326 X86Assembler::link(code, bucketsOfFail[i], lastProtoBegin); 3327 3328 // On success return back to the hot patch code, at a point it will perform the store to dest for us. 3329 intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + repatchOffsetGetByIdPropertyMapOffset; 3330 X86Assembler::link(code, success, reinterpret_cast<void*>(successDest)); 3331 3332 // Track the stub we have created so that it will be deleted later. 3333 structure->ref(); 3334 chain->ref(); 3335 prototypeStructures->list[currentIndex].set(cachedOffset, code, structure, chain); 3336 3337 // Finally repatch the jump to slow case back in the hot path to jump here instead. 3338 intptr_t jmpLocation = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + repatchOffsetGetByIdBranchToSlowCase; 3339 X86Assembler::repatchBranchOffset(jmpLocation, code); 3340 } 3341 #endif 3342 3343 void JIT::privateCompileGetByIdChain(Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame) 3344 { 3345 #if USE(CTI_REPATCH_PIC) 3346 StructureStubInfo& info = m_codeBlock->getStubInfo(returnAddress); 3347 3348 // We don't want to repatch more than once - in future go to cti_op_put_by_id_generic. 3349 ctiRepatchCallByReturnAddress(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_list)); 3350 3351 ASSERT(count); 3352 3353 Vector<JmpSrc> bucketsOfFail; 3354 3355 // Check eax is an object of the right Structure. 3356 bucketsOfFail.append(checkStructure(X86::eax, structure)); 3357 3358 Structure* currStructure = structure; 3359 RefPtr<Structure>* chainEntries = chain->head(); 3360 JSObject* protoObject = 0; 3361 for (unsigned i = 0; i < count; ++i) { 3362 protoObject = asObject(currStructure->prototypeForLookup(callFrame)); 3363 currStructure = chainEntries[i].get(); 3364 3365 // Check the prototype object's Structure had not changed. 3366 Structure** prototypeStructureAddress = &(protoObject->m_structure); 3367 __ cmpl_i32m(reinterpret_cast<uint32_t>(currStructure), prototypeStructureAddress); 3326 3368 bucketsOfFail.append(__ jne()); 3327 3369 } … … 3370 3412 // Check the prototype object's Structure had not changed. 3371 3413 Structure** prototypeStructureAddress = &(protoObject->m_structure); 3372 __ cmpl_i32m(reinterpret_cast<uint32_t>(currStructure), static_cast<void*>(prototypeStructureAddress));3414 __ cmpl_i32m(reinterpret_cast<uint32_t>(currStructure), prototypeStructureAddress); 3373 3415 bucketsOfFail.append(__ jne()); 3374 3416 } … … 3383 3425 3384 3426 for (unsigned i = 0; i < bucketsOfFail.size(); ++i) 3385 X86Assembler::link(code, bucketsOfFail[i], reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_ chain_fail));3427 X86Assembler::link(code, bucketsOfFail[i], reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_fail)); 3386 3428 3387 3429 m_codeBlock->getStubInfo(returnAddress).stubRoutine = code; … … 3769 3811 3770 3812 // Check eax is an array 3771 __ testl_i32r(JSImmediate::TagMask, X86::eax);3813 __ cmpl_i32m(reinterpret_cast<unsigned>(m_interpreter->m_jsArrayVptr), X86::eax); 3772 3814 JmpSrc failureCases1 = __ jne(); 3773 __ cmpl_i32m(reinterpret_cast<unsigned>(m_interpreter->m_jsArrayVptr), X86::eax);3774 JmpSrc failureCases2 = __ jne();3775 3815 3776 3816 // Checks out okay! - get the length from the storage … … 3779 3819 3780 3820 __ cmpl_i32r(JSImmediate::maxImmediateInt, X86::ecx); 3781 JmpSrc failureCases 3= __ ja();3821 JmpSrc failureCases2 = __ ja(); 3782 3822 3783 3823 __ addl_rr(X86::ecx, X86::ecx); … … 3792 3832 X86Assembler::link(code, failureCases1, slowCaseBegin); 3793 3833 X86Assembler::link(code, failureCases2, slowCaseBegin); 3794 X86Assembler::link(code, failureCases3, slowCaseBegin);3795 3834 3796 3835 // On success return back to the hot patch code, at a point it will perform the store to dest for us.
Note:
See TracChangeset
for help on using the changeset viewer.