<commit_before>//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

#pragma once

class JITRecyclableObject
{
private:
    intptr_t remoteVTable;
    Js::TypeId * typeId;
public:
    Js::TypeId GetTypeId() const
    {
        return *typeId;
    }
};

class JITJavascriptString : JITRecyclableObject
{
private:
    const char16* m_pszValue;
    charcount_t m_charLength;
public:
    const char16* GetString() const
    {
        return m_pszValue;
    }

    charcount_t GetLength() const
    {
        return m_charLength;
    }

    static bool JITJavascriptString::Equals(Js::Var aLeft, Js::Var aRight)
    {
        return Js::JavascriptStringHelpers<JITJavascriptString>::Equals(aLeft, aRight);
    }

    static bool JITJavascriptString::Is(Js::Var var)
    {
        JITRecyclableObject * jitObj = reinterpret_cast<JITRecyclableObject*>(var);
        return jitObj->GetTypeId() == Js::TypeIds_String;
    }

    static JITJavascriptString * JITJavascriptString::FromVar(Js::Var var)
    {
#ifdef HAS_CONSTEXPR<commit_msg>[MERGE #1687 @MikeHolman] should check for tagged number in JITJavascriptString::Is<commit_after>//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

#pragma once

class JITRecyclableObject
{
private:
    intptr_t remoteVTable;
    Js::TypeId * typeId;
public:
    static bool Is(Js::Var var)
    {
        return !Js::TaggedNumber::Is(var);
    }

    Js::TypeId GetTypeId() const
    {
        return *typeId;
    }
};

class JITJavascriptString : JITRecyclableObject
{
private:
    const char16* m_pszValue;
    charcount_t m_charLength;
public:
    const char16* GetString() const
    {
        return m_pszValue;
    }

    charcount_t GetLength() const
    {
        return m_charLength;
    }

    static bool Equals(Js::Var aLeft, Js::Var aRight)
    {
        return Js::JavascriptStringHelpers<JITJavascriptString>::Equals(aLeft, aRight);
    }

    static bool Is(Js::Var var)
    {
        if (!JITRecyclableObject::Is(var))
        {
            return false;
        }
        JITRecyclableObject * jitObj = reinterpret_cast<JITRecyclableObject*>(var);
        return jitObj->GetTypeId() == Js::TypeIds_String;
    }

    static JITJavascriptString * FromVar(Js::Var var)
    {
#ifdef HAS_CONSTEXPR
{'fraction_non_alphanumeric': 0.22857142857142856, 'fraction_numerical': 0.004181184668989547, 'mean_word_length': 1.8397626112759644, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5195742', 'n_tokens_mistral': 836, 'n_tokens_neox': 808, 'n_words': 186}