source: webkit/trunk/Source/JavaScriptCore/Target.pri@ 111889

Last change on this file since 111889 was 111889, checked in by [email protected], 13 years ago

RexExp constructor last match properties should not rely on previous ovector
https://bugs.webkit.org/show_bug.cgi?id=82077

Reviewed by Oliver Hunt.

This change simplifies matching, and will enable subpattern results to be fully lazily generated in the future.

This patch changes the scheme used to lazily generate the last match properties of the RegExp object.
Instead of relying on the results in the ovector, we can instead lazily generate the subpatters using
a RegExpMatchesArray. To do so we just need to store the input, the regexp matched, and the match
location (the MatchResult). When the match is accessed or the input is set, we reify results. We use
a special value of setting the saved result to MatchResult::failed() to indicated that we're in a
reified state. This means that next time a match is performed, the store of the result will
automatically blow away the reified value.

  • JavaScriptCore.xcodeproj/project.pbxproj:
    • Added new files.
  • runtime/RegExp.cpp:

(JSC::RegExpFunctionalTestCollector::outputOneTest):

  • changed 'subPattern' -> 'subpattern' (there was a mix in JSC, 'subpattern' was more common).
  • runtime/RegExpCachedResult.cpp: Added.

(JSC::RegExpCachedResult::visitChildren):
(JSC::RegExpCachedResult::lastResult):
(JSC::RegExpCachedResult::setInput):

  • New methods, mark GC objects, lazily create the matches array, and record a user provided input (via assignment to RegExp.inupt).
  • runtime/RegExpCachedResult.h: Added.

(RegExpCachedResult):

  • Added new class.

(JSC::RegExpCachedResult::RegExpCachedResult):
(JSC::RegExpCachedResult::record):
(JSC::RegExpCachedResult::input):

  • Initialize the object, record the result of a RegExp match, access the stored input property.
  • runtime/RegExpConstructor.cpp:

(JSC::RegExpConstructor::RegExpConstructor):

  • Initialize m_result/m_multiline properties.

(JSC::RegExpConstructor::visitChildren):

  • Make sure the cached results (or lazy source for them) are marked.

(JSC::RegExpConstructor::getBackref):
(JSC::RegExpConstructor::getLastParen):
(JSC::RegExpConstructor::getLeftContext):
(JSC::RegExpConstructor::getRightContext):

  • Moved from RegExpConstructor, moved to RegExpCachedResult, and using new caching scheme.

(JSC::regExpConstructorInput):
(JSC::setRegExpConstructorInput):

  • Changed to use RegExpCachedResult.
  • runtime/RegExpConstructor.h:

(JSC::RegExpConstructor::create):
(RegExpConstructor):
(JSC::RegExpConstructor::setMultiline):
(JSC::RegExpConstructor::multiline):

  • Move multiline property onto the constructor object; it is not affected by the last match.

(JSC::RegExpConstructor::setInput):
(JSC::RegExpConstructor::input):

  • These defer to RegExpCachedResult.

(JSC::RegExpConstructor::performMatch):

  • runtime/RegExpMatchesArray.cpp: Added.

(JSC::RegExpMatchesArray::visitChildren):

  • Eeeep! added missing visitChildren!

(JSC::RegExpMatchesArray::finishCreation):
(JSC::RegExpMatchesArray::reifyAllProperties):
(JSC::RegExpMatchesArray::reifyMatchProperty):

  • Moved from RegExpConstructor.cpp.

(JSC::RegExpMatchesArray::leftContext):
(JSC::RegExpMatchesArray::rightContext):

  • Since the match start/
  • runtime/RegExpMatchesArray.h:

(RegExpMatchesArray):

  • Declare new methods & structure flags.
  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::match):

  • performMatch now requires the JSString input, to cache.
  • runtime/StringPrototype.cpp:

(JSC::removeUsingRegExpSearch):
(JSC::replaceUsingRegExpSearch):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):

  • performMatch now requires the JSString input, to cache.
File size: 7.5 KB
Line 
1# -------------------------------------------------------------------
2# Target file for the JavaScriptSource library
3#
4# See 'Tools/qmake/README' for an overview of the build system
5# -------------------------------------------------------------------
6
7TEMPLATE = lib
8TARGET = JavaScriptCore
9
10include(JavaScriptCore.pri)
11
12WEBKIT += wtf
13QT += core
14QT -= gui
15
16CONFIG += staticlib
17
18*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
19*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3
20
21# Rules when JIT enabled (not disabled)
22!contains(DEFINES, ENABLE_JIT=0) {
23 linux*-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) {
24 QMAKE_CXXFLAGS += -fno-stack-protector
25 QMAKE_CFLAGS += -fno-stack-protector
26 }
27}
28
29wince* {
30 SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.c
31}
32
33include(yarr/yarr.pri)
34
35INSTALLDEPS += all
36
37SOURCES += \
38 API/JSBase.cpp \
39 API/JSCallbackConstructor.cpp \
40 API/JSCallbackFunction.cpp \
41 API/JSCallbackObject.cpp \
42 API/JSClassRef.cpp \
43 API/JSContextRef.cpp \
44 API/JSObjectRef.cpp \
45 API/JSStringRef.cpp \
46 API/JSValueRef.cpp \
47 API/OpaqueJSString.cpp \
48 assembler/ARMAssembler.cpp \
49 assembler/ARMv7Assembler.cpp \
50 assembler/MacroAssemblerARM.cpp \
51 assembler/MacroAssemblerSH4.cpp \
52 bytecode/CallLinkInfo.cpp \
53 bytecode/CallLinkStatus.cpp \
54 bytecode/CodeBlock.cpp \
55 bytecode/DFGExitProfile.cpp \
56 bytecode/ExecutionCounter.cpp \
57 bytecode/GetByIdStatus.cpp \
58 bytecode/JumpTable.cpp \
59 bytecode/LazyOperandValueProfile.cpp \
60 bytecode/MethodCallLinkInfo.cpp \
61 bytecode/MethodCallLinkStatus.cpp \
62 bytecode/MethodOfGettingAValueProfile.cpp \
63 bytecode/Opcode.cpp \
64 bytecode/PolymorphicPutByIdList.cpp \
65 bytecode/PredictedType.cpp \
66 bytecode/PutByIdStatus.cpp \
67 bytecode/SamplingTool.cpp \
68 bytecode/StructureStubInfo.cpp \
69 bytecompiler/BytecodeGenerator.cpp \
70 bytecompiler/NodesCodegen.cpp \
71 heap/CopiedSpace.cpp \
72 heap/ConservativeRoots.cpp \
73 heap/DFGCodeBlocks.cpp \
74 heap/HandleHeap.cpp \
75 heap/HandleStack.cpp \
76 heap/Heap.cpp \
77 heap/MachineStackMarker.cpp \
78 heap/MarkStack.cpp \
79 heap/MarkedAllocator.cpp \
80 heap/MarkedBlock.cpp \
81 heap/MarkedSpace.cpp \
82 heap/VTableSpectrum.cpp \
83 heap/WriteBarrierSupport.cpp \
84 debugger/DebuggerActivation.cpp \
85 debugger/DebuggerCallFrame.cpp \
86 debugger/Debugger.cpp \
87 dfg/DFGAbstractState.cpp \
88 dfg/DFGAssemblyHelpers.cpp \
89 dfg/DFGByteCodeParser.cpp \
90 dfg/DFGCapabilities.cpp \
91 dfg/DFGCFAPhase.cpp \
92 dfg/DFGCorrectableJumpPoint.cpp \
93 dfg/DFGCSEPhase.cpp \
94 dfg/DFGDriver.cpp \
95 dfg/DFGGraph.cpp \
96 dfg/DFGJITCompiler.cpp \
97 dfg/DFGNodeFlags.cpp \
98 dfg/DFGOperations.cpp \
99 dfg/DFGOSREntry.cpp \
100 dfg/DFGOSRExit.cpp \
101 dfg/DFGOSRExitCompiler.cpp \
102 dfg/DFGOSRExitCompiler64.cpp \
103 dfg/DFGOSRExitCompiler32_64.cpp \
104 dfg/DFGPhase.cpp \
105 dfg/DFGPredictionPropagationPhase.cpp \
106 dfg/DFGRedundantPhiEliminationPhase.cpp \
107 dfg/DFGRepatch.cpp \
108 dfg/DFGSpeculativeJIT.cpp \
109 dfg/DFGSpeculativeJIT32_64.cpp \
110 dfg/DFGSpeculativeJIT64.cpp \
111 dfg/DFGThunks.cpp \
112 dfg/DFGVirtualRegisterAllocationPhase.cpp \
113 interpreter/AbstractPC.cpp \
114 interpreter/CallFrame.cpp \
115 interpreter/Interpreter.cpp \
116 interpreter/RegisterFile.cpp \
117 jit/ExecutableAllocatorFixedVMPool.cpp \
118 jit/ExecutableAllocator.cpp \
119 jit/HostCallReturnValue.cpp \
120 jit/JITArithmetic.cpp \
121 jit/JITArithmetic32_64.cpp \
122 jit/JITCall.cpp \
123 jit/JITCall32_64.cpp \
124 jit/JIT.cpp \
125 jit/JITExceptions.cpp \
126 jit/JITOpcodes.cpp \
127 jit/JITOpcodes32_64.cpp \
128 jit/JITPropertyAccess.cpp \
129 jit/JITPropertyAccess32_64.cpp \
130 jit/JITStubs.cpp \
131 jit/ThunkGenerators.cpp \
132 parser/Lexer.cpp \
133 parser/Nodes.cpp \
134 parser/ParserArena.cpp \
135 parser/Parser.cpp \
136 parser/SourceProviderCache.cpp \
137 profiler/Profile.cpp \
138 profiler/ProfileGenerator.cpp \
139 profiler/ProfileNode.cpp \
140 profiler/Profiler.cpp \
141 runtime/ArgList.cpp \
142 runtime/Arguments.cpp \
143 runtime/ArrayConstructor.cpp \
144 runtime/ArrayPrototype.cpp \
145 runtime/BooleanConstructor.cpp \
146 runtime/BooleanObject.cpp \
147 runtime/BooleanPrototype.cpp \
148 runtime/CallData.cpp \
149 runtime/CommonIdentifiers.cpp \
150 runtime/Completion.cpp \
151 runtime/ConstructData.cpp \
152 runtime/DateConstructor.cpp \
153 runtime/DateConversion.cpp \
154 runtime/DateInstance.cpp \
155 runtime/DatePrototype.cpp \
156 runtime/ErrorConstructor.cpp \
157 runtime/Error.cpp \
158 runtime/ErrorInstance.cpp \
159 runtime/ErrorPrototype.cpp \
160 runtime/ExceptionHelpers.cpp \
161 runtime/Executable.cpp \
162 runtime/FunctionConstructor.cpp \
163 runtime/FunctionPrototype.cpp \
164 runtime/GCActivityCallback.cpp \
165 runtime/GetterSetter.cpp \
166 runtime/Options.cpp \
167 runtime/Identifier.cpp \
168 runtime/InitializeThreading.cpp \
169 runtime/InternalFunction.cpp \
170 runtime/JSActivation.cpp \
171 runtime/JSAPIValueWrapper.cpp \
172 runtime/JSArray.cpp \
173 runtime/JSByteArray.cpp \
174 runtime/JSCell.cpp \
175 runtime/JSDateMath.cpp \
176 runtime/JSFunction.cpp \
177 runtime/JSBoundFunction.cpp \
178 runtime/JSGlobalData.cpp \
179 runtime/JSGlobalObject.cpp \
180 runtime/JSGlobalObjectFunctions.cpp \
181 runtime/JSGlobalThis.cpp \
182 runtime/JSLock.cpp \
183 runtime/JSNotAnObject.cpp \
184 runtime/JSObject.cpp \
185 runtime/JSONObject.cpp \
186 runtime/JSPropertyNameIterator.cpp \
187 runtime/JSStaticScopeObject.cpp \
188 runtime/JSString.cpp \
189 runtime/JSValue.cpp \
190 runtime/JSVariableObject.cpp \
191 runtime/JSWrapperObject.cpp \
192 runtime/LiteralParser.cpp \
193 runtime/Lookup.cpp \
194 runtime/MathObject.cpp \
195 runtime/NativeErrorConstructor.cpp \
196 runtime/NativeErrorPrototype.cpp \
197 runtime/NumberConstructor.cpp \
198 runtime/NumberObject.cpp \
199 runtime/NumberPrototype.cpp \
200 runtime/ObjectConstructor.cpp \
201 runtime/ObjectPrototype.cpp \
202 runtime/Operations.cpp \
203 runtime/PropertyDescriptor.cpp \
204 runtime/PropertyNameArray.cpp \
205 runtime/PropertySlot.cpp \
206 runtime/RegExpConstructor.cpp \
207 runtime/RegExpCachedResult.cpp \
208 runtime/RegExpMatchesArray.cpp \
209 runtime/RegExp.cpp \
210 runtime/RegExpObject.cpp \
211 runtime/RegExpPrototype.cpp \
212 runtime/RegExpCache.cpp \
213 runtime/SamplingCounter.cpp \
214 runtime/ScopeChain.cpp \
215 runtime/SmallStrings.cpp \
216 runtime/StrictEvalActivation.cpp \
217 runtime/StringConstructor.cpp \
218 runtime/StringObject.cpp \
219 runtime/StringPrototype.cpp \
220 runtime/StringRecursionChecker.cpp \
221 runtime/StructureChain.cpp \
222 runtime/Structure.cpp \
223 runtime/TimeoutChecker.cpp \
224 runtime/UString.cpp \
225 tools/CodeProfile.cpp \
226 tools/CodeProfiling.cpp \
227 yarr/YarrJIT.cpp \
228
229*sh4* {
230 QMAKE_CXXFLAGS += -mieee -w
231 QMAKE_CFLAGS += -mieee -w
232}
233
234lessThan(QT_GCC_MAJOR_VERSION, 5) {
235 # GCC 4.5 and before
236 lessThan(QT_GCC_MINOR_VERSION, 6) {
237 # Disable C++0x mode in JSC for those who enabled it in their Qt's mkspec.
238 *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
239 }
240
241 # GCC 4.6 and after.
242 greaterThan(QT_GCC_MINOR_VERSION, 5) {
243 if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) {
244 # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr).
245 QMAKE_CFLAGS_WARN_ON += -Wno-c++0x-compat
246 QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat
247 QMAKE_CFLAGS += -Wno-c++0x-compat
248 QMAKE_CXXFLAGS += -Wno-c++0x-compat
249 }
250 }
251}
Note: See TracBrowser for help on using the repository browser.