source: webkit/trunk/JavaScriptCore/JavaScriptCore.exp@ 28106

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

JavaScriptCore:

Reviewed by Darin and Geoff.


Implement mark stack. This version is not suitable for prime time because it makes a
huge allocation on every collect, and potentially makes marking of detached subtrees
slow. But it is an 0.4% SunSpider speedup even without much tweaking.


The basic approach is to replace mark() methods with
markChildren(MarkStack&) methods. Reachable references are pushed
onto a mark stack (which encapsulates ignoring already-marked
references).


Objects are no longer responsible for actually setting their own
mark bits, the collector does that. This means that for objects on
the number heap we don't have to call markChildren() at all since
we know there aren't any.


The mark phase of collect pushes roots onto the mark stack
and drains it as often as possible.


To make this approach viable requires a constant-size mark stack
and a slow fallback approach for when the stack size is exceeded,
plus optimizations to make the required stack small in common
cases. This should be doable.

  • JavaScriptCore.exp: Export new symbols.
  • JavaScriptCore.xcodeproj/project.pbxproj: Add new file.
  • kjs/collector.cpp: (KJS::Collector::heapAllocate): (KJS::drainMarkStack): Helper for all of the below. (KJS::Collector::markStackObjectsConservatively): Use mark stack. (KJS::Collector::markCurrentThreadConservatively): ditto (KJS::Collector::markOtherThreadConservatively): ditto (KJS::Collector::markProtectedObjects): ditto (KJS::Collector::markMainThreadOnlyObjects): ditto (KJS::Collector::collect): ditto
  • kjs/collector.h: (KJS::Collector::cellMayHaveRefs): Helper for MarkStack.
  • kjs/MarkStack.h: Added. The actual mark stack implementation. (KJS::MarkStack::push): (KJS::MarkStack::pushAtom): (KJS::MarkStack::pop): (KJS::MarkStack::isEmpty): (KJS::MarkStack::reserveCapacity):

Changed mark() methods to markChildren() methods:


  • kjs/ExecState.cpp: (KJS::ExecState::markChildren):
  • kjs/ExecState.h:
  • kjs/JSWrapperObject.cpp: (KJS::JSWrapperObject::markChildren):
  • kjs/JSWrapperObject.h:
  • kjs/array_instance.cpp: (KJS::ArrayInstance::markChildren):
  • kjs/array_instance.h:
  • kjs/bool_object.cpp: (BooleanInstance::markChildren):
  • kjs/bool_object.h:
  • kjs/error_object.cpp:
  • kjs/error_object.h:
  • kjs/function.cpp: (KJS::FunctionImp::markChildren): (KJS::Arguments::Arguments): (KJS::Arguments::markChildren): (KJS::ActivationImp::markChildren):
  • kjs/function.h:
  • kjs/internal.cpp: (KJS::GetterSetterImp::markChildren):
  • kjs/interpreter.cpp: (KJS::Interpreter::markRoots):
  • kjs/interpreter.h:
  • kjs/list.cpp: (KJS::List::markProtectedListsSlowCase):
  • kjs/list.h: (KJS::List::markProtectedLists):
  • kjs/object.cpp: (KJS::JSObject::markChildren):
  • kjs/object.h: (KJS::ScopeChain::markChildren):
  • kjs/property_map.cpp: (KJS::PropertyMap::markChildren):
  • kjs/property_map.h:
  • kjs/scope_chain.h:
  • kjs/string_object.cpp: (KJS::StringInstance::markChildren):
  • kjs/string_object.h:

JavaScriptGlue:

Reviewed by Darin and Geoff.

Fixups for JavaScriptCore mark stack.

  • JSObject.cpp: (JSUserObject::Mark):
  • JSObject.h:
  • JSValueWrapper.cpp: (JSValueWrapper::JSObjectMark):
  • JSValueWrapper.h:
  • UserObjectImp.cpp:
  • UserObjectImp.h:

WebCore:

Reviewed by Darin and Geoff.

Implement mark stack. This version is not suitable for prime time because it makes a
huge allocation on every collect, and potentially makes marking of detached subtrees
slow. But it is a .2% - .4% speedup even without much tweaking.

I replaced mark() methods with markChildren() as usual. One
optimization that is lost is avoiding walking detached DOM
subtrees more than once to mark them; since marking is not
recursive there's no obvious way to bracket operation on the tree
any more.

  • bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::markChildren):
  • bindings/js/JSNodeCustom.cpp: (WebCore::JSNode::markChildren):
  • bindings/js/JSNodeFilterCondition.cpp:
  • bindings/js/JSNodeFilterCondition.h:
  • bindings/js/JSNodeFilterCustom.cpp: (WebCore::JSNodeFilter::markChildren):
  • bindings/js/JSNodeIteratorCustom.cpp: (WebCore::JSNodeIterator::markChildren):
  • bindings/js/JSTreeWalkerCustom.cpp: (WebCore::JSTreeWalker::markChildren):
  • bindings/js/JSXMLHttpRequest.cpp: (KJS::JSXMLHttpRequest::markChildren):
  • bindings/js/JSXMLHttpRequest.h:
  • bindings/js/kjs_binding.cpp: (KJS::ScriptInterpreter::markDOMNodesForDocument):
  • bindings/js/kjs_binding.h:
  • bindings/js/kjs_events.cpp: (WebCore::JSUnprotectedEventListener::markChildren):
  • bindings/js/kjs_events.h:
  • bindings/js/kjs_window.cpp: (KJS::Window::markChildren):
  • bindings/js/kjs_window.h:
  • bindings/scripts/CodeGeneratorJS.pm:
  • dom/Node.cpp: (WebCore::Node::Node):
  • dom/Node.h:
  • dom/NodeFilter.h:
  • dom/NodeFilterCondition.h:

LayoutTests:

Not reviewed.


I have fixed this with the mark stack work.


  • fast/js/gc-breadth-2-expected.txt: Added.
  • fast/js/gc-breadth-2.html: Added.
  • fast/js/gc-breadth-expected.txt: Added.
  • fast/js/gc-breadth.html: Added.
  • fast/js/gc-depth-expected.txt: Added.
  • fast/js/gc-depth.html: Added.
  • fast/js/resources/gc-breadth-2.js: Added.
  • fast/js/resources/gc-breadth.js: Added.
  • fast/js/resources/gc-depth.js: Added.
File size: 10.7 KB
Line 
1_JSCheckScriptSyntax
2_JSClassCreate
3_JSClassRelease
4_JSClassRetain
5_JSContextGetGlobalObject
6_JSEvaluateScript
7_JSGarbageCollect
8_JSGlobalContextCreate
9_JSGlobalContextRelease
10_JSGlobalContextRetain
11_JSObjectCallAsConstructor
12_JSObjectCallAsFunction
13_JSObjectCopyPropertyNames
14_JSObjectDeleteProperty
15_JSObjectGetPrivate
16_JSObjectGetProperty
17_JSObjectGetPropertyAtIndex
18_JSObjectGetPrototype
19_JSObjectHasProperty
20_JSObjectIsConstructor
21_JSObjectIsFunction
22_JSObjectMake
23_JSObjectMakeConstructor
24_JSObjectMakeFunction
25_JSObjectMakeFunctionWithCallback
26_JSObjectSetPrivate
27_JSObjectSetProperty
28_JSObjectSetPropertyAtIndex
29_JSObjectSetPrototype
30_JSPropertyNameAccumulatorAddName
31_JSPropertyNameArrayGetCount
32_JSPropertyNameArrayGetNameAtIndex
33_JSPropertyNameArrayRelease
34_JSPropertyNameArrayRetain
35_JSStringCopyCFString
36_JSStringCreateWithCFString
37_JSStringCreateWithCharacters
38_JSStringCreateWithUTF8CString
39_JSStringGetCharactersPtr
40_JSStringGetLength
41_JSStringGetMaximumUTF8CStringSize
42_JSStringGetUTF8CString
43_JSStringIsEqual
44_JSStringIsEqualToUTF8CString
45_JSStringRelease
46_JSStringRetain
47_JSValueGetType
48_JSValueIsBoolean
49_JSValueIsEqual
50_JSValueIsInstanceOfConstructor
51_JSValueIsNull
52_JSValueIsNumber
53_JSValueIsObject
54_JSValueIsObjectOfClass
55_JSValueIsStrictEqual
56_JSValueIsString
57_JSValueIsUndefined
58_JSValueMakeBoolean
59_JSValueMakeNull
60_JSValueMakeNumber
61_JSValueMakeString
62_JSValueMakeUndefined
63_JSValueProtect
64_JSValueToBoolean
65_JSValueToNumber
66_JSValueToObject
67_JSValueToStringCopy
68_JSValueUnprotect
69_KJS_JSCreateNativeJSObject
70_KJS_JSObject_JSFinalize
71_KJS_JSObject_JSObjectCall
72_KJS_JSObject_JSObjectEval
73_KJS_JSObject_JSObjectGetMember
74_KJS_JSObject_JSObjectGetSlot
75_KJS_JSObject_JSObjectRemoveMember
76_KJS_JSObject_JSObjectSetMember
77_KJS_JSObject_JSObjectSetSlot
78_KJS_JSObject_JSObjectToString
79_WTFLog
80_WTFLogVerbose
81_WTFReportArgumentAssertionFailure
82_WTFReportAssertionFailure
83_WTFReportAssertionFailureWithMessage
84_WTFReportError
85_WTFReportFatalError
86__NPN_CreateObject
87__NPN_DeallocateObject
88__NPN_Enumerate
89__NPN_Evaluate
90__NPN_GetIntIdentifier
91__NPN_GetProperty
92__NPN_GetStringIdentifier
93__NPN_GetStringIdentifiers
94__NPN_IdentifierIsString
95__NPN_Invoke
96__NPN_InvokeDefault
97__NPN_ReleaseObject
98__NPN_ReleaseVariantValue
99__NPN_RemoveProperty
100__NPN_RetainObject
101__NPN_SetException
102__NPN_SetProperty
103__NPN_UTF8FromIdentifier
104__Z12jsRegExpFreeP8JSRegExp
105__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
106__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
107__Z23_NPN_CreateScriptObjectP4_NPPPN3KJS8JSObjectEN3WTF10PassRefPtrINS1_8Bindings10RootObjectEEES8_
108__Z25_NPN_CreateNoScriptObjectv
109__ZN3KJS10Identifier11addSlowCaseEPNS_7UString3RepE
110__ZN3KJS10Identifier3addEPKNS_5UCharEi
111__ZN3KJS10Identifier3addEPKc
112__ZN3KJS10Identifier5equalEPKNS_7UString3RepEPKc
113__ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
114__ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
115__ZN3KJS11Interpreter10globalExecEv
116__ZN3KJS11Interpreter11checkSyntaxERKNS_7UStringEiPKNS_5UCharEi
117__ZN3KJS11Interpreter11checkSyntaxERKNS_7UStringEiS3_
118__ZN3KJS11Interpreter15restoreBuiltinsERKNS_13SavedBuiltinsE
119__ZN3KJS11Interpreter15setGlobalObjectEPNS_14JSGlobalObjectE
120__ZN3KJS11Interpreter16stopTimeoutCheckEv
121__ZN3KJS11Interpreter17startTimeoutCheckEv
122__ZN3KJS11Interpreter21shouldPrintExceptionsEv
123__ZN3KJS11Interpreter24setShouldPrintExceptionsEb
124__ZN3KJS11Interpreter27resetGlobalObjectPropertiesEv
125__ZN3KJS11Interpreter6s_hookE
126__ZN3KJS11Interpreter8evaluateERKNS_7UStringEiPKNS_5UCharEiPNS_7JSValueE
127__ZN3KJS11Interpreter8evaluateERKNS_7UStringEiS3_PNS_7JSValueE
128__ZN3KJS11Interpreter9markRootsERNS_9MarkStackE
129__ZN3KJS11InterpreterC1Ev
130__ZN3KJS11InterpreterC2Ev
131__ZN3KJS11InterpreterD1Ev
132__ZN3KJS11InterpreterD2Ev
133__ZN3KJS11JSImmediate4typeEPKNS_7JSValueE
134__ZN3KJS11JSImmediate8toObjectEPKNS_7JSValueEPNS_9ExecStateE
135__ZN3KJS11JSImmediate8toStringEPKNS_7JSValueE
136__ZN3KJS11PropertyMap11getLocationERKNS_10IdentifierE
137__ZN3KJS11PropertyMap5clearEv
138__ZN3KJS11PropertyMap7restoreERKNS_15SavedPropertiesE
139__ZN3KJS11PropertyMapD1Ev
140__ZN3KJS12DateInstance4infoE
141__ZN3KJS12PropertySlot15undefinedGetterEPNS_9ExecStateEPNS_8JSObjectERKNS_10IdentifierERKS0_
142__ZN3KJS12jsNumberCellEd
143__ZN3KJS13ArrayInstance4infoE
144__ZN3KJS13SavedBuiltinsC1Ev
145__ZN3KJS13SavedBuiltinsD1Ev
146__ZN3KJS13jsOwnedStringERKNS_7UStringE
147__ZN3KJS14StringInstance12markChildrenERNS_9MarkStackE
148__ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
149__ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
150__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
151__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
152__ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEi
153__ZN3KJS14StringInstance4infoE
154__ZN3KJS14StringInstanceC1EPNS_8JSObjectERKNS_7UStringE
155__ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE
156__ZN3KJS15SavedPropertiesC1Ev
157__ZN3KJS15SavedPropertiesD1Ev
158__ZN3KJS16RuntimeObjectImp4infoE
159__ZN3KJS16RuntimeObjectImpC1EPNS_8Bindings8InstanceE
160__ZN3KJS17PropertyNameArray3addERKNS_10IdentifierE
161__ZN3KJS19InternalFunctionImp4infoE
162__ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
163__ZN3KJS4List15expandAndAppendEPNS_7JSValueE
164__ZN3KJS4List7markSetEv
165__ZN3KJS4Node5derefEv
166__ZN3KJS6JSCell9getObjectEv
167__ZN3KJS6JSCellnwEm
168__ZN3KJS6JSLock12DropAllLocksC1Ev
169__ZN3KJS6JSLock12DropAllLocksD1Ev
170__ZN3KJS6JSLock14registerThreadEv
171__ZN3KJS6JSLock4lockEv
172__ZN3KJS6JSLock6unlockEv
173__ZN3KJS6JSLock9lockCountEv
174__ZN3KJS6Lookup9findEntryEPKNS_9HashTableERKNS_10IdentifierE
175__ZN3KJS6Parser12parseProgramERKNS_7UStringEiPKNS_5UCharEjPiS7_PS1_
176__ZN3KJS6parserEv
177__ZN3KJS7CStringD1Ev
178__ZN3KJS7UString3Rep4nullE
179__ZN3KJS7UString3Rep7destroyEv
180__ZN3KJS7UString6appendERKS0_
181__ZN3KJS7UStringC1EPKNS_5UCharEi
182__ZN3KJS7UStringC1EPKc
183__ZN3KJS7UStringC1ERKS0_S2_
184__ZN3KJS7UStringaSEPKc
185__ZN3KJS8Bindings10RootObject10invalidateEv
186__ZN3KJS8Bindings10RootObject11gcUnprotectEPNS_8JSObjectE
187__ZN3KJS8Bindings10RootObject17_createRootObjectE
188__ZN3KJS8Bindings10RootObject19setCreateRootObjectEPFN3WTF10PassRefPtrIS1_EEPvE
189__ZN3KJS8Bindings10RootObject6createEPKvN3WTF10PassRefPtrINS_11InterpreterEEE
190__ZN3KJS8Bindings10RootObject9gcProtectEPNS_8JSObjectE
191__ZN3KJS8Bindings10RootObjectD1Ev
192__ZN3KJS8Bindings10throwErrorEPNS_9ExecStateENS_9ErrorTypeEP8NSString
193__ZN3KJS8Bindings23convertObjcValueToValueEPNS_9ExecStateEPvNS0_13ObjcValueTypeEPNS0_10RootObjectE
194__ZN3KJS8Bindings23convertValueToObjcValueEPNS_9ExecStateEPNS_7JSValueENS0_13ObjcValueTypeE
195__ZN3KJS8Bindings8Instance18didExecuteFunctionEv
196__ZN3KJS8Bindings8Instance21setDidExecuteFunctionEPFvPNS_9ExecStateEPNS_8JSObjectEE
197__ZN3KJS8Bindings8Instance32createBindingForLanguageInstanceENS1_15BindingLanguageEPvN3WTF10PassRefPtrINS0_10RootObjectEEE
198__ZN3KJS8Debugger12sourceUnusedEPNS_9ExecStateEi
199__ZN3KJS8Debugger6attachEPNS_11InterpreterE
200__ZN3KJS8Debugger9exceptionEPNS_9ExecStateEiiPNS_7JSValueE
201__ZN3KJS8DebuggerC2Ev
202__ZN3KJS8DebuggerD2Ev
203__ZN3KJS8JSObject11hasInstanceEPNS_9ExecStateEPNS_7JSValueE
204__ZN3KJS8JSObject12markChildrenERNS_9MarkStackE
205__ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
206__ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
207__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
208__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
209__ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
210__ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
211__ZN3KJS8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
212__ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
213__ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEi
214__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueEi
215__ZN3KJS8JSObject4callEPNS_9ExecStateEPS0_RKNS_4ListE
216__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListE
217__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7UStringEi
218__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEPNS_7JSValueEi
219__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEii
220__ZN3KJS8jsStringEPKc
221__ZN3KJS8jsStringERKNS_7UStringE
222__ZN3KJS9Collector15numInterpretersEv
223__ZN3KJS9Collector15recordExtraCostEm
224__ZN3KJS9Collector19numProtectedObjectsEv
225__ZN3KJS9Collector20rootObjectTypeCountsEv
226__ZN3KJS9Collector23collectOnMainThreadOnlyEPNS_7JSValueE
227__ZN3KJS9Collector4sizeEv
228__ZN3KJS9Collector7collectEv
229__ZN3KJS9Collector7protectEPNS_7JSValueE
230__ZN3KJS9Collector9unprotectEPNS_7JSValueE
231__ZN3KJSeqERKNS_7UStringEPKc
232__ZN3WTF10fastCallocEmm
233__ZN3WTF10fastMallocEm
234__ZN3WTF11fastReallocEPvm
235__ZN3WTF16fastZeroedMallocEm
236__ZN3WTF8fastFreeEPv
237__ZNK3KJS11Interpreter12builtinArrayEv
238__ZNK3KJS11Interpreter12globalObjectEv
239__ZNK3KJS11Interpreter12saveBuiltinsERNS_13SavedBuiltinsE
240__ZNK3KJS11Interpreter15builtinFunctionEv
241__ZNK3KJS11Interpreter22builtinObjectPrototypeEv
242__ZNK3KJS11Interpreter22builtinStringPrototypeEv
243__ZNK3KJS11Interpreter24builtinFunctionPrototypeEv
244__ZNK3KJS11PropertyMap3getERKNS_10IdentifierE
245__ZNK3KJS11PropertyMap4saveERNS_15SavedPropertiesE
246__ZNK3KJS12DateInstance7getTimeERdRi
247__ZNK3KJS13ArrayInstance7getItemEj
248__ZNK3KJS19InternalFunctionImp14implementsCallEv
249__ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv
250__ZNK3KJS4List8getSliceEiRS0_
251__ZNK3KJS4Node8toStringEv
252__ZNK3KJS6JSCell17getTruncatedInt32ERi
253__ZNK3KJS6JSCell18getTruncatedUInt32ERj
254__ZNK3KJS6JSCell9getNumberERd
255__ZNK3KJS6JSCell9getNumberEv
256__ZNK3KJS6JSCell9getStringERNS_7UStringE
257__ZNK3KJS6JSCell9getStringEv
258__ZNK3KJS6JSCell9getUInt32ERj
259__ZNK3KJS7JSValue15toInt32SlowCaseEPNS_9ExecStateERb
260__ZNK3KJS7JSValue16toUInt32SlowCaseEPNS_9ExecStateERb
261__ZNK3KJS7JSValue7toFloatEPNS_9ExecStateE
262__ZNK3KJS7JSValue9toIntegerEPNS_9ExecStateE
263__ZNK3KJS7UString10UTF8StringEb
264__ZNK3KJS7UString14toStrictUInt32EPb
265__ZNK3KJS7UString5asciiEv
266__ZNK3KJS7UString6is8BitEv
267__ZNK3KJS7UString8toUInt32EPb
268__ZNK3KJS7UString8toUInt32EPbb
269__ZNK3KJS8Bindings10RootObject11interpreterEv
270__ZNK3KJS8Bindings8Instance10rootObjectEv
271__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
272__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
273__ZNK3KJS8JSObject14implementsCallEv
274__ZNK3KJS8JSObject19implementsConstructEv
275__ZNK3KJS8JSObject21implementsHasInstanceEv
276__ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE
277__ZNK3KJS8JSObject3getEPNS_9ExecStateEj
278__ZNK3KJS8JSObject4typeEv
279__ZNK3KJS8JSObject6canPutEPNS_9ExecStateERKNS_10IdentifierE
280__ZNK3KJS8JSObject8toNumberEPNS_9ExecStateE
281__ZNK3KJS8JSObject8toObjectEPNS_9ExecStateE
282__ZNK3KJS8JSObject8toStringEPNS_9ExecStateE
283__ZNK3KJS8JSObject9classInfoEv
284__ZNK3KJS8JSObject9classNameEv
285__ZNK3KJS8JSObject9toBooleanEPNS_9ExecStateE
286__ZNK3KJS9ExecState18lexicalInterpreterEv
287__ZTVN3KJS14StringInstanceE
288__ZTVN3KJS15JSWrapperObjectE
289__ZTVN3KJS19InternalFunctionImpE
290__ZTVN3KJS8JSObjectE
291_jscore_collector_introspection
292_jscore_fastmalloc_introspection
293_kJSClassDefinitionEmpty
294_kjs_strtod
Note: See TracBrowser for help on using the repository browser.