Changeset 39229 in webkit for trunk/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Dec 12, 2008, 12:02:09 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r39197 r39229 4087 4087 4088 4088 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(returnAddress); 4089 Instruction* vPC = codeBlock->instructions().begin() + stubInfo->bytecodeIndex;4090 4089 4091 4090 // Cache hit: Specialize instruction and ref Structures. … … 4093 4092 // Structure transition, cache transition info 4094 4093 if (slot.type() == PutPropertySlot::NewProperty) { 4095 vPC[0] = getOpcode(op_put_by_id_transition);4096 vPC[4] = structure->previousID();4097 vPC[5] = structure;4098 4094 StructureChain* chain = structure->cachedPrototypeChain(); 4099 4095 if (!chain) { 4100 4096 chain = cachePrototypeChain(callFrame, structure); 4101 4097 if (!chain) { 4102 // This happens if someone has manually inserted null into the prototype chain 4103 vPC[0] = getOpcode(op_put_by_id_generic);4098 // This happens if someone has manually inserted null into the prototype chain 4099 stubInfo->opcodeID = op_put_by_id_generic; 4104 4100 return; 4105 4101 } 4106 4102 } 4107 vPC[6] = chain; 4108 vPC[7] = slot.cachedOffset(); 4109 codeBlock->refStructures(vPC); 4103 stubInfo->initPutByIdTransition(structure->previousID(), structure, chain); 4110 4104 JIT::compilePutByIdTransition(callFrame->scopeChain()->globalData, codeBlock, stubInfo, structure->previousID(), structure, slot.cachedOffset(), chain, returnAddress); 4111 4105 return; 4112 4106 } 4113 4107 4114 vPC[0] = getOpcode(op_put_by_id_replace); 4115 vPC[4] = structure; 4116 vPC[5] = slot.cachedOffset(); 4117 codeBlock->refStructures(vPC); 4108 stubInfo->initPutByIdReplace(structure); 4118 4109 4119 4110 #if USE(CTI_REPATCH_PIC) … … 4169 4160 4170 4161 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(returnAddress); 4171 Instruction* vPC = codeBlock->instructions().begin() + stubInfo->bytecodeIndex;4172 4162 4173 4163 // Cache hit: Specialize instruction and ref Structures. … … 4175 4165 if (slot.slotBase() == baseValue) { 4176 4166 // set this up, so derefStructures can do it's job. 4177 vPC[0] = getOpcode(op_get_by_id_self); 4178 vPC[4] = structure; 4179 vPC[5] = slot.cachedOffset(); 4180 codeBlock->refStructures(vPC); 4167 stubInfo->initGetByIdSelf(structure); 4181 4168 4182 4169 #if USE(CTI_REPATCH_PIC) … … 4200 4187 asObject(baseValue)->structure()->setCachedPrototypeChain(0); 4201 4188 } 4202 4203 vPC[0] = getOpcode(op_get_by_id_proto); 4204 vPC[4] = structure; 4205 vPC[5] = slotBaseObject->structure(); 4206 vPC[6] = slot.cachedOffset(); 4207 codeBlock->refStructures(vPC); 4189 4190 stubInfo->initGetByIdProto(structure, slotBaseObject->structure()); 4208 4191 4209 4192 JIT::compileGetByIdProto(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, structure, slotBaseObject->structure(), slot.cachedOffset(), returnAddress); … … 4213 4196 size_t count = countPrototypeChainEntriesAndCheckForProxies(callFrame, baseValue, slot); 4214 4197 if (!count) { 4215 vPC[0] = getOpcode(op_get_by_id_generic);4198 stubInfo->opcodeID = op_get_by_id_generic; 4216 4199 return; 4217 4200 } … … 4222 4205 ASSERT(chain); 4223 4206 4224 vPC[0] = getOpcode(op_get_by_id_chain); 4225 vPC[4] = structure; 4226 vPC[5] = chain; 4227 vPC[6] = count; 4228 vPC[7] = slot.cachedOffset(); 4229 codeBlock->refStructures(vPC); 4207 stubInfo->initGetByIdChain(structure, chain); 4230 4208 4231 4209 JIT::compileGetByIdChain(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, structure, chain, count, slot.cachedOffset(), returnAddress); … … 4576 4554 CodeBlock* codeBlock = callFrame->codeBlock(); 4577 4555 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(CTI_RETURN_ADDRESS); 4578 Instruction* vPC = codeBlock->instructions().begin() + stubInfo->bytecodeIndex;4579 4556 4580 4557 ASSERT(slot.slotBase()->isObject()); … … 4583 4560 int listIndex = 1; 4584 4561 4585 if ( vPC[0].u.opcode == ARG_globalData->interpreter->getOpcode(op_get_by_id_self)) {4562 if (stubInfo->opcodeID == op_get_by_id_self) { 4586 4563 ASSERT(!stubInfo->stubRoutine); 4587 polymorphicStructureList = new PolymorphicAccessStructureList(vPC[5].u.operand, 0, vPC[4].u.structure); 4588 4589 vPC[0] = ARG_globalData->interpreter->getOpcode(op_get_by_id_self_list); 4590 vPC[4] = polymorphicStructureList; 4591 vPC[5] = 2; 4564 polymorphicStructureList = new PolymorphicAccessStructureList(0, stubInfo->u.getByIdSelf.baseObjectStructure); 4565 stubInfo->initGetByIdSelfList(polymorphicStructureList, 2); 4592 4566 } else { 4593 polymorphicStructureList = vPC[4].u.polymorphicStructures; 4594 listIndex = vPC[5].u.operand; 4595 4596 vPC[5] = listIndex + 1; 4567 polymorphicStructureList = stubInfo->u.getByIdSelfList.structureList; 4568 listIndex = stubInfo->u.getByIdSelfList.listSize; 4569 stubInfo->u.getByIdSelfList.listSize++; 4597 4570 } 4598 4571 … … 4607 4580 } 4608 4581 4609 static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot( Interpreter* interpreter, StructureStubInfo* stubInfo, Instruction* vPC, int& listIndex)4610 { 4611 PolymorphicAccessStructureList* prototypeStructureList ;4582 static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(StructureStubInfo* stubInfo, int& listIndex) 4583 { 4584 PolymorphicAccessStructureList* prototypeStructureList = 0; 4612 4585 listIndex = 1; 4613 4586 4614 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { 4615 prototypeStructureList = new PolymorphicAccessStructureList(vPC[6].u.operand, stubInfo->stubRoutine, vPC[4].u.structure, vPC[5].u.structure); 4587 switch (stubInfo->opcodeID) { 4588 case op_get_by_id_proto: 4589 prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdProto.baseObjectStructure, stubInfo->u.getByIdProto.prototypeStructure); 4616 4590 stubInfo->stubRoutine = 0; 4617 4618 vPC[0] = interpreter->getOpcode(op_get_by_id_proto_list); 4619 vPC[4] = prototypeStructureList; 4620 vPC[5] = 2; 4621 } else if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { 4622 prototypeStructureList = new PolymorphicAccessStructureList(vPC[6].u.operand, stubInfo->stubRoutine, vPC[4].u.structure, vPC[5].u.structureChain); 4591 stubInfo->initGetByIdProtoList(prototypeStructureList, 2); 4592 break; 4593 case op_get_by_id_chain: 4594 prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure, stubInfo->u.getByIdChain.chain); 4623 4595 stubInfo->stubRoutine = 0; 4624 4625 vPC[0] = interpreter->getOpcode(op_get_by_id_proto_list); 4626 vPC[4] = prototypeStructureList; 4627 vPC[5] = 2; 4628 } else { 4629 ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)); 4630 prototypeStructureList = vPC[4].u.polymorphicStructures; 4631 listIndex = vPC[5].u.operand; 4632 vPC[5] = listIndex + 1; 4633 4634 ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); 4596 stubInfo->initGetByIdProtoList(prototypeStructureList, 2); 4597 break; 4598 case op_get_by_id_proto_list: 4599 prototypeStructureList = stubInfo->u.getByIdProtoList.structureList; 4600 listIndex = stubInfo->u.getByIdProtoList.listSize; 4601 stubInfo->u.getByIdProtoList.listSize++; 4602 break; 4603 default: 4604 ASSERT_NOT_REACHED(); 4635 4605 } 4636 4606 4607 ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); 4637 4608 return prototypeStructureList; 4638 4609 } … … 4658 4629 CodeBlock* codeBlock = callFrame->codeBlock(); 4659 4630 StructureStubInfo* stubInfo = &codeBlock->getStubInfo(CTI_RETURN_ADDRESS); 4660 Instruction* vPC = codeBlock->instructions().begin() + stubInfo->bytecodeIndex;4661 4631 4662 4632 ASSERT(slot.slotBase()->isObject()); … … 4675 4645 4676 4646 int listIndex; 4677 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot( ARG_globalData->interpreter, stubInfo, vPC, listIndex);4647 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex); 4678 4648 4679 4649 JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), slot.cachedOffset()); … … 4688 4658 4689 4659 int listIndex; 4690 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot( ARG_globalData->interpreter, stubInfo, vPC, listIndex);4660 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex); 4691 4661 4692 4662 JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, chain, count, slot.cachedOffset()); … … 5358 5328 JSGlobalObject* globalObject = asGlobalObject(ARG_src1); 5359 5329 Identifier& ident = *ARG_id2; 5360 Instruction* vPC = ARG_instr3; 5330 unsigned globalResolveInfoIndex = ARG_int3; 5331 Instruction* vPC = ARG_instr4; 5361 5332 ASSERT(globalObject->isGlobalObject()); 5362 5333 … … 5365 5336 JSValue* result = slot.getValue(callFrame, ident); 5366 5337 if (slot.isCacheable()) { 5367 if (vPC[4].u.structure) 5368 vPC[4].u.structure->deref(); 5338 GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex); 5339 if (globalResolveInfo.structure) 5340 globalResolveInfo.structure->deref(); 5369 5341 globalObject->structure()->ref(); 5370 vPC[4]= globalObject->structure();5371 vPC[5]= slot.cachedOffset();5342 globalResolveInfo.structure = globalObject->structure(); 5343 globalResolveInfo.offset = slot.cachedOffset(); 5372 5344 return result; 5373 5345 }
Note:
See TracChangeset
for help on using the changeset viewer.