| 1 | /* |
| 2 | * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) |
| 3 | * Copyright (C) 2007-2008, 2013, 2016 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include "JITOperations.h" |
| 24 | #include "StringObject.h" |
| 25 | |
| 26 | namespace JSC { |
| 27 | |
| 28 | class ObjectPrototype; |
| 29 | class RegExp; |
| 30 | class RegExpObject; |
| 31 | |
| 32 | class StringPrototype final : public StringObject { |
| 33 | private: |
| 34 | StringPrototype(VM&, Structure*); |
| 35 | |
| 36 | public: |
| 37 | typedef StringObject Base; |
| 38 | static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; |
| 39 | |
| 40 | static StringPrototype* create(VM&, JSGlobalObject*, Structure*); |
| 41 | |
| 42 | static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) |
| 43 | { |
| 44 | return Structure::create(vm, globalObject, prototype, TypeInfo(StringObjectType, StructureFlags), info()); |
| 45 | } |
| 46 | |
| 47 | DECLARE_INFO; |
| 48 | |
| 49 | protected: |
| 50 | void finishCreation(VM&, JSGlobalObject*, JSString*); |
| 51 | }; |
| 52 | |
| 53 | JSCell* JIT_OPERATION operationStringProtoFuncReplaceGeneric( |
| 54 | ExecState*, EncodedJSValue thisValue, EncodedJSValue searchValue, EncodedJSValue replaceValue); |
| 55 | |
| 56 | JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpEmptyStr( |
| 57 | ExecState*, JSString* thisValue, RegExpObject* searchValue); |
| 58 | |
| 59 | JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpString( |
| 60 | ExecState*, JSString* thisValue, RegExpObject* searchValue, JSString* replaceValue); |
| 61 | |
| 62 | void substituteBackreferences(StringBuilder& result, const String& replacement, StringView source, const int* ovector, RegExp*); |
| 63 | |
| 64 | EncodedJSValue JSC_HOST_CALL stringProtoFuncRepeatCharacter(ExecState*); |
| 65 | EncodedJSValue JSC_HOST_CALL stringProtoFuncSplitFast(ExecState*); |
| 66 | |
| 67 | EncodedJSValue JSC_HOST_CALL builtinStringSubstrInternal(ExecState*); |
| 68 | EncodedJSValue JSC_HOST_CALL builtinStringIncludesInternal(ExecState*); |
| 69 | |
| 70 | } // namespace JSC |
| 71 | |