本文整理汇总了C++中Identifier::impl方法的典型用法代码示例。如果您正苦于以下问题:C++ Identifier::impl方法的具体用法?C++ Identifier::impl怎么用?C++ Identifier::impl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier::impl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: methodsNamed
MethodList EAClass::methodsNamed(const Identifier& identifier, Instance* instance) const
{
MethodList methodList;
// Check to see if the method has been cached first.
Method* method = mMethods.get(identifier.impl());
if (method)
{
methodList.append(method);
return methodList;
}
// Method hasn't been called before, see if the object supports it.
// Rather than doing identifier.ascii().data(), we need to create CString separately otherwise it goes out of scope.
CString identStr = identifier.ascii();
const char *ident = identStr.data();
const EAInstance *inst = static_cast<const EAInstance*>(instance);
EA::WebKit::IJSBoundObject *obj = inst->getObject();
if (obj->hasMethod(ident))
{
// The object says it has this method, cache it so that the string
// lookup can be avoided in the future.
EAMethod* aMethod = new EAMethod(ident);
{
JSLock lock(SilenceAssertionsOnly);
mMethods.set(identifier.impl(), aMethod);
}
methodList.append(aMethod);
}
return methodList;
}
示例2: slot
// Returns true if we found enough information to terminate optimization.
static inline bool abstractAccess(ExecState* exec, JSScope* scope, const Identifier& ident, GetOrPut getOrPut, size_t depth, bool& needsVarInjectionChecks, ResolveOp& op)
{
if (JSActivation* activation = jsDynamicCast<JSActivation*>(scope)) {
if (ident == exec->propertyNames().arguments) {
// We know the property will be at this activation scope, but we don't know how to cache it.
op = ResolveOp(Dynamic, 0, 0, 0, 0);
return true;
}
SymbolTableEntry entry = activation->symbolTable()->get(ident.impl());
if (entry.isReadOnly() && getOrPut == Put) {
// We know the property will be at this activation scope, but we don't know how to cache it.
op = ResolveOp(Dynamic, 0, 0, 0, 0);
return true;
}
if (!entry.isNull()) {
op = ResolveOp(makeType(ClosureVar, needsVarInjectionChecks), depth, activation->structure(), 0, entry.getIndex());
return true;
}
if (activation->symbolTable()->usesNonStrictEval())
needsVarInjectionChecks = true;
return false;
}
if (JSGlobalObject* globalObject = jsDynamicCast<JSGlobalObject*>(scope)) {
SymbolTableEntry entry = globalObject->symbolTable()->get(ident.impl());
if (!entry.isNull()) {
if (getOrPut == Put && entry.isReadOnly()) {
// We know the property will be at global scope, but we don't know how to cache it.
op = ResolveOp(Dynamic, 0, 0, 0, 0);
return true;
}
op = ResolveOp(
makeType(GlobalVar, needsVarInjectionChecks), depth, 0, entry.watchpointSet(),
reinterpret_cast<uintptr_t>(globalObject->registerAt(entry.getIndex()).slot()));
return true;
}
PropertySlot slot(globalObject);
if (!globalObject->getOwnPropertySlot(globalObject, exec, ident, slot)
|| !slot.isCacheableValue()
|| !globalObject->structure()->propertyAccessesAreCacheable()
|| (globalObject->structure()->hasReadOnlyOrGetterSetterPropertiesExcludingProto() && getOrPut == Put)) {
// We know the property will be at global scope, but we don't know how to cache it.
ASSERT(!scope->next());
op = ResolveOp(makeType(GlobalProperty, needsVarInjectionChecks), depth, 0, 0, 0);
return true;
}
op = ResolveOp(makeType(GlobalProperty, needsVarInjectionChecks), depth, globalObject->structure(), 0, slot.cachedOffset());
return true;
}
op = ResolveOp(Dynamic, 0, 0, 0, 0);
return true;
}
示例3: ASSERT
PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
{
ASSERT(!structure->isDictionary());
ASSERT(structure->typeInfo().type() == ObjectType);
ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset));
if (structure->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
specificValue = 0;
if (structure->transitionCount() > s_maxTransitionLength) {
RefPtr<Structure> transition = toCacheableDictionaryTransition(structure);
ASSERT(structure != transition);
offset = transition->put(propertyName, attributes, specificValue);
ASSERT(offset >= structure->m_anonymousSlotCount);
ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
transition->growPropertyStorageCapacity();
return transition.release();
}
RefPtr<Structure> transition = create(structure->m_prototype.get(), structure->typeInfo(), structure->anonymousSlotCount());
transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;
transition->m_previous = structure;
transition->m_nameInPrevious = propertyName.impl();
transition->m_attributesInPrevious = attributes;
transition->m_specificValueInPrevious = specificValue;
transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;
if (structure->m_propertyTable) {
if (structure->m_isPinnedPropertyTable)
transition->m_propertyTable = structure->copyPropertyTable();
else {
transition->m_propertyTable = structure->m_propertyTable;
structure->m_propertyTable = 0;
}
} else {
if (structure->m_previous)
transition->materializePropertyMap();
else
transition->createPropertyMapHashTable();
}
offset = transition->put(propertyName, attributes, specificValue);
ASSERT(offset >= structure->m_anonymousSlotCount);
ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
transition->growPropertyStorageCapacity();
transition->m_offset = offset - structure->m_anonymousSlotCount;
ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
structure->transitionTableAdd(make_pair(propertyName.impl(), attributes), transition.get(), specificValue);
return transition.release();
}
示例4: moduleLoaderObjectParseModule
EncodedJSValue JSC_HOST_CALL moduleLoaderObjectParseModule(ExecState* exec)
{
VM& vm = exec->vm();
const Identifier moduleKey = exec->argument(0).toPropertyKey(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
String source = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
SourceCode sourceCode = makeSource(source, moduleKey.impl());
CodeProfiling profile(sourceCode);
ParserError error;
std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
&vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, error);
if (error.isValid()) {
throwVMError(exec, error.toErrorObject(exec->lexicalGlobalObject(), sourceCode));
return JSValue::encode(jsUndefined());
}
ASSERT(moduleProgramNode);
ModuleAnalyzer moduleAnalyzer(exec, moduleKey, sourceCode, moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables());
JSModuleRecord* moduleRecord = moduleAnalyzer.analyze(*moduleProgramNode);
return JSValue::encode(moduleRecord);
}
示例5: deleteProperty
bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
if (symbolTable().contains(propertyName.impl()))
return false;
return JSObject::deleteProperty(exec, propertyName);
}
示例6: putSpecificValue
size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue)
{
ASSERT(!propertyName.isNull());
ASSERT(get(globalData, propertyName) == notFound);
checkConsistency();
if (attributes & DontEnum)
m_hasNonEnumerableProperties = true;
StringImpl* rep = propertyName.impl();
if (!m_propertyTable)
createPropertyMap();
unsigned newOffset;
if (m_propertyTable->hasDeletedOffset())
newOffset = m_propertyTable->getDeletedOffset();
else
newOffset = m_propertyTable->size();
m_propertyTable->add(PropertyMapEntry(globalData, this, rep, newOffset, attributes, specificValue));
checkConsistency();
return newOffset;
}
示例7: storageForGeneratorLocal
Storage storageForGeneratorLocal(unsigned index)
{
// We assign a symbol to a register. There is one-on-one corresponding between a register and a symbol.
// By doing so, we allocate the specific storage to save the given register.
// This allow us not to save all the live registers even if the registers are not overwritten from the previous resuming time.
// It means that, the register can be retrieved even if the immediate previous op_save does not save it.
if (m_storages.size() <= index)
m_storages.resize(index + 1);
if (Optional<Storage> storage = m_storages[index])
return *storage;
Identifier identifier = Identifier::fromUid(PrivateName());
unsigned identifierIndex = m_codeBlock->numberOfIdentifiers();
m_codeBlock->addIdentifier(identifier);
ScopeOffset scopeOffset = m_generatorFrameSymbolTable->takeNextScopeOffset(NoLockingNecessary);
m_generatorFrameSymbolTable->set(NoLockingNecessary, identifier.impl(), SymbolTableEntry(VarOffset(scopeOffset)));
Storage storage = {
identifier,
identifierIndex,
scopeOffset
};
m_storages[index] = storage;
return storage;
}
示例8: lookup
BytecodeIntrinsicNode::EmitterType BytecodeIntrinsicRegistry::lookup(const Identifier& ident) const
{
if (!m_vm.propertyNames->isPrivateName(ident))
return nullptr;
auto iterator = m_bytecodeIntrinsicMap.find(ident.impl());
if (iterator == m_bytecodeIntrinsicMap.end())
return nullptr;
return iterator->value;
}
示例9: symbolTableGet
bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor)
{
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
if (!entry.isNull()) {
descriptor.setDescriptor(registerAt(entry.getIndex()).jsValue(), entry.getAttributes() | DontDelete);
return true;
}
return false;
}
示例10: cssPropertyName
static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPosPrefix = 0)
{
if (hadPixelOrPosPrefix)
*hadPixelOrPosPrefix = false;
unsigned length = propertyName.length();
if (!length)
return String();
StringImpl* propertyNameString = propertyName.impl();
// If there is no uppercase character in the propertyName, there can
// be no prefix, nor extension and we can return the same string.
if (!containsASCIIUpperChar(*propertyNameString))
return String(propertyNameString);
StringBuilder builder;
builder.reserveCapacity(length);
unsigned i = 0;
switch (getCSSPropertyNamePrefix(*propertyNameString)) {
case PropertyNamePrefixNone:
if (isASCIIUpper((*propertyNameString)[0]))
return String();
break;
case PropertyNamePrefixCSS:
i += 3;
break;
case PropertyNamePrefixPixel:
i += 5;
if (hadPixelOrPosPrefix)
*hadPixelOrPosPrefix = true;
break;
case PropertyNamePrefixPos:
i += 3;
if (hadPixelOrPosPrefix)
*hadPixelOrPosPrefix = true;
break;
case PropertyNamePrefixApple:
case PropertyNamePrefixEpub:
case PropertyNamePrefixKHTML:
case PropertyNamePrefixWebKit:
builder.append('-');
}
builder.append(toASCIILower((*propertyNameString)[i++]));
for (; i < length; ++i) {
UChar c = (*propertyNameString)[i];
if (!isASCIIUpper(c))
builder.append(c);
else
builder.append(makeString('-', toASCIILower(c)));
}
return builder.toString();
}
示例11: symbolTableGet
inline bool JSActivation::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
{
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
if (!entry.isNull()) {
ASSERT(entry.getIndex() < static_cast<int>(d()->functionExecutable->capturedVariableCount()));
slot.setRegisterSlot(®isterAt(entry.getIndex()));
return true;
}
return false;
}
示例12: symbolTableGet
inline bool JSActivation::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
{
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
if (entry.isNull())
return false;
if (entry.getIndex() >= m_numCapturedVars)
return false;
slot.setValue(registerAt(entry.getIndex()).get());
return true;
}
示例13: symbolTablePut
inline bool JSActivation::symbolTablePut(const Identifier& propertyName, JSValue value)
{
ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
if (entry.isNull())
return false;
if (entry.isReadOnly())
return true;
ASSERT(entry.getIndex() < static_cast<int>(d()->functionExecutable->capturedVariableCount()));
registerAt(entry.getIndex()) = value;
return true;
}
示例14: despecifyDictionaryFunction
void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Identifier& propertyName)
{
StringImpl* rep = propertyName.impl();
materializePropertyMapIfNecessary(globalData);
ASSERT(isDictionary());
ASSERT(m_propertyTable);
PropertyMapEntry* entry = m_propertyTable->find(rep).first;
ASSERT(entry);
entry->specificValue.clear();
}
示例15: despecifyFunction
bool Structure::despecifyFunction(const Identifier& propertyName)
{
ASSERT(!propertyName.isNull());
materializePropertyMapIfNecessary();
if (!m_propertyTable)
return false;
StringImpl* rep = propertyName.impl();
unsigned i = rep->existingHash();
#if DUMP_PROPERTYMAP_STATS
++numProbes;
#endif
unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
if (entryIndex == emptyEntryIndex)
return false;
if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
ASSERT(m_propertyTable->entries()[entryIndex - 1].specificValue);
m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
return true;
}
#if DUMP_PROPERTYMAP_STATS
++numCollisions;
#endif
unsigned k = 1 | doubleHash(rep->existingHash());
while (1) {
i += k;
#if DUMP_PROPERTYMAP_STATS
++numRehashes;
#endif
entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
if (entryIndex == emptyEntryIndex)
return false;
if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
ASSERT(m_propertyTable->entries()[entryIndex - 1].specificValue);
m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
return true;
}
}
}