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#ifndef StringPrototype_h
22#define StringPrototype_h
23
24#include "JITOperations.h"
25#include "StringObject.h"
26
27namespace JSC {
28
29class ObjectPrototype;
30class RegExpObject;
31
32class StringPrototype : public StringObject {
33private:
34 StringPrototype(VM&, Structure*);
35
36public:
37 typedef StringObject Base;
38 static const unsigned StructureFlags = OverridesGetOwnPropertySlot | Base::StructureFlags;
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(ObjectType, StructureFlags), info());
45 }
46
47 DECLARE_INFO;
48
49protected:
50 void finishCreation(VM&, JSGlobalObject*, JSString*);
51
52private:
53 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
54};
55
56EncodedJSValue JIT_OPERATION operationStringProtoFuncReplaceGeneric(
57 ExecState*, EncodedJSValue thisValue, EncodedJSValue searchValue, EncodedJSValue replaceValue);
58
59EncodedJSValue JIT_OPERATION operationStringProtoFuncReplaceRegExpEmptyStr(
60 ExecState*, JSString* thisValue, RegExpObject* searchValue);
61
62EncodedJSValue JIT_OPERATION operationStringProtoFuncReplaceRegExpString(
63 ExecState*, JSString* thisValue, RegExpObject* searchValue, JSString* replaceValue);
64
65} // namespace JSC
66
67#endif // StringPrototype_h
68