Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef RegexJIT_h
27 #define RegexJIT_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h:27:9`!
28
29 #include <wtf/Platform.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h`/
30
31 #if ENABLEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:57:9`!(YARR_JIT)
32
33 #include "MacroAssembler.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h`/
34 #include "RegexPattern.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h`/
35 #include <UString.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.h`/
36
37 #include <pcre.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre.h`/
38 struct JSRegExpcxx . . $ JSRegExp#; // temporary, remove when fallback is removed.
39
40 #if CPUcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:44:9`!(X86) && !COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(MSVC)
41 #define YARR_CALL __attribute__ ((regparm (3)))
42 #else
43 #define YARR_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h:43:9`!
44 #endif
45
46 namespace JSCcxx . . $ `<built-in>:463:9`! {
47
48 class JSGlobalDatacxx . . $ QTJSC/JSGlobalData#;
49 class ExecutablePoolcxx . . $ QTJSC/ExecutablePool#;
50
51 namespace Yarrcxx . . $ QTJSC/Yarr/ {
52
53 class RegexCodeBlockcxx . . $ QTJSC/Yarr/RegexCodeBlock# {
54 typedef int (*RegexJITCodecxx . . $ QTJSC/Yarr/RegexCodeBlock#RegexJITCode#)(const UCharcxx . . $ UChar#* input, unsigned start, unsigned length, int* output) YARR_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h:43:9`!;
55
56 public:
57 RegexCodeBlockcxx . . $ QTJSC/Yarr/RegexCodeBlock#RegexCodeBlock(49f6e7a06ebc5aa8).()
58 : m_fallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_fallback.(0)
59 {
60 }
61
62 ~cxx . . $ QTJSC/Yarr/RegexCodeBlock#`~RegexCodeBlock`(49f6e7a06ebc5aa8).RegexCodeBlockcxx . . $ QTJSC/Yarr/RegexCodeBlock#()
63 {
64 if (m_fallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_fallback.)
65 jsRegExpFreecxx . . $ jsRegExpFree(5352636f5a3848ef).(m_fallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_fallback.);
66 }
67
68 JSRegExpcxx . . $ JSRegExp#* getFallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#getFallback(5d2f14306b3bf7d8).() { return m_fallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_fallback.; }
69 void setFallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#setFallback(5352636f5a3848ef).(JSRegExpcxx . . $ JSRegExp#* fallback) { m_fallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_fallback. = fallback; }
70
71 bool operatorcxx . . $ QTJSC/Yarr/RegexCodeBlock#`operator!`(c9857a73d68e59ba).!() { return !m_ref.m_code.executableAddress(); }
72 void setcxx . . $ QTJSC/Yarr/RegexCodeBlock#set(d4f767463ce0a6b3).(MacroAssembler::CodeRef ref) { m_ref = ref; }
73
74 int executecxx . . $ QTJSC/Yarr/RegexCodeBlock#execute(b1871f24c34862d1).(const UCharcxx . . $ UChar#* input, unsigned start, unsigned length, int* output)
75 {
76 return ((RegexJITCode)(m_ref.m_code.executableAddress()))(input, start, length, output);
77 }
78
79 private:
80 MacroAssembler::CodeRef m_refcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_ref.;
81 JSRegExpcxx . . $ JSRegExp#* m_fallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#m_fallback.;
82 };
83
84 void jitCompileRegexcxx . . $ QTJSC/Yarr/jitCompileRegex(eb7cf78519d4005a).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, RegexCodeBlockcxx . . $ QTJSC/Yarr/RegexCodeBlock#& jitObject, const UStringcxx . . $ QTJSC/UString#& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase = false, bool multiline = false);
85
86 inline int executeRegexcxx . . $ QTJSC/Yarr/executeRegex(82a7c76d7837da02).(RegexCodeBlockcxx . . $ QTJSC/Yarr/RegexCodeBlock#& jitObject, const UCharcxx . . $ UChar#* input, unsigned start, unsigned length, int* output, int outputArraySize)
87 {
88 if (JSRegExpcxx . . $ JSRegExp#* fallback = jitObject.getFallbackcxx . . $ QTJSC/Yarr/RegexCodeBlock#getFallback(5d2f14306b3bf7d8).())
89 return (jsRegExpExecutecxx . . $ jsRegExpExecute(126e0e9594abe774).(fallback, input, length, start, output, outputArraySize) < 0) ? -1 : output[0];
90
91 return jitObject.executecxx . . $ QTJSC/Yarr/RegexCodeBlock#execute(b1871f24c34862d1).(input, start, length, output);
92 }
93
94 } } // namespace JSC::Yarr
95
96 #endif
97
98 #endif // RegexJIT_h