Structure* Structure::changePrototypeTransition(JSGlobalData& globalData, Structure* structure, JSValue prototype) { Structure* transition = create(globalData, structure); transition->m_prototype.set(globalData, transition, prototype); structure->materializePropertyMapIfNecessary(globalData); transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition)); transition->m_offset = structure->m_offset; transition->pin(); transition->checkOffsetConsistency(); return transition; }
void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, CallFrame* callFrame) { ASSERT(count); Vector<JmpSrc> bucketsOfFail; // Check eax is an object of the right Structure. JmpSrc baseObjectCheck = checkStructure(X86::eax, structure); bucketsOfFail.append(baseObjectCheck); Structure* currStructure = structure; RefPtr<Structure>* chainEntries = chain->head(); JSObject* protoObject = 0; for (unsigned i = 0; i < count; ++i) { protoObject = asObject(currStructure->prototypeForLookup(callFrame)); currStructure = chainEntries[i].get(); // Check the prototype object's Structure had not changed. Structure** prototypeStructureAddress = &(protoObject->m_structure); __ cmpl_im(reinterpret_cast<uint32_t>(currStructure), prototypeStructureAddress); bucketsOfFail.append(__ jne()); } ASSERT(protoObject); PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; __ movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx); __ movl_mr(cachedOffset * sizeof(JSValue*), X86::edx, X86::eax); JmpSrc success = __ jmp(); void* code = __ executableCopy(m_codeBlock->executablePool()); // Use the repatch information to link the failure cases back to the original slow case routine. void* lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine; for (unsigned i = 0; i < bucketsOfFail.size(); ++i) X86Assembler::link(code, bucketsOfFail[i], lastProtoBegin); // On success return back to the hot patch code, at a point it will perform the store to dest for us. intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + repatchOffsetGetByIdPropertyMapOffset; X86Assembler::link(code, success, reinterpret_cast<void*>(successDest)); // Track the stub we have created so that it will be deleted later. structure->ref(); chain->ref(); prototypeStructures->list[currentIndex].set(code, structure, chain); // Finally repatch the jump to slow case back in the hot path to jump here instead. intptr_t jmpLocation = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + repatchOffsetGetByIdBranchToSlowCase; X86Assembler::repatchBranchOffset(jmpLocation, code); }
Structure* Structure::changePrototypeTransition(JSGlobalData& globalData, Structure* structure, JSValue prototype) { Structure* transition = create(globalData, structure); transition->m_prototype.set(globalData, transition, prototype); // Don't set m_offset, as one can not transition to this. structure->materializePropertyMapIfNecessary(globalData); transition->m_propertyTable = structure->copyPropertyTableForPinning(globalData, transition); transition->pin(); return transition; }
int main() { // Structure sub domain class Structure : public SubDomain { bool inside(const Array<double>& x, bool on_boundary) const { return x[0] > 1.4 - DOLFIN_EPS and x[0] < 1.6 + DOLFIN_EPS and x[1] < 0.6 + DOLFIN_EPS; } }; // Create mesh auto mesh = std::make_shared<RectangleMesh>(Point(0.0, 0.0), Point(3.0, 1.0), 60, 20); // Create sub domain markers and mark everything as 0 MeshFunction<std::size_t> sub_domains(mesh, mesh->topology().dim()); sub_domains = 0; // Mark structure domain as 1 Structure structure; structure.mark(sub_domains, 1); // Extract sub meshes auto fluid_mesh = std::make_shared<SubMesh>(*mesh, sub_domains, 0); auto structure_mesh = std::make_shared<SubMesh>(*mesh, sub_domains, 1); // Move structure mesh MeshGeometry& geometry = structure_mesh->geometry(); for (VertexIterator v(*structure_mesh); !v.end(); ++v) { std::array<double, 2> x = {{v->x()[0], v->x()[1]}}; x[0] += 0.1*x[0]*x[1]; geometry.set(v->index(), x.data()); } // Move fluid mesh according to structure mesh ALE::move(fluid_mesh, *structure_mesh); fluid_mesh->smooth(); // Plot meshes plot(fluid_mesh); plot(structure_mesh); interactive(); return 0; }
bool GetByIdStatus::computeForChain(CodeBlock* profiledBlock, StringImpl* uid, PassRefPtr<IntendedStructureChain> passedChain) { #if ENABLE(JIT) RefPtr<IntendedStructureChain> chain = passedChain; // Validate the chain. If the chain is invalid, then currently the best thing // we can do is to assume that TakesSlow is true. In the future, it might be // worth exploring reifying the structure chain from the structure we've got // instead of using the one from the cache, since that will do the right things // if the structure chain has changed. But that may be harder, because we may // then end up having a different type of access altogether. And it currently // does not appear to be worth it to do so -- effectively, the heuristic we // have now is that if the structure chain has changed between when it was // cached on in the baseline JIT and when the DFG tried to inline the access, // then we fall back on a polymorphic access. if (!chain->isStillValid()) return false; if (chain->head()->takesSlowPathInDFGForImpureProperty()) return false; size_t chainSize = chain->size(); for (size_t i = 0; i < chainSize; i++) { if (chain->at(i)->takesSlowPathInDFGForImpureProperty()) return false; } JSObject* currentObject = chain->terminalPrototype(); Structure* currentStructure = chain->last(); ASSERT_UNUSED(currentObject, currentObject); unsigned attributesIgnored; JSCell* specificValue; PropertyOffset offset = currentStructure->getConcurrently( *profiledBlock->vm(), uid, attributesIgnored, specificValue); if (currentStructure->isDictionary()) specificValue = 0; if (!isValidOffset(offset)) return false; return appendVariant(GetByIdVariant(StructureSet(chain->head()), offset, specificValue, chain)); #else // ENABLE(JIT) UNUSED_PARAM(profiledBlock); UNUSED_PARAM(uid); UNUSED_PARAM(passedChain); UNREACHABLE_FOR_PLATFORM(); return false; #endif // ENABLE(JIT) }
int main(int argc, char* argv[]) { std::shared_ptr<Process> wow = ProcessTools::Open(_T("Wow.exe"), 20173, true); if (!wow) return 1; std::vector<GameObjectProperty> props = wow->ReadArray<GameObjectProperty>(PROPERTY_DATA - 0x400000, MAX_PROPERTY_INDEX); std::string propertyNames[MAX_PROPERTY_INDEX]; for (std::uint32_t i = 0; i < props.size(); ++i) propertyNames[i] = wow->Read<std::string>(props[i].Name); std::vector<GameObjectPropertyInfo> typeData = wow->ReadArray<GameObjectPropertyInfo>(GO_TYPE_DATA - 0x400000, MAX_GAMEOBJECT_TYPE); InitTypes(); Structure templateUnion; templateUnion.SetName("GameObjectTemplateData"); for (std::uint32_t i = 0; i < typeData.size(); ++i) { Structure typeStructure; typeStructure.SetComment(std::to_string(i) + " " + TCEnumName[i]); typeStructure.SetValueCommentPadding(40); std::uint32_t propCount = std::min<std::uint32_t>(MAX_GAMEOBJECT_DATA, typeData[i].Count); std::vector<std::uint32_t> propIndexes = wow->ReadArray<std::uint32_t>(typeData[i].List, propCount); for (std::size_t j = 0; j < propIndexes.size(); ++j) { std::string name = propertyNames[propIndexes[j]]; GameObjectPropertyTypeInfo* type = wow->Read<GameObjectPropertyTypeInfo*>(typeData[i].TypeInfo + j); typeStructure.AddMember(Structure::Member(j, "uint32", FixName(name), static_cast<std::ostringstream&>(std::ostringstream() << j << " " << name << ", " << FormatType(wow, props[propIndexes[j]].TypeIndex, wow->Read<GameObjectPropertyTypeInfo>(type))).str())); } templateUnion.AddMember(Structure::Member(i, static_cast<std::ostringstream&>(std::ostringstream() << SourceOutput<Structure>(std::make_unique<CppStruct>(true), typeStructure, 4)).str(), FixName(wow->Read<std::string>(typeData[i].TypeName)), "")); } Structure raw; raw.AddMember(Structure::Member(0, "uint32", "data[MAX_GAMEOBJECT_DATA]", "")); templateUnion.AddMember(Structure::Member(MAX_GAMEOBJECT_TYPE, static_cast<std::ostringstream&>(std::ostringstream() << SourceOutput<Structure>(std::make_unique<CppStruct>(true), raw, 4)).str(), "raw", "")); std::ofstream structure("GameObjectTemplate.h"); structure << SourceOutput<Structure>(std::make_unique<CppUnion>(false), templateUnion, 0); return 0; }
long DBController::checkStructure(BSONObj* obj) { Structure* structure = new Structure(); for (std::map<std::string, BSONContent* >::const_iterator i = obj->begin(); i != obj->end(); i++) { structure->add(i->first); } StructureCache* cache = CacheManager::structuresCache(); long strId = structure->crc(); if (!cache->containsKey(strId)) { cache->add(strId, structure); } else { delete(structure); } return strId; }
Structure* Structure::toDictionaryTransition(JSGlobalData& globalData, Structure* structure, DictionaryKind kind) { ASSERT(!structure->isUncacheableDictionary()); Structure* transition = create(globalData, structure); structure->materializePropertyMapIfNecessary(globalData); transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition)); transition->m_offset = structure->m_offset; transition->m_dictionaryKind = kind; transition->pin(); transition->checkOffsetConsistency(); return transition; }
QList<Structure*> QueueManager::getAllOptimizedStructures() { QList<Structure*> list; m_tracker->lockForRead(); Structure* s; for (int i = 0; i < m_tracker->list()->size(); i++) { s = m_tracker->list()->at(i); s->lock().lockForRead(); if (s->getStatus() == Structure::Optimized) list.append(s); s->lock().unlock(); } m_tracker->unlock(); return list; }
// In future we may want to cache this transition. Structure* Structure::preventExtensionsTransition(JSGlobalData& globalData, Structure* structure) { Structure* transition = create(globalData, structure); // Don't set m_offset, as one can not transition to this. structure->materializePropertyMapIfNecessary(globalData); transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition)); transition->m_offset = structure->m_offset; transition->m_preventExtensions = true; transition->pin(); transition->checkOffsetConsistency(); return transition; }
Structure* Structure::changePrototypeTransition(VM& vm, Structure* structure, JSValue prototype) { Structure* transition = create(vm, structure); transition->m_prototype.set(vm, transition, prototype); DeferGC deferGC(vm.heap); structure->materializePropertyMapIfNecessary(vm, deferGC); transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); transition->m_offset = structure->m_offset; transition->pin(); transition->checkOffsetConsistency(); return transition; }
String HeapSnapshotBuilder::descriptionForCell(JSCell *cell) const { if (cell->isString()) return emptyString(); // FIXME: get part of string. VM& vm = m_profiler.vm(); Structure* structure = cell->structure(vm); if (structure->classInfo()->isSubClassOf(Structure::info())) { Structure* cellAsStructure = jsCast<Structure*>(cell); return cellAsStructure->classInfo()->className; } return emptyString(); }
void TypeGroup::UpdateParent(Member *parent) { // Update my parent. Member::UpdateParent(parent); // Update my children parent. for(size_t i = 0; i < buildings.size(); i++) { Structure *child = buildings[i]; if(!child) continue; child->UpdateParent(parent); } }
void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview) { // Prevent the cell from getting collected as we look it up. VM& vm = m_environment.vm(); JSLockHolder lock(vm); DeferGC deferGC(vm.heap); unsigned heapObjectIdentifier = static_cast<unsigned>(heapObjectId); const Optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier); if (!optionalNode) return; // String preview. JSCell* cell = optionalNode->cell; if (cell->isString()) { *resultString = cell->getString(nullptr); return; } // FIXME: Provide preview information for Internal Objects? CodeBlock, Executable, etc. Structure* structure = cell->structure(m_environment.vm()); if (!structure) { errorString = ASCIILiteral("Unable to get object details - Structure"); return; } JSGlobalObject* globalObject = structure->globalObject(); if (!globalObject) { errorString = ASCIILiteral("Unable to get object details - GlobalObject"); return; } InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(globalObject->globalExec()); if (injectedScript.hasNoValue()) { errorString = ASCIILiteral("Unable to get object details - InjectedScript"); return; } // Function preview. if (cell->inherits(JSFunction::info())) { injectedScript.functionDetails(errorString, cell, &functionDetails); return; } // Object preview. objectPreview = injectedScript.previewValue(cell); }
Structure* Structure::toDictionaryTransition(VM& vm, Structure* structure, DictionaryKind kind) { ASSERT(!structure->isUncacheableDictionary()); Structure* transition = create(vm, structure); DeferGC deferGC(vm.heap); structure->materializePropertyMapIfNecessary(vm, deferGC); transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); transition->m_offset = structure->m_offset; transition->setDictionaryKind(kind); transition->pin(); transition->checkOffsetConsistency(); return transition; }
size_t batch_simplify( Structure & structure, const std::vector<std::string> & routes, const char * source_file, const char * destin_file) { POMAGMA_INFO("simplifying expressions"); POMAGMA_ASSERT( std::string(source_file) != std::string(destin_file), "source and destin cannot be the same"); SimplifyParser parser(structure.signature(), routes); std::ofstream destin(destin_file); POMAGMA_ASSERT(destin, "failed to open " << destin_file); destin << "# expressions simplifed by pomagma\n"; size_t line_count = 0; for (LineParser iter(source_file); iter.ok(); iter.next()) { const std::string & expression = * iter; POMAGMA_DEBUG("simplifying " << expression); // simplify relations like EQUAL I APP APP S K K parser.begin(expression); std::string type = parser.parse_token(); SimplifyTerm lhs = parser.parse_term(); SimplifyTerm rhs = parser.parse_term(); parser.end(); destin << type << " " << lhs.route << " " << rhs.route << "\n"; ++line_count; } return line_count; }
// In future we may want to cache this transition. Structure* Structure::preventExtensionsTransition(VM& vm, Structure* structure) { Structure* transition = create(vm, structure); // Don't set m_offset, as one can not transition to this. DeferGC deferGC(vm.heap); structure->materializePropertyMapIfNecessary(vm, deferGC); transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); transition->m_offset = structure->m_offset; transition->setPreventExtensions(true); transition->pin(); transition->checkOffsetConsistency(); return transition; }
void Structure::materializePropertyMap(VM& vm) { ASSERT(structure()->classInfo() == info()); ASSERT(!propertyTable()); Vector<Structure*, 8> structures; Structure* structure; PropertyTable* table; findStructuresAndMapForMaterialization(structures, structure, table); if (table) { table = table->copy(vm, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)); structure->m_lock.unlock(); } // Must hold the lock on this structure, since we will be modifying this structure's // property map. We don't want getConcurrently() to see the property map in a half-baked // state. GCSafeConcurrentJITLocker locker(m_lock, vm.heap); if (!table) createPropertyMap(locker, vm, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)); else propertyTable().set(vm, this, table); for (size_t i = structures.size(); i--;) { structure = structures[i]; if (!structure->m_nameInPrevious) continue; PropertyMapEntry entry(structure->m_nameInPrevious.get(), structure->m_offset, structure->attributesInPrevious()); propertyTable()->add(entry, m_offset, PropertyTable::PropertyOffsetMustNotChange); } checkOffsetConsistency(); }
inline Class *GetTemplateClass(Module *module, const std::string &className) { // Find the class type group. Member *member = module->GetMember(className + " <TG> "); if(!member || !member->IsTypeGroup()) throw VirtualMachineException("Failed to load " + className + " <TG> "); // Use the first template in the group. TypeGroup *group = static_cast<TypeGroup*> (member); Structure *building = group->GetType(0); if(!building || !building->IsClass()) throw VirtualMachineException("Failed to load template class " + className); // Cast the class. return static_cast<Class*> (building); }
// In future we may want to cache this transition. Structure* Structure::freezeTransition(JSGlobalData& globalData, Structure* structure) { Structure* transition = preventExtensionsTransition(globalData, structure); if (transition->propertyTable()) { PropertyTable::iterator iter = transition->propertyTable()->begin(); PropertyTable::iterator end = transition->propertyTable()->end(); if (iter != end) transition->m_hasReadOnlyOrGetterSetterPropertiesExcludingProto = true; for (; iter != end; ++iter) iter->attributes |= iter->attributes & Accessor ? DontDelete : (DontDelete | ReadOnly); } transition->checkOffsetConsistency(); return transition; }
intermediate_pk(intermediate_pk &prev, set<move_fp>::iterator it, const char *seq, short *s0, short *s1, short *new_struct = NULL): pknot(prev.pknot) { if (new_struct) structure = new_struct; else { structure = allocopy(prev.structure); if (it->left>0) { structure[it->left] = it->right; structure[it->right] = it->left; } else if (it->left<0) { structure[-it->left] = 0; structure[-it->right] = 0; } } int energy_chng = pknot.MakeMove(seq, s0, s1, it->left, it->right); energy = prev.energy + energy_chng; Sen = max(prev.Sen, energy); dist = prev.dist+1; moves_todo = prev.moves_todo; moves_todo.erase(*it); moves_done = prev.moves_done; moves_done.push_back(*it); moves_done[moves_done.size()-1].dE = energy_chng; }
int main() { // Structure sub domain class Structure : public SubDomain { bool inside(const Array<double>& x, bool on_boundary) const { return x[0] > 1.4 - DOLFIN_EPS and x[0] < 1.6 + DOLFIN_EPS and x[1] < 0.6 + DOLFIN_EPS; } }; // Create mesh RectangleMesh mesh(0.0, 0.0, 3.0, 1.0, 60, 20); // Create sub domain markers and mark everything as 0 MeshFunction<std::size_t> sub_domains(mesh, mesh.topology().dim()); sub_domains = 0; // Mark structure domain as 1 Structure structure; structure.mark(sub_domains, 1); // Extract sub meshes SubMesh fluid_mesh(mesh, sub_domains, 0); SubMesh structure_mesh(mesh, sub_domains, 1); // Move structure mesh MeshGeometry& geometry = structure_mesh.geometry(); for (VertexIterator v(structure_mesh); !v.end(); ++v) { const double* x = v->x(); geometry.x(v->index())[0] += 0.1*x[0]*x[1]; } // Move fluid mesh according to structure mesh fluid_mesh.move(structure_mesh); fluid_mesh.smooth(); // Plot meshes plot(fluid_mesh); plot(structure_mesh); interactive(); return 0; }
void GL::init(int* argcp, char** argv, const char* name, const char* init_data, const int screen_x, const int screen_y) { /* データ準備 */ // 基本となる正方形を初期化 glNewList(PRI_SQUARE, GL_COMPILE); glBegin(GL_QUADS); glVertex3d(0.0, 0.0, 0.0); glVertex3d(1.0, 0.0, 0.0); glVertex3d(1.0, 1.0, 0.0); glVertex3d(0.0, 1.0, 0.0); glEnd(); glEndList(); mMap = new Map(name, init_data); mStructureManager = new StructureManager(); Structure* t = new SimpleStructure(); t->setLocate(1, 1); mStructureManager->addStructure(t); mViewpoint.setComp(mMap->width() / 2.0, mMap->height() / 2.0, 0.0); mCameraDir.setComp(0.0, 1.0, 10.0); mCameraDir.normalize(); mMagni = 10.0; mScreenX = screen_x; mScreenY = screen_y; /* OpenGL, GLUTの設定 */ glutInitWindowSize(mScreenX, mScreenY); glutInit(argcp, argv); glutInitDisplayMode(GLUT_RGBA/* | GLUT_DEPTH*/); glutCreateWindow("My Sim"); glutDisplayFunc(GL::display); glutReshapeFunc(GL::resize); glutMouseFunc(GL::mouse); glutMotionFunc(GL::motion); glutKeyboardFunc(GL::keyboard); //glEnable(GL_DEPTH_TEST); glClearColor(1.0, 1.0, 1.0, 1.0); }
void BondGeometry::calculateCurrentBondGeometry(const Structure& structure) { int bondIndex = 0; for (AtomIterator iterator = structure.getAtomIterator(); !iterator.isDone(); iterator.next()) { Atom atom = iterator.getCurrentAtom(); setBondsForAnAtom(atom, bondIndex); } }
std::size_t getNumFastTrackers(const Structure& structure) { std::size_t count(0); std::size_t depth(structure.coldDepthBegin()); static const std::size_t maxFastTrackers(std::pow(4, 12)); while ( count < maxFastTrackers && depth < 64 && (depth < structure.coldDepthEnd() || !structure.coldDepthEnd())) { count += structure.numChunksAtDepth(depth); ++depth; } return count; }
inline Structure* getBoundFunctionStructure(VM& vm, ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction) { auto scope = DECLARE_THROW_SCOPE(vm); JSValue prototype = targetFunction->getPrototype(vm, exec); RETURN_IF_EXCEPTION(scope, nullptr); JSFunction* targetJSFunction = jsDynamicCast<JSFunction*>(vm, targetFunction); // We only cache the structure of the bound function if the bindee is a JSFunction since there // isn't any good place to put the structure on Internal Functions. if (targetJSFunction) { Structure* structure = targetJSFunction->rareData(vm)->getBoundFunctionStructure(); if (structure && structure->storedPrototype() == prototype && structure->globalObject() == globalObject) return structure; } Structure* result = globalObject->boundFunctionStructure(); // It would be nice if the structure map was keyed global objects in addition to the other things. Unfortunately, it is not // currently. Whoever works on caching structure changes for prototype transistions should consider this problem as well. // See: https://bugs.webkit.org/show_bug.cgi?id=152738 if (prototype.isObject() && prototype.getObject()->globalObject() == globalObject) { result = vm.prototypeMap.emptyStructureForPrototypeFromBaseStructure(globalObject, prototype.getObject(), result); ASSERT_WITH_SECURITY_IMPLICATION(result->globalObject() == globalObject); } else result = Structure::create(vm, globalObject, prototype, result->typeInfo(), result->classInfo()); if (targetJSFunction) targetJSFunction->rareData(vm)->setBoundFunctionStructure(vm, result); return result; }
Structure* Structure::nonPropertyTransition(JSGlobalData& globalData, Structure* structure, NonPropertyTransition transitionKind) { unsigned attributes = toAttributes(transitionKind); IndexingType indexingType = newIndexingType(structure->indexingTypeIncludingHistory(), transitionKind); if (JSGlobalObject* globalObject = structure->m_globalObject.get()) { if (globalObject->isOriginalArrayStructure(structure)) { Structure* result = globalObject->originalArrayStructureForIndexingType(indexingType); if (result->indexingTypeIncludingHistory() == indexingType) { structure->notifyTransitionFromThisStructure(); return result; } } } if (Structure* existingTransition = structure->m_transitionTable.get(0, attributes)) { ASSERT(existingTransition->m_attributesInPrevious == attributes); ASSERT(existingTransition->indexingTypeIncludingHistory() == indexingType); return existingTransition; } Structure* transition = create(globalData, structure); transition->setPreviousID(globalData, transition, structure); transition->m_attributesInPrevious = attributes; transition->m_indexingType = indexingType; transition->propertyTable().set(globalData, transition, structure->takePropertyTableOrCloneIfPinned(globalData, transition)); transition->m_offset = structure->m_offset; checkOffset(transition->m_offset, transition->inlineCapacity()); structure->m_transitionTable.add(globalData, transition); transition->checkOffsetConsistency(); return transition; }
// Doxygen skip: /// @cond void QueueManager::unlockForNaming_() { Structure* s; m_tracker->lockForWrite(); m_newStructureTracker.lockForWrite(); if (!m_newStructureTracker.popFirst(s)) { m_newStructureTracker.unlock(); m_tracker->unlock(); return; } // Update structure s->lock().lockForWrite(); if (s->getStatus() != Structure::Optimized) s->setStatus(Structure::WaitingForOptimization); s->lock().unlock(); m_tracker->append(s); m_newStructureTracker.unlock(); m_tracker->unlock(); if (s->getStatus() != Structure::Optimized) emit structureStarted(s); else if (s->getStatus() == Structure::Optimized) emit structureFinished(s); }
void GetByIdStatus::computeForChain(GetByIdStatus& result, CodeBlock* profiledBlock, Identifier& ident, Structure* structure) { #if ENABLE(JIT) && ENABLE(VALUE_PROFILER) // Validate the chain. If the chain is invalid, then currently the best thing // we can do is to assume that TakesSlow is true. In the future, it might be // worth exploring reifying the structure chain from the structure we've got // instead of using the one from the cache, since that will do the right things // if the structure chain has changed. But that may be harder, because we may // then end up having a different type of access altogether. And it currently // does not appear to be worth it to do so -- effectively, the heuristic we // have now is that if the structure chain has changed between when it was // cached on in the baseline JIT and when the DFG tried to inline the access, // then we fall back on a polymorphic access. Structure* currentStructure = structure; JSObject* currentObject = 0; for (unsigned i = 0; i < result.m_chain.size(); ++i) { ASSERT(!currentStructure->isDictionary()); currentObject = asObject(currentStructure->prototypeForLookup(profiledBlock)); currentStructure = result.m_chain[i]; if (currentObject->structure() != currentStructure) return; } ASSERT(currentObject); unsigned attributesIgnored; JSCell* specificValue; result.m_offset = currentStructure->get( *profiledBlock->vm(), ident, attributesIgnored, specificValue); if (currentStructure->isDictionary()) specificValue = 0; if (!isValidOffset(result.m_offset)) return; result.m_structureSet.add(structure); result.m_specificValue = JSValue(specificValue); #else UNUSED_PARAM(result); UNUSED_PARAM(profiledBlock); UNUSED_PARAM(ident); UNUSED_PARAM(structure); UNREACHABLE_FOR_PLATFORM(); #endif }
bool read(const Structure &s, T *p, const size_t cnt, const FileDatabase &db) { for (size_t i = 0; i < cnt; ++i) { T read; s.Convert(read, db); *p = read; p++; } return true; }