9c975ba11515dd7134b01a8559ab89cb1071df01
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-11-05  Gavin Barraclough  <barraclough@apple.com>
2
3         Reviewed by Maciej Stachowiak.
4
5         https://bugs.webkit.org/show_bug.cgi?id=22094
6
7         Fix for bug where the callee incorrectly recieves the caller's lexical
8         global object as this, rather than its own.  Implementation closely
9         follows the spec, passing jsNull, checking in the callee and replacing
10         with the global object where necessary.
11
12         * VM/CTI.cpp:
13         (JSC::CTI::compileOpCall):
14         * VM/Machine.cpp:
15         (JSC::Machine::cti_op_call_NotJSFunction):
16         (JSC::Machine::cti_op_call_eval):
17         * runtime/JSCell.h:
18         (JSC::JSValue::toThisObject):
19         * runtime/JSImmediate.cpp:
20         (JSC::JSImmediate::toThisObject):
21         * runtime/JSImmediate.h:
22
23 2008-11-05  Kevin Ollivier  <kevino@theolliviers.com>
24
25         wx build fix after Operations.cpp move.
26
27         * JavaScriptCoreSources.bkl:
28
29 2008-11-05  Cameron Zwarich  <zwarich@apple.com>
30
31         Not reviewed.
32
33         Fix the build for case-sensitive build systems and wxWindows.
34
35         * JavaScriptCoreSources.bkl:
36         * kjs/create_hash_table:
37
38 2008-11-05  Cameron Zwarich  <zwarich@apple.com>
39
40         Not reviewed.
41
42         Fix the build for case-sensitive build systems.
43
44         * JavaScriptCoreSources.bkl:
45         * kjs/Shell.cpp:
46         * runtime/Interpreter.cpp:
47         * runtime/JSArray.cpp:
48
49 2008-11-05  Cameron Zwarich  <zwarich@apple.com>
50
51         Not reviewed.
52
53         Fix the build for case-sensitive build systems.
54
55         * API/JSBase.cpp:
56         * API/JSObjectRef.cpp:
57         * runtime/CommonIdentifiers.h:
58         * runtime/Identifier.cpp:
59         * runtime/InitializeThreading.cpp:
60         * runtime/InternalFunction.h:
61         * runtime/JSString.h:
62         * runtime/Lookup.h:
63         * runtime/PropertyNameArray.h:
64         * runtime/PropertySlot.h:
65         * runtime/StructureID.cpp:
66         * runtime/StructureID.h:
67         * runtime/UString.cpp:
68
69 2008-11-05  Cameron Zwarich  <zwarich@apple.com>
70
71         Rubber-stamped by Sam Weinig.
72
73         Move more files to the runtime subdirectory of JavaScriptCore.
74
75         * API/APICast.h:
76         * API/JSBase.cpp:
77         * API/JSCallbackObject.cpp:
78         * API/JSClassRef.cpp:
79         * API/JSClassRef.h:
80         * API/JSStringRefCF.cpp:
81         * API/JSValueRef.cpp:
82         * API/OpaqueJSString.cpp:
83         * API/OpaqueJSString.h:
84         * AllInOneFile.cpp:
85         * GNUmakefile.am:
86         * JavaScriptCore.pri:
87         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
88         * JavaScriptCore.xcodeproj/project.pbxproj:
89         * JavaScriptCoreSources.bkl:
90         * VM/CodeBlock.h:
91         * VM/CodeGenerator.cpp:
92         * VM/Machine.cpp:
93         * VM/RegisterFile.h:
94         * debugger/Debugger.h:
95         * kjs/SourceProvider.h:
96         * kjs/TypeInfo.h: Removed.
97         * kjs/collector.cpp: Removed.
98         * kjs/collector.h: Removed.
99         * kjs/completion.h: Removed.
100         * kjs/create_hash_table:
101         * kjs/identifier.cpp: Removed.
102         * kjs/identifier.h: Removed.
103         * kjs/interpreter.cpp: Removed.
104         * kjs/interpreter.h: Removed.
105         * kjs/lexer.cpp:
106         * kjs/lexer.h:
107         * kjs/lookup.cpp: Removed.
108         * kjs/lookup.h: Removed.
109         * kjs/nodes.cpp:
110         * kjs/nodes.h:
111         * kjs/operations.cpp: Removed.
112         * kjs/operations.h: Removed.
113         * kjs/protect.h: Removed.
114         * kjs/regexp.cpp: Removed.
115         * kjs/regexp.h: Removed.
116         * kjs/ustring.cpp: Removed.
117         * kjs/ustring.h: Removed.
118         * pcre/pcre_exec.cpp:
119         * profiler/CallIdentifier.h:
120         * profiler/Profile.h:
121         * runtime/ArrayConstructor.cpp:
122         * runtime/ArrayPrototype.cpp:
123         * runtime/ArrayPrototype.h:
124         * runtime/Collector.cpp: Copied from kjs/collector.cpp.
125         * runtime/Collector.h: Copied from kjs/collector.h.
126         * runtime/CollectorHeapIterator.h:
127         * runtime/Completion.h: Copied from kjs/completion.h.
128         * runtime/ErrorPrototype.cpp:
129         * runtime/Identifier.cpp: Copied from kjs/identifier.cpp.
130         * runtime/Identifier.h: Copied from kjs/identifier.h.
131         * runtime/InitializeThreading.cpp:
132         * runtime/Interpreter.cpp: Copied from kjs/interpreter.cpp.
133         * runtime/Interpreter.h: Copied from kjs/interpreter.h.
134         * runtime/JSCell.h:
135         * runtime/JSGlobalData.cpp:
136         * runtime/JSGlobalData.h:
137         * runtime/JSLock.cpp:
138         * runtime/JSNumberCell.cpp:
139         * runtime/JSNumberCell.h:
140         * runtime/JSObject.cpp:
141         * runtime/JSValue.h:
142         * runtime/Lookup.cpp: Copied from kjs/lookup.cpp.
143         * runtime/Lookup.h: Copied from kjs/lookup.h.
144         * runtime/MathObject.cpp:
145         * runtime/NativeErrorPrototype.cpp:
146         * runtime/NumberPrototype.cpp:
147         * runtime/Operations.cpp: Copied from kjs/operations.cpp.
148         * runtime/Operations.h: Copied from kjs/operations.h.
149         * runtime/PropertyMapHashTable.h:
150         * runtime/Protect.h: Copied from kjs/protect.h.
151         * runtime/RegExp.cpp: Copied from kjs/regexp.cpp.
152         * runtime/RegExp.h: Copied from kjs/regexp.h.
153         * runtime/RegExpConstructor.cpp:
154         * runtime/RegExpObject.h:
155         * runtime/RegExpPrototype.cpp:
156         * runtime/SmallStrings.h:
157         * runtime/StringObjectThatMasqueradesAsUndefined.h:
158         * runtime/StructureID.cpp:
159         * runtime/StructureID.h:
160         * runtime/StructureIDTransitionTable.h:
161         * runtime/SymbolTable.h:
162         * runtime/TypeInfo.h: Copied from kjs/TypeInfo.h.
163         * runtime/UString.cpp: Copied from kjs/ustring.cpp.
164         * runtime/UString.h: Copied from kjs/ustring.h.
165         * wrec/CharacterClassConstructor.h:
166         * wrec/WREC.h:
167
168 2008-11-05  Geoffrey Garen  <ggaren@apple.com>
169
170         Suggested by Darin Adler.
171         
172         Removed two copy constructors that the compiler can generate for us
173         automatically.
174
175         * VM/LabelID.h:
176         (JSC::LabelID::setLocation):
177         (JSC::LabelID::offsetFrom):
178         (JSC::LabelID::ref):
179         (JSC::LabelID::refCount):
180         * kjs/LabelScope.h:
181
182 2008-11-05  Anders Carlsson  <andersca@apple.com>
183
184         Fix Snow Leopard build.
185         
186         * JavaScriptCore.xcodeproj/project.pbxproj:
187
188 2008-11-04  Cameron Zwarich  <zwarich@apple.com>
189
190         Rubber-stamped by Steve Falkenburg.
191
192         Move dtoa.cpp and dtoa.h to the WTF Visual Studio project to reflect
193         their movement in the filesystem.
194
195         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
196         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
197
198 2008-11-04  Cameron Zwarich  <zwarich@apple.com>
199
200         Rubber-stamped by Sam Weinig.
201
202         Move kjs/dtoa.h to the wtf subdirectory of JavaScriptCore.
203
204         * AllInOneFile.cpp:
205         * GNUmakefile.am:
206         * JavaScriptCore.pri:
207         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
208         * JavaScriptCore.xcodeproj/project.pbxproj:
209         * JavaScriptCoreSources.bkl:
210         * kjs/dtoa.cpp: Removed.
211         * kjs/dtoa.h: Removed.
212         * wtf/dtoa.cpp: Copied from kjs/dtoa.cpp.
213         * wtf/dtoa.h: Copied from kjs/dtoa.h.
214
215 2008-11-04  Cameron Zwarich  <zwarich@apple.com>
216
217         Rubber-stamped by Sam Weinig.
218
219         Move kjs/config.h to the top level of JavaScriptCore.
220
221         * GNUmakefile.am:
222         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
223         * JavaScriptCore.xcodeproj/project.pbxproj:
224         * config.h: Copied from kjs/config.h.
225         * kjs/config.h: Removed.
226
227 2008-11-04  Darin Adler  <darin@apple.com>
228
229         Reviewed by Tim Hatcher.
230
231         * wtf/ThreadingNone.cpp: Tweak formatting.
232
233 2008-11-03  Darin Adler  <darin@apple.com>
234
235         Reviewed by Tim Hatcher.
236
237         - https://bugs.webkit.org/show_bug.cgi?id=22061
238           create script to check for exit-time destructors
239
240         * JavaScriptCore.exp: Changed to export functions rather than
241         a global for the atomically initialized static mutex.
242
243         * JavaScriptCore.xcodeproj/project.pbxproj: Added a script
244         phase that runs the check-for-exit-time-destructors script.
245
246         * wtf/MainThread.cpp:
247         (WTF::mainThreadFunctionQueueMutex): Changed to leak an object
248         rather than using an exit time destructor.
249         (WTF::functionQueue): Ditto.
250         * wtf/unicode/icu/CollatorICU.cpp:
251         (WTF::cachedCollatorMutex): Ditto.
252
253         * wtf/Threading.h: Changed other platforms to share the Windows
254         approach where the mutex is internal and the functions are exported.
255         * wtf/ThreadingGtk.cpp:
256         (WTF::lockAtomicallyInitializedStaticMutex): Ditto.
257         (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
258         * wtf/ThreadingNone.cpp:
259         (WTF::lockAtomicallyInitializedStaticMutex): Ditto.
260         (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
261         * wtf/ThreadingPthreads.cpp:
262         (WTF::threadMapMutex): Changed to leak an object rather than using
263         an exit time destructor.
264         (WTF::lockAtomicallyInitializedStaticMutex): Mutex change.
265         (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
266         (WTF::threadMap): Changed to leak an object rather than using
267         an exit time destructor.
268         * wtf/ThreadingQt.cpp:
269         (WTF::lockAtomicallyInitializedStaticMutex): Mutex change.
270         (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
271         * wtf/ThreadingWin.cpp:
272         (WTF::lockAtomicallyInitializedStaticMutex): Added an assertion.
273
274 2008-11-04  Adam Roben  <aroben@apple.com>
275
276         Windows build fix
277
278         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update
279         the location of JSStaticScopeObject.{cpp,h}.
280
281 2008-11-04  Cameron Zwarich  <zwarich@apple.com>
282
283         Reviewed by Alexey Proskuryakov.
284
285         Move AllInOneFile.cpp to the top level of JavaScriptCore.
286
287         * AllInOneFile.cpp: Copied from kjs/AllInOneFile.cpp.
288         * GNUmakefile.am:
289         * JavaScriptCore.xcodeproj/project.pbxproj:
290         * kjs/AllInOneFile.cpp: Removed.
291
292 2008-11-04  Cameron Zwarich  <zwarich@apple.com>
293
294         Rubber-stamped by Alexey Proskuryakov.
295
296         Add NodeInfo.h to the JavaScriptCore Xcode project.
297
298         * JavaScriptCore.xcodeproj/project.pbxproj:
299
300 2008-11-03  Cameron Zwarich  <zwarich@apple.com>
301
302         Rubber-stamped by Maciej Stachowiak.
303
304         Move more files into the runtime subdirectory of JavaScriptCore.
305
306         * API/JSBase.cpp:
307         * API/JSCallbackConstructor.cpp:
308         * API/JSCallbackFunction.cpp:
309         * API/JSClassRef.cpp:
310         * API/OpaqueJSString.cpp:
311         * GNUmakefile.am:
312         * JavaScriptCore.pri:
313         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
314         * JavaScriptCore.xcodeproj/project.pbxproj:
315         * JavaScriptCoreSources.bkl:
316         * kjs/AllInOneFile.cpp:
317         * kjs/ArgList.cpp: Removed.
318         * kjs/ArgList.h: Removed.
319         * kjs/Arguments.cpp: Removed.
320         * kjs/Arguments.h: Removed.
321         * kjs/BatchedTransitionOptimizer.h: Removed.
322         * kjs/CollectorHeapIterator.h: Removed.
323         * kjs/CommonIdentifiers.cpp: Removed.
324         * kjs/CommonIdentifiers.h: Removed.
325         * kjs/ExecState.cpp: Removed.
326         * kjs/ExecState.h: Removed.
327         * kjs/GetterSetter.cpp: Removed.
328         * kjs/GetterSetter.h: Removed.
329         * kjs/InitializeThreading.cpp: Removed.
330         * kjs/InitializeThreading.h: Removed.
331         * kjs/JSActivation.cpp: Removed.
332         * kjs/JSActivation.h: Removed.
333         * kjs/JSGlobalData.cpp: Removed.
334         * kjs/JSGlobalData.h: Removed.
335         * kjs/JSLock.cpp: Removed.
336         * kjs/JSLock.h: Removed.
337         * kjs/JSStaticScopeObject.cpp: Removed.
338         * kjs/JSStaticScopeObject.h: Removed.
339         * kjs/JSType.h: Removed.
340         * kjs/PropertyNameArray.cpp: Removed.
341         * kjs/PropertyNameArray.h: Removed.
342         * kjs/ScopeChain.cpp: Removed.
343         * kjs/ScopeChain.h: Removed.
344         * kjs/ScopeChainMark.h: Removed.
345         * kjs/SymbolTable.h: Removed.
346         * kjs/Tracing.d: Removed.
347         * kjs/Tracing.h: Removed.
348         * runtime/ArgList.cpp: Copied from kjs/ArgList.cpp.
349         * runtime/ArgList.h: Copied from kjs/ArgList.h.
350         * runtime/Arguments.cpp: Copied from kjs/Arguments.cpp.
351         * runtime/Arguments.h: Copied from kjs/Arguments.h.
352         * runtime/BatchedTransitionOptimizer.h: Copied from kjs/BatchedTransitionOptimizer.h.
353         * runtime/CollectorHeapIterator.h: Copied from kjs/CollectorHeapIterator.h.
354         * runtime/CommonIdentifiers.cpp: Copied from kjs/CommonIdentifiers.cpp.
355         * runtime/CommonIdentifiers.h: Copied from kjs/CommonIdentifiers.h.
356         * runtime/ExecState.cpp: Copied from kjs/ExecState.cpp.
357         * runtime/ExecState.h: Copied from kjs/ExecState.h.
358         * runtime/GetterSetter.cpp: Copied from kjs/GetterSetter.cpp.
359         * runtime/GetterSetter.h: Copied from kjs/GetterSetter.h.
360         * runtime/InitializeThreading.cpp: Copied from kjs/InitializeThreading.cpp.
361         * runtime/InitializeThreading.h: Copied from kjs/InitializeThreading.h.
362         * runtime/JSActivation.cpp: Copied from kjs/JSActivation.cpp.
363         * runtime/JSActivation.h: Copied from kjs/JSActivation.h.
364         * runtime/JSGlobalData.cpp: Copied from kjs/JSGlobalData.cpp.
365         * runtime/JSGlobalData.h: Copied from kjs/JSGlobalData.h.
366         * runtime/JSLock.cpp: Copied from kjs/JSLock.cpp.
367         * runtime/JSLock.h: Copied from kjs/JSLock.h.
368         * runtime/JSStaticScopeObject.cpp: Copied from kjs/JSStaticScopeObject.cpp.
369         * runtime/JSStaticScopeObject.h: Copied from kjs/JSStaticScopeObject.h.
370         * runtime/JSType.h: Copied from kjs/JSType.h.
371         * runtime/PropertyNameArray.cpp: Copied from kjs/PropertyNameArray.cpp.
372         * runtime/PropertyNameArray.h: Copied from kjs/PropertyNameArray.h.
373         * runtime/ScopeChain.cpp: Copied from kjs/ScopeChain.cpp.
374         * runtime/ScopeChain.h: Copied from kjs/ScopeChain.h.
375         * runtime/ScopeChainMark.h: Copied from kjs/ScopeChainMark.h.
376         * runtime/SymbolTable.h: Copied from kjs/SymbolTable.h.
377         * runtime/Tracing.d: Copied from kjs/Tracing.d.
378         * runtime/Tracing.h: Copied from kjs/Tracing.h.
379
380 2008-11-03  Sam Weinig  <sam@webkit.org>
381
382         Reviewed by Mark Rowe.
383
384         Move #define to turn on dumping StructureID statistics to StructureID.cpp so that
385         turning it on does not require a full rebuild. 
386
387         * runtime/StructureID.cpp:
388         (JSC::StructureID::dumpStatistics):
389         * runtime/StructureID.h:
390
391 2008-11-03  Alp Toker  <alp@nuanti.com>
392
393         Reviewed by Geoffrey Garen.
394
395         Fix warning when building on Darwin without JSC_MULTIPLE_THREADS
396         enabled.
397
398         * kjs/InitializeThreading.cpp:
399
400 2008-11-02  Matt Lilek  <webkit@mattlilek.com>
401
402         Reviewed by Cameron Zwarich.
403
404         Bug 22042: REGRESSION(r38066): ASSERTION FAILED: source in CodeBlock
405         <https://bugs.webkit.org/show_bug.cgi?id=22042>
406
407         Rename parameter name to avoid ASSERT.
408
409         * VM/CodeBlock.h:
410         (JSC::CodeBlock::CodeBlock):
411         (JSC::ProgramCodeBlock::ProgramCodeBlock):
412         (JSC::EvalCodeBlock::EvalCodeBlock):
413
414 2008-11-02  Cameron Zwarich  <zwarich@apple.com>
415
416         Reviewed by Oliver Hunt.
417
418         Bug 22035: Remove the '_' suffix on constructor parameter names for structs
419         <https://bugs.webkit.org/show_bug.cgi?id=22035>
420
421         * API/JSCallbackObject.h:
422         (JSC::JSCallbackObject::JSCallbackObjectData::JSCallbackObjectData):
423         * VM/CodeBlock.h:
424         (JSC::CodeBlock::CodeBlock):
425         (JSC::ProgramCodeBlock::ProgramCodeBlock):
426         (JSC::EvalCodeBlock::EvalCodeBlock):
427         * wrec/WREC.h:
428         (JSC::Quantifier::Quantifier):
429
430 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
431
432         Rubber-stamped by Geoff Garen.
433
434         Rename SourceRange.h to SourceCode.h.
435
436         * API/JSBase.cpp:
437         * GNUmakefile.am:
438         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
439         * JavaScriptCore.xcodeproj/project.pbxproj:
440         * VM/CodeBlock.h:
441         * kjs/SourceCode.h: Copied from kjs/SourceRange.h.
442         * kjs/SourceRange.h: Removed.
443         * kjs/grammar.y:
444         * kjs/lexer.h:
445         * kjs/nodes.cpp:
446         (JSC::ForInNode::ForInNode):
447         * kjs/nodes.h:
448         (JSC::ThrowableExpressionData::setExceptionSourceCode):
449
450 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
451
452         Reviewed by Darin Adler.
453
454         Bug 22019: Move JSC::Interpreter::shouldPrintExceptions() to WebCore::Console
455         <https://bugs.webkit.org/show_bug.cgi?id=22019>
456
457         The JSC::Interpreter::shouldPrintExceptions() function is not used at
458         all in JavaScriptCore, so it should be moved to WebCore::Console, its
459         only user.
460
461         * JavaScriptCore.exp:
462         * kjs/interpreter.cpp:
463         * kjs/interpreter.h:
464
465 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
466
467         Not reviewed.
468
469         Windows build fix.
470
471         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
472
473 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
474
475         Rubber-stamped by Sam Weinig.
476
477         Remove the call to Interpreter::setShouldPrintExceptions() from the
478         GlobalObject constructor in the shell. The shouldPrintExceptions()
479         information is not used anywhere in JavaScriptCore, only in WebCore.
480
481         * kjs/Shell.cpp:
482         (GlobalObject::GlobalObject):
483
484 2008-10-31  Kevin Ollivier  <kevino@theolliviers.com>
485
486         wxMSW build fix.
487
488         * wtf/Threading.h:
489
490 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
491
492         Rubber-stamped by Sam Weinig.
493
494         Move more files from the kjs subdirectory of JavaScriptCore to the
495         runtime subdirectory.
496
497         * GNUmakefile.am:
498         * JavaScriptCore.pri:
499         * JavaScriptCore.xcodeproj/project.pbxproj:
500         * JavaScriptCoreSources.bkl:
501         * kjs/AllInOneFile.cpp:
502         * kjs/RegExpConstructor.cpp: Removed.
503         * kjs/RegExpConstructor.h: Removed.
504         * kjs/RegExpMatchesArray.h: Removed.
505         * kjs/RegExpObject.cpp: Removed.
506         * kjs/RegExpObject.h: Removed.
507         * kjs/RegExpPrototype.cpp: Removed.
508         * kjs/RegExpPrototype.h: Removed.
509         * runtime/RegExpConstructor.cpp: Copied from kjs/RegExpConstructor.cpp.
510         * runtime/RegExpConstructor.h: Copied from kjs/RegExpConstructor.h.
511         * runtime/RegExpMatchesArray.h: Copied from kjs/RegExpMatchesArray.h.
512         * runtime/RegExpObject.cpp: Copied from kjs/RegExpObject.cpp.
513         * runtime/RegExpObject.h: Copied from kjs/RegExpObject.h.
514         * runtime/RegExpPrototype.cpp: Copied from kjs/RegExpPrototype.cpp.
515         * runtime/RegExpPrototype.h: Copied from kjs/RegExpPrototype.h.
516
517 2008-10-31  Mark Rowe  <mrowe@apple.com>
518
519         Revert an incorrect portion of r38034.
520
521         * profiler/ProfilerServer.mm:
522
523 2008-10-31  Mark Rowe  <mrowe@apple.com>
524
525         Fix the 64-bit build.
526
527         Disable strict aliasing in ProfilerServer.mm as it leads to the compiler being unhappy
528         with the common Obj-C idiom self = [super init];
529
530         * JavaScriptCore.xcodeproj/project.pbxproj:
531
532 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
533
534         Reviewed by Alexey Proskuryakov.
535
536         Change a header guard to match our coding style.
537
538         * kjs/InitializeThreading.h:
539
540 2008-10-30  Geoffrey Garen  <ggaren@apple.com>
541
542         Reviewed by Oliver Hunt.
543         
544         Fixed a small bit of https://bugs.webkit.org/show_bug.cgi?id=21962
545         AST uses way too much memory
546         
547         Removed a word from StatementNode by nixing LabelStack and turning it
548         into a compile-time data structure managed by CodeGenerator.
549         
550         v8 tests and SunSpider, run by Gavin, report no change.
551
552         * GNUmakefile.am:
553         * JavaScriptCore.order:
554         * JavaScriptCore.pri:
555         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
556         * JavaScriptCore.xcodeproj/project.pbxproj:
557         * kjs/AllInOneFile.cpp:
558         * JavaScriptCoreSources.bkl: I sure hope this builds!
559         
560         * VM/CodeGenerator.cpp:
561         (JSC::CodeGenerator::CodeGenerator):
562         (JSC::CodeGenerator::newLabelScope):
563         (JSC::CodeGenerator::breakTarget):
564         (JSC::CodeGenerator::continueTarget):
565         * VM/CodeGenerator.h: Nixed the JumpContext system because it depended
566         on a LabelStack in the AST, and it was a little cumbersome on the client
567         side. Replaced with LabelScope, which tracks all break / continue
568         information in the CodeGenerator, just like we track LabelIDs and other
569         stacks of compile-time data.
570
571         * kjs/LabelScope.h: Added.
572         (JSC::LabelScope::):
573         (JSC::LabelScope::LabelScope):
574         (JSC::LabelScope::ref):
575         (JSC::LabelScope::deref):
576         (JSC::LabelScope::refCount):
577         (JSC::LabelScope::breakTarget):
578         (JSC::LabelScope::continueTarget):
579         (JSC::LabelScope::type):
580         (JSC::LabelScope::name):
581         (JSC::LabelScope::scopeDepth): Simple abstraction for holding everything
582         you might want to know about a break-able / continue-able scope.
583
584         * kjs/LabelStack.cpp: Removed.
585         * kjs/LabelStack.h: Removed.
586
587         * kjs/grammar.y: No need to push labels at parse time -- we don't store
588         LabelStacks in the AST anymore.
589
590         * kjs/nodes.cpp:
591         (JSC::DoWhileNode::emitCode):
592         (JSC::WhileNode::emitCode):
593         (JSC::ForNode::emitCode):
594         (JSC::ForInNode::emitCode):
595         (JSC::ContinueNode::emitCode):
596         (JSC::BreakNode::emitCode):
597         (JSC::SwitchNode::emitCode):
598         (JSC::LabelNode::emitCode):
599         * kjs/nodes.h:
600         (JSC::StatementNode::):
601         (JSC::LabelNode::): Use LabelScope where we used to use JumpContext.
602         Simplified a bunch of code. Touched up label-related error messages a
603         bit.
604
605         * kjs/nodes2string.cpp:
606         (JSC::LabelNode::streamTo): Updated for rename.
607
608 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
609
610         Reviewed by Darin Adler.
611
612         Bug 22005: Move StructureIDChain into its own file
613         <https://bugs.webkit.org/show_bug.cgi?id=22005>
614
615         * GNUmakefile.am:
616         * JavaScriptCore.pri:
617         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
618         * JavaScriptCore.xcodeproj/project.pbxproj:
619         * JavaScriptCoreSources.bkl:
620         * runtime/StructureID.cpp:
621         * runtime/StructureID.h:
622         * runtime/StructureIDChain.cpp: Copied from runtime/StructureID.cpp.
623         * runtime/StructureIDChain.h: Copied from runtime/StructureID.h.
624
625 2008-10-31  Steve Falkenburg  <sfalken@apple.com>
626
627         Build fix.
628
629         * JavaScriptCore.vcproj/jsc/jsc.vcproj:
630
631 2008-10-31  Steve Falkenburg  <sfalken@apple.com>
632
633         Build fix.
634
635         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
636
637 2008-10-31  Darin Adler  <darin@apple.com>
638
639         Reviewed by Dan Bernstein.
640
641         - fix storage leak seen on buildbot
642
643         Some other cleanup too. The storage leak was caused by the fact
644         that HashTraits<CallIdentifier>::needsDestruction was false, so
645         the call identifier objects didn't get deleted.
646
647         * profiler/CallIdentifier.h:
648         
649         Added a default constructor to create empty call identifiers.
650
651         Changed the normal constructor to use const UString&
652         to avoid extra copying and reference count thrash.
653         
654         Removed the explicit copy constructor definition, since it's what
655         the compiler will automatically generate. (Rule of thumb: Either
656         you need both a custom copy constructor and a custom assignment
657         operator, or neither.)
658
659         Moved the CallIdentifier hash function out of the WTF namespace;
660         there's no reason to put it there.
661
662         Changed the CallIdentifier hash function to be a struct rather than
663         a specialization of the IntHash struct template. Having it be
664         a specialization made no sense, since CallIdentifier is not an integer,
665         and did no good.
666
667         Removed explicit definition of emptyValueIsZero in the hash traits,
668         since inheriting from GenericHashTraits already makes that false.
669
670         Removed explicit definition of emptyValue, instead relying on the
671         default constructor and GenericHashTraits.
672
673         Removed explicit definition of needsDestruction, because we want it
674         to have its default value: true, not false. This fixes the leak!
675
676         Changed constructDeletedValue and isDeletedValue to use a line number
677         of numeric_limits<unsigned>::max() to indicate a value is deleted.
678         Previously this used empty strings for the empty value and null strings
679         for the deleted value, but it's more efficient to use null for both.
680
681 2008-10-31  Timothy Hatcher  <timothy@apple.com>
682
683         Emit the WillExecuteStatement debugger hook before the for loop body
684         when the statement node for the body isn't a block. This allows
685         breakpoints on those statements in the Web Inspector.
686
687         https://bugs.webkit.org/show_bug.cgi?id=22004
688
689         Reviewed by Darin Adler.
690
691         * kjs/nodes.cpp:
692         (JSC::ForNode::emitCode): Emit the WillExecuteStatement
693         debugger hook before the statement node if isn't a block.
694         Also emit the WillExecuteStatement debugger hook for the
695         loop as the first op-code.
696         (JSC::ForInNode::emitCode): Ditto.
697
698 2008-10-31  Timothy Hatcher  <timothy@apple.com>
699
700         Fixes console warnings about not having an autorelease pool.
701         Also fixes the build for Snow Leopard, by including individual
702         Foundation headers instead of Foundation.h.
703
704         https://bugs.webkit.org/show_bug.cgi?id=21995
705
706         Reviewed by Oliver Hunt.
707
708         * profiler/ProfilerServer.mm:
709         (-[ProfilerServer init]): Create a NSAutoreleasePool and drain it.
710
711 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
712
713         Not reviewed.
714
715         Speculative wxWindows build fix.
716
717         * JavaScriptCoreSources.bkl:
718         * jscore.bkl:
719
720 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
721
722         Rubber-stamped by Maciej Stachowiak.
723
724         Move VM/JSPropertyNameIterator.cpp and VM/JSPropertyNameIterator.h to
725         the runtime directory.
726
727         * GNUmakefile.am:
728         * JavaScriptCore.pri:
729         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
730         * JavaScriptCore.xcodeproj/project.pbxproj:
731         * JavaScriptCoreSources.bkl:
732         * VM/JSPropertyNameIterator.cpp: Removed.
733         * VM/JSPropertyNameIterator.h: Removed.
734         * runtime/JSPropertyNameIterator.cpp: Copied from VM/JSPropertyNameIterator.cpp.
735         * runtime/JSPropertyNameIterator.h: Copied from VM/JSPropertyNameIterator.h.
736
737 2008-10-31  Cameron Zwarich  <zwarich@apple.com>
738
739         Not reviewed.
740
741         Speculative wxWindows build fix.
742
743         * jscore.bkl:
744
745 2008-10-30  Mark Rowe  <mrowe@apple.com>
746
747         Reviewed by Jon Homeycutt.
748
749         Explicitly default to building for only the native architecture in debug and release builds.
750
751         * Configurations/DebugRelease.xcconfig:
752
753 2008-10-30  Cameron Zwarich  <zwarich@apple.com>
754
755         Rubber-stamped by Sam Weinig.
756
757         Create a debugger directory in JavaScriptCore and move the relevant
758         files to it.
759
760         * GNUmakefile.am:
761         * JavaScriptCore.pri:
762         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
763         * JavaScriptCore.xcodeproj/project.pbxproj:
764         * VM/CodeBlock.cpp:
765         * VM/CodeGenerator.h:
766         * VM/Machine.cpp:
767         * debugger: Added.
768         * debugger/Debugger.cpp: Copied from kjs/debugger.cpp.
769         * debugger/Debugger.h: Copied from kjs/debugger.h.
770         * debugger/DebuggerCallFrame.cpp: Copied from kjs/DebuggerCallFrame.cpp.
771         * debugger/DebuggerCallFrame.h: Copied from kjs/DebuggerCallFrame.h.
772         * kjs/AllInOneFile.cpp:
773         * kjs/DebuggerCallFrame.cpp: Removed.
774         * kjs/DebuggerCallFrame.h: Removed.
775         * kjs/Parser.cpp:
776         * kjs/Parser.h:
777         * kjs/debugger.cpp: Removed.
778         * kjs/debugger.h: Removed.
779         * kjs/interpreter.cpp:
780         * kjs/nodes.cpp:
781         * runtime/FunctionConstructor.cpp:
782         * runtime/JSGlobalObject.cpp:
783
784 2008-10-30  Benjamin K. Stuhl  <bks24@cornell.edu>
785
786         gcc 4.3.3/linux-x86 generates "suggest parentheses around && within ||"
787         warnings; add some parentheses to disambiguate things. No functional
788         changes, so no tests.
789
790         https://bugs.webkit.org/show_bug.cgi?id=21973
791         Add parentheses to clean up some gcc warnings
792
793         Reviewed by Dan Bernstein.
794
795         * wtf/ASCIICType.h:
796         (WTF::isASCIIAlphanumeric):
797         (WTF::isASCIIHexDigit):
798
799 2008-10-30  Kevin Lindeman  <klindeman@apple.com>
800
801         Adds ProfilerServer, which is a distributed notification listener
802         that allows starting and stopping the profiler remotely for use
803         in conjunction with the profiler's DTace probes.
804
805         https://bugs.webkit.org/show_bug.cgi?id=21719
806
807         Reviewed by Timothy Hatcher.
808
809         * JavaScriptCore.xcodeproj/project.pbxproj:
810         * kjs/JSGlobalData.cpp:
811         (JSC::JSGlobalData::JSGlobalData): Calls startProfilerServerIfNeeded.
812         * profiler/ProfilerServer.h: Added.
813         * profiler/ProfilerServer.mm: Added.
814         (+[ProfilerServer sharedProfileServer]):
815         (-[ProfilerServer init]):
816         (-[ProfilerServer startProfiling]):
817         (-[ProfilerServer stopProfiling]):
818         (JSC::startProfilerServerIfNeeded):
819
820 2008-10-30  Kevin Ollivier  <kevino@theolliviers.com>
821
822         wx build fix after PropertyMap and StructureID merge.
823
824         * JavaScriptCoreSources.bkl:
825
826 2008-10-30  Cameron Zwarich  <zwarich@apple.com>
827
828         Reviewed by Mark Rowe.
829
830         Change the JavaScriptCore Xcode project to use relative paths for the
831         PCRE source files.
832
833         * JavaScriptCore.xcodeproj/project.pbxproj:
834
835 2008-10-30  Sam Weinig  <sam@webkit.org>
836
837         Reviewed by Cameron Zwarich and Geoffrey Garen.
838
839         Fix for https://bugs.webkit.org/show_bug.cgi?id=21989
840         Merge PropertyMap and StructureID
841
842         - Move PropertyMap code into StructureID in preparation for lazily
843           creating the map on gets.
844         - Make remove with transition explicit by adding removePropertyTransition.
845         - Make the put/remove without transition explicit.
846         - Make cache invalidation part of put/remove without transition.
847
848         1% speedup on SunSpider; 0.5% speedup on v8 suite.
849
850         * GNUmakefile.am:
851         * JavaScriptCore.exp:
852         * JavaScriptCore.pri:
853         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
854         * JavaScriptCore.xcodeproj/project.pbxproj:
855         * JavaScriptCoreSources.bkl:
856         * kjs/AllInOneFile.cpp:
857         * kjs/identifier.h:
858         * runtime/JSObject.cpp:
859         (JSC::JSObject::removeDirect):
860         * runtime/JSObject.h:
861         (JSC::JSObject::putDirect):
862         * runtime/PropertyMap.cpp: Removed.
863         * runtime/PropertyMap.h: Removed.
864         * runtime/PropertyMapHashTable.h: Copied from runtime/PropertyMap.h.
865         * runtime/StructureID.cpp:
866         (JSC::StructureID::dumpStatistics):
867         (JSC::StructureID::StructureID):
868         (JSC::StructureID::~StructureID):
869         (JSC::StructureID::getEnumerablePropertyNames):
870         (JSC::StructureID::addPropertyTransition):
871         (JSC::StructureID::removePropertyTransition):
872         (JSC::StructureID::toDictionaryTransition):
873         (JSC::StructureID::changePrototypeTransition):
874         (JSC::StructureID::getterSetterTransition):
875         (JSC::StructureID::addPropertyWithoutTransition):
876         (JSC::StructureID::removePropertyWithoutTransition):
877         (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
878         (JSC::StructureID::checkConsistency):
879         (JSC::StructureID::copyPropertyTable):
880         (JSC::StructureID::get):
881         (JSC::StructureID::put):
882         (JSC::StructureID::remove):
883         (JSC::StructureID::insertIntoPropertyMapHashTable):
884         (JSC::StructureID::expandPropertyMapHashTable):
885         (JSC::StructureID::createPropertyMapHashTable):
886         (JSC::StructureID::rehashPropertyMapHashTable):
887         (JSC::comparePropertyMapEntryIndices):
888         (JSC::StructureID::getEnumerablePropertyNamesInternal):
889         * runtime/StructureID.h:
890         (JSC::StructureID::propertyStorageSize):
891         (JSC::StructureID::isEmpty):
892         (JSC::StructureID::get):
893
894 2008-10-30  Cameron Zwarich  <zwarich@apple.com>
895
896         Reviewed by Oliver Hunt.
897
898         Bug 21987: CTI::putDoubleResultToJSNumberCellOrJSImmediate() hardcodes its result register
899         <https://bugs.webkit.org/show_bug.cgi?id=21987>
900
901         CTI::putDoubleResultToJSNumberCellOrJSImmediate() hardcodes its result
902         register as ecx, but it should be tempReg1, which is ecx at all of its
903         callsites.
904
905         * VM/CTI.cpp:
906         (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
907
908 2008-10-30  Cameron Zwarich  <zwarich@apple.com>
909
910         Reviewed by Sam Weinig.
911
912         Bug 21985: Opcodes should use eax as their destination register whenever possible
913         <https://bugs.webkit.org/show_bug.cgi?id=21985>
914
915         Change more opcodes to use eax as the register for their final result,
916         and change calls to emitPutResult() that pass eax to rely on the default
917         value of eax.
918
919         * VM/CTI.cpp:
920         (JSC::CTI::privateCompileMainPass):
921
922 2008-10-30  Alp Toker  <alp@nuanti.com>
923
924         Build fix attempt for older gcc on the trunk-mac-intel build bot
925         (error: initializer for scalar variable requires one element).
926
927         Modify the initializer syntax slightly with an additional comma.
928
929         * VM/Machine.cpp:
930         (JSC::Machine::cti_op_call_JSFunction):
931         (JSC::Machine::cti_op_construct_JSConstruct):
932         (JSC::Machine::cti_op_resolve_func):
933         (JSC::Machine::cti_op_post_inc):
934         (JSC::Machine::cti_op_resolve_with_base):
935         (JSC::Machine::cti_op_post_dec):
936
937 2008-10-30  Alp Toker  <alp@nuanti.com>
938
939         Reviewed by Alexey Proskuryakov.
940
941         https://bugs.webkit.org/show_bug.cgi?id=21571
942         VoidPtrPair breaks CTI on Linux
943
944         The VoidPtrPair return change made in r37457 does not work on Linux
945         since POD structs aren't passed in registers.
946
947         This patch uses a union to vectorize VoidPtrPair to a uint64_t and
948         matches Darwin/MSVC fixing CTI/WREC on Linux.
949
950         Alexey reports no measurable change in Mac performance with this fix.
951
952         * VM/Machine.cpp:
953         (JSC::Machine::cti_op_call_JSFunction):
954         (JSC::Machine::cti_op_construct_JSConstruct):
955         (JSC::Machine::cti_op_resolve_func):
956         (JSC::Machine::cti_op_post_inc):
957         (JSC::Machine::cti_op_resolve_with_base):
958         (JSC::Machine::cti_op_post_dec):
959         * VM/Machine.h:
960         (JSC::):
961
962 2008-10-29  Oliver Hunt  <oliver@apple.com>
963
964         Reviewed by Geoff Garen.
965
966         Initial work to reduce cost of JSNumberCell allocation
967
968         This does the initial work needed to bring more of number
969         allocation into CTI code directly, rather than just falling
970         back onto the slow paths if we can't guarantee that a number
971         cell can be reused.
972
973         Initial implementation only used by op_negate to make sure
974         it all works.  In a negate heavy (though not dominated) test
975         it results in a 10% win in the non-reusable cell case.
976
977         * VM/CTI.cpp:
978         (JSC::):
979         (JSC::CTI::emitAllocateNumber):
980         (JSC::CTI::emitNakedFastCall):
981         (JSC::CTI::emitArithIntToImmWithJump):
982         (JSC::CTI::privateCompileMainPass):
983         (JSC::CTI::privateCompileSlowCases):
984         * VM/CTI.h:
985         * VM/CodeBlock.cpp:
986         (JSC::CodeBlock::dump):
987         * VM/CodeGenerator.cpp:
988         (JSC::CodeGenerator::emitUnaryOp):
989         * VM/CodeGenerator.h:
990         (JSC::CodeGenerator::emitToJSNumber):
991         (JSC::CodeGenerator::emitTypeOf):
992         (JSC::CodeGenerator::emitGetPropertyNames):
993         * VM/Machine.cpp:
994         (JSC::Machine::privateExecute):
995         * VM/Machine.h:
996         * kjs/ResultType.h:
997         (JSC::ResultType::isReusableNumber):
998         (JSC::ResultType::toInt):
999         * kjs/nodes.cpp:
1000         (JSC::UnaryOpNode::emitCode):
1001         (JSC::BinaryOpNode::emitCode):
1002         (JSC::EqualNode::emitCode):
1003         * masm/X86Assembler.h:
1004         (JSC::X86Assembler::):
1005         (JSC::X86Assembler::negl_r):
1006         (JSC::X86Assembler::xorpd_mr):
1007         * runtime/JSNumberCell.h:
1008         (JSC::JSNumberCell::JSNumberCell):
1009
1010 2008-10-29  Steve Falkenburg  <sfalken@apple.com>
1011
1012         <rdar://problem/6326563> Crash on launch
1013
1014         For Windows, export explicit functions rather than exporting data for atomicallyInitializedStaticMutex.
1015         
1016         Exporting data from a DLL on Windows requires specifying __declspec(dllimport) in the header used by
1017         callers, but __declspec(dllexport) when defined in the DLL implementation. By instead exporting
1018         the explicit lock/unlock functions, we can avoid this.
1019         
1020         Fixes a crash on launch, since we were previously erroneously exporting atomicallyInitializedStaticMutex as a function.
1021         
1022         Reviewed by Darin Adler.
1023
1024         * wtf/Threading.h:
1025         (WTF::lockAtomicallyInitializedStaticMutex):
1026         (WTF::unlockAtomicallyInitializedStaticMutex):
1027         * wtf/ThreadingWin.cpp:
1028         (WTF::lockAtomicallyInitializedStaticMutex):
1029         (WTF::unlockAtomicallyInitializedStaticMutex):
1030
1031 2008-10-29  Sam Weinig  <sam@webkit.org>
1032
1033         Reviewed by Oliver Hunt.
1034
1035         Remove direct use of PropertyMap.
1036
1037         * JavaScriptCore.exp:
1038         * runtime/JSObject.cpp:
1039         (JSC::JSObject::mark):
1040         (JSC::JSObject::put):
1041         (JSC::JSObject::deleteProperty):
1042         (JSC::JSObject::getPropertyAttributes):
1043         (JSC::JSObject::removeDirect):
1044         * runtime/JSObject.h:
1045         (JSC::JSObject::getDirect):
1046         (JSC::JSObject::getDirectLocation):
1047         (JSC::JSObject::hasCustomProperties):
1048         (JSC::JSObject::JSObject):
1049         (JSC::JSObject::putDirect):
1050         * runtime/PropertyMap.cpp:
1051         (JSC::PropertyMap::get):
1052         * runtime/PropertyMap.h:
1053         (JSC::PropertyMap::isEmpty):
1054         (JSC::PropertyMap::get):
1055         * runtime/StructureID.cpp:
1056         (JSC::StructureID::dumpStatistics):
1057         * runtime/StructureID.h:
1058         (JSC::StructureID::propertyStorageSize):
1059         (JSC::StructureID::get):
1060         (JSC::StructureID::put):
1061         (JSC::StructureID::remove):
1062         (JSC::StructureID::isEmpty):
1063
1064 2008-10-29  Sam Weinig  <sam@webkit.org>
1065
1066         Reviewed by Geoffrey Garen.
1067
1068         Rename and move the StructureID transition table to its own file.
1069
1070         * GNUmakefile.am:
1071         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1072         * JavaScriptCore.xcodeproj/project.pbxproj:
1073         * runtime/StructureID.cpp:
1074         (JSC::StructureID::addPropertyTransition):
1075         * runtime/StructureID.h:
1076         (JSC::StructureID::):
1077         * runtime/StructureIDTransitionTable.h: Copied from runtime/StructureID.h.
1078         (JSC::StructureIDTransitionTableHash::hash):
1079         (JSC::StructureIDTransitionTableHash::equal):
1080
1081 2008-10-29  Sam Weinig  <sam@webkit.org>
1082
1083         Reviewed by Cameron Zwarich.
1084
1085         Fix for https://bugs.webkit.org/show_bug.cgi?id=21958
1086         Pack bits in StructureID to reduce the size of each StructureID by 2 words.
1087
1088         * runtime/PropertyMap.h:
1089         (JSC::PropertyMap::propertyMapSize):
1090         * runtime/StructureID.cpp:
1091         (JSC::StructureID::dumpStatistics): Add additional size statistics when dumping.
1092         (JSC::StructureID::StructureID):
1093         * runtime/StructureID.h:
1094
1095 2008-10-29  Kevin Ollivier  <kevino@theolliviers.com>
1096
1097         wx build fixes after addition of runtime and ImageBuffer changes.
1098
1099         * JavaScriptCoreSources.bkl:
1100         * jscore.bkl:
1101
1102 2008-10-29  Timothy Hatcher  <timothy@apple.com>
1103
1104         Emit the WillExecuteStatement debugger hook before the "else" body
1105         when there is no block for the "else" body. This allows breakpoints
1106         on those statements in the Web Inspector.
1107
1108         https://bugs.webkit.org/show_bug.cgi?id=21944
1109
1110         Reviewed by Maciej Stachowiak.
1111
1112         * kjs/nodes.cpp:
1113         (JSC::IfElseNode::emitCode): Emit the WillExecuteStatement
1114         debugger hook before the else node if isn't a block.
1115
1116 2008-10-29  Alexey Proskuryakov  <ap@webkit.org>
1117
1118         Build fix.
1119
1120         * JavaScriptCore.exp: Export HashTable::deleteTable().
1121
1122 2008-10-28  Alp Toker  <alp@nuanti.com>
1123
1124         Fix builddir != srcdir builds after kjs -> runtime breakage. Sources
1125         may now be generated in both kjs/ and runtime/.
1126
1127         Also sort the sources list for readability.
1128
1129         * GNUmakefile.am:
1130
1131 2008-10-28  Alp Toker  <alp@nuanti.com>
1132
1133         Reviewed by Cameron Zwarich.
1134
1135         Build fix attempt after kjs -> runtime rename.
1136
1137         * GNUmakefile.am:
1138
1139 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1140
1141         Not reviewed.
1142
1143         Remove a duplicate includes directory.
1144
1145         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1146
1147 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1148
1149         Not reviewed.
1150
1151         Attempt to fix the Windows build.
1152
1153         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1154         * JavaScriptCore.vcproj/jsc/jsc.vcproj:
1155
1156 2008-10-28  Dan Bernstein  <mitz@apple.com>
1157
1158         Reviewed by Mark Rowe.
1159
1160         - export WTF::atomicallyInitializedStaticMutex
1161
1162         * JavaScriptCore.exp:
1163
1164 2008-10-28  Geoffrey Garen  <ggaren@apple.com>
1165
1166         Reviewed by Cameron Zwarich.
1167         
1168         Fixed CodeBlock dumping to accurately report constant register indices.
1169
1170         * VM/CodeBlock.cpp:
1171         (JSC::CodeBlock::dump):
1172
1173 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1174
1175         Not reviewed.
1176
1177         More Qt build fixes.
1178
1179         * JavaScriptCore.pri:
1180
1181 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1182
1183         Not reviewed.
1184
1185         Fix the Qt build, hopefully for real this time.
1186
1187         * JavaScriptCore.pri:
1188
1189 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1190
1191         Not reviewed.
1192
1193         Fix the Qt build.
1194
1195         * JavaScriptCore.pri:
1196
1197 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1198
1199         Not reviewed.
1200
1201         Fix the Windows build.
1202
1203         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1204
1205 2008-10-28  Cameron Zwarich  <zwarich@apple.com>
1206
1207         Rubber-stamped by Sam Weinig.
1208
1209         Create a runtime directory in JavaScriptCore and begin moving files to
1210         it. This is the first step towards removing the kjs directory and
1211         placing files in more meaningful subdirectories of JavaScriptCore.
1212
1213         * API/JSBase.cpp:
1214         * API/JSCallbackConstructor.cpp:
1215         * API/JSCallbackConstructor.h:
1216         * API/JSCallbackFunction.cpp:
1217         * API/JSClassRef.cpp:
1218         * API/JSClassRef.h:
1219         * API/JSStringRefCF.cpp:
1220         * API/JSValueRef.cpp:
1221         * API/OpaqueJSString.cpp:
1222         * DerivedSources.make:
1223         * GNUmakefile.am:
1224         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1225         * JavaScriptCore.xcodeproj/project.pbxproj:
1226         * kjs/AllInOneFile.cpp:
1227         * kjs/ArrayConstructor.cpp: Removed.
1228         * kjs/ArrayConstructor.h: Removed.
1229         * kjs/ArrayPrototype.cpp: Removed.
1230         * kjs/ArrayPrototype.h: Removed.
1231         * kjs/BooleanConstructor.cpp: Removed.
1232         * kjs/BooleanConstructor.h: Removed.
1233         * kjs/BooleanObject.cpp: Removed.
1234         * kjs/BooleanObject.h: Removed.
1235         * kjs/BooleanPrototype.cpp: Removed.
1236         * kjs/BooleanPrototype.h: Removed.
1237         * kjs/CallData.cpp: Removed.
1238         * kjs/CallData.h: Removed.
1239         * kjs/ClassInfo.h: Removed.
1240         * kjs/ConstructData.cpp: Removed.
1241         * kjs/ConstructData.h: Removed.
1242         * kjs/DateConstructor.cpp: Removed.
1243         * kjs/DateConstructor.h: Removed.
1244         * kjs/DateInstance.cpp: Removed.
1245         * kjs/DateInstance.h: Removed.
1246         * kjs/DateMath.cpp: Removed.
1247         * kjs/DateMath.h: Removed.
1248         * kjs/DatePrototype.cpp: Removed.
1249         * kjs/DatePrototype.h: Removed.
1250         * kjs/Error.cpp: Removed.
1251         * kjs/Error.h: Removed.
1252         * kjs/ErrorConstructor.cpp: Removed.
1253         * kjs/ErrorConstructor.h: Removed.
1254         * kjs/ErrorInstance.cpp: Removed.
1255         * kjs/ErrorInstance.h: Removed.
1256         * kjs/ErrorPrototype.cpp: Removed.
1257         * kjs/ErrorPrototype.h: Removed.
1258         * kjs/FunctionConstructor.cpp: Removed.
1259         * kjs/FunctionConstructor.h: Removed.
1260         * kjs/FunctionPrototype.cpp: Removed.
1261         * kjs/FunctionPrototype.h: Removed.
1262         * kjs/GlobalEvalFunction.cpp: Removed.
1263         * kjs/GlobalEvalFunction.h: Removed.
1264         * kjs/InternalFunction.cpp: Removed.
1265         * kjs/InternalFunction.h: Removed.
1266         * kjs/JSArray.cpp: Removed.
1267         * kjs/JSArray.h: Removed.
1268         * kjs/JSCell.cpp: Removed.
1269         * kjs/JSCell.h: Removed.
1270         * kjs/JSFunction.cpp: Removed.
1271         * kjs/JSFunction.h: Removed.
1272         * kjs/JSGlobalObject.cpp: Removed.
1273         * kjs/JSGlobalObject.h: Removed.
1274         * kjs/JSGlobalObjectFunctions.cpp: Removed.
1275         * kjs/JSGlobalObjectFunctions.h: Removed.
1276         * kjs/JSImmediate.cpp: Removed.
1277         * kjs/JSImmediate.h: Removed.
1278         * kjs/JSNotAnObject.cpp: Removed.
1279         * kjs/JSNotAnObject.h: Removed.
1280         * kjs/JSNumberCell.cpp: Removed.
1281         * kjs/JSNumberCell.h: Removed.
1282         * kjs/JSObject.cpp: Removed.
1283         * kjs/JSObject.h: Removed.
1284         * kjs/JSString.cpp: Removed.
1285         * kjs/JSString.h: Removed.
1286         * kjs/JSValue.cpp: Removed.
1287         * kjs/JSValue.h: Removed.
1288         * kjs/JSVariableObject.cpp: Removed.
1289         * kjs/JSVariableObject.h: Removed.
1290         * kjs/JSWrapperObject.cpp: Removed.
1291         * kjs/JSWrapperObject.h: Removed.
1292         * kjs/MathObject.cpp: Removed.
1293         * kjs/MathObject.h: Removed.
1294         * kjs/NativeErrorConstructor.cpp: Removed.
1295         * kjs/NativeErrorConstructor.h: Removed.
1296         * kjs/NativeErrorPrototype.cpp: Removed.
1297         * kjs/NativeErrorPrototype.h: Removed.
1298         * kjs/NumberConstructor.cpp: Removed.
1299         * kjs/NumberConstructor.h: Removed.
1300         * kjs/NumberObject.cpp: Removed.
1301         * kjs/NumberObject.h: Removed.
1302         * kjs/NumberPrototype.cpp: Removed.
1303         * kjs/NumberPrototype.h: Removed.
1304         * kjs/ObjectConstructor.cpp: Removed.
1305         * kjs/ObjectConstructor.h: Removed.
1306         * kjs/ObjectPrototype.cpp: Removed.
1307         * kjs/ObjectPrototype.h: Removed.
1308         * kjs/PropertyMap.cpp: Removed.
1309         * kjs/PropertyMap.h: Removed.
1310         * kjs/PropertySlot.cpp: Removed.
1311         * kjs/PropertySlot.h: Removed.
1312         * kjs/PrototypeFunction.cpp: Removed.
1313         * kjs/PrototypeFunction.h: Removed.
1314         * kjs/PutPropertySlot.h: Removed.
1315         * kjs/SmallStrings.cpp: Removed.
1316         * kjs/SmallStrings.h: Removed.
1317         * kjs/StringConstructor.cpp: Removed.
1318         * kjs/StringConstructor.h: Removed.
1319         * kjs/StringObject.cpp: Removed.
1320         * kjs/StringObject.h: Removed.
1321         * kjs/StringObjectThatMasqueradesAsUndefined.h: Removed.
1322         * kjs/StringPrototype.cpp: Removed.
1323         * kjs/StringPrototype.h: Removed.
1324         * kjs/StructureID.cpp: Removed.
1325         * kjs/StructureID.h: Removed.
1326         * kjs/completion.h:
1327         * kjs/interpreter.h:
1328         * runtime: Added.
1329         * runtime/ArrayConstructor.cpp: Copied from kjs/ArrayConstructor.cpp.
1330         * runtime/ArrayConstructor.h: Copied from kjs/ArrayConstructor.h.
1331         * runtime/ArrayPrototype.cpp: Copied from kjs/ArrayPrototype.cpp.
1332         * runtime/ArrayPrototype.h: Copied from kjs/ArrayPrototype.h.
1333         * runtime/BooleanConstructor.cpp: Copied from kjs/BooleanConstructor.cpp.
1334         * runtime/BooleanConstructor.h: Copied from kjs/BooleanConstructor.h.
1335         * runtime/BooleanObject.cpp: Copied from kjs/BooleanObject.cpp.
1336         * runtime/BooleanObject.h: Copied from kjs/BooleanObject.h.
1337         * runtime/BooleanPrototype.cpp: Copied from kjs/BooleanPrototype.cpp.
1338         * runtime/BooleanPrototype.h: Copied from kjs/BooleanPrototype.h.
1339         * runtime/CallData.cpp: Copied from kjs/CallData.cpp.
1340         * runtime/CallData.h: Copied from kjs/CallData.h.
1341         * runtime/ClassInfo.h: Copied from kjs/ClassInfo.h.
1342         * runtime/ConstructData.cpp: Copied from kjs/ConstructData.cpp.
1343         * runtime/ConstructData.h: Copied from kjs/ConstructData.h.
1344         * runtime/DateConstructor.cpp: Copied from kjs/DateConstructor.cpp.
1345         * runtime/DateConstructor.h: Copied from kjs/DateConstructor.h.
1346         * runtime/DateInstance.cpp: Copied from kjs/DateInstance.cpp.
1347         * runtime/DateInstance.h: Copied from kjs/DateInstance.h.
1348         * runtime/DateMath.cpp: Copied from kjs/DateMath.cpp.
1349         * runtime/DateMath.h: Copied from kjs/DateMath.h.
1350         * runtime/DatePrototype.cpp: Copied from kjs/DatePrototype.cpp.
1351         * runtime/DatePrototype.h: Copied from kjs/DatePrototype.h.
1352         * runtime/Error.cpp: Copied from kjs/Error.cpp.
1353         * runtime/Error.h: Copied from kjs/Error.h.
1354         * runtime/ErrorConstructor.cpp: Copied from kjs/ErrorConstructor.cpp.
1355         * runtime/ErrorConstructor.h: Copied from kjs/ErrorConstructor.h.
1356         * runtime/ErrorInstance.cpp: Copied from kjs/ErrorInstance.cpp.
1357         * runtime/ErrorInstance.h: Copied from kjs/ErrorInstance.h.
1358         * runtime/ErrorPrototype.cpp: Copied from kjs/ErrorPrototype.cpp.
1359         * runtime/ErrorPrototype.h: Copied from kjs/ErrorPrototype.h.
1360         * runtime/FunctionConstructor.cpp: Copied from kjs/FunctionConstructor.cpp.
1361         * runtime/FunctionConstructor.h: Copied from kjs/FunctionConstructor.h.
1362         * runtime/FunctionPrototype.cpp: Copied from kjs/FunctionPrototype.cpp.
1363         * runtime/FunctionPrototype.h: Copied from kjs/FunctionPrototype.h.
1364         * runtime/GlobalEvalFunction.cpp: Copied from kjs/GlobalEvalFunction.cpp.
1365         * runtime/GlobalEvalFunction.h: Copied from kjs/GlobalEvalFunction.h.
1366         * runtime/InternalFunction.cpp: Copied from kjs/InternalFunction.cpp.
1367         * runtime/InternalFunction.h: Copied from kjs/InternalFunction.h.
1368         * runtime/JSArray.cpp: Copied from kjs/JSArray.cpp.
1369         * runtime/JSArray.h: Copied from kjs/JSArray.h.
1370         * runtime/JSCell.cpp: Copied from kjs/JSCell.cpp.
1371         * runtime/JSCell.h: Copied from kjs/JSCell.h.
1372         * runtime/JSFunction.cpp: Copied from kjs/JSFunction.cpp.
1373         * runtime/JSFunction.h: Copied from kjs/JSFunction.h.
1374         * runtime/JSGlobalObject.cpp: Copied from kjs/JSGlobalObject.cpp.
1375         * runtime/JSGlobalObject.h: Copied from kjs/JSGlobalObject.h.
1376         * runtime/JSGlobalObjectFunctions.cpp: Copied from kjs/JSGlobalObjectFunctions.cpp.
1377         * runtime/JSGlobalObjectFunctions.h: Copied from kjs/JSGlobalObjectFunctions.h.
1378         * runtime/JSImmediate.cpp: Copied from kjs/JSImmediate.cpp.
1379         * runtime/JSImmediate.h: Copied from kjs/JSImmediate.h.
1380         * runtime/JSNotAnObject.cpp: Copied from kjs/JSNotAnObject.cpp.
1381         * runtime/JSNotAnObject.h: Copied from kjs/JSNotAnObject.h.
1382         * runtime/JSNumberCell.cpp: Copied from kjs/JSNumberCell.cpp.
1383         * runtime/JSNumberCell.h: Copied from kjs/JSNumberCell.h.
1384         * runtime/JSObject.cpp: Copied from kjs/JSObject.cpp.
1385         * runtime/JSObject.h: Copied from kjs/JSObject.h.
1386         * runtime/JSString.cpp: Copied from kjs/JSString.cpp.
1387         * runtime/JSString.h: Copied from kjs/JSString.h.
1388         * runtime/JSValue.cpp: Copied from kjs/JSValue.cpp.
1389         * runtime/JSValue.h: Copied from kjs/JSValue.h.
1390         * runtime/JSVariableObject.cpp: Copied from kjs/JSVariableObject.cpp.
1391         * runtime/JSVariableObject.h: Copied from kjs/JSVariableObject.h.
1392         * runtime/JSWrapperObject.cpp: Copied from kjs/JSWrapperObject.cpp.
1393         * runtime/JSWrapperObject.h: Copied from kjs/JSWrapperObject.h.
1394         * runtime/MathObject.cpp: Copied from kjs/MathObject.cpp.
1395         * runtime/MathObject.h: Copied from kjs/MathObject.h.
1396         * runtime/NativeErrorConstructor.cpp: Copied from kjs/NativeErrorConstructor.cpp.
1397         * runtime/NativeErrorConstructor.h: Copied from kjs/NativeErrorConstructor.h.
1398         * runtime/NativeErrorPrototype.cpp: Copied from kjs/NativeErrorPrototype.cpp.
1399         * runtime/NativeErrorPrototype.h: Copied from kjs/NativeErrorPrototype.h.
1400         * runtime/NumberConstructor.cpp: Copied from kjs/NumberConstructor.cpp.
1401         * runtime/NumberConstructor.h: Copied from kjs/NumberConstructor.h.
1402         * runtime/NumberObject.cpp: Copied from kjs/NumberObject.cpp.
1403         * runtime/NumberObject.h: Copied from kjs/NumberObject.h.
1404         * runtime/NumberPrototype.cpp: Copied from kjs/NumberPrototype.cpp.
1405         * runtime/NumberPrototype.h: Copied from kjs/NumberPrototype.h.
1406         * runtime/ObjectConstructor.cpp: Copied from kjs/ObjectConstructor.cpp.
1407         * runtime/ObjectConstructor.h: Copied from kjs/ObjectConstructor.h.
1408         * runtime/ObjectPrototype.cpp: Copied from kjs/ObjectPrototype.cpp.
1409         * runtime/ObjectPrototype.h: Copied from kjs/ObjectPrototype.h.
1410         * runtime/PropertyMap.cpp: Copied from kjs/PropertyMap.cpp.
1411         * runtime/PropertyMap.h: Copied from kjs/PropertyMap.h.
1412         * runtime/PropertySlot.cpp: Copied from kjs/PropertySlot.cpp.
1413         * runtime/PropertySlot.h: Copied from kjs/PropertySlot.h.
1414         * runtime/PrototypeFunction.cpp: Copied from kjs/PrototypeFunction.cpp.
1415         * runtime/PrototypeFunction.h: Copied from kjs/PrototypeFunction.h.
1416         * runtime/PutPropertySlot.h: Copied from kjs/PutPropertySlot.h.
1417         * runtime/SmallStrings.cpp: Copied from kjs/SmallStrings.cpp.
1418         * runtime/SmallStrings.h: Copied from kjs/SmallStrings.h.
1419         * runtime/StringConstructor.cpp: Copied from kjs/StringConstructor.cpp.
1420         * runtime/StringConstructor.h: Copied from kjs/StringConstructor.h.
1421         * runtime/StringObject.cpp: Copied from kjs/StringObject.cpp.
1422         * runtime/StringObject.h: Copied from kjs/StringObject.h.
1423         * runtime/StringObjectThatMasqueradesAsUndefined.h: Copied from kjs/StringObjectThatMasqueradesAsUndefined.h.
1424         * runtime/StringPrototype.cpp: Copied from kjs/StringPrototype.cpp.
1425         * runtime/StringPrototype.h: Copied from kjs/StringPrototype.h.
1426         * runtime/StructureID.cpp: Copied from kjs/StructureID.cpp.
1427         * runtime/StructureID.h: Copied from kjs/StructureID.h.
1428
1429 2008-10-28  Geoffrey Garen  <ggaren@apple.com>
1430
1431         Reviewed by Sam Weinig.
1432         
1433         Fixed https://bugs.webkit.org/show_bug.cgi?id=21919
1434         Sampler reports bogus time in op_enter during 3d-raytrace.js
1435         
1436         Fixed a bug where we would pass the incorrect Instruction* during some
1437         parts of CTI codegen.
1438
1439         * VM/CTI.cpp:
1440         (JSC::CTI::privateCompileMainPass):
1441         (JSC::CTI::privateCompileSlowCases):
1442         * VM/SamplingTool.cpp:
1443         (JSC::SamplingTool::run):
1444         * wtf/Platform.h:
1445
1446 2008-10-28  Kevin McCullough  <kmccullough@apple.com>
1447
1448         Reviewed by Dan Bernstein.
1449
1450         -Removed unused includes.
1451         Apparent .4% speedup in Sunspider
1452
1453         * kjs/JSObject.cpp:
1454         * kjs/interpreter.cpp:
1455
1456 2008-10-28  Alp Toker  <alp@nuanti.com>
1457
1458         Include copyright license files in the autotools dist target.
1459
1460         Change suggested by Mike Hommey.
1461
1462         * GNUmakefile.am:
1463
1464 2008-10-27  Geoffrey Garen  <ggaren@apple.com>
1465
1466         Reviewed by Maciej Stachowiak.
1467         
1468         Stop discarding CodeBlock samples that can't be charged to a specific
1469         opcode. Instead, charge the relevant CodeBlock, and provide a footnote
1470         explaining the situation.
1471         
1472         This will help us tell which CodeBlocks are hot, even if we can't
1473         identify specific lines of code within the CodeBlocks.
1474
1475         * VM/SamplingTool.cpp:
1476         (JSC::ScopeSampleRecord::sample):
1477         (JSC::compareScopeSampleRecords):
1478         (JSC::SamplingTool::dump):
1479
1480         * VM/SamplingTool.h:
1481         (JSC::ScopeSampleRecord::ScopeSampleRecord):
1482         (JSC::ScopeSampleRecord::~ScopeSampleRecord):
1483
1484 2008-10-27  Geoffrey Garen  <ggaren@apple.com>
1485
1486         Reviewed by Sam Weinig.
1487         
1488         Added a mutex around the SamplingTool's ScopeNode* map, to solve a crash
1489         when sampling the v8 tests.
1490
1491         * VM/SamplingTool.cpp:
1492         (JSC::SamplingTool::run):
1493         (JSC::SamplingTool::notifyOfScope):
1494         * VM/SamplingTool.h: Since new ScopeNodes can be created after
1495         the SamplingTools has begun sampling, reads and writes to / from the
1496         map need to be synchronized. Shark says this doesn't measurably increase
1497         sampling overhead.
1498
1499 2008-10-25  Geoffrey Garen  <ggaren@apple.com>
1500
1501         Not reviewed.
1502         
1503         Try to fix Windows build.
1504
1505         * VM/Machine.cpp:
1506         (JSC::Machine::privateExecute): Provide a dummy value to the
1507         HostCallRecord in CTI non-sampling builds, to silence compiler warning.
1508
1509 2008-10-25  Geoffrey Garen  <ggaren@apple.com>
1510
1511         Not reviewed.
1512         
1513         Try to fix Windows build.
1514
1515         * VM/SamplingTool.h:
1516         (JSC::SamplingTool::encodeSample): Explicitly cast bool to int, to
1517         silence compiler warning.
1518
1519 2008-10-25  Geoffrey Garen  <ggaren@apple.com>
1520
1521         Reviewed by Sam Weinig, with Gavin Barraclough's help.
1522         
1523         Fixed Sampling Tool:
1524             - Made CodeBlock sampling work with CTI
1525             - Improved accuracy by unifying most sampling data into a single
1526               32bit word, which can be written / read atomically.
1527             - Split out three different #ifdefs for modularity: OPCODE_SAMPLING;
1528               CODEBLOCK_SAMPLING; OPCODE_STATS.
1529             - Improved reporting clarity
1530             - Refactored for code clarity
1531
1532         * JavaScriptCore.exp: Exported another symbol.
1533
1534         * VM/CTI.cpp:
1535         (JSC::CTI::emitCTICall):
1536         (JSC::CTI::compileOpCall):
1537         (JSC::CTI::emitSlowScriptCheck):
1538         (JSC::CTI::compileBinaryArithOpSlowCase):
1539         (JSC::CTI::privateCompileMainPass):
1540         (JSC::CTI::privateCompileSlowCases):
1541         (JSC::CTI::privateCompile):
1542         * VM/CTI.h: Updated CTI codegen to use the unified SamplingTool interface
1543         for encoding samples. (This required passing the current vPC to a lot
1544         more functions, since the unified interface samples the current vPC.)
1545         Added hooks for writing the current CodeBlock* on function entry and
1546         after a function call, for the sake of the CodeBlock sampler. Removed
1547         obsolete hook for clearing the current sample inside op_end. Also removed
1548         the custom enum used to differentiate flavors of op_call, since the
1549         OpcodeID enum works just as well. (This was important in an earlier
1550         version of the patch, but now it's just cleanup.)
1551
1552         * VM/CodeBlock.cpp:
1553         (JSC::CodeBlock::lineNumberForVPC):
1554         * VM/CodeBlock.h: Upated for refactored #ifdefs. Changed lineNumberForVPC
1555         to be robust against vPCs not recorded for exception handling, since
1556         the Sampler may ask for an arbitrary vPC.
1557
1558         * VM/Machine.cpp:
1559         (JSC::Machine::execute):
1560         (JSC::Machine::privateExecute):
1561         (JSC::Machine::cti_op_call_NotJSFunction):
1562         (JSC::Machine::cti_op_construct_NotJSConstruct):
1563         * VM/Machine.h:
1564         (JSC::Machine::setSampler):
1565         (JSC::Machine::sampler):
1566         (JSC::Machine::jitCodeBuffer): Upated for refactored #ifdefs. Changed
1567         Machine to use SamplingTool helper objects to record movement in and
1568         out of host code. This makes samples a bit more precise.
1569         
1570         * VM/Opcode.cpp:
1571         (JSC::OpcodeStats::~OpcodeStats):
1572         * VM/Opcode.h: Upated for refactored #ifdefs. Added a little more padding,
1573         to accomodate our more verbose opcode names.
1574
1575         * VM/SamplingTool.cpp:
1576         (JSC::ScopeSampleRecord::sample): Only count a sample toward our total
1577         if we actually record it. This solves cases where a CodeBlock will
1578         claim to have been sampled many times, with reported samples that don't
1579         match.
1580
1581         (JSC::SamplingTool::run): Read the current sample into a Sample helper
1582         object, to ensure that the data doesn't change while we're analyzing it,
1583         and to help decode the data. Only access the CodeBlock sampling hash
1584         table if CodeBlock sampling has been enabled, so non-CodeBlock sampling
1585         runs can operate with even less overhead.
1586
1587         (JSC::SamplingTool::dump): I reorganized this code a lot to print the
1588         most important info at the top, print as a table, annotate and document
1589         the stuff I didn't understand when I started, etc.
1590
1591         * VM/SamplingTool.h: New helper classes, described above.
1592
1593         * kjs/Parser.h:
1594         * kjs/Shell.cpp:
1595         (runWithScripts):
1596         * kjs/nodes.cpp:
1597         (JSC::ScopeNode::ScopeNode): Updated for new sampling APIs.
1598
1599         * wtf/Platform.h: Moved sampling #defines here, since our custom is to
1600         put ENABLE #defines into Platform.h. Made explicit the fact that
1601         CODEBLOCK_SAMPLING depends on OPCODE_SAMPLING.
1602
1603 2008-10-25  Jan Michael Alonzo  <jmalonzo@webkit.org>
1604
1605         JSC Build fix, not reviewed.
1606
1607         * VM/CTI.cpp: add missing include stdio.h for debug builds
1608
1609 2008-10-24  Eric Seidel  <eric@webkit.org>
1610
1611         Reviewed by Darin Adler.
1612         
1613         Get rid of a bonus ASSERT when using a null string as a regexp.
1614         Specifically calling: RegularExpression::match() with String::empty()
1615         will hit this ASSERT.
1616         Chromium hits this, but I don't know of any way to make a layout test.
1617
1618         * pcre/pcre_exec.cpp:
1619         (jsRegExpExecute):
1620
1621 2008-10-24  Alexey Proskuryakov  <ap@webkit.org>
1622
1623         Suggested and rubber-stamped by Geoff Garen.
1624
1625         Fix a crash when opening Font Picker.
1626
1627         The change also hopefully fixes this bug, which I could never reproduce:
1628         https://bugs.webkit.org/show_bug.cgi?id=20241
1629         <rdar://problem/6290576> Safari crashes at JSValueUnprotect() when fontpicker view close
1630
1631         * API/JSContextRef.cpp: (JSContextGetGlobalObject): Use lexical global object instead of
1632         dynamic one.
1633
1634 2008-10-24  Cameron Zwarich  <zwarich@apple.com>
1635
1636         Reviewed by Geoff Garen.
1637
1638         Remove ScopeChainNode::bottom() and inline it into its only caller,
1639         ScopeChainnode::globalObject().
1640
1641         * kjs/JSGlobalObject.h:
1642         (JSC::ScopeChainNode::globalObject):
1643         * kjs/ScopeChain.h:
1644         (JSC::ScopeChain::bottom):
1645
1646 2008-10-24  Cameron Zwarich  <zwarich@apple.com>
1647
1648         Reviewed by Maciej Stachowiak.
1649
1650         Bug 21862: Create JSFunction prototype property lazily
1651         <https://bugs.webkit.org/show_bug.cgi?id=21862>
1652
1653         This is a 1.5% speedup on SunSpider and a 1.4% speedup on the V8
1654         benchmark suite, including a 3.8% speedup on Earley-Boyer.
1655
1656         * kjs/JSFunction.cpp:
1657         (JSC::JSFunction::getOwnPropertySlot):
1658         * kjs/nodes.cpp:
1659         (JSC::FuncDeclNode::makeFunction):
1660         (JSC::FuncExprNode::makeFunction):
1661
1662 2008-10-24  Greg Bolsinga  <bolsinga@apple.com>
1663
1664         Reviewed by Sam Weinig.
1665
1666         https://bugs.webkit.org/show_bug.cgi?id=21475
1667         
1668         Provide support for the Geolocation API
1669         
1670         http://dev.w3.org/geo/api/spec-source.html
1671
1672         * wtf/Platform.h: ENABLE_GEOLOCATION defaults to 0
1673
1674 2008-10-24  Darin Adler  <darin@apple.com>
1675
1676         - finish rolling out https://bugs.webkit.org/show_bug.cgi?id=21732
1677
1678         * API/APICast.h:
1679         * API/JSCallbackConstructor.h:
1680         * API/JSCallbackFunction.cpp:
1681         * API/JSCallbackFunction.h:
1682         * API/JSCallbackObject.h:
1683         * API/JSCallbackObjectFunctions.h:
1684         * API/JSContextRef.cpp:
1685         * API/JSObjectRef.cpp:
1686         * API/JSValueRef.cpp:
1687         * VM/CTI.cpp:
1688         * VM/CTI.h:
1689         * VM/CodeBlock.cpp:
1690         * VM/CodeBlock.h:
1691         * VM/CodeGenerator.cpp:
1692         * VM/CodeGenerator.h:
1693         * VM/ExceptionHelpers.cpp:
1694         * VM/ExceptionHelpers.h:
1695         * VM/JSPropertyNameIterator.cpp:
1696         * VM/JSPropertyNameIterator.h:
1697         * VM/Machine.cpp:
1698         * VM/Machine.h:
1699         * VM/Register.h:
1700         * kjs/ArgList.cpp:
1701         * kjs/ArgList.h:
1702         * kjs/Arguments.cpp:
1703         * kjs/Arguments.h:
1704         * kjs/ArrayConstructor.cpp:
1705         * kjs/ArrayPrototype.cpp:
1706         * kjs/BooleanConstructor.cpp:
1707         * kjs/BooleanConstructor.h:
1708         * kjs/BooleanObject.h:
1709         * kjs/BooleanPrototype.cpp:
1710         * kjs/CallData.cpp:
1711         * kjs/CallData.h:
1712         * kjs/ConstructData.cpp:
1713         * kjs/ConstructData.h:
1714         * kjs/DateConstructor.cpp:
1715         * kjs/DateInstance.h:
1716         * kjs/DatePrototype.cpp:
1717         * kjs/DatePrototype.h:
1718         * kjs/DebuggerCallFrame.cpp:
1719         * kjs/DebuggerCallFrame.h:
1720         * kjs/ErrorConstructor.cpp:
1721         * kjs/ErrorPrototype.cpp:
1722         * kjs/ExecState.cpp:
1723         * kjs/ExecState.h:
1724         * kjs/FunctionConstructor.cpp:
1725         * kjs/FunctionPrototype.cpp:
1726         * kjs/FunctionPrototype.h:
1727         * kjs/GetterSetter.cpp:
1728         * kjs/GetterSetter.h:
1729         * kjs/InternalFunction.h:
1730         * kjs/JSActivation.cpp:
1731         * kjs/JSActivation.h:
1732         * kjs/JSArray.cpp:
1733         * kjs/JSArray.h:
1734         * kjs/JSCell.cpp:
1735         * kjs/JSCell.h:
1736         * kjs/JSFunction.cpp:
1737         * kjs/JSFunction.h:
1738         * kjs/JSGlobalData.h:
1739         * kjs/JSGlobalObject.cpp:
1740         * kjs/JSGlobalObject.h:
1741         * kjs/JSGlobalObjectFunctions.cpp:
1742         * kjs/JSGlobalObjectFunctions.h:
1743         * kjs/JSImmediate.cpp:
1744         * kjs/JSImmediate.h:
1745         * kjs/JSNotAnObject.cpp:
1746         * kjs/JSNotAnObject.h:
1747         * kjs/JSNumberCell.cpp:
1748         * kjs/JSNumberCell.h:
1749         * kjs/JSObject.cpp:
1750         * kjs/JSObject.h:
1751         * kjs/JSStaticScopeObject.cpp:
1752         * kjs/JSStaticScopeObject.h:
1753         * kjs/JSString.cpp:
1754         * kjs/JSString.h:
1755         * kjs/JSValue.h:
1756         * kjs/JSVariableObject.h:
1757         * kjs/JSWrapperObject.h:
1758         * kjs/MathObject.cpp:
1759         * kjs/MathObject.h:
1760         * kjs/NativeErrorConstructor.cpp:
1761         * kjs/NumberConstructor.cpp:
1762         * kjs/NumberConstructor.h:
1763         * kjs/NumberObject.cpp:
1764         * kjs/NumberObject.h:
1765         * kjs/NumberPrototype.cpp:
1766         * kjs/ObjectConstructor.cpp:
1767         * kjs/ObjectPrototype.cpp:
1768         * kjs/ObjectPrototype.h:
1769         * kjs/PropertyMap.h:
1770         * kjs/PropertySlot.cpp:
1771         * kjs/PropertySlot.h:
1772         * kjs/RegExpConstructor.cpp:
1773         * kjs/RegExpConstructor.h:
1774         * kjs/RegExpMatchesArray.h:
1775         * kjs/RegExpObject.cpp:
1776         * kjs/RegExpObject.h:
1777         * kjs/RegExpPrototype.cpp:
1778         * kjs/Shell.cpp:
1779         * kjs/StringConstructor.cpp:
1780         * kjs/StringObject.cpp:
1781         * kjs/StringObject.h:
1782         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1783         * kjs/StringPrototype.cpp:
1784         * kjs/StructureID.cpp:
1785         * kjs/StructureID.h:
1786         * kjs/collector.cpp:
1787         * kjs/collector.h:
1788         * kjs/completion.h:
1789         * kjs/grammar.y:
1790         * kjs/interpreter.cpp:
1791         * kjs/interpreter.h:
1792         * kjs/lookup.cpp:
1793         * kjs/lookup.h:
1794         * kjs/nodes.h:
1795         * kjs/operations.cpp:
1796         * kjs/operations.h:
1797         * kjs/protect.h:
1798         * profiler/ProfileGenerator.cpp:
1799         * profiler/Profiler.cpp:
1800         * profiler/Profiler.h:
1801         Use JSValue* instead of JSValuePtr.
1802
1803 2008-10-24  David Kilzer  <ddkilzer@apple.com>
1804
1805         Rolled out r37840.
1806
1807         * wtf/Platform.h:
1808
1809 2008-10-23  Greg Bolsinga  <bolsinga@apple.com>
1810
1811         Reviewed by Sam Weinig.
1812
1813         https://bugs.webkit.org/show_bug.cgi?id=21475
1814         
1815         Provide support for the Geolocation API
1816         
1817         http://dev.w3.org/geo/api/spec-source.html
1818
1819         * wtf/Platform.h: ENABLE_GEOLOCATION defaults to 0
1820
1821 2008-10-23  David Kilzer  <ddkilzer@apple.com>
1822
1823         Bug 21832: Fix scripts using 'new File::Temp' for Perl 5.10
1824
1825         <https://bugs.webkit.org/show_bug.cgi?id=21832>
1826
1827         Reviewed by Sam Weinig.
1828
1829         * pcre/dftables: Use imported tempfile() from File::Temp instead of
1830         'new File::Temp' to make the script work with Perl 5.10.
1831
1832 2008-10-23  Gavin Barraclough  <barraclough@apple.com>
1833
1834         Reviewed by Oliver Hunt.
1835
1836         Fix hideous pathological case performance when looking up repatch info, bug #21727.
1837
1838         When repatching JIT code to optimize we look up records providing information about
1839         the generated code (also used to track recsources used in linking to be later released). 
1840         The lookup was being performed using a linear scan of all such records.
1841
1842         (1) Split up the different types of reptach information.  This means we can search them
1843             separately, and in some cases should reduce their size.
1844         (2) In the case of property accesses, search with a binary chop over the data.
1845         (3) In the case of calls, pass a pointer to the repatch info into the relink function.
1846
1847         * VM/CTI.cpp:
1848         (JSC::CTI::CTI):
1849         (JSC::CTI::compileOpCall):
1850         (JSC::CTI::privateCompileMainPass):
1851         (JSC::CTI::privateCompileSlowCases):
1852         (JSC::CTI::privateCompile):
1853         (JSC::CTI::unlinkCall):
1854         (JSC::CTI::linkCall):
1855         * VM/CTI.h:
1856         * VM/CodeBlock.cpp:
1857         (JSC::CodeBlock::dump):
1858         (JSC::CodeBlock::~CodeBlock):
1859         (JSC::CodeBlock::unlinkCallers):
1860         (JSC::CodeBlock::derefStructureIDs):
1861         * VM/CodeBlock.h:
1862         (JSC::StructureStubInfo::StructureStubInfo):
1863         (JSC::CallLinkInfo::CallLinkInfo):
1864         (JSC::CallLinkInfo::setUnlinked):
1865         (JSC::CallLinkInfo::isLinked):
1866         (JSC::getStructureStubInfoReturnLocation):
1867         (JSC::binaryChop):
1868         (JSC::CodeBlock::addCaller):
1869         (JSC::CodeBlock::getStubInfo):
1870         * VM/CodeGenerator.cpp:
1871         (JSC::CodeGenerator::emitResolve):
1872         (JSC::CodeGenerator::emitGetById):
1873         (JSC::CodeGenerator::emitPutById):
1874         (JSC::CodeGenerator::emitCall):
1875         (JSC::CodeGenerator::emitConstruct):
1876         * VM/Machine.cpp:
1877         (JSC::Machine::cti_vm_lazyLinkCall):
1878
1879 2008-10-23  Peter Kasting  <pkasting@google.com>
1880
1881         Reviewed by Adam Roben.
1882
1883         https://bugs.webkit.org/show_bug.cgi?id=21833
1884         Place JavaScript Debugger hooks under #if ENABLE(JAVASCRIPT_DEBUGGER).
1885
1886         * wtf/Platform.h:
1887
1888 2008-10-23  David Kilzer  <ddkilzer@apple.com>
1889
1890         Bug 21831: Fix create_hash_table for Perl 5.10
1891
1892         <https://bugs.webkit.org/show_bug.cgi?id=21831>
1893
1894         Reviewed by Sam Weinig.
1895
1896         * kjs/create_hash_table: Escaped square brackets so that Perl 5.10
1897         doesn't try to use @nameEntries.
1898
1899 2008-10-23  Darin Adler  <darin@apple.com>
1900
1901         - roll out https://bugs.webkit.org/show_bug.cgi?id=21732
1902           to remove the JSValuePtr class, to fix two problems
1903
1904             1) slowness under MSVC, since it doesn't handle a
1905                class with a single pointer in it as efficiently
1906                as a pointer
1907
1908             2) uninitialized pointers in Vector
1909
1910         * JavaScriptCore.exp: Updated.
1911
1912         * API/APICast.h:
1913         (toRef):
1914         * VM/CTI.cpp:
1915         (JSC::CTI::asInteger):
1916         * VM/CodeGenerator.cpp:
1917         (JSC::CodeGenerator::addConstant):
1918         * VM/CodeGenerator.h:
1919         (JSC::CodeGenerator::JSValueHashTraits::constructDeletedValue):
1920         (JSC::CodeGenerator::JSValueHashTraits::isDeletedValue):
1921         * VM/Machine.cpp:
1922         (JSC::Machine::cti_op_add):
1923         (JSC::Machine::cti_op_pre_inc):
1924         (JSC::Machine::cti_op_get_by_id):
1925         (JSC::Machine::cti_op_get_by_id_second):
1926         (JSC::Machine::cti_op_get_by_id_generic):
1927         (JSC::Machine::cti_op_get_by_id_fail):
1928         (JSC::Machine::cti_op_instanceof):
1929         (JSC::Machine::cti_op_del_by_id):
1930         (JSC::Machine::cti_op_mul):
1931         (JSC::Machine::cti_op_call_NotJSFunction):
1932         (JSC::Machine::cti_op_resolve):
1933         (JSC::Machine::cti_op_construct_NotJSConstruct):
1934         (JSC::Machine::cti_op_get_by_val):
1935         (JSC::Machine::cti_op_sub):
1936         (JSC::Machine::cti_op_lesseq):
1937         (JSC::Machine::cti_op_negate):
1938         (JSC::Machine::cti_op_resolve_base):
1939         (JSC::Machine::cti_op_resolve_skip):
1940         (JSC::Machine::cti_op_resolve_global):
1941         (JSC::Machine::cti_op_div):
1942         (JSC::Machine::cti_op_pre_dec):
1943         (JSC::Machine::cti_op_not):
1944         (JSC::Machine::cti_op_eq):
1945         (JSC::Machine::cti_op_lshift):
1946         (JSC::Machine::cti_op_bitand):
1947         (JSC::Machine::cti_op_rshift):
1948         (JSC::Machine::cti_op_bitnot):
1949         (JSC::Machine::cti_op_mod):
1950         (JSC::Machine::cti_op_less):
1951         (JSC::Machine::cti_op_neq):
1952         (JSC::Machine::cti_op_urshift):
1953         (JSC::Machine::cti_op_bitxor):
1954         (JSC::Machine::cti_op_bitor):
1955         (JSC::Machine::cti_op_call_eval):
1956         (JSC::Machine::cti_op_throw):
1957         (JSC::Machine::cti_op_next_pname):
1958         (JSC::Machine::cti_op_typeof):
1959         (JSC::Machine::cti_op_is_undefined):
1960         (JSC::Machine::cti_op_is_boolean):
1961         (JSC::Machine::cti_op_is_number):
1962         (JSC::Machine::cti_op_is_string):
1963         (JSC::Machine::cti_op_is_object):
1964         (JSC::Machine::cti_op_is_function):
1965         (JSC::Machine::cti_op_stricteq):
1966         (JSC::Machine::cti_op_nstricteq):
1967         (JSC::Machine::cti_op_to_jsnumber):
1968         (JSC::Machine::cti_op_in):
1969         (JSC::Machine::cti_op_del_by_val):
1970         (JSC::Machine::cti_vm_throw):
1971         Removed calls to payload functions.
1972
1973         * VM/Register.h:
1974         (JSC::Register::Register): Removed overload for JSCell and call
1975         to payload function.
1976
1977         * kjs/JSCell.h: Changed JSCell to derive from JSValue again.
1978         Removed JSValuePtr constructor.
1979         (JSC::asCell): Changed cast from reinterpret_cast to static_cast.
1980
1981         * kjs/JSImmediate.h: Removed JSValuePtr class. Added typedef back.
1982
1983         * kjs/JSValue.h:
1984         (JSC::JSValue::JSValue): Added empty protected inline constructor back.
1985         (JSC::JSValue::~JSValue): Same for destructor.
1986         Removed == and != operator for JSValuePtr.
1987
1988         * kjs/PropertySlot.h:
1989         (JSC::PropertySlot::PropertySlot): Chnaged argument to const JSValue*
1990         and added a const_cast.
1991
1992         * kjs/protect.h: Removed overloads and specialization for JSValuePtr.
1993
1994 2008-10-22  Oliver Hunt  <oliver@apple.com>
1995
1996         Reviewed by Maciej Stachowiak.
1997
1998         Really "fix" CTI mode on windows 2k3.
1999
2000         This adds new methods fastMallocExecutable and fastFreeExecutable
2001         to wrap allocation for cti code.  This still just makes fastMalloc
2002         return executable memory all the time, which will be fixed in a
2003         later patch.
2004
2005         However in windows debug builds all executable allocations will be
2006         allocated on separate executable pages, which should resolve any
2007         remaining 2k3 issues.  Conveniently the 2k3 bot will now also fail
2008         if there are any fastFree vs. fastFreeExecutable errors.
2009
2010         * ChangeLog:
2011         * VM/CodeBlock.cpp:
2012         (JSC::CodeBlock::~CodeBlock):
2013         * kjs/regexp.cpp:
2014         (JSC::RegExp::~RegExp):
2015         * masm/X86Assembler.h:
2016         (JSC::JITCodeBuffer::copy):
2017         * wtf/FastMalloc.cpp:
2018         (WTF::fastMallocExecutable):
2019         (WTF::fastFreeExecutable):
2020         (WTF::TCMallocStats::fastMallocExecutable):
2021         (WTF::TCMallocStats::fastFreeExecutable):
2022         * wtf/FastMalloc.h:
2023
2024 2008-10-22  Darin Adler  <darin@apple.com>
2025
2026         Reviewed by Sam Weinig.
2027
2028         - fix https://bugs.webkit.org/show_bug.cgi?id=21294
2029           Bug 21294: Devirtualize getOwnPropertySlot()
2030
2031         A bit over 3% faster on V8 tests.
2032
2033         * JavascriptCore.exp: Export leak-related functions..
2034
2035         * API/JSCallbackConstructor.h:
2036         (JSC::JSCallbackConstructor::createStructureID): Set HasStandardGetOwnPropertySlot
2037         since this class doesn't override getPropertySlot.
2038         * API/JSCallbackFunction.h:
2039         (JSC::JSCallbackFunction::createStructureID): Ditto.
2040
2041         * VM/ExceptionHelpers.cpp:
2042         (JSC::InterruptedExecutionError::InterruptedExecutionError): Use a structure
2043         that's created just for this class instead of trying to share a single "null
2044         prototype" structure.
2045
2046         * VM/Machine.cpp:
2047         (JSC::Machine::cti_op_create_arguments_no_params): Rename
2048         Arguments::ArgumentsNoParameters to Arguments::NoParameters.
2049         
2050         * kjs/Arguments.h: Rename the enum from Arguments::ArgumentsParameters to
2051         Arguments::NoParametersType and the value from Arguments::ArgumentsNoParameters
2052         to Arguments::NoParameters.
2053         (JSC::Arguments::createStructureID): Added. Returns a structure without
2054         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2055         (JSC::Arguments::Arguments): Added an assertion that there are no parameters.
2056
2057         * kjs/DatePrototype.h:
2058         (JSC::DatePrototype::createStructureID): Added. Returns a structure without
2059         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2060
2061         * kjs/FunctionPrototype.h:
2062         (JSC::FunctionPrototype::createStructureID): Set HasStandardGetOwnPropertySlot
2063         since this class doesn't override getPropertySlot.
2064         * kjs/InternalFunction.h:
2065         (JSC::InternalFunction::createStructureID): Ditto.
2066
2067         * kjs/JSArray.h:
2068         (JSC::JSArray::createStructureID): Added. Returns a structure without
2069         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2070
2071         * kjs/JSCell.h: Added declaration of fastGetOwnPropertySlot; a non-virtual
2072         version that uses the structure bit to decide whether to call the virtual
2073         version.
2074
2075         * kjs/JSFunction.h:
2076         (JSC::JSFunction::createStructureID): Added. Returns a structure without
2077         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2078
2079         * kjs/JSGlobalData.cpp:
2080         (JSC::JSGlobalData::JSGlobalData): Initialize new structures; removed
2081         nullProtoStructureID.
2082         * kjs/JSGlobalData.h: Added new structures. Removed nullProtoStructureID.
2083
2084         * kjs/JSGlobalObject.h:
2085         (JSC::JSGlobalObject::createStructureID): Added. Returns a structure without
2086         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2087
2088         * kjs/JSNotAnObject.h:
2089         (JSC::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub): Use a structure
2090         that's created just for this class instead of trying to share a single "null
2091         prototype" structure.
2092         (JSC::JSNotAnObjectErrorStub::isNotAnObjectErrorStub): Marked this function
2093         virtual for clarity and made it private since no one should call it if they
2094         already have a pointer to this specific type.
2095         (JSC::JSNotAnObject::JSNotAnObject): Use a structure that's created just
2096         for this class instead of trying to share a single "null prototype" structure.
2097         (JSC::JSNotAnObject::createStructureID): Added. Returns a structure without
2098         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2099
2100         * kjs/JSObject.h:
2101         (JSC::JSObject::createStructureID): Added HasStandardGetOwnPropertySlot.
2102         (JSC::JSObject::inlineGetOwnPropertySlot): Added. Used so we can share code
2103         between getOwnPropertySlot and fastGetOwnPropertySlot.
2104         (JSC::JSObject::getOwnPropertySlot): Moved so that functions are above the
2105         functions that call them. Moved the guts of this function into
2106         inlineGetOwnPropertySlot.
2107         (JSC::JSCell::fastGetOwnPropertySlot): Added. Checks the
2108         HasStandardGetOwnPropertySlot bit and if it's set, calls
2109         inlineGetOwnPropertySlot, otherwise calls getOwnPropertySlot.
2110         (JSC::JSObject::getPropertySlot): Changed to call fastGetOwnPropertySlot.
2111         (JSC::JSValue::get): Changed to call fastGetOwnPropertySlot.
2112
2113         * kjs/JSWrapperObject.h: Made constructor protected to emphasize that
2114         this class is only a base class and never instantiated.
2115
2116         * kjs/MathObject.h:
2117         (JSC::MathObject::createStructureID): Added. Returns a structure without
2118         HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
2119         * kjs/NumberConstructor.h:
2120         (JSC::NumberConstructor::createStructureID): Ditto.
2121         * kjs/RegExpConstructor.h:
2122         (JSC::RegExpConstructor::createStructureID): Ditto.
2123         * kjs/RegExpObject.h:
2124         (JSC::RegExpObject::createStructureID): Ditto.
2125         * kjs/StringObject.h:
2126         (JSC::StringObject::createStructureID): Ditto.
2127
2128         * kjs/TypeInfo.h: Added HasStandardGetOwnPropertySlot flag and
2129         hasStandardGetOwnPropertySlot accessor function.
2130
2131 2008-10-22  Cameron Zwarich  <zwarich@apple.com>
2132
2133         Reviewed by Geoff Garen.
2134
2135         Bug 21803: Fuse op_jfalse with op_eq_null and op_neq_null
2136         <https://bugs.webkit.org/show_bug.cgi?id=21803>
2137
2138         Fuse op_jfalse with op_eq_null and op_neq_null to make the new opcodes
2139         op_jeq_null and op_jneq_null.
2140
2141         This is a 2.6% speedup on the V8 Raytrace benchmark, and strangely also
2142         a 4.7% speedup on the V8 Arguments benchmark, even though it uses
2143         neither of the two new opcodes.
2144
2145         * VM/CTI.cpp:
2146         (JSC::CTI::privateCompileMainPass):
2147         * VM/CodeBlock.cpp:
2148         (JSC::CodeBlock::dump):
2149         * VM/CodeGenerator.cpp:
2150         (JSC::CodeGenerator::emitJumpIfTrue):
2151         (JSC::CodeGenerator::emitJumpIfFalse):
2152         * VM/Machine.cpp:
2153         (JSC::Machine::privateExecute):
2154         * VM/Opcode.h:
2155
2156 2008-10-22  Darin Fisher  <darin@chromium.org>
2157
2158         Reviewed by Eric Seidel.
2159
2160         Should not define PLATFORM(WIN,MAC,GTK) when PLATFORM(CHROMIUM) is defined
2161         https://bugs.webkit.org/show_bug.cgi?id=21757
2162
2163         PLATFORM(CHROMIUM) implies HAVE_ACCESSIBILITY
2164
2165         * wtf/Platform.h:
2166
2167 2008-10-22  Cameron Zwarich  <zwarich@apple.com>
2168
2169         Reviewed by Alexey Proskuryakov.
2170
2171         Correct opcode names in documentation.
2172
2173         * VM/Machine.cpp:
2174         (JSC::Machine::privateExecute):
2175
2176 2008-10-21  Oliver Hunt <oliver@apple.com>
2177
2178         RS=Maciej Stachowiak.
2179
2180         Force FastMalloc to make all allocated pages executable in
2181         a vague hope this will allow the Win2k3 bot to be able to
2182         run tests.
2183
2184         Filed Bug 21783: Need more granular control over allocation of executable memory
2185         to cover a more granular version of this patch.
2186
2187         * wtf/TCSystemAlloc.cpp:
2188         (TryVirtualAlloc):
2189
2190 2008-10-21  Alexey Proskuryakov  <ap@webkit.org>
2191
2192         Reviewed by Darin Adler.
2193
2194         https://bugs.webkit.org/show_bug.cgi?id=21769
2195         MessagePort should be GC protected if there are messages to be delivered
2196
2197         * wtf/MessageQueue.h:
2198         (WTF::::isEmpty): Added. Also added a warning for methods that return a snapshot of queue
2199         state, thus likely to cause race conditions.
2200
2201 2008-10-21  Darin Adler  <darin@apple.com>
2202
2203         Reviewed by Maciej Stachowiak.
2204
2205         - convert post-increment to pre-increment in a couple more places for speed
2206
2207         Speeds up V8 benchmarks a little on most computers. (But, strangely, slows
2208         them down a little on my computer.)
2209
2210         * kjs/nodes.cpp:
2211         (JSC::statementListEmitCode): Removed default argument, since we always want
2212         to specify this explicitly.
2213         (JSC::ForNode::emitCode): Tolerate ignoredResult() as the dst -- means the
2214         same thing as 0.
2215         (JSC::ReturnNode::emitCode): Ditto.
2216         (JSC::ThrowNode::emitCode): Ditto.
2217         (JSC::FunctionBodyNode::emitCode): Pass ignoredResult() so that we know we
2218         don't have to compute the result of function statements.
2219
2220 2008-10-21  Peter Kasting  <pkasting@google.com>
2221
2222         Reviewed by Maciej Stachowiak.
2223
2224         Fix an include of a non-public header to use "" instead of <>.
2225
2226         * API/JSProfilerPrivate.cpp:
2227
2228 2008-10-20  Sam Weinig  <sam@webkit.org>
2229
2230         Reviewed by Cameron Zwarich.
2231
2232         Fix for https://bugs.webkit.org/show_bug.cgi?id=21766
2233         REGRESSION: 12 JSC tests fail
2234
2235         The JSGlobalObject was mutating the shared nullProtoStructureID when
2236         used in jsc.  Instead of using nullProtoStructureID, use a new StructureID.
2237
2238         * API/JSCallbackObject.h:
2239         * API/JSCallbackObjectFunctions.h:
2240         (JSC::::JSCallbackObject):
2241         * API/JSContextRef.cpp:
2242         (JSGlobalContextCreateInGroup):
2243         * kjs/JSGlobalObject.h:
2244         (JSC::JSGlobalObject::JSGlobalObject):
2245         * kjs/Shell.cpp:
2246         (GlobalObject::GlobalObject):
2247         (jscmain):
2248
2249 2008-10-20  Cameron Zwarich  <zwarich@apple.com>
2250
2251         Reviewed by Maciej Stachowiak.
2252
2253         Remove an untaken branch in CodeGenerator::emitJumpIfFalse(). This
2254         function is never called with a backwards target LabelID, and there is
2255         even an assertion to this effect at the top of the function body.
2256
2257         * VM/CodeGenerator.cpp:
2258         (JSC::CodeGenerator::emitJumpIfFalse):
2259
2260 2008-10-20  Cameron Zwarich  <zwarich@apple.com>
2261
2262         Rubber-stamped by Sam Weinig.
2263
2264         Add opcode documentation for undocumented opcodes.
2265
2266         * VM/Machine.cpp:
2267         (JSC::Machine::privateExecute):
2268
2269 2008-10-16  Sam Weinig  <sam@webkit.org>
2270
2271         Reviewed by Cameron Zwarich.
2272
2273         Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
2274         Don't create intermediate StructureIDs for builtin objects
2275
2276         Second stage in reduce number of StructureIDs created when initializing the
2277         JSGlobalObject.
2278
2279         - Use putDirectWithoutTransition for the remaining singleton objects to reduce
2280           the number of StructureIDs create for about:blank from 132 to 73.
2281
2282         * kjs/ArrayConstructor.cpp:
2283         (JSC::ArrayConstructor::ArrayConstructor):
2284         * kjs/BooleanConstructor.cpp:
2285         (JSC::BooleanConstructor::BooleanConstructor):
2286         * kjs/BooleanPrototype.cpp:
2287         (JSC::BooleanPrototype::BooleanPrototype):
2288         * kjs/DateConstructor.cpp:
2289         (JSC::DateConstructor::DateConstructor):
2290         * kjs/ErrorConstructor.cpp:
2291         (JSC::ErrorConstructor::ErrorConstructor):
2292         * kjs/ErrorPrototype.cpp:
2293         (JSC::ErrorPrototype::ErrorPrototype):
2294         * kjs/FunctionConstructor.cpp:
2295         (JSC::FunctionConstructor::FunctionConstructor):
2296         * kjs/FunctionPrototype.cpp:
2297         (JSC::FunctionPrototype::FunctionPrototype):
2298         (JSC::FunctionPrototype::addFunctionProperties):
2299         * kjs/FunctionPrototype.h:
2300         (JSC::FunctionPrototype::createStructureID):
2301         * kjs/InternalFunction.cpp:
2302         * kjs/InternalFunction.h:
2303         (JSC::InternalFunction::InternalFunction):
2304         * kjs/JSGlobalObject.cpp:
2305         (JSC::JSGlobalObject::reset):
2306         * kjs/JSObject.h:
2307         * kjs/MathObject.cpp:
2308         (JSC::MathObject::MathObject):
2309         * kjs/NumberConstructor.cpp:
2310         (JSC::NumberConstructor::NumberConstructor):
2311         * kjs/NumberPrototype.cpp:
2312         (JSC::NumberPrototype::NumberPrototype):
2313         * kjs/ObjectConstructor.cpp:
2314         (JSC::ObjectConstructor::ObjectConstructor):
2315         * kjs/RegExpConstructor.cpp:
2316         (JSC::RegExpConstructor::RegExpConstructor):
2317         * kjs/RegExpPrototype.cpp:
2318         (JSC::RegExpPrototype::RegExpPrototype):
2319         * kjs/StringConstructor.cpp:
2320         (JSC::StringConstructor::StringConstructor):
2321         * kjs/StringPrototype.cpp:
2322         (JSC::StringPrototype::StringPrototype):
2323         * kjs/StructureID.cpp:
2324         (JSC::StructureID::dumpStatistics):
2325         * kjs/StructureID.h:
2326         (JSC::StructureID::setPrototypeWithoutTransition):
2327
2328 2008-10-20  Alp Toker  <alp@nuanti.com>
2329
2330         Fix autotools dist build target by listing recently added header
2331         files only. Not reviewed.
2332
2333         * GNUmakefile.am:
2334
2335 2008-10-20  Geoffrey Garen  <ggaren@apple.com>
2336
2337         Reviewed by Anders Carlsson.
2338
2339         * VM/Machine.cpp:
2340         (JSC::Machine::tryCacheGetByID): Removed a redundant and sometimes
2341         incorrect cast, which started ASSERTing after Darin's last checkin.
2342
2343 2008-10-20  Geoffrey Garen  <ggaren@apple.com>
2344
2345         Not reviewed.
2346         
2347         Re-enable CTI, which I accidentally disabled while checking in fixes
2348         to bytecode.
2349
2350         * wtf/Platform.h:
2351
2352 2008-10-20  Alp Toker  <alp@nuanti.com>
2353
2354         Rubber-stamped by Mark Rowe.
2355
2356         Typo fix in function name: mimimum -> minimum.
2357
2358         * kjs/DateMath.cpp:
2359         (JSC::minimumYearForDST):
2360         (JSC::equivalentYearForDST):
2361
2362 2008-10-20  Alp Toker  <alp@nuanti.com>
2363
2364         Reviewed by Mark Rowe.
2365
2366         Use pthread instead of GThread where possible in the GTK+ port. This
2367         fixes issues with global initialisation, particularly on GTK+/Win32
2368         where a late g_thread_init() will cause hangs.
2369
2370         * GNUmakefile.am:
2371         * wtf/Platform.h:
2372         * wtf/Threading.h:
2373         * wtf/ThreadingGtk.cpp:
2374         * wtf/ThreadingPthreads.cpp:
2375
2376 2008-10-20  Geoffrey Garen  <ggaren@apple.com>
2377
2378         Reviewed by Darin Adler.
2379         
2380         Fixed https://bugs.webkit.org/show_bug.cgi?id=21735
2381         Emit profiling instrumentation only if the Web Inspector's profiling
2382         feature is enabled
2383
2384         22.2% speedup on empty function call benchmark.
2385         2.9% speedup on v8 benchmark.
2386         0.7% speedup on SunSpider.
2387         
2388         Lesser but similar speedups in bytecode.
2389
2390         * VM/CTI.cpp:
2391         (JSC::CTI::compileOpCall):
2392         (JSC::CTI::privateCompileMainPass):
2393         (JSC::CTI::privateCompileSlowCases): Nixed JITed profiler hooks. Profiler
2394         hooks now have their own opcodes. Added support for compiling profiler
2395         hook opcodes.
2396         
2397         (JSC::CodeBlock::dump): Dump support for the new profiling opcodes.
2398
2399         * VM/CodeGenerator.h:
2400         * VM/CodeGenerator.cpp:
2401         (JSC::CodeGenerator::CodeGenerator):
2402         (JSC::CodeGenerator::emitCall):
2403         (JSC::CodeGenerator::emitConstruct): Conditionally emit profiling hooks
2404         around call and construct, at the call site. (It's easier to get things
2405         right this way, if you have profiled code calling non-profiled code.
2406         Also, you get a slightly more accurate profile, since you charge the full
2407         cost of the call / construct operation to the callee.)
2408         
2409         Also, fixed a bug where construct would fetch the ".prototype" property
2410         from the constructor before evaluating the arguments to the constructor,
2411         incorrectly allowing an "invalid constructor" exception to short-circuit
2412         argument evaluation. I encountered this bug when trying to make
2413         constructor exceptions work with profiling.
2414
2415         * VM/Machine.cpp:
2416         (JSC::Machine::callEval): Removed obsolete profiler hooks.
2417
2418         (JSC::Machine::throwException): Added a check for an exception thrown
2419         within a call instruction. We didn't need this before because the call
2420         instruction would check for a valid call before involing the profiler.
2421         (JSC::Machine::execute): Added a didExecute hook at the end of top-level
2422         function invocation, since op_ret no longer does this for us.
2423
2424         (JSC::Machine::privateExecute): Removed obsolete profiler hooks. Added
2425         profiler opcodes. Changed some ++vPC to vPC[x] notation, since the
2426         latter is better for performance, and it makes reasoning about the
2427         current opcode in exception handling much simpler.
2428
2429         (JSC::Machine::cti_op_call_NotJSFunction): Removed obsolete profiler
2430         hooks.
2431
2432         (JSC::Machine::cti_op_create_arguments_no_params): Added missing
2433         CTI_STACK_HACK that I noticed when adding CTI_STACK_HACK to the new
2434         profiler opcode functions.
2435
2436         (JSC::Machine::cti_op_profile_will_call):
2437         (JSC::Machine::cti_op_profile_did_call): The new profiler opcode
2438         functions.
2439
2440         (JSC::Machine::cti_op_construct_NotJSConstruct): Removed obsolete profiler
2441         hooks.
2442
2443         * VM/Machine.h:
2444         (JSC::Machine::isCallOpcode): Helper for exception handling.
2445
2446         * VM/Opcode.h: Declare new opcodes.
2447
2448         * kjs/JSGlobalObject.h:
2449         (JSC::JSGlobalObject::supportsProfiling): Added virtual interface that
2450         allows WebCore to specify whether the target global object has the Web
2451         Inspector's profiling feature enabled.
2452
2453         * profiler/Profiler.cpp:
2454         (JSC::Profiler::willExecute):
2455         (JSC::Profiler::didExecute):
2456         (JSC::Profiler::createCallIdentifier):
2457         * profiler/Profiler.h: Added support for invoking the profiler with
2458         an arbitrary JSValue*, and not a known object. We didn't need this
2459         before because the call instruction would check for a valid call before
2460         involing the profiler.
2461
2462 2008-10-20  Darin Adler  <darin@apple.com>
2463
2464         Reviewed by Geoff Garen.
2465
2466         - get CTI working on Windows again
2467
2468         * VM/CTI.cpp:
2469         (JSC::CTI::emitCTICall): Add an overload for functions that
2470         return JSObject*.
2471         * VM/CTI.h: Use JSValue* and JSObject* as return types for
2472         cti_op functions. Apparently, MSVC doesn't handle returning
2473         the JSValuePtr struct in a register. We'll have to look into
2474         this more.
2475
2476         * VM/Machine.cpp:
2477         (JSC::Machine::cti_op_convert_this):
2478         (JSC::Machine::cti_op_add):
2479         (JSC::Machine::cti_op_pre_inc):
2480         (JSC::Machine::cti_op_new_object):
2481         (JSC::Machine::cti_op_get_by_id):
2482         (JSC::Machine::cti_op_get_by_id_second):
2483         (JSC::Machine::cti_op_get_by_id_generic):
2484         (JSC::Machine::cti_op_get_by_id_fail):
2485         (JSC::Machine::cti_op_instanceof):
2486         (JSC::Machine::cti_op_del_by_id):
2487         (JSC::Machine::cti_op_mul):
2488         (JSC::Machine::cti_op_new_func):
2489         (JSC::Machine::cti_op_push_activation):
2490         (JSC::Machine::cti_op_call_NotJSFunction):
2491         (JSC::Machine::cti_op_new_array):
2492         (JSC::Machine::cti_op_resolve):
2493         (JSC::Machine::cti_op_construct_JSConstructFast):
2494         (JSC::Machine::cti_op_construct_NotJSConstruct):
2495         (JSC::Machine::cti_op_get_by_val):
2496         (JSC::Machine::cti_op_sub):
2497         (JSC::Machine::cti_op_lesseq):
2498         (JSC::Machine::cti_op_negate):
2499         (JSC::Machine::cti_op_resolve_base):
2500         (JSC::Machine::cti_op_resolve_skip):
2501         (JSC::Machine::cti_op_resolve_global):
2502         (JSC::Machine::cti_op_div):
2503         (JSC::Machine::cti_op_pre_dec):
2504         (JSC::Machine::cti_op_not):
2505         (JSC::Machine::cti_op_eq):
2506         (JSC::Machine::cti_op_lshift):
2507         (JSC::Machine::cti_op_bitand):
2508         (JSC::Machine::cti_op_rshift):
2509         (JSC::Machine::cti_op_bitnot):
2510         (JSC::Machine::cti_op_new_func_exp):
2511         (JSC::Machine::cti_op_mod):
2512         (JSC::Machine::cti_op_less):
2513         (JSC::Machine::cti_op_neq):
2514         (JSC::Machine::cti_op_urshift):
2515         (JSC::Machine::cti_op_bitxor):
2516         (JSC::Machine::cti_op_new_regexp):
2517         (JSC::Machine::cti_op_bitor):
2518         (JSC::Machine::cti_op_call_eval):
2519         (JSC::Machine::cti_op_throw):
2520         (JSC::Machine::cti_op_next_pname):
2521         (JSC::Machine::cti_op_typeof):
2522         (JSC::Machine::cti_op_is_undefined):
2523         (JSC::Machine::cti_op_is_boolean):
2524         (JSC::Machine::cti_op_is_number):
2525         (JSC::Machine::cti_op_is_string):
2526         (JSC::Machine::cti_op_is_object):
2527         (JSC::Machine::cti_op_is_function):
2528         (JSC::Machine::cti_op_stricteq):
2529         (JSC::Machine::cti_op_nstricteq):
2530         (JSC::Machine::cti_op_to_jsnumber):
2531         (JSC::Machine::cti_op_in):
2532         (JSC::Machine::cti_op_push_new_scope):
2533         (JSC::Machine::cti_op_del_by_val):
2534         (JSC::Machine::cti_op_new_error):
2535         (JSC::Machine::cti_vm_throw):
2536         Change these functions to return pointer types, and never
2537         JSValuePtr.
2538         * VM/Machine.h: Ditto.
2539
2540 2008-10-20  Geoffrey Garen  <ggaren@apple.com>
2541
2542         Reviewed by Darin Adler.
2543         
2544         Fixed some recent break-age in bytecode mode.
2545
2546         * VM/CodeBlock.cpp:
2547         (JSC::CodeBlock::printStructureIDs): Fixed up an ASSERT caused by
2548         Gavin's last checkin. This is a temporary fix so I can keep on moving.
2549         I'll send email about what I think is an underlying problem soon.
2550
2551         * VM/Machine.cpp:
2552         (JSC::Machine::privateExecute): Removed a redundant and sometimes
2553         incorrect cast, which started ASSERTing after Darin's last checkin.
2554
2555 2008-10-20  Darin Adler  <darin@apple.com>
2556
2557         - another similar Windows build fix
2558
2559         * VM/CTI.cpp: Changed return type to JSObject* instead of JSValuePtr.
2560
2561 2008-10-20  Darin Adler  <darin@apple.com>
2562
2563         - try to fix Windows build
2564
2565         * VM/CTI.cpp: Use JSValue* instead of JSValuePtr for ctiTrampoline.
2566         * VM/CTI.h: Ditto.
2567
2568 2008-10-19  Darin Adler  <darin@apple.com>
2569
2570         Reviewed by Cameron Zwarich.
2571
2572         - finish https://bugs.webkit.org/show_bug.cgi?id=21732
2573           improve performance by eliminating JSValue as a base class for JSCell
2574
2575         * VM/Machine.cpp:
2576         (JSC::Machine::cti_op_call_profiler): Use asFunction.
2577         (JSC::Machine::cti_vm_lazyLinkCall): Ditto.
2578         (JSC::Machine::cti_op_construct_JSConstructFast): Use asObject.
2579
2580         * kjs/JSCell.h: Re-sort friend classes. Eliminate inheritance from
2581         JSValue. Changed cast in asCell from static_cast to reinterpret_cast.
2582         Removed JSValue::getNumber(double&) and one of JSValue::getObject
2583         overloads.
2584
2585         * kjs/JSValue.h: Made the private constructor and destructor both
2586         non-virtual and also remove the definitions. This class can never
2587         be instantiated or derived.
2588
2589 2008-10-19  Darin Adler  <darin@apple.com>
2590
2591         Reviewed by Cameron Zwarich.
2592
2593         - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
2594           improve performance by eliminating JSValue as a base class for JSCell
2595
2596         Change JSValuePtr from a typedef into a class. This allows us to support
2597         conversion from JSCell* to JSValuePtr even if JSCell isn't derived from
2598         JSValue.
2599
2600         * JavaScriptCore.exp: Updated symbols that involve JSValuePtr, since
2601         it's now a distinct type.
2602
2603         * API/APICast.h:
2604         (toRef): Extract the JSValuePtr payload explicitly since we can't just
2605         cast any more.
2606         * VM/CTI.cpp:
2607         (JSC::CTI::asInteger): Ditto.
2608
2609         * VM/CodeGenerator.cpp:
2610         (JSC::CodeGenerator::addConstant): Get at the payload directly.
2611         (JSC::CodeGenerator::emitLoad): Added an overload of JSCell* because
2612         otherwise classes derived from JSValue end up calling the bool
2613         overload instead of JSValuePtr.
2614         * VM/CodeGenerator.h: Ditto. Also update traits to use JSValue*
2615         and the payload functions.
2616
2617         * VM/Register.h: Added a JSCell* overload and use of payload functions.
2618
2619         * kjs/JSCell.h:
2620         (JSC::asCell): Use payload function.
2621         (JSC::JSValue::asCell): Use JSValue* instead of JSValuePtr.
2622         (JSC::JSValuePtr::JSValuePtr): Added. Constructor that takes JSCell*
2623         and creates a JSValuePtr.
2624
2625         * kjs/JSImmediate.h: Added JSValuePtr class. Also updated makeValue
2626         and makeInt to work with JSValue* and the payload function.
2627
2628         * kjs/JSValue.h: Added == and != operators for JSValuePtr. Put them
2629         here because eventually all the JSValue functions should go here
2630         except what's needed by JSImmediate. Also fix asValue to use
2631         JSValue* instead of JSValuePtr.
2632
2633         * kjs/PropertySlot.h: Change constructor to take JSValuePtr.
2634
2635         * kjs/protect.h: Update gcProtect functions to work with JSCell*
2636         as well as JSValuePtr. Also updated the ProtectedPtr<JSValuePtr>
2637         specialization to work more directly. Also changed all the call
2638         sites to use gcProtectNullTolerant.
2639
2640 2008-10-19  Darin Adler  <darin@apple.com>
2641
2642         Reviewed by Oliver Hunt.
2643
2644         - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
2645           improve performance by eliminating JSValue as a base class for JSCell
2646
2647         Remove most uses of JSValue, which will be removed in a future patch.
2648
2649         * VM/Machine.cpp:
2650         (JSC::fastToUInt32): Call toUInt32SlowCase function; no longer a member
2651         of JSValue.
2652         * kjs/JSNumberCell.h:
2653         (JSC::JSNumberCell::toInt32): Ditto.
2654         (JSC::JSNumberCell::toUInt32): Ditto.
2655
2656         * kjs/JSValue.cpp:
2657         (JSC::toInt32SlowCase): Made a non-member function.
2658         (JSC::JSValue::toInt32SlowCase): Changed to call non-member function.
2659         (JSC::toUInt32SlowCase): More of the same.
2660         (JSC::JSValue::toUInt32SlowCase): Ditto.
2661
2662         * kjs/JSValue.h: Moved static member function so they are no longer
2663         member functions at all.
2664
2665         * VM/CTI.h: Removed forward declaration of JSValue.
2666         * VM/ExceptionHelpers.h: Ditto.
2667         * kjs/CallData.h: Ditto.
2668         * kjs/ConstructData.h: Ditto.
2669         * kjs/JSGlobalObjectFunctions.h: Ditto.
2670         * kjs/PropertyMap.h: Ditto.
2671         * kjs/StructureID.h: Ditto.
2672         * kjs/collector.h: Ditto.
2673         * kjs/completion.h: Ditto.
2674
2675         * kjs/grammar.y:
2676         (JSC::makeBitwiseNotNode): Call new non-member toInt32 function.
2677         (JSC::makeLeftShiftNode): More of the same.
2678         (JSC::makeRightShiftNode): Ditto.
2679
2680         * kjs/protect.h: Added a specialization for ProtectedPtr<JSValuePtr>
2681         so this can be used with JSValuePtr.
2682
2683 2008-10-18  Darin Adler  <darin@apple.com>
2684
2685         Reviewed by Oliver Hunt.
2686
2687         - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
2688           improve performance by eliminating JSValue as a base class for JSCell
2689
2690         Tweak a little more to get closer to where we can make JSValuePtr a class.
2691
2692         * API/APICast.h:
2693         (toJS): Change back to JSValue* here, since we're converting the
2694         pointer type.
2695         * VM/CTI.cpp:
2696         (JSC::CTI::unlinkCall): Call asPointer.
2697         * VM/CTI.h: Cast to JSValue* here, since it's a pointer cast.
2698         * kjs/DebuggerCallFrame.h:
2699         (JSC::DebuggerCallFrame::DebuggerCallFrame): Call noValue.
2700         * kjs/JSGlobalData.cpp:
2701         (JSC::JSGlobalData::JSGlobalData): Call noValue.
2702         * kjs/JSImmediate.cpp:
2703         (JSC::JSImmediate::toObject): Remove unneeded const_cast.
2704         * kjs/JSWrapperObject.h:
2705         (JSC::JSWrapperObject::JSWrapperObject): Call noValue.
2706
2707 2008-10-18  Darin Adler  <darin@apple.com>
2708
2709         - fix non-all-in-one build
2710
2711         * kjs/completion.h:
2712         (JSC::Completion::Completion): Add include of JSValue.h.
2713
2714 2008-10-18  Darin Adler  <darin@apple.com>
2715
2716         Reviewed by Oliver Hunt.
2717
2718         - fix assertions I introduced with my casting changes
2719
2720         These were showing up as failures in the JavaScriptCore tests.
2721
2722         * VM/Machine.cpp:
2723         (JSC::Machine::cti_op_instanceof): Remove the bogus asCell casting that
2724         was at the top of the function, and instead cast at the point of use.
2725         (JSC::Machine::cti_op_construct_NotJSConstruct): Moved the cast to
2726         object after checking the construct type.
2727
2728 2008-10-18  Darin Adler  <darin@apple.com>
2729
2730         - fix non-all-in-one build
2731
2732         * kjs/JSGlobalObjectFunctions.h: Add include of JSImmedate.h (for now).
2733
2734 2008-10-18  Darin Adler  <darin@apple.com>
2735
2736         - fix build
2737
2738         * kjs/interpreter.h: Include JSValue.h instead of JSImmediate.h.
2739
2740 2008-10-18  Darin Adler  <darin@apple.com>
2741
2742         * kjs/interpreter.h: Fix include of JSImmediate.h.
2743
2744 2008-10-18  Darin Adler  <darin@apple.com>
2745
2746         - fix non-all-in-one build
2747
2748         * kjs/interpreter.h: Add include of JSImmediate.h.
2749
2750 2008-10-18  Darin Adler  <darin@apple.com>
2751
2752         - fix non-all-in-one build
2753
2754         * kjs/ConstructData.h: Add include of JSImmedate.h (for now).
2755
2756 2008-10-18  Darin Adler  <darin@apple.com>
2757
2758         - try to fix Windows build
2759
2760         * VM/Machine.cpp:
2761         (JSC::Machine::Machine): Use JSCell* type since MSVC seems to only allow
2762         calling ~JSCell directly if it's a JSCell*.
2763
2764 2008-10-18  Darin Adler  <darin@apple.com>
2765
2766         Reviewed by Cameron Zwarich.
2767
2768         - next step on https://bugs.webkit.org/show_bug.cgi?id=21732
2769           improve performance by eliminating JSValue as a base class for JSCell
2770
2771         Use JSValuePtr everywhere instead of JSValue*. In the future, we'll be
2772         changing JSValuePtr to be a class, and then eventually renaming it
2773         to JSValue once that's done.
2774
2775         * JavaScriptCore.exp: Update entry points, since some now take JSValue*
2776         instead of const JSValue*.
2777
2778         * API/APICast.h:
2779         * API/JSCallbackConstructor.h:
2780         * API/JSCallbackFunction.cpp:
2781         * API/JSCallbackFunction.h:
2782         * API/JSCallbackObject.h:
2783         * API/JSCallbackObjectFunctions.h:
2784         * API/JSContextRef.cpp:
2785         * API/JSObjectRef.cpp:
2786         * API/JSValueRef.cpp:
2787         * VM/CTI.cpp:
2788         * VM/CTI.h:
2789         * VM/CodeBlock.cpp:
2790         * VM/CodeBlock.h:
2791         * VM/CodeGenerator.cpp:
2792         * VM/CodeGenerator.h:
2793         * VM/ExceptionHelpers.cpp:
2794         * VM/ExceptionHelpers.h:
2795         * VM/JSPropertyNameIterator.cpp:
2796         * VM/JSPropertyNameIterator.h:
2797         * VM/Machine.cpp:
2798         * VM/Machine.h:
2799         * VM/Register.h:
2800         * kjs/ArgList.cpp:
2801         * kjs/ArgList.h:
2802         * kjs/Arguments.cpp:
2803         * kjs/Arguments.h:
2804         * kjs/ArrayConstructor.cpp:
2805         * kjs/ArrayPrototype.cpp:
2806         * kjs/BooleanConstructor.cpp:
2807         * kjs/BooleanConstructor.h:
2808         * kjs/BooleanObject.h:
2809         * kjs/BooleanPrototype.cpp:
2810         * kjs/CallData.cpp:
2811         * kjs/CallData.h:
2812         * kjs/ConstructData.cpp:
2813         * kjs/ConstructData.h:
2814         * kjs/DateConstructor.cpp:
2815         * kjs/DateInstance.h:
2816         * kjs/DatePrototype.cpp:
2817         * kjs/DebuggerCallFrame.cpp:
2818         * kjs/DebuggerCallFrame.h:
2819         * kjs/ErrorConstructor.cpp:
2820         * kjs/ErrorPrototype.cpp:
2821         * kjs/ExecState.cpp:
2822         * kjs/ExecState.h:
2823         * kjs/FunctionConstructor.cpp:
2824         * kjs/FunctionPrototype.cpp:
2825         * kjs/GetterSetter.cpp:
2826         * kjs/GetterSetter.h:
2827         * kjs/InternalFunction.h:
2828         * kjs/JSActivation.cpp:
2829         * kjs/JSActivation.h:
2830         * kjs/JSArray.cpp:
2831         * kjs/JSArray.h:
2832         * kjs/JSCell.cpp:
2833         * kjs/JSCell.h:
2834         * kjs/JSFunction.cpp:
2835         * kjs/JSFunction.h:
2836         * kjs/JSGlobalData.h:
2837         * kjs/JSGlobalObject.cpp:
2838         * kjs/JSGlobalObject.h:
2839         * kjs/JSGlobalObjectFunctions.cpp:
2840         * kjs/JSGlobalObjectFunctions.h:
2841         * kjs/JSImmediate.cpp:
2842         * kjs/JSImmediate.h:
2843         * kjs/JSNotAnObject.cpp:
2844         * kjs/JSNotAnObject.h:
2845         * kjs/JSNumberCell.cpp:
2846         * kjs/JSNumberCell.h:
2847         * kjs/JSObject.cpp:
2848         * kjs/JSObject.h:
2849         * kjs/JSStaticScopeObject.cpp:
2850         * kjs/JSStaticScopeObject.h:
2851         * kjs/JSString.cpp:
2852         * kjs/JSString.h:
2853         * kjs/JSValue.h:
2854         * kjs/JSVariableObject.h:
2855         * kjs/JSWrapperObject.h:
2856         * kjs/MathObject.cpp:
2857         * kjs/NativeErrorConstructor.cpp:
2858         * kjs/NumberConstructor.cpp:
2859         * kjs/NumberConstructor.h:
2860         * kjs/NumberObject.cpp:
2861         * kjs/NumberObject.h:
2862         * kjs/NumberPrototype.cpp:
2863         * kjs/ObjectConstructor.cpp:
2864         * kjs/ObjectPrototype.cpp:
2865         * kjs/ObjectPrototype.h:
2866         * kjs/PropertyMap.h:
2867         * kjs/PropertySlot.cpp:
2868         * kjs/PropertySlot.h:
2869         * kjs/RegExpConstructor.cpp:
2870         * kjs/RegExpConstructor.h:
2871         * kjs/RegExpMatchesArray.h:
2872         * kjs/RegExpObject.cpp:
2873         * kjs/RegExpObject.h:
2874         * kjs/RegExpPrototype.cpp:
2875         * kjs/Shell.cpp:
2876         * kjs/StringConstructor.cpp:
2877         * kjs/StringObject.cpp:
2878         * kjs/StringObject.h:
2879         * kjs/StringObjectThatMasqueradesAsUndefined.h:
2880         * kjs/StringPrototype.cpp:
2881         * kjs/StructureID.cpp:
2882         * kjs/StructureID.h:
2883         * kjs/collector.cpp:
2884         * kjs/collector.h:
2885         * kjs/completion.h:
2886         * kjs/grammar.y:
2887         * kjs/interpreter.cpp:
2888         * kjs/interpreter.h:
2889         * kjs/lookup.cpp:
2890         * kjs/lookup.h:
2891         * kjs/nodes.h:
2892         * kjs/operations.cpp:
2893         * kjs/operations.h:
2894         * kjs/protect.h:
2895         * profiler/ProfileGenerator.cpp:
2896         Replace JSValue* with JSValuePtr.
2897
2898 2008-10-18  Darin Adler  <darin@apple.com>
2899
2900         * VM/Machine.cpp:
2901         (JSC::Machine::cti_op_call_eval): Removed stray parentheses from my
2902         last check-in.
2903
2904 2008-10-18  Darin Adler  <darin@apple.com>
2905
2906         Reviewed by Oliver Hunt.
2907
2908         - first step of https://bugs.webkit.org/show_bug.cgi?id=21732
2909           improve performance by eliminating JSValue as a base class for JSCell
2910
2911         Remove casts from JSValue* to derived classes, replacing them with
2912         calls to inline casting functions. These functions are also a bit
2913         better than aidrect cast because they also do a runtime assertion.
2914
2915         Removed use of 0 as for JSValue*, changing call sites to use a
2916         noValue() function instead.
2917
2918         Move things needed by classes derived from JSValue out of the class,
2919         since the classes won't be deriving from JSValue any more soon.
2920
2921         I did most of these changes by changing JSValue to not be JSValue* any
2922         more, then fixing a lot of the compilation problems, then rolling out
2923         the JSValue change.
2924
2925         1.011x as fast on SunSpider (presumably due to some of the Machine.cpp changes)
2926
2927         * API/APICast.h: Removed unneeded forward declarations.
2928
2929         * API/JSCallbackObject.h: Added an asCallbackObject function for casting.
2930         * API/JSCallbackObjectFunctions.h:
2931         (JSC::JSCallbackObject::asCallbackObject): Added.
2932         (JSC::JSCallbackObject::getOwnPropertySlot): Use asObject.
2933         (JSC::JSCallbackObject::call): Use noValue.
2934         (JSC::JSCallbackObject::staticValueGetter): Use asCallbackObject.
2935         (JSC::JSCallbackObject::staticFunctionGetter): Ditto.
2936         (JSC::JSCallbackObject::callbackGetter): Ditto.
2937
2938         * JavaScriptCore.exp: Updated.
2939
2940         * JavaScriptCore.xcodeproj/project.pbxproj: Added RegExpMatchesArray.h.
2941
2942         * VM/CTI.cpp:
2943         (JSC::CTI::asInteger): Added. For use casting a JSValue to an integer.
2944         (JSC::CTI::emitGetArg): Use asInteger.
2945         (JSC::CTI::emitGetPutArg): Ditto.
2946         (JSC::CTI::getConstantImmediateNumericArg): Ditto. Also use noValue.
2947         (JSC::CTI::emitInitRegister): Use asInteger.
2948         (JSC::CTI::getDeTaggedConstantImmediate): Ditto.
2949         (JSC::CTI::compileOpCallInitializeCallFrame): Ditto.
2950         (JSC::CTI::compileOpCall): Ditto.
2951         (JSC::CTI::compileOpStrictEq): Ditto.
2952         (JSC::CTI::privateCompileMainPass): Ditto.
2953         (JSC::CTI::privateCompileGetByIdProto): Ditto.
2954         (JSC::CTI::privateCompileGetByIdChain): Ditto.
2955         (JSC::CTI::privateCompilePutByIdTransition): Ditto.
2956         * VM/CTI.h: Rewrite the ARG-related macros to use C++ casts instead of
2957         C casts and get rid of some extra parentheses. Addd declaration of
2958         asInteger.
2959
2960         * VM/CodeGenerator.cpp:
2961         (JSC::CodeGenerator::emitEqualityOp): Use asString.
2962         (JSC::CodeGenerator::emitLoad): Use noValue.
2963         (JSC::CodeGenerator::findScopedProperty): Change globalObject argument
2964         to JSObject* instead of JSValue*.
2965         (JSC::CodeGenerator::emitResolve): Remove unneeded cast.
2966         (JSC::CodeGenerator::emitGetScopedVar): Use asCell.
2967         (JSC::CodeGenerator::emitPutScopedVar): Ditto.
2968         * VM/CodeGenerator.h: Changed out argument of findScopedProperty.
2969         Also change the JSValueMap to use PtrHash explicitly instead of
2970         getting it from DefaultHash.
2971
2972         * VM/JSPropertyNameIterator.cpp:
2973         (JSC::JSPropertyNameIterator::toPrimitive): Use noValue.
2974         * VM/JSPropertyNameIterator.h:
2975         (JSC::JSPropertyNameIterator::next): Ditto.
2976
2977         * VM/Machine.cpp:
2978         (JSC::fastIsNumber): Moved isImmediate check here instead of
2979         checking for 0 inside Heap::isNumber. Use asCell and asNumberCell.
2980         (JSC::fastToInt32): Ditto.
2981         (JSC::fastToUInt32): Ditto.
2982         (JSC::jsLess): Use asString.
2983         (JSC::jsLessEq): Ditto.
2984         (JSC::jsAdd): Ditto.
2985         (JSC::jsTypeStringForValue): Use asObject.
2986         (JSC::jsIsObjectType): Ditto.
2987         (JSC::jsIsFunctionType): Ditto.
2988         (JSC::inlineResolveBase): Use noValue.
2989         (JSC::Machine::callEval): Use asString. Initialize result to
2990         undefined, not 0.
2991         (JSC::Machine::Machine): Remove unneeded casts to JSCell*.
2992         (JSC::Machine::throwException): Use asObject.
2993         (JSC::Machine::debug): Remove explicit calls to the DebuggerCallFrame
2994         constructor.
2995         (JSC::Machine::checkTimeout): Use noValue.
2996         (JSC::cachePrototypeChain): Use asObject.
2997         (JSC::Machine::tryCachePutByID): Use asCell.
2998         (JSC::Machine::tryCacheGetByID): Use aCell and asObject.
2999         (JSC::Machine::privateExecute): Use noValue, asCell, asObject, asString,
3000         asArray, asActivation, asFunction. Changed code that creates call frames
3001         for host functions to pass 0 for the function pointer -- the call frame
3002         needs a JSFunction* and a host function object is not one. This was
3003         caught by the assertions in the casting functions. Also remove some
3004         unneeded casts in cases where two values are compared.
3005         (JSC::Machine::retrieveLastCaller): Use noValue.
3006         (JSC::Machine::tryCTICachePutByID): Use asCell.
3007         (JSC::Machine::tryCTICacheGetByID): Use aCell and asObject.
3008         (JSC::setUpThrowTrampolineReturnAddress): Added this function to restore
3009         the PIC-branch-avoidance that was recently lost.
3010         (JSC::Machine::cti_op_add): Use asString.
3011         (JSC::Machine::cti_op_instanceof): Use asCell and asObject.
3012         (JSC::Machine::cti_op_call_JSFunction): Use asFunction.
3013         (JSC::Machine::cti_op_call_NotJSFunction): Changed code to pass 0 for
3014         the function pointer, since we don't have a JSFunction. Use asObject.
3015         (JSC::Machine::cti_op_tear_off_activation): Use asActivation.
3016         (JSC::Machine::cti_op_construct_JSConstruct): Use asFunction and asObject.
3017         (JSC::Machine::cti_op_construct_NotJSConstruct): use asObject.
3018         (JSC::Machine::cti_op_get_by_val): Use asArray and asString.
3019         (JSC::Machine::cti_op_resolve_func): Use asPointer; this helps prepare
3020         us for a situation where JSValue is not a pointer.
3021         (JSC::Machine::cti_op_put_by_val): Use asArray.
3022         (JSC::Machine::cti_op_put_by_val_array): Ditto.
3023         (JSC::Machine::cti_op_resolve_global): Use asGlobalObject.
3024         (JSC::Machine::cti_op_post_inc): Change VM_CHECK_EXCEPTION_2 to
3025         VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after
3026         that point. Also use asPointer.
3027         (JSC::Machine::cti_op_resolve_with_base): Use asPointer.
3028         (JSC::Machine::cti_op_post_dec): Change VM_CHECK_EXCEPTION_2 to
3029         VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after
3030         that point. Also use asPointer.
3031         (JSC::Machine::cti_op_call_eval): Use asObject, noValue, and change
3032         VM_CHECK_EXCEPTION_ARG to VM_THROW_EXCEPTION_AT_END.
3033         (JSC::Machine::cti_op_throw): Change return value to a JSValue*.
3034         (JSC::Machine::cti_op_in): Use asObject.
3035         (JSC::Machine::cti_op_switch_char): Use asString.
3036         (JSC::Machine::cti_op_switch_string): Ditto.
3037         (JSC::Machine::cti_op_put_getter): Use asObject.
3038         (JSC::Machine::cti_op_put_setter): Ditto.
3039         (JSC::Machine::cti_vm_throw): Change return value to a JSValue*.
3040         Use noValue.
3041         * VM/Machine.h: Change return values of both cti_op_throw and
3042         cti_vm_throw to JSValue*.
3043
3044         * VM/Register.h: Remove nullJSValue, which is the same thing
3045         as noValue(). Also removed unneeded definition of JSValue.
3046
3047         * kjs/ArgList.h: Removed unneeded definition of JSValue.
3048
3049         * kjs/Arguments.h:
3050         (JSC::asArguments): Added.
3051
3052         * kjs/ArrayPrototype.cpp:
3053         (JSC::getProperty): Use noValue.
3054         (JSC::arrayProtoFuncToString): Use asArray.
3055         (JSC::arrayProtoFuncToLocaleString): Ditto.
3056         (JSC::arrayProtoFuncConcat): Ditto.
3057         (JSC::arrayProtoFuncPop): Ditto. Also removed unneeded initialization
3058         of the result, which is set in both sides of the branch.
3059         (JSC::arrayProtoFuncPush): Ditto.
3060         (JSC::arrayProtoFuncShift): Removed unneeded initialization
3061         of the result, which is set in both sides of the branch.
3062         (JSC::arrayProtoFuncSort): Use asArray.
3063
3064         * kjs/BooleanObject.h:
3065         (JSC::asBooleanObject): Added.
3066
3067         * kjs/BooleanPrototype.cpp:
3068         (JSC::booleanProtoFuncToString): Use asBooleanObject.
3069         (JSC::booleanProtoFuncValueOf): Ditto.
3070
3071         * kjs/CallData.cpp:
3072         (JSC::call): Use asObject and asFunction.
3073         * kjs/ConstructData.cpp:
3074         (JSC::construct): Ditto.
3075
3076         * kjs/DateConstructor.cpp:
3077         (JSC::constructDate): Use asDateInstance.
3078
3079         * kjs/DateInstance.h:
3080         (JSC::asDateInstance): Added.
3081
3082         * kjs/DatePrototype.cpp:
3083         (JSC::dateProtoFuncToString): Use asDateInstance.
3084         (JSC::dateProtoFuncToUTCString): Ditto.
3085         (JSC::dateProtoFuncToDateString): Ditto.
3086         (JSC::dateProtoFuncToTimeString): Ditto.
3087         (JSC::dateProtoFuncToLocaleString): Ditto.
3088         (JSC::dateProtoFuncToLocaleDateString): Ditto.
3089         (JSC::dateProtoFuncToLocaleTimeString): Ditto.
3090         (JSC::dateProtoFuncValueOf): Ditto.
3091         (JSC::dateProtoFuncGetTime): Ditto.
3092         (JSC::dateProtoFuncGetFullYear): Ditto.
3093         (JSC::dateProtoFuncGetUTCFullYear): Ditto.
3094         (JSC::dateProtoFuncToGMTString): Ditto.
3095         (JSC::dateProtoFuncGetMonth): Ditto.
3096         (JSC::dateProtoFuncGetUTCMonth): Ditto.
3097         (JSC::dateProtoFuncGetDate): Ditto.
3098         (JSC::dateProtoFuncGetUTCDate): Ditto.
3099         (JSC::dateProtoFuncGetDay): Ditto.
3100         (JSC::dateProtoFuncGetUTCDay): Ditto.
3101         (JSC::dateProtoFuncGetHours): Ditto.
3102         (JSC::dateProtoFuncGetUTCHours): Ditto.
3103         (JSC::dateProtoFuncGetMinutes): Ditto.
3104         (JSC::dateProtoFuncGetUTCMinutes): Ditto.
3105         (JSC::dateProtoFuncGetSeconds): Ditto.
3106         (JSC::dateProtoFuncGetUTCSeconds): Ditto.
3107         (JSC::dateProtoFuncGetMilliSeconds): Ditto.
3108         (JSC::dateProtoFuncGetUTCMilliseconds): Ditto.
3109         (JSC::dateProtoFuncGetTimezoneOffset): Ditto.
3110         (JSC::dateProtoFuncSetTime): Ditto.
3111         (JSC::setNewValueFromTimeArgs): Ditto.
3112         (JSC::setNewValueFromDateArgs): Ditto.
3113         (JSC::dateProtoFuncSetYear): Ditto.
3114         (JSC::dateProtoFuncGetYear): Ditto.
3115
3116         * kjs/DebuggerCallFrame.cpp:
3117         (JSC::DebuggerCallFrame::thisObject): Use asObject.
3118         (JSC::DebuggerCallFrame::evaluate): Use noValue.
3119         * kjs/DebuggerCallFrame.h: Added a constructor that
3120         takes only a callFrame.
3121
3122         * kjs/ExecState.h:
3123         (JSC::ExecState::clearException): Use noValue.
3124
3125         * kjs/FunctionPrototype.cpp:
3126         (JSC::functionProtoFuncToString): Use asFunction.
3127         (JSC::functionProtoFuncApply): Use asArguments and asArray.
3128
3129         * kjs/GetterSetter.cpp:
3130         (JSC::GetterSetter::getPrimitiveNumber): Use noValue.
3131
3132         * kjs/GetterSetter.h:
3133         (JSC::asGetterSetter): Added.
3134
3135         * kjs/InternalFunction.cpp:
3136         (JSC::InternalFunction::name): Use asString.
3137
3138         * kjs/InternalFunction.h:
3139         (JSC::asInternalFunction): Added.
3140
3141         * kjs/JSActivation.cpp:
3142         (JSC::JSActivation::argumentsGetter): Use asActivation.
3143
3144         * kjs/JSActivation.h:
3145         (JSC::asActivation): Added.
3146
3147         * kjs/JSArray.cpp:
3148         (JSC::JSArray::putSlowCase): Use noValue.
3149         (JSC::JSArray::deleteProperty): Ditto.
3150         (JSC::JSArray::increaseVectorLength): Ditto.
3151         (JSC::JSArray::setLength): Ditto.
3152         (JSC::JSArray::pop): Ditto.
3153         (JSC::JSArray::sort): Ditto.
3154         (JSC::JSArray::compactForSorting): Ditto.
3155         * kjs/JSArray.h:
3156         (JSC::asArray): Added.
3157
3158         * kjs/JSCell.cpp:
3159         (JSC::JSCell::getJSNumber): Use noValue.
3160
3161         * kjs/JSCell.h:
3162         (JSC::asCell): Added.
3163         (JSC::JSValue::asCell): Changed to not preserve const.
3164         Given the wide use of JSValue* and JSCell*, it's not
3165         really useful to use const.
3166         (JSC::JSValue::isNumber): Use asValue.
3167         (JSC::JSValue::isString): Ditto.
3168         (JSC::JSValue::isGetterSetter): Ditto.
3169         (JSC::JSValue::isObject): Ditto.
3170         (JSC::JSValue::getNumber): Ditto.
3171         (JSC::JSValue::getString): Ditto.
3172         (JSC::JSValue::getObject): Ditto.
3173         (JSC::JSValue::getCallData): Ditto.
3174         (JSC::JSValue::getConstructData): Ditto.
3175         (JSC::JSValue::getUInt32): Ditto.
3176         (JSC::JSValue::getTruncatedInt32): Ditto.
3177         (JSC::JSValue::getTruncatedUInt32): Ditto.
3178         (JSC::JSValue::mark): Ditto.
3179         (JSC::JSValue::marked): Ditto.
3180         (JSC::JSValue::toPrimitive): Ditto.
3181         (JSC::JSValue::getPrimitiveNumber): Ditto.
3182         (JSC::JSValue::toBoolean): Ditto.
3183         (JSC::JSValue::toNumber): Ditto.
3184         (JSC::JSValue::toString): Ditto.
3185         (JSC::JSValue::toObject): Ditto.
3186         (JSC::JSValue::toThisObject): Ditto.
3187         (JSC::JSValue::needsThisConversion): Ditto.
3188         (JSC::JSValue::toThisString): Ditto.
3189         (JSC::JSValue::getJSNumber): Ditto.
3190
3191         * kjs/JSFunction.cpp:
3192         (JSC::JSFunction::argumentsGetter): Use asFunction.
3193         (JSC::JSFunction::callerGetter): Ditto.
3194         (JSC::JSFunction::lengthGetter): Ditto.
3195         (JSC::JSFunction::construct): Use asObject.
3196
3197         * kjs/JSFunction.h:
3198         (JSC::asFunction): Added.
3199
3200         * kjs/JSGlobalObject.cpp:
3201         (JSC::lastInPrototypeChain): Use asObject.
3202
3203         * kjs/JSGlobalObject.h:
3204         (JSC::asGlobalObject): Added.
3205         (JSC::ScopeChainNode::globalObject): Use asGlobalObject.
3206
3207         * kjs/JSImmediate.h: Added noValue, asPointer, and makeValue
3208         functions. Use rawValue, makeValue, and noValue consistently
3209         instead of doing reinterpret_cast in various functions.
3210
3211         * kjs/JSNumberCell.h:
3212         (JSC::asNumberCell): Added.
3213         (JSC::JSValue::uncheckedGetNumber): Use asValue and asNumberCell.
3214         (JSC::JSValue::toJSNumber): Use asValue.
3215
3216         * kjs/JSObject.cpp:
3217         (JSC::JSObject::put): Use asObject and asGetterSetter.
3218         (JSC::callDefaultValueFunction): Use noValue.
3219         (JSC::JSObject::defineGetter): Use asGetterSetter.
3220         (JSC::JSObject::defineSetter): Ditto.
3221         (JSC::JSObject::lookupGetter): Ditto. Also use asObject.
3222         (JSC::JSObject::lookupSetter): Ditto.
3223         (JSC::JSObject::hasInstance): Use asObject.
3224         (JSC::JSObject::fillGetterPropertySlot): Use asGetterSetter.
3225
3226         * kjs/JSObject.h:
3227         (JSC::JSObject::getDirect): Use noValue.
3228         (JSC::asObject): Added.
3229         (JSC::JSValue::isObject): Use asValue.
3230         (JSC::JSObject::get): Removed unneeded const_cast.
3231         (JSC::JSObject::getPropertySlot): Use asObject.
3232         (JSC::JSValue::get): Removed unneeded const_cast.
3233         Use asValue, asCell, and asObject.
3234         (JSC::JSValue::put): Ditto.
3235         (JSC::JSObject::allocatePropertyStorageInline): Fixed spelling
3236         of "oldPropertStorage".
3237
3238         * kjs/JSString.cpp:
3239         (JSC::JSString::getOwnPropertySlot): Use asObject.
3240
3241         * kjs/JSString.h:
3242         (JSC::asString): Added.
3243         (JSC::JSValue::toThisJSString): Use asValue.
3244
3245         * kjs/JSValue.h: Make PreferredPrimitiveType a top level enum
3246         instead of a member of JSValue. Added an asValue function that
3247         returns this. Removed overload of asCell for const. Use asValue
3248         instead of getting right at this.
3249
3250         * kjs/ObjectPrototype.cpp:
3251         (JSC::objectProtoFuncIsPrototypeOf): Use asObject.
3252         (JSC::objectProtoFuncDefineGetter): Ditto.
3253         (JSC::objectProtoFuncDefineSetter): Ditto.
3254
3255         * kjs/PropertySlot.h:
3256         (JSC::PropertySlot::PropertySlot): Take a const JSValue* so the
3257         callers don't have to worry about const.
3258         (JSC::PropertySlot::clearBase): Use noValue.
3259         (JSC::PropertySlot::clearValue): Ditto.
3260
3261         * kjs/RegExpConstructor.cpp:
3262         (JSC::regExpConstructorDollar1): Use asRegExpConstructor.
3263         (JSC::regExpConstructorDollar2): Ditto.
3264         (JSC::regExpConstructorDollar3): Ditto.
3265         (JSC::regExpConstructorDollar4): Ditto.
3266         (JSC::regExpConstructorDollar5): Ditto.
3267         (JSC::regExpConstructorDollar6): Ditto.
3268         (JSC::regExpConstructorDollar7): Ditto.
3269         (JSC::regExpConstructorDollar8): Ditto.
3270         (JSC::regExpConstructorDollar9): Ditto.
3271         (JSC::regExpConstructorInput): Ditto.
3272         (JSC::regExpConstructorMultiline): Ditto.
3273         (JSC::regExpConstructorLastMatch): Ditto.
3274         (JSC::regExpConstructorLastParen): Ditto.
3275         (JSC::regExpConstructorLeftContext): Ditto.
3276         (JSC::regExpConstructorRightContext): Ditto.
3277         (JSC::setRegExpConstructorInput): Ditto.
3278         (JSC::setRegExpConstructorMultiline): Ditto.
3279         (JSC::constructRegExp): Use asObject.
3280
3281         * kjs/RegExpConstructor.h:
3282         (JSC::asRegExpConstructor): Added.
3283
3284         * kjs/RegExpObject.cpp:
3285         (JSC::regExpObjectGlobal): Use asRegExpObject.
3286         (JSC::regExpObjectIgnoreCase): Ditto.
3287         (JSC::regExpObjectMultiline): Ditto.
3288         (JSC::regExpObjectSource): Ditto.
3289         (JSC::regExpObjectLastIndex): Ditto.
3290         (JSC::setRegExpObjectLastIndex): Ditto.
3291         (JSC::callRegExpObject): Ditto.
3292
3293         * kjs/RegExpObject.h:
3294         (JSC::asRegExpObject): Added.
3295
3296         * kjs/RegExpPrototype.cpp:
3297         (JSC::regExpProtoFuncTest): Use asRegExpObject.
3298         (JSC::regExpProtoFuncExec): Ditto.
3299         (JSC::regExpProtoFuncCompile): Ditto.
3300         (JSC::regExpProtoFuncToString): Ditto.
3301
3302         * kjs/StringObject.h:
3303         (JSC::StringObject::internalValue): Use asString.
3304         (JSC::asStringObject): Added.
3305
3306         * kjs/StringPrototype.cpp:
3307         (JSC::stringProtoFuncReplace): Use asRegExpObject.
3308         (JSC::stringProtoFuncToString): Ue asStringObject.
3309         (JSC::stringProtoFuncMatch): Use asRegExpObject.
3310         (JSC::stringProtoFuncSearch): Ditto.
3311         (JSC::stringProtoFuncSplit): Ditto.
3312
3313         * kjs/StructureID.cpp:
3314         (JSC::StructureID::getEnumerablePropertyNames): Use asObject.
3315         (JSC::StructureID::createCachedPrototypeChain): Ditto.
3316         (JSC::StructureIDChain::StructureIDChain): Use asCell and asObject.
3317
3318         * kjs/collector.h:
3319         (JSC::Heap::isNumber): Removed null handling. This can only be called
3320         on valid cells.
3321         (JSC::Heap::cellBlock): Removed overload for const and non-const.
3322         Whether the JSCell* is const or not really should have no effect on
3323         whether you can modify the collector block it's in.
3324
3325         * kjs/interpreter.cpp:
3326         (JSC::Interpreter::evaluate): Use noValue and noObject.
3327
3328         * kjs/nodes.cpp:
3329         (JSC::FunctionCallResolveNode::emitCode): Use JSObject for the global
3330         object rather than JSValue.
3331         (JSC::PostfixResolveNode::emitCode): Ditto.
3332         (JSC::PrefixResolveNode::emitCode): Ditto.
3333         (JSC::ReadModifyResolveNode::emitCode): Ditto.
3334         (JSC::AssignResolveNode::emitCode): Ditto.
3335
3336         * kjs/operations.h:
3337         (JSC::equalSlowCaseInline): Use asString, asCell, asNumberCell, 
3338         (JSC::strictEqualSlowCaseInline): Ditto.
3339
3340 2008-10-18  Cameron Zwarich  <zwarich@apple.com>
3341
3342         Reviewed by Oliver Hunt.
3343
3344         Bug 21702: Special op_create_activation for the case where there are no named parameters
3345         <https://bugs.webkit.org/show_bug.cgi?id=21702>
3346
3347         This is a 2.5% speedup on the V8 Raytrace benchmark and a 1.1% speedup
3348         on the V8 Earley-Boyer benchmark.
3349
3350         * VM/CTI.cpp:
3351         (JSC::CTI::privateCompileMainPass):
3352         * VM/Machine.cpp:
3353         (JSC::Machine::cti_op_create_arguments_no_params):
3354         * VM/Machine.h:
3355         * kjs/Arguments.h:
3356         (JSC::Arguments::):
3357         (JSC::Arguments::Arguments):
3358
3359 2008-10-17  Maciej Stachowiak  <mjs@apple.com>
3360
3361         Reviewed by Cameron Zwarich.
3362         
3363         - in debug builds, alter the stack to avoid blowing out MallocStackLogging
3364         
3365         (In essence, while executing a CTI function we alter the return
3366         address to jscGeneratedNativeCode so that a single consistent
3367         function is on the stack instead of many random functions without
3368         symbols.)
3369
3370         * VM/CTI.h:
3371         * VM/Machine.cpp:
3372         (JSC::doSetReturnAddress):
3373         (JSC::):
3374         (JSC::StackHack::StackHack):
3375         (JSC::StackHack::~StackHack):
3376         (JSC::Machine::cti_op_convert_this):
3377         (JSC::Machine::cti_op_end):
3378         (JSC::Machine::cti_op_add):
3379         (JSC::Machine::cti_op_pre_inc):
3380         (JSC::Machine::cti_timeout_check):
3381         (JSC::Machine::cti_register_file_check):
3382         (JSC::Machine::cti_op_loop_if_less):
3383         (JSC::Machine::cti_op_loop_if_lesseq):
3384         (JSC::Machine::cti_op_new_object):
3385         (JSC::Machine::cti_op_put_by_id):
3386         (JSC::Machine::cti_op_put_by_id_second):
3387         (JSC::Machine::cti_op_put_by_id_generic):
3388         (JSC::Machine::cti_op_put_by_id_fail):
3389         (JSC::Machine::cti_op_get_by_id):
3390         (JSC::Machine::cti_op_get_by_id_second):
3391         (JSC::Machine::cti_op_get_by_id_generic):
3392         (JSC::Machine::cti_op_get_by_id_fail):
3393         (JSC::Machine::cti_op_instanceof):
3394         (JSC::Machine::cti_op_del_by_id):
3395         (JSC::Machine::cti_op_mul):
3396         (JSC::Machine::cti_op_new_func):
3397         (JSC::Machine::cti_op_call_profiler):
3398         (JSC::Machine::cti_op_call_JSFunction):
3399         (JSC::Machine::cti_vm_lazyLinkCall):
3400         (JSC::Machine::cti_vm_compile):
3401         (JSC::Machine::cti_op_push_activation):
3402         (JSC::Machine::cti_op_call_NotJSFunction):
3403         (JSC::Machine::cti_op_create_arguments):
3404         (JSC::Machine::cti_op_tear_off_activation):
3405         (JSC::Machine::cti_op_tear_off_arguments):
3406         (JSC::Machine::cti_op_ret_profiler):
3407         (JSC::Machine::cti_op_ret_scopeChain):
3408         (JSC::Machine::cti_op_new_array):
3409         (JSC::Machine::cti_op_resolve):
3410         (JSC::Machine::cti_op_construct_JSConstructFast):
3411         (JSC::Machine::cti_op_construct_JSConstruct):
3412         (JSC::Machine::cti_op_construct_NotJSConstruct):
3413         (JSC::Machine::cti_op_get_by_val):
3414         (JSC::Machine::cti_op_resolve_func):
3415         (JSC::Machine::cti_op_sub):
3416         (JSC::Machine::cti_op_put_by_val):
3417         (JSC::Machine::cti_op_put_by_val_array):
3418         (JSC::Machine::cti_op_lesseq):
3419         (JSC::Machine::cti_op_loop_if_true):
3420         (JSC::Machine::cti_op_negate):
3421         (JSC::Machine::cti_op_resolve_base):
3422         (JSC::Machine::cti_op_resolve_skip):
3423         (JSC::Machine::cti_op_resolve_global):
3424         (JSC::Machine::cti_op_div):
3425         (JSC::Machine::cti_op_pre_dec):
3426         (JSC::Machine::cti_op_jless):
3427         (JSC::Machine::cti_op_not):
3428         (JSC::Machine::cti_op_jtrue):
3429         (JSC::Machine::cti_op_post_inc):
3430         (JSC::Machine::cti_op_eq):
3431         (JSC::Machine::cti_op_lshift):
3432         (JSC::Machine::cti_op_bitand):
3433         (JSC::Machine::cti_op_rshift):
3434         (JSC::Machine::cti_op_bitnot):
3435         (JSC::Machine::cti_op_resolve_with_base):
3436         (JSC::Machine::cti_op_new_func_exp):
3437         (JSC::Machine::cti_op_mod):
3438         (JSC::Machine::cti_op_less):
3439         (JSC::Machine::cti_op_neq):
3440         (JSC::Machine::cti_op_post_dec):
3441         (JSC::Machine::cti_op_urshift):
3442         (JSC::Machine::cti_op_bitxor):
3443         (JSC::Machine::cti_op_new_regexp):
3444         (JSC::Machine::cti_op_bitor):
3445         (JSC::Machine::cti_op_call_eval):
3446         (JSC::Machine::cti_op_throw):
3447         (JSC::Machine::cti_op_get_pnames):
3448         (JSC::Machine::cti_op_next_pname):
3449         (JSC::Machine::cti_op_push_scope):
3450         (JSC::Machine::cti_op_pop_scope):
3451         (JSC::Machine::cti_op_typeof):
3452         (JSC::Machine::cti_op_is_undefined):
3453         (JSC::Machine::cti_op_is_boolean):
3454         (JSC::Machine::cti_op_is_number):
3455         (JSC::Machine::cti_op_is_string):
3456         (JSC::Machine::cti_op_is_object):
3457         (JSC::Machine::cti_op_is_function):
3458         (JSC::Machine::cti_op_stricteq):
3459         (JSC::Machine::cti_op_nstricteq):
3460         (JSC::Machine::cti_op_to_jsnumber):
3461         (JSC::Machine::cti_op_in):
3462         (JSC::Machine::cti_op_push_new_scope):
3463         (JSC::Machine::cti_op_jmp_scopes):
3464         (JSC::Machine::cti_op_put_by_index):
3465         (JSC::Machine::cti_op_switch_imm):
3466         (JSC::Machine::cti_op_switch_char):
3467         (JSC::Machine::cti_op_switch_string):
3468         (JSC::Machine::cti_op_del_by_val):
3469         (JSC::Machine::cti_op_put_getter):
3470         (JSC::Machine::cti_op_put_setter):
3471         (JSC::Machine::cti_op_new_error):
3472         (JSC::Machine::cti_op_debug):
3473         (JSC::Machine::cti_vm_throw):
3474
3475 2008-10-17  Gavin Barraclough  <barraclough@apple.com>
3476
3477         Optimize op_call by allowing call sites to be directly linked to callees.
3478
3479         For the hot path of op_call, CTI now generates a check (initially for an impossible
3480         value), and the first time the call is executed we attempt to link the call directly
3481         to the callee.  We can currently only do so if the arity of the caller and callee
3482         match.  The (optimized) setup for the call on the hot path is linked directly to
3483         the ctiCode for the callee, without indirection.
3484         
3485         Two forms of the slow case of the call are generated, the first will be executed the
3486         first time the call is reached.  As well as this path attempting to link the call to
3487         a callee, it also relinks the slow case to a second slow case, which will not continue
3488         to attempt relinking the call.  (This policy could be changed in future, but for not
3489         this is intended to prevent thrashing).
3490
3491         If a callee that the caller has been linked to is garbage collected, then the link
3492         in the caller's JIt code will be reset back to a value that cannot match - to prevent
3493         any false positive matches.
3494
3495         ~20% progression on deltablue & richards, >12% overall reduction in v8-tests
3496         runtime, one or two percent progression on sunspider.
3497
3498         Reviewed by Oliver Hunt.
3499
3500         * VM/CTI.cpp:
3501         (JSC::):
3502         (JSC::CTI::emitNakedCall):
3503         (JSC::unreachable):
3504         (JSC::CTI::compileOpCallInitializeCallFrame):
3505         (JSC::CTI::compileOpCallSetupArgs):
3506         (JSC::CTI::compileOpCall):
3507         (JSC::CTI::privateCompileMainPass):
3508         (JSC::CTI::privateCompileSlowCases):
3509         (JSC::CTI::privateCompile):
3510         (JSC::CTI::unlinkCall):
3511         (JSC::CTI::linkCall):
3512         * VM/CTI.h:
3513         * VM/CodeBlock.cpp:
3514         (JSC::CodeBlock::~CodeBlock):
3515         (JSC::CodeBlock::unlinkCallers):
3516         (JSC::CodeBlock::derefStructureIDs):
3517         * VM/CodeBlock.h:
3518         (JSC::StructureStubInfo::StructureStubInfo):
3519         (JSC::CallLinkInfo::CallLinkInfo):
3520         (JSC::CodeBlock::addCaller):
3521         (JSC::CodeBlock::removeCaller):
3522         (JSC::CodeBlock::getStubInfo):
3523         * VM/CodeGenerator.cpp:
3524         (JSC::CodeGenerator::emitCall):
3525         (JSC::CodeGenerator::emitConstruct):
3526         * VM/Machine.cpp:
3527         (JSC::Machine::cti_op_call_profiler):
3528         (JSC::Machine::cti_op_call_JSFunction):
3529         (JSC::Machine::cti_vm_lazyLinkCall):
3530         (JSC::Machine::cti_op_construct_JSConstructFast):
3531         (JSC::Machine::cti_op_construct_JSConstruct):
3532         (JSC::Machine::cti_op_construct_NotJSConstruct):
3533         * VM/Machine.h:
3534         * kjs/JSFunction.cpp:
3535         (JSC::JSFunction::~JSFunction):
3536         * kjs/JSFunction.h:
3537         * kjs/nodes.h:
3538         (JSC::FunctionBodyNode::):
3539         * masm/X86Assembler.h:
3540         (JSC::X86Assembler::getDifferenceBetweenLabels):
3541
3542 2008-10-17  Maciej Stachowiak  <mjs@apple.com>
3543
3544         Reviewed by Geoff Garen.
3545         
3546         - remove ASSERT that makes the leaks buildbot cry
3547
3548         * kjs/JSFunction.cpp:
3549         (JSC::JSFunction::JSFunction):
3550
3551 2008-10-17  Maciej Stachowiak  <mjs@apple.com>
3552
3553         Reviewed by Cameron Zwarich
3554         
3555         - don't bother to do arguments tearoff when it will have no effect
3556
3557         ~1% on v8 raytrace
3558         
3559         * VM/CodeGenerator.cpp:
3560         (JSC::CodeGenerator::emitReturn):
3561
3562 2008-10-17  Marco Barisione  <marco.barisione@collabora.co.uk>
3563
3564         Reviewed by Sam Weinig. Landed by Jan Alonzo.
3565
3566         https://bugs.webkit.org/show_bug.cgi?id=21603
3567         [GTK] Minor fixes to GOwnPtr
3568
3569         * wtf/GOwnPtr.cpp:
3570         (WTF::GError):
3571         (WTF::GList):
3572         (WTF::GCond):
3573         (WTF::GMutex):
3574         (WTF::GPatternSpec):
3575         (WTF::GDir):
3576         * wtf/GOwnPtr.h:
3577         (WTF::freeOwnedGPtr):
3578         (WTF::GOwnPtr::~GOwnPtr):
3579         (WTF::GOwnPtr::outPtr):
3580         (WTF::GOwnPtr::set):
3581         (WTF::GOwnPtr::clear):
3582         * wtf/Threading.h:
3583
3584 2008-10-17  Maciej Stachowiak  <mjs@apple.com>
3585
3586         Reviewed by Cameron Zwarich.
3587         
3588         - speed up transitions that resize the property storage a fair bit
3589         
3590         ~3% speedup on v8 RayTrace benchmark, ~1% on DeltaBlue
3591
3592         * VM/CTI.cpp:
3593         (JSC::resizePropertyStorage): renamed from transitionObject, and reduced to just resize
3594         the object's property storage with one inline call.
3595         (JSC::CTI::privateCompilePutByIdTransition): Use a separate function for property storage
3596         resize, but still do all the rest of the work in assembly in that case, and pass the known
3597         compile-time constants of old and new size rather than structureIDs, saving a bunch of
3598         redundant memory access.
3599         * kjs/JSObject.cpp:
3600         (JSC::JSObject::allocatePropertyStorage): Just call the inline version.
3601         * kjs/JSObject.h:
3602         (JSC::JSObject::allocatePropertyStorageInline): Inline version of allocatePropertyStorage
3603         * masm/X86Assembler.h:
3604         (JSC::X86Assembler::):
3605         (JSC::X86Assembler::pushl_i32): Add code to assmeble push of a constant; code originally by Cameron Zwarich.
3606
3607 2008-10-17  Cameron Zwarich  <zwarich@apple.com>
3608
3609         Reviewed by Maciej Stachowiak.
3610
3611         Remove some C style casts.
3612
3613         * masm/X86Assembler.h:
3614         (JSC::JITCodeBuffer::putIntUnchecked):
3615         (JSC::X86Assembler::link):
3616         (JSC::X86Assembler::linkAbsoluteAddress):
3617         (JSC::X86Assembler::getRelocatedAddress):
3618
3619 2008-10-17  Cameron Zwarich  <zwarich@apple.com>
3620
3621         Rubber-stamped by Maciej Stachowiak.
3622
3623         Remove some C style casts.
3624
3625         * VM/CTI.cpp:
3626         (JSC::CTI::patchGetByIdSelf):
3627         (JSC::CTI::patchPutByIdReplace):
3628         * VM/Machine.cpp:
3629         (JSC::Machine::tryCTICachePutByID):
3630         (JSC::Machine::tryCTICacheGetByID):
3631         (JSC::Machine::cti_op_put_by_id):
3632         (JSC::Machine::cti_op_put_by_id_fail):
3633         (JSC::Machine::cti_op_get_by_id):
3634         (JSC::Machine::cti_op_get_by_id_fail):
3635
3636 2008-10-17  Maciej Stachowiak  <mjs@apple.com>
3637
3638         Reviewed by Cameron Zwarich.
3639         
3640         - Avoid restoring the caller's 'r' value in op_ret
3641         https://bugs.webkit.org/show_bug.cgi?id=21319
3642
3643         This patch stops writing the call frame at call and return points;
3644         instead it does so immediately before any CTI call.
3645         
3646         0.5% speedup or so on the v8 benchmark
3647                
3648         * VM/CTI.cpp:
3649         (JSC::CTI::emitCTICall):
3650         (JSC::CTI::compileOpCall):
3651         (JSC::CTI::emitSlowScriptCheck):
3652         (JSC::CTI::compileBinaryArithOpSlowCase):
3653         (JSC::CTI::privateCompileMainPass):
3654         (JSC::CTI::privateCompileSlowCases):
3655         (JSC::CTI::privateCompile):
3656         * VM/CTI.h:
3657
3658 2008-10-17  Cameron Zwarich  <zwarich@apple.com>
3659
3660         Reviewed by Sam Weinig.
3661
3662         Make WREC require CTI because it won't actually compile otherwise.
3663
3664         * wtf/Platform.h:
3665
3666 2008-10-16  Maciej Stachowiak  <mjs@apple.com>
3667
3668         Reviewed by Geoff Garen.
3669
3670         - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
3671         - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
3672
3673         This time there is no performance regression; we can avoid having
3674         to use the fastcall calling convention for CTI functions by using
3675         varargs to prevent the compiler from moving things around on the
3676         stack.
3677         
3678         * Configurations/DebugRelease.xcconfig:
3679         * JavaScriptCore.xcodeproj/project.pbxproj:
3680         * VM/CTI.cpp:
3681         * VM/Machine.h:
3682         * wtf/Platform.h:
3683
3684 2008-10-16  Maciej Stachowiak  <mjs@apple.com>
3685
3686         Reviewed by Oliver Hunt.
3687
3688         - fix for REGRESSION: r37631 causing crashes on buildbot
3689         https://bugs.webkit.org/show_bug.cgi?id=21682
3690         
3691         * kjs/collector.cpp:
3692         (JSC::Heap::collect): Avoid crashing when a GC occurs while no global objects are live.
3693
3694 2008-10-16  Sam Weinig  <sam@webkit.org>
3695
3696         Reviewed by Maciej Stachowiak.
3697
3698         Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
3699         Don't create intermediate StructureIDs for builtin objects
3700
3701         First step in reduce number of StructureIDs created when initializing the
3702         JSGlobalObject.
3703
3704         - In order to avoid creating the intermediate StructureIDs use the new putDirectWithoutTransition
3705           and putDirectFunctionWithoutTransition to add properties to JSObjects without transitioning
3706           the StructureID.  This patch just implements this strategy for ObjectPrototype but alone
3707           reduces the number of StructureIDs create for about:blank by 10, from 142 to 132.
3708
3709         * kjs/JSGlobalObject.cpp:
3710         (JSC::JSGlobalObject::reset):
3711         * kjs/JSObject.cpp:
3712         (JSC::JSObject::putDirectFunctionWithoutTransition):
3713         * kjs/JSObject.h:
3714         (JSC::JSObject::putDirectWithoutTransition):
3715         * kjs/ObjectPrototype.cpp:
3716         (JSC::ObjectPrototype::ObjectPrototype):
3717         * kjs/ObjectPrototype.h:
3718         * kjs/StructureID.cpp:
3719         (JSC::StructureID::addPropertyWithoutTransition):
3720         * kjs/StructureID.h:
3721
3722 2008-10-16  Maciej Stachowiak  <mjs@apple.com>
3723
3724         Reviewed by Cameron Zwarich.
3725         
3726         - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
3727         
3728         Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
3729
3730         * kjs/StructureID.cpp:
3731         (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
3732         itself from the destructor; that doesn't even make sense.
3733         (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
3734         the rule is that parent StructureIDs are ref'd but child ones are not. Refing
3735         the child creates a cycle.
3736
3737 2008-10-15  Alexey Proskuryakov  <ap@webkit.org>
3738
3739         Reviewed by Darin Adler.
3740
3741         https://bugs.webkit.org/show_bug.cgi?id=21609
3742         Make MessagePorts protect their peers across heaps
3743
3744         * JavaScriptCore.exp:
3745         * kjs/JSGlobalObject.cpp:
3746         (JSC::JSGlobalObject::markCrossHeapDependentObjects):
3747         * kjs/JSGlobalObject.h:
3748         * kjs/collector.cpp:
3749         (JSC::Heap::collect):
3750         Before GC sweep phase, a function supplied by global object is now called for all global
3751         objects in the heap, making it possible to implement cross-heap dependencies.
3752
3753 2008-10-15  Alexey Proskuryakov  <ap@webkit.org>
3754
3755         Reviewed by Darin Adler.
3756
3757         https://bugs.webkit.org/show_bug.cgi?id=21610
3758         run-webkit-threads --threaded crashes in StructureID destructor
3759
3760         * kjs/StructureID.cpp:
3761         (JSC::StructureID::StructureID):
3762         (JSC::StructureID::~StructureID):
3763         Protect access to a static (debug-only) HashSet with a lock.
3764
3765 2008-10-15  Sam Weinig  <sam@webkit.org>
3766
3767         Reviewed by Goeffrey Garen.
3768
3769         Add function to dump statistics for StructureIDs.
3770
3771         * kjs/StructureID.cpp:
3772         (JSC::StructureID::dumpStatistics):
3773         (JSC::StructureID::StructureID):
3774         (JSC::StructureID::~StructureID):
3775         * kjs/StructureID.h:
3776
3777 2008-10-15  Cameron Zwarich  <zwarich@apple.com>
3778
3779         Reviewed by Maciej Stachowiak.
3780
3781         Bug 21633: Avoid using a HashMap when there is only a single transition
3782         <https://bugs.webkit.org/show_bug.cgi?id=21633>
3783
3784         This is a 0.8% speedup on SunSpider and between a 0.5% and 1.0% speedup
3785         on the V8 benchmark suite, depending on which harness we use. It will
3786         also slightly reduce the memory footprint of a StructureID.
3787
3788         * kjs/StructureID.cpp:
3789         (JSC::StructureID::StructureID):
3790         (JSC::StructureID::~StructureID):
3791         (JSC::StructureID::addPropertyTransition):
3792         * kjs/StructureID.h:
3793         (JSC::StructureID::):
3794
3795 2008-10-15  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
3796
3797         Reviewed by Geoffrey Garen.
3798
3799         1.40% speedup on SunSpider, 1.44% speedup on V8. (Linux)
3800         
3801         No change on Mac.
3802
3803         * VM/Machine.cpp:
3804         (JSC::fastIsNumber): ALWAYS_INLINE modifier added.
3805
3806 2008-10-15  Geoffrey Garen  <ggaren@apple.com>
3807
3808         Reviewed by Cameron Zwarich.
3809
3810         Fixed https://bugs.webkit.org/show_bug.cgi?id=21345
3811         Start the debugger without reloading the inspected page
3812
3813         * JavaScriptCore.exp: New symbols.
3814         * JavaScriptCore.xcodeproj/project.pbxproj: New files.
3815
3816         * VM/CodeBlock.h:
3817         (JSC::EvalCodeCache::get): Updated for tweak to parsing API.
3818
3819         * kjs/CollectorHeapIterator.h: Added. An iterator for the object heap,
3820         which we use to find all the live functions and recompile them.
3821
3822         * kjs/DebuggerCallFrame.cpp:
3823         (JSC::DebuggerCallFrame::evaluate): Updated for tweak to parsing API.
3824
3825         * kjs/FunctionConstructor.cpp:
3826         (JSC::constructFunction): Updated for tweak to parsing API.
3827
3828         * kjs/JSFunction.cpp:
3829         (JSC::JSFunction::JSFunction): Try to validate our SourceCode in debug
3830         builds by ASSERTing that it's syntactically valid. This doesn't catch
3831         all SourceCode bugs, but it catches a lot of them.
3832
3833         * kjs/JSGlobalObjectFunctions.cpp:
3834         (JSC::globalFuncEval): Updated for tweak to parsing API.
3835
3836         * kjs/Parser.cpp:
3837         (JSC::Parser::parse):
3838         * kjs/Parser.h:
3839         (JSC::Parser::parse): Tweaked the parser to make it possible to parse
3840         without an ExecState, and to allow the client to specify a debugger to
3841         notify (or not) about the source we parse. This allows the inspector
3842         to recompile even though no JavaScript is executing, then notify the
3843         debugger about all source code when it's done.
3844
3845         * kjs/Shell.cpp:
3846         (prettyPrintScript): Updated for tweak to parsing API.
3847
3848         * kjs/SourceRange.h:
3849         (JSC::SourceCode::isNull): Added to help with ASSERTs.
3850
3851         * kjs/collector.cpp:
3852         (JSC::Heap::heapAllocate):
3853         (JSC::Heap::sweep):
3854         (JSC::Heap::primaryHeapBegin):
3855         (JSC::Heap::primaryHeapEnd):
3856         * kjs/collector.h:
3857         (JSC::): Moved a bunch of declarations around to enable compilation of
3858         CollectorHeapIterator.
3859
3860         * kjs/interpreter.cpp:
3861         (JSC::Interpreter::checkSyntax):
3862         (JSC::Interpreter::evaluate): Updated for tweak to parsing API.
3863
3864         * kjs/lexer.h:
3865         (JSC::Lexer::sourceCode): BUG FIX: Calculate SourceCode ranges relative
3866         to the SourceCode range in which we're lexing, otherwise nested functions
3867         that are compiled individually get SourceCode ranges that don't reflect
3868         their nesting.
3869
3870         * kjs/nodes.cpp:
3871         (JSC::FunctionBodyNode::FunctionBodyNode):
3872         (JSC::FunctionBodyNode::finishParsing):
3873         (JSC::FunctionBodyNode::create):
3874         (JSC::FunctionBodyNode::copyParameters):
3875         * kjs/nodes.h:
3876         (JSC::ScopeNode::setSource):
3877         (JSC::FunctionBodyNode::parameterCount): Added some helper functions for
3878         copying one FunctionBodyNode's parameters to another. The recompiler uses
3879         these when calling "finishParsing".
3880
3881 2008-10-15  Joerg Bornemann  <joerg.bornemann@trolltech.com>
3882
3883         Reviewed by Darin Adler.
3884
3885         - part of https://bugs.webkit.org/show_bug.cgi?id=20746
3886           Fix compilation on Windows CE.
3887
3888         str(n)icmp, strdup and vsnprintf are not available on Windows CE,
3889         they are called _str(n)icmp, etc. instead
3890
3891         * wtf/StringExtras.h: Added inline function implementations.
3892
3893 2008-10-15  Gabor Loki  <loki@inf.u-szeged.hu>
3894
3895         Reviewed by Cameron Zwarich.
3896
3897         <https://bugs.webkit.org/show_bug.cgi?id=20912>
3898         Use simple uint32_t multiplication on op_mul if both operands are
3899         immediate number and they are between zero and 0x7FFF.
3900
3901         * VM/Machine.cpp:
3902         (JSC::Machine::privateExecute):
3903
3904 2008-10-09  Darin Fisher  <darin@chromium.org>
3905
3906         Reviewed by Sam Weinig.
3907
3908         Make pan scrolling a platform configurable option.
3909         https://bugs.webkit.org/show_bug.cgi?id=21515
3910
3911         * wtf/Platform.h: Add ENABLE_PAN_SCROLLING
3912
3913 2008-10-14  Maciej Stachowiak  <mjs@apple.com>
3914
3915         Rubber stamped by Sam Weinig.
3916         
3917         - revert r37572 and r37581 for now
3918         
3919         Turns out GCC 4.2 is still a (small) regression, we'll have to do
3920         more work to turn it on.
3921
3922         * Configurations/DebugRelease.xcconfig:
3923         * JavaScriptCore.xcodeproj/project.pbxproj:
3924         * VM/CTI.cpp:
3925         * VM/CTI.h:
3926         * VM/Machine.cpp:
3927         (JSC::Machine::cti_op_convert_this):
3928         (JSC::Machine::cti_op_end):
3929         (JSC::Machine::cti_op_add):
3930         (JSC::Machine::cti_op_pre_inc):
3931         (JSC::Machine::cti_timeout_check):
3932         (JSC::Machine::cti_register_file_check):
3933         (JSC::Machine::cti_op_loop_if_less):
3934         (JSC::Machine::cti_op_loop_if_lesseq):
3935         (JSC::Machine::cti_op_new_object):
3936         (JSC::Machine::cti_op_put_by_id):
3937         (JSC::Machine::cti_op_put_by_id_second):
3938         (JSC::Machine::cti_op_put_by_id_generic):
3939         (JSC::Machine::cti_op_put_by_id_fail):
3940         (JSC::Machine::cti_op_get_by_id):
3941         (JSC::Machine::cti_op_get_by_id_second):
3942         (JSC::Machine::cti_op_get_by_id_generic):
3943         (JSC::Machine::cti_op_get_by_id_fail):
3944         (JSC::Machine::cti_op_instanceof):
3945         (JSC::Machine::cti_op_del_by_id):
3946         (JSC::Machine::cti_op_mul):
3947         (JSC::Machine::cti_op_new_func):
3948         (JSC::Machine::cti_op_call_JSFunction):
3949         (JSC::Machine::cti_vm_compile):
3950         (JSC::Machine::cti_op_push_activation):
3951         (JSC::Machine::cti_op_call_NotJSFunction):
3952         (JSC::Machine::cti_op_create_arguments):
3953         (JSC::Machine::cti_op_tear_off_activation):
3954         (JSC::Machine::cti_op_tear_off_arguments):
3955         (JSC::Machine::cti_op_ret_profiler):
3956         (JSC::Machine::cti_op_ret_scopeChain):
3957         (JSC::Machine::cti_op_new_array):
3958         (JSC::Machine::cti_op_resolve):
3959         (JSC::Machine::cti_op_construct_JSConstruct):
3960         (JSC::Machine::cti_op_construct_NotJSConstruct):
3961         (JSC::Machine::cti_op_get_by_val):
3962         (JSC::Machine::cti_op_resolve_func):
3963         (JSC::Machine::cti_op_sub):
3964         (JSC::Machine::cti_op_put_by_val):
3965         (JSC::Machine::cti_op_put_by_val_array):
3966         (JSC::Machine::cti_op_lesseq):
3967         (JSC::Machine::cti_op_loop_if_true):
3968         (JSC::Machine::cti_op_negate):
3969         (JSC::Machine::cti_op_resolve_base):
3970         (JSC::Machine::cti_op_resolve_skip):
3971         (JSC::Machine::cti_op_resolve_global):
3972         (JSC::Machine::cti_op_div):
3973         (JSC::Machine::cti_op_pre_dec):
3974         (JSC::Machine::cti_op_jless):
3975         (JSC::Machine::cti_op_not):
3976         (JSC::Machine::cti_op_jtrue):
3977         (JSC::Machine::cti_op_post_inc):
3978         (JSC::Machine::cti_op_eq):
3979         (JSC::Machine::cti_op_lshift):
3980         (JSC::Machine::cti_op_bitand):
3981         (JSC::Machine::cti_op_rshift):
3982         (JSC::Machine::cti_op_bitnot):
3983         (JSC::Machine::cti_op_resolve_with_base):
3984         (JSC::Machine::cti_op_new_func_exp):
3985         (JSC::Machine::cti_op_mod):
3986         (JSC::Machine::cti_op_less):
3987         (JSC::Machine::cti_op_neq):
3988         (JSC::Machine::cti_op_post_dec):
3989         (JSC::Machine::cti_op_urshift):
3990         (JSC::Machine::cti_op_bitxor):
3991         (JSC::Machine::cti_op_new_regexp):
3992         (JSC::Machine::cti_op_bitor):
3993         (JSC::Machine::cti_op_call_eval):
3994         (JSC::Machine::cti_op_throw):
3995         (JSC::Machine::cti_op_get_pnames):
3996         (JSC::Machine::cti_op_next_pname):
3997         (JSC::Machine::cti_op_push_scope):
3998         (JSC::Machine::cti_op_pop_scope):
3999         (JSC::Machine::cti_op_typeof):
4000         (JSC::Machine::cti_op_is_undefined):
4001         (JSC::Machine::cti_op_is_boolean):
4002         (JSC::Machine::cti_op_is_number):
4003         (JSC::Machine::cti_op_is_string):
4004         (JSC::Machine::cti_op_is_object):
4005         (JSC::Machine::cti_op_is_function):
4006         (JSC::Machine::cti_op_stricteq):
4007         (JSC::Machine::cti_op_nstricteq):
4008         (JSC::Machine::cti_op_to_jsnumber):
4009         (JSC::Machine::cti_op_in):
4010         (JSC::Machine::cti_op_push_new_scope):
4011         (JSC::Machine::cti_op_jmp_scopes):
4012         (JSC::Machine::cti_op_put_by_index):
4013         (JSC::Machine::cti_op_switch_imm):
4014         (JSC::Machine::cti_op_switch_char):
4015         (JSC::Machine::cti_op_switch_string):
4016         (JSC::Machine::cti_op_del_by_val):
4017         (JSC::Machine::cti_op_put_getter):
4018         (JSC::Machine::cti_op_put_setter):
4019         (JSC::Machine::cti_op_new_error):
4020         (JSC::Machine::cti_op_debug):
4021         (JSC::Machine::cti_vm_throw):
4022         * VM/Machine.h:
4023         * masm/X86Assembler.h:
4024         (JSC::X86Assembler::emitRestoreArgumentReference):
4025         (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
4026         * wtf/Platform.h:
4027
4028 2008-10-14  Alexey Proskuryakov  <ap@webkit.org>
4029
4030         Reviewed by Darin Adler.
4031
4032         https://bugs.webkit.org/show_bug.cgi?id=20256
4033         Array.push and other standard methods disappear
4034
4035         * kjs/JSGlobalData.cpp:
4036         (JSC::JSGlobalData::JSGlobalData):
4037         (JSC::JSGlobalData::~JSGlobalData):
4038         Don't use static hash tables even on platforms that don't enable JSC_MULTIPLE_THREADS -
4039         these tables reference IdentifierTable, which is always per-GlobalData.
4040
4041 2008-10-14  Maciej Stachowiak  <mjs@apple.com>
4042
4043         Reviewed by Cameron Zwarich.
4044         
4045         - always use CTI_ARGUMENTS and CTI_ARGUMENTS_FASTCALL
4046         
4047         This is a small regression for GCC 4.0, but simplifies the code
4048         for future improvements and lets us focus on GCC 4.2+ and MSVC.
4049
4050         * VM/CTI.cpp:
4051         * VM/CTI.h:
4052         * VM/Machine.cpp:
4053         (JSC::Machine::cti_op_convert_this):
4054         (JSC::Machine::cti_op_end):
4055         (JSC::Machine::cti_op_add):
4056         (JSC::Machine::cti_op_pre_inc):
4057         (JSC::Machine::cti_timeout_check):
4058         (JSC::Machine::cti_register_file_check):
4059         (JSC::Machine::cti_op_loop_if_less):
4060         (JSC::Machine::cti_op_loop_if_lesseq):
4061         (JSC::Machine::cti_op_new_object):
4062         (JSC::Machine::cti_op_put_by_id):
4063         (JSC::Machine::cti_op_put_by_id_second):
4064         (JSC::Machine::cti_op_put_by_id_generic):
4065         (JSC::Machine::cti_op_put_by_id_fail):
4066         (JSC::Machine::cti_op_get_by_id):
4067         (JSC::Machine::cti_op_get_by_id_second):
4068         (JSC::Machine::cti_op_get_by_id_generic):
4069         (JSC::Machine::cti_op_get_by_id_fail):
4070         (JSC::Machine::cti_op_instanceof):
4071         (JSC::Machine::cti_op_del_by_id):
4072         (JSC::Machine::cti_op_mul):
4073         (JSC::Machine::cti_op_new_func):
4074         (JSC::Machine::cti_op_call_JSFunction):
4075         (JSC::Machine::cti_vm_compile):
4076         (JSC::Machine::cti_op_push_activation):
4077         (JSC::Machine::cti_op_call_NotJSFunction):
4078         (JSC::Machine::cti_op_create_arguments):
4079         (JSC::Machine::cti_op_tear_off_activation):
4080         (JSC::Machine::cti_op_tear_off_arguments):
4081         (JSC::Machine::cti_op_ret_profiler):
4082         (JSC::Machine::cti_op_ret_scopeChain):
4083         (JSC::Machine::cti_op_new_array):
4084         (JSC::Machine::cti_op_resolve):
4085         (JSC::Machine::cti_op_construct_JSConstruct):
4086         (JSC::Machine::cti_op_construct_NotJSConstruct):
4087         (JSC::Machine::cti_op_get_by_val):
4088         (JSC::Machine::cti_op_resolve_func):
4089         (JSC::Machine::cti_op_sub):
4090         (JSC::Machine::cti_op_put_by_val):
4091         (JSC::Machine::cti_op_put_by_val_array):
4092         (JSC::Machine::cti_op_lesseq):
4093         (JSC::Machine::cti_op_loop_if_true):
4094         (JSC::Machine::cti_op_negate):
4095         (JSC::Machine::cti_op_resolve_base):
4096         (JSC::Machine::cti_op_resolve_skip):
4097         (JSC::Machine::cti_op_resolve_global):
4098         (JSC::Machine::cti_op_div):
4099         (JSC::Machine::cti_op_pre_dec):
4100         (JSC::Machine::cti_op_jless):
4101         (JSC::Machine::cti_op_not):
4102         (JSC::Machine::cti_op_jtrue):
4103         (JSC::Machine::cti_op_post_inc):
4104         (JSC::Machine::cti_op_eq):
4105         (JSC::Machine::cti_op_lshift):
4106         (JSC::Machine::cti_op_bitand):
4107         (JSC::Machine::cti_op_rshift):
4108         (JSC::Machine::cti_op_bitnot):
4109         (JSC::Machine::cti_op_resolve_with_base):
4110         (JSC::Machine::cti_op_new_func_exp):
4111         (JSC::Machine::cti_op_mod):
4112         (JSC::Machine::cti_op_less):
4113         (JSC::Machine::cti_op_neq):
4114         (JSC::Machine::cti_op_post_dec):
4115         (JSC::Machine::cti_op_urshift):
4116         (JSC::Machine::cti_op_bitxor):
4117         (JSC::Machine::cti_op_new_regexp):
4118         (JSC::Machine::cti_op_bitor):
4119         (JSC::Machine::cti_op_call_eval):
4120         (JSC::Machine::cti_op_throw):
4121         (JSC::Machine::cti_op_get_pnames):
4122         (JSC::Machine::cti_op_next_pname):
4123         (JSC::Machine::cti_op_push_scope):
4124         (JSC::Machine::cti_op_pop_scope):
4125         (JSC::Machine::cti_op_typeof):
4126         (JSC::Machine::cti_op_is_undefined):
4127         (JSC::Machine::cti_op_is_boolean):
4128         (JSC::Machine::cti_op_is_number):
4129         (JSC::Machine::cti_op_is_string):
4130         (JSC::Machine::cti_op_is_object):
4131         (JSC::Machine::cti_op_is_function):
4132         (JSC::Machine::cti_op_stricteq):
4133         (JSC::Machine::cti_op_nstricteq):
4134         (JSC::Machine::cti_op_to_jsnumber):
4135         (JSC::Machine::cti_op_in):
4136         (JSC::Machine::cti_op_push_new_scope):
4137         (JSC::Machine::cti_op_jmp_scopes):
4138         (JSC::Machine::cti_op_put_by_index):
4139         (JSC::Machine::cti_op_switch_imm):
4140         (JSC::Machine::cti_op_switch_char):
4141         (JSC::Machine::cti_op_switch_string):
4142         (JSC::Machine::cti_op_del_by_val):
4143         (JSC::Machine::cti_op_put_getter):
4144         (JSC::Machine::cti_op_put_setter):
4145         (JSC::Machine::cti_op_new_error):
4146         (JSC::Machine::cti_op_debug):