• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetScriptContext函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetScriptContext函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScriptContext函数的具体用法?C++ GetScriptContext怎么用?C++ GetScriptContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetScriptContext函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetScriptContext

    void RegexPattern::Finalize(bool isShutdown)
    {
        if(isShutdown)
            return;

        const auto scriptContext = GetScriptContext();
        if(!scriptContext)
            return;

#if DBG
        if(!isLiteral && !scriptContext->IsClosed())
        {
            const auto source = GetSource();
            RegexPattern *p;
            Assert(
                !GetScriptContext()->GetDynamicRegexMap()->TryGetValue(
                    RegexKey(source.GetBuffer(), source.GetLength(), GetFlags()),
                    &p) || ( source.GetLength() == 0 ) ||
                p != this);
        }
#endif

        if(isShallowClone)
            return;

        rep.unified.program->FreeBody(scriptContext->RegexAllocator());
    }
开发者ID:EdMaurer,项目名称:ChakraCore,代码行数:27,代码来源:RegexPattern.cpp


示例2: switch

    BOOL JavascriptRegExpConstructor::DeleteProperty(PropertyId propertyId, PropertyOperationFlags flags)
    {
        switch (propertyId)
        {
            // all globals are 'fNoDelete' in V5.8
        case PropertyIds::input:
        case PropertyIds::$_:
        case PropertyIds::lastMatch:
        case PropertyIds::$Ampersand:
        case PropertyIds::lastParen:
        case PropertyIds::$Plus:
        case PropertyIds::leftContext:
        case PropertyIds::$BackTick:
        case PropertyIds::rightContext:
        case PropertyIds::$Tick:
        case PropertyIds::$1:
        case PropertyIds::$2:
        case PropertyIds::$3:
        case PropertyIds::$4:
        case PropertyIds::$5:
        case PropertyIds::$6:
        case PropertyIds::$7:
        case PropertyIds::$8:
        case PropertyIds::$9:
        case PropertyIds::index:
            JavascriptError::ThrowCantDeleteIfStrictMode(flags, GetScriptContext(), GetScriptContext()->GetPropertyName(propertyId)->GetBuffer());
            return false;

        default:
            return JavascriptFunction::DeleteProperty(propertyId, flags);
        }
    }
开发者ID:bjjones,项目名称:ChakraCore,代码行数:32,代码来源:JavascriptRegExpConstructor.cpp


示例3: ArrayBufferBase

    SharedArrayBuffer::SharedArrayBuffer(uint32 length, DynamicType * type, Allocator allocator) :
        ArrayBufferBase(type), sharedContents(nullptr)
    {
        BYTE * buffer = nullptr;
        if (length > MaxSharedArrayBufferLength)
        {
            JavascriptError::ThrowTypeError(GetScriptContext(), JSERR_FunctionArgument_Invalid);
        }
        else if (length > 0)
        {
            Recycler* recycler = GetType()->GetLibrary()->GetRecycler();
            if (recycler->ReportExternalMemoryAllocation(length))
            {
                buffer = (BYTE*)allocator(length);
                if (buffer == nullptr)
                {
                    recycler->ReportExternalMemoryFree(length);
                }
            }

            if (buffer == nullptr)
            {
                recycler->CollectNow<CollectOnTypedArrayAllocation>();

                if (recycler->ReportExternalMemoryAllocation(length))
                {
                    buffer = (BYTE*)allocator(length);
                    if (buffer == nullptr)
                    {
                        recycler->ReportExternalMemoryFailure(length);
                    }
                }
                else
                {
                    JavascriptError::ThrowOutOfMemoryError(GetScriptContext());
                }
            }

            if (buffer != nullptr)
            {
                ZeroMemory(buffer, length);
                sharedContents = HeapNew(SharedContents, buffer, length);
                if (sharedContents == nullptr)
                {
                    recycler->ReportExternalMemoryFailure(length);

                    // What else could we do?
                    JavascriptError::ThrowOutOfMemoryError(GetScriptContext());
                }
#if DBG
                sharedContents->AddAgent((DWORD_PTR)GetScriptContext());
#endif
            }

        }
    }
开发者ID:sankha93,项目名称:ChakraCore,代码行数:56,代码来源:SharedArrayBuffer.cpp


示例4: GetScriptContext

 void ArrayObject::ThrowItemNotConfigurableError(PropertyId propId /*= Constants::NoProperty*/)
 {
     ScriptContext* scriptContext = GetScriptContext();
     JavascriptError::ThrowTypeError(scriptContext, JSERR_DefineProperty_NotConfigurable,
         propId != Constants::NoProperty ?
             scriptContext->GetThreadContext()->GetPropertyName(propId)->GetBuffer() : nullptr);
 }
开发者ID:muh00mad,项目名称:ChakraCore,代码行数:7,代码来源:ArrayObject.cpp


示例5: GetScriptContext

    BOOL JavascriptStringObject::GetProperty(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
    {
        BOOL result;
        if (GetPropertyBuiltIns(propertyId, value, requestContext, &result))
        {
            return result;
        }

        if (DynamicObject::GetProperty(originalInstance, propertyId, value, info, requestContext))
        {
            return true;
        }

        // For NumericPropertyIds check that index is less than JavascriptString length
        ScriptContext*scriptContext = GetScriptContext();
        uint32 index;
        if (scriptContext->IsNumericPropertyId(propertyId, &index))
        {
            JavascriptString* str = JavascriptString::FromVar(CrossSite::MarshalVar(requestContext, this->InternalUnwrap()));
            return str->GetItemAt(index, value);
        }

        *value = requestContext->GetMissingPropertyResult();
        return false;
    }
开发者ID:Rastaban,项目名称:ChakraCore,代码行数:25,代码来源:JavascriptStringObject.cpp


示例6: GetScriptContext

    PropertyQueryFlags JavascriptStringObject::GetPropertyQuery(Var originalInstance, PropertyId propertyId, Var* value, PropertyValueInfo* info, ScriptContext* requestContext)
    {
        BOOL result;
        if (GetPropertyBuiltIns(propertyId, value, requestContext, &result))
        {
            return JavascriptConversion::BooleanToPropertyQueryFlags(result);
        }

        if (JavascriptConversion::PropertyQueryFlagsToBoolean(DynamicObject::GetPropertyQuery(originalInstance, propertyId, value, info, requestContext)))
        {
            return PropertyQueryFlags::Property_Found;
        }

        // For NumericPropertyIds check that index is less than JavascriptString length
        ScriptContext*scriptContext = GetScriptContext();
        uint32 index;
        if (scriptContext->IsNumericPropertyId(propertyId, &index))
        {
            JavascriptString* str = this->InternalUnwrap();
            str = JavascriptString::FromVar(CrossSite::MarshalVar(requestContext, str, scriptContext));

            return JavascriptConversion::BooleanToPropertyQueryFlags(str->GetItemAt(index, value));
        }

        *value = requestContext->GetMissingPropertyResult();
        return PropertyQueryFlags::Property_NotFound;
    }
开发者ID:raghujayan,项目名称:ChakraCore,代码行数:27,代码来源:JavascriptStringObject.cpp


示例7: Assert

    BOOL ForInObjectEnumerator::GetCurrentEnumerator()
    {
        Assert(object);
        ScriptContext* scriptContext = GetScriptContext();

        if (VirtualTableInfo<DynamicObject>::HasVirtualTable(object))
        {
            DynamicObject* dynamicObject = (DynamicObject*)object;
            if (!dynamicObject->GetTypeHandler()->EnsureObjectReady(dynamicObject))
            {
                return false;
            }
            dynamicObject->GetDynamicType()->PrepareForTypeSnapshotEnumeration();
            embeddedEnumerator.Initialize(dynamicObject, true);
            currentEnumerator = &embeddedEnumerator;
            return true;
        }

        if (!object->GetEnumerator(TRUE /*enumNonEnumerable*/, (Var *)&currentEnumerator, scriptContext, true /*preferSnapshotSemantics */, enumSymbols))
        {
            currentEnumerator = scriptContext->GetLibrary()->GetNullEnumerator();
            return false;
        }
        return true;
    }
开发者ID:digitalinfinity,项目名称:ChakraCore,代码行数:25,代码来源:ForInObjectEnumerator.cpp


示例8: GetLdElemInlineCache

    PolymorphicInlineCache * PropertyString::CreateBiggerPolymorphicInlineCache(bool isLdElem)
    {
        PolymorphicInlineCache * polymorphicInlineCache = isLdElem ? GetLdElemInlineCache() : GetStElemInlineCache();
        Assert(polymorphicInlineCache && polymorphicInlineCache->CanAllocateBigger());
        uint16 polymorphicInlineCacheSize = polymorphicInlineCache->GetSize();
        uint16 newPolymorphicInlineCacheSize = PolymorphicInlineCache::GetNextSize(polymorphicInlineCacheSize);
        Assert(newPolymorphicInlineCacheSize > polymorphicInlineCacheSize);
        PolymorphicInlineCache * newPolymorphicInlineCache = ScriptContextPolymorphicInlineCache::New(newPolymorphicInlineCacheSize, GetLibrary());
        polymorphicInlineCache->CopyTo(this->propertyRecord->GetPropertyId(), GetScriptContext(), newPolymorphicInlineCache);
        if (isLdElem)
        {
            this->ldElemInlineCache = newPolymorphicInlineCache;
        }
        else
        {
            this->stElemInlineCache = newPolymorphicInlineCache;
        }
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
        if (PHASE_VERBOSE_TRACE1(Js::PolymorphicInlineCachePhase) || PHASE_TRACE1(PropertyStringCachePhase))
        {
            Output::Print(_u("PropertyString '%s' : Bigger PIC, oldSize = %d, newSize = %d\n"), GetString(), polymorphicInlineCacheSize, newPolymorphicInlineCacheSize);
        }
#endif
        return newPolymorphicInlineCache;
    }
开发者ID:litian2025,项目名称:ChakraCore,代码行数:25,代码来源:PropertyString.cpp


示例9: propertyDescriptor

 BOOL ModuleNamespace::FindNextProperty(BigPropertyIndex& index, JavascriptString** propertyString, PropertyId* propertyId, PropertyAttributes* attributes) const
 {
     if (index < propertyMap->Count())
     {
         SimpleDictionaryPropertyDescriptor<BigPropertyIndex> propertyDescriptor(propertyMap->GetValueAt(index));
         Assert(propertyDescriptor.Attributes == PropertyModuleNamespaceDefault);
         const PropertyRecord* propertyRecord = propertyMap->GetKeyAt(index);
         *propertyId = propertyRecord->GetPropertyId();
         if (propertyString != nullptr)
         {
             *propertyString = GetScriptContext()->GetPropertyString(*propertyId);
         }
         if (attributes != nullptr)
         {
             *attributes = propertyDescriptor.Attributes;
         }
         return TRUE;
     }
     else
     {
         *propertyId = Constants::NoProperty;
         if (propertyString != nullptr)
         {
             *propertyString = nullptr;
         }
     }
     return FALSE;
 }
开发者ID:ashleygwilliams,项目名称:ChakraCore,代码行数:28,代码来源:ModuleNamespace.cpp


示例10: GetScriptContext

 // We will make sure the iterator will iterate through the exported properties in sorted order.
 // There is no such requirement for enumerator (forin).
 ListForListIterator* ModuleNamespace::EnsureSortedExportedNames()
 {
     if (sortedExportedNames == nullptr)
     {
         ExportedNames* exportedNames = moduleRecord->GetExportedNames(nullptr);
         ScriptContext* scriptContext = GetScriptContext();
         sortedExportedNames = ListForListIterator::New(scriptContext->GetRecycler());
         exportedNames->Map([&](PropertyId propertyId) {
             JavascriptString* propertyString = scriptContext->GetPropertyString(propertyId);
             sortedExportedNames->Add(propertyString);
         });
         sortedExportedNames->Sort([](void* context, const void* left, const void* right) ->int {
             JavascriptString** leftString = (JavascriptString**) (left);
             JavascriptString** rightString = (JavascriptString**) (right);
             if (JavascriptString::LessThan(*leftString, *rightString))
             {
                 return -1;
             }
             if (JavascriptString::LessThan(*rightString, *leftString))
             {
                 return 1;
             }
             return 0;
         }, nullptr);
     }
     return sortedExportedNames;
 }
开发者ID:ashleygwilliams,项目名称:ChakraCore,代码行数:29,代码来源:ModuleNamespace.cpp


示例11: ENTER_PINNED_SCOPE

 BOOL JavascriptNumberObject::GetDiagValueString(StringBuilder<ArenaAllocator>* stringBuilder, ScriptContext* requestContext)
 {
     ENTER_PINNED_SCOPE(JavascriptString, valueStr);
     valueStr = JavascriptNumber::ToStringRadix10(this->GetValue(), GetScriptContext());
     stringBuilder->Append(valueStr->GetString(), valueStr->GetLength());
     LEAVE_PINNED_SCOPE();
     return TRUE;
 }
开发者ID:AlexElting,项目名称:ChakraCore,代码行数:8,代码来源:JavascriptNumberObject.cpp


示例12: GetScriptContext

 void JavascriptSet::Add(Var value)
 {
     if (!set->ContainsKey(value))
     {
         SetDataNode* node = list.Append(value, GetScriptContext()->GetRecycler());
         set->Add(value, node);
     }
 }
开发者ID:thiagolimaa,项目名称:ChakraCore,代码行数:8,代码来源:JavascriptSet.cpp


示例13: Init

 BOOL ModuleNamespaceEnumerator::Init()
 {
     if (!nsObject->DynamicObject::GetEnumerator(&symbolEnumerator, flags, GetScriptContext()))
     {
         return FALSE;
     }
     nonLocalMap = nsObject->GetUnambiguousNonLocalExports();
     Reset();
     return TRUE;
 }
开发者ID:dilijev,项目名称:ChakraCore,代码行数:10,代码来源:ModuleNamespaceEnumerator.cpp


示例14:

    bool ES5Array::GetPropertyBuiltIns(PropertyId propertyId, Var* value, BOOL* result)
    {
        if (propertyId == PropertyIds::length)
        {
            *value = JavascriptNumber::ToVar(this->GetLength(), GetScriptContext());
            *result = true;
            return true;
        }

        return false;
    }
开发者ID:Rastaban,项目名称:ChakraCore,代码行数:11,代码来源:ES5Array.cpp


示例15: InitializeCurrentEnumerator

 BOOL ForInObjectEnumerator::InitializeCurrentEnumerator(RecyclableObject * object, ForInCache * forInCache)
 {
     EnumeratorFlags flags = enumerator.GetFlags();
     RecyclableObject * prototype = object->GetPrototype();
     if (prototype == nullptr || prototype->GetTypeId() == TypeIds_Null)
     {
         // If this is the last object on the prototype chain, we don't need to get the non-enumerable properties any more to track shadowing
         flags &= ~EnumeratorFlags::EnumNonEnumerable;
     }
     return InitializeCurrentEnumerator(object, flags, GetScriptContext(), forInCache);
 }
开发者ID:litian2025,项目名称:ChakraCore,代码行数:11,代码来源:ForInObjectEnumerator.cpp


示例16: ArrayBufferBase

    SharedArrayBuffer::SharedArrayBuffer(SharedContents * contents, DynamicType * type) :
        ArrayBufferBase(type), sharedContents(nullptr)
    {
        if (contents == nullptr || contents->bufferLength > MaxSharedArrayBufferLength)
        {
            JavascriptError::ThrowTypeError(GetScriptContext(), JSERR_FunctionArgument_Invalid);
        }

        if (contents->AddRef() > 1)
        {
            sharedContents = contents;
        }
        else 
        {
            Js::Throw::FatalInternalError();
        }
#if DBG
        sharedContents->AddAgent((DWORD_PTR)GetScriptContext());
#endif
    }
开发者ID:sunnyeo,项目名称:ChakraCore,代码行数:20,代码来源:SharedArrayBuffer.cpp


示例17: GetScriptContext

 ArrayObject* DynamicObject::EnsureObjectArray()
 {
     if (!HasObjectArray())
     {
         ScriptContext* scriptContext = GetScriptContext();
         ArrayObject* objArray = scriptContext->GetLibrary()->CreateArray(0, SparseArraySegmentBase::SMALL_CHUNK_SIZE);
         SetObjectArray(objArray);
     }
     Assert(HasObjectArray());
     return GetObjectArrayOrFlagsAsArray();
 }
开发者ID:JefferyQ,项目名称:spidernode,代码行数:11,代码来源:DynamicObject.cpp


示例18: GetLibrary

 Var ModuleNamespace::GetNextProperty(BigPropertyIndex& index)
 {
     PropertyId propertyId;
     Var result = GetLibrary()->GetUndefined();
     BOOL retVal = FALSE;
     if (this->FindNextProperty(index, nullptr, &propertyId, nullptr))
     {
         retVal = this->GetProperty(this, propertyId, &result, nullptr, GetScriptContext());
         Assert(retVal);
     }
     return result;
 }
开发者ID:ashleygwilliams,项目名称:ChakraCore,代码行数:12,代码来源:ModuleNamespace.cpp


示例19: GetScriptContext

    PropertyQueryFlags HeapArgumentsObject::HasPropertyQuery(PropertyId id, _Inout_opt_ PropertyValueInfo* info)
    {
        ScriptContext *scriptContext = GetScriptContext();

        // Try to get a numbered property that maps to an actual argument.
        uint32 index;
        if (scriptContext->IsNumericPropertyId(id, &index) && index < this->HeapArgumentsObject::GetNumberOfArguments())
        {
            return HeapArgumentsObject::HasItemQuery(index);
        }

        return DynamicObject::HasPropertyQuery(id, info);
    }
开发者ID:muh00mad,项目名称:ChakraCore,代码行数:13,代码来源:ArgumentsObject.cpp


示例20: Assert

    Var DiagNativeStackFrame::CreateHeapArguments()
    {
        // We would be creating the arguments object if there is no default arguments object present.
        Assert(GetArgumentsObject() == NULL);

        CallInfo const * callInfo  = (CallInfo const *)&(((void **)m_stackAddr)[JavascriptFunctionArgIndex_CallInfo]);

        // At the least we will have 'this' by default.
        Assert(callInfo->Count > 0);

        // Get the passed parameter's position (which is starting from 'this')
        Var * inParams = (Var *)&(((void **)m_stackAddr)[JavascriptFunctionArgIndex_This]);

        return JavascriptOperators::LoadHeapArguments(
                                        m_function,
                                        callInfo->Count - 1,
                                        &inParams[1],
                                        GetScriptContext()->GetLibrary()->GetNull(),
                                        (PropertyId*)GetScriptContext()->GetLibrary()->GetNull(),
                                        GetScriptContext(),
                                        /* formalsAreLetDecls */ false);
    }
开发者ID:EdwardBetts,项目名称:spidernode,代码行数:22,代码来源:DiagStackFrame.cpp



注:本文中的GetScriptContext函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetScriptId函数代码示例发布时间:2022-05-30
下一篇:
C++ GetScreenWidth函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap