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
26namespace JSC {
27
28class ObjectPrototype;
29class RegExp;
30class RegExpObject;
31
32class StringPrototype final : public StringObject {
33private:
34 StringPrototype(VM&, Structure*);
35
36public:
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
49protected:
50 void finishCreation(VM&, JSGlobalObject*, JSString*);
51};
52
53JSCell* JIT_OPERATION operationStringProtoFuncReplaceGeneric(
54 ExecState*, EncodedJSValue thisValue, EncodedJSValue searchValue, EncodedJSValue replaceValue);
55
56JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpEmptyStr(
57 ExecState*, JSString* thisValue, RegExpObject* searchValue);
58
59JSCell* JIT_OPERATION operationStringProtoFuncReplaceRegExpString(
60 ExecState*, JSString* thisValue, RegExpObject* searchValue, JSString* replaceValue);
61
62void substituteBackreferences(StringBuilder& result, const String& replacement, StringView source, const int* ovector, RegExp*);
63
64EncodedJSValue JSC_HOST_CALL stringProtoFuncRepeatCharacter(ExecState*);
65EncodedJSValue JSC_HOST_CALL stringProtoFuncSplitFast(ExecState*);
66
67EncodedJSValue JSC_HOST_CALL builtinStringSubstrInternal(ExecState*);
68EncodedJSValue JSC_HOST_CALL builtinStringIncludesInternal(ExecState*);
69
70} // namespace JSC
71