2008-07-02 Geoffrey Garen <ggaren@apple.com>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-07-02  Geoffrey Garen  <ggaren@apple.com>
2
3         Reviewed by Oliver Hunt.
4
5         Optimized a[n] get for cases where a is an array or a string, and a[n]
6         put for cases where a is an array.
7         
8         SunSpider says 9.0% faster.
9
10 2008-07-02  Kevin McCullough  <kmccullough@apple.com>
11
12         Reviewed by Darin.
13
14         -Small cleanup in preparation for implementing Bottom-up.
15
16         * profiler/CallIdentifier.h: Rename debug function to make it clear of
17         its output and intention to be debug only.
18         (KJS::CallIdentifier::operator const char* ): Implement in terms of
19         c_str.
20         (KJS::CallIdentifier::c_str):
21         * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
22         by the bottom-up implementation.
23         (KJS::ProfileNode::findChild):
24         * profiler/ProfileNode.h: Added comments to make the collections of
25         functions more clear.
26         (KJS::ProfileNode::operator==):
27         (KJS::ProfileNode::c_str):
28
29 2008-07-02  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
30
31         Reviewed by Darin.
32
33         Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
34         <https://bugs.webkit.org/show_bug.cgi?id=19776>
35
36         Perform the sign check for the exponent on the actual exponent value,
37         which is 1 less than the value of decimalPoint, instead of on the value
38         of decimalPoint itself.
39
40         * kjs/NumberPrototype.cpp:
41         (KJS::exponentialPartToString):
42
43 2008-07-02  Kevin McCullough  <kmccullough@apple.com>
44
45         Reviewed by Darin.
46
47         <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
48         - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
49         later.
50
51         * JavaScriptCore.xcodeproj/project.pbxproj:
52         * profiler/Profile.cpp: By default we create a TreeProfile.
53         (KJS::Profile::create):
54         * profiler/Profile.h: Changes to the Profile class to make it amenable
55         to be inherited from.
56         (KJS::Profile::~Profile):
57         * profiler/TreeProfile.cpp: Added.
58         (KJS::TreeProfile::create):
59         (KJS::TreeProfile::TreeProfile):
60         (KJS::TreeProfile::heavyProfile):
61         * profiler/TreeProfile.h: Added.
62         (KJS::TreeProfile::treeProfile):
63
64 2008-07-02  Kevin McCullough  <kmccullough@apple.com>
65
66         Reviewed by Dan.
67
68         Broke CallIdentifier out into its own file. I did this because it's
69         going to grow a lot soon and I wanted this to be a separate patch.
70
71         * JavaScriptCore.xcodeproj/project.pbxproj:
72         * profiler/CallIdentifier.h: Added.
73         (KJS::CallIdentifier::CallIdentifier):
74         (KJS::CallIdentifier::operator==):
75         (KJS::CallIdentifier::operator!=):
76         (KJS::CallIdentifier::operator const char* ):
77         (KJS::CallIdentifier::toString):
78         * profiler/ProfileNode.h:
79
80 2008-07-02  Simon Hausmann  <hausmann@webkit.org>
81
82         Build fix. Implemented missing functions for single-threaded build.
83
84         * kjs/JSLock.cpp:
85         (KJS::JSLock::JSLock):
86         (KJS::JSLock::lock):
87         (KJS::JSLock::unlock):
88         (KJS::JSLock::DropAllLocks::DropAllLocks):
89
90 2008-07-02  Alexey Proskuryakov  <ap@webkit.org>
91
92         Another non-AllInOne build fix.
93
94         * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
95
96 2008-07-02  Alexey Proskuryakov  <ap@webkit.org>
97
98         Non-AllInOne build fix.
99
100         * kjs/interpreter.cpp: Include JSLock.h.
101
102 2008-06-30  Alexey Proskuryakov  <ap@webkit.org>
103
104         Reviewed by Darin.
105
106         Disable JSLock for per-thread contexts.
107
108         No change on SunSpider.
109
110         * kjs/JSGlobalData.h:
111         * kjs/JSGlobalData.cpp:
112         (KJS::JSGlobalData::JSGlobalData):
113         (KJS::JSGlobalData::sharedInstance):
114         Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
115
116         * kjs/JSLock.cpp:
117         (KJS::createJSLockCount):
118         (KJS::JSLock::lockCount):
119         (KJS::setLockCount):
120         (KJS::JSLock::JSLock):
121         (KJS::JSLock::lock):
122         (KJS::JSLock::unlock):
123         (KJS::JSLock::currentThreadIsHoldingLock):
124         (KJS::JSLock::DropAllLocks::DropAllLocks):
125         (KJS::JSLock::DropAllLocks::~DropAllLocks):
126         * kjs/JSLock.h:
127         (KJS::JSLock::JSLock):
128         (KJS::JSLock::~JSLock):
129         Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
130         actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
131         if we want to keep existing assertions working.
132         Made recursion count per-thread, now that locks may not lock.
133
134         * API/JSBase.cpp:
135         (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
136         locking in any case), so that a decision whether to actually lock can be made.
137         (JSCheckScriptSyntax): Ditto.
138         (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
139
140         * API/JSObjectRef.cpp:
141         (JSClassCreate): Don't lock, as there is no reason to.
142         (JSClassRetain): Ditto.
143         (JSClassRelease): Ditto.
144         (JSPropertyNameArrayRetain): Ditto.
145         (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
146         identifier table.
147         (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
148         lookup, and possibly modification.
149
150         * API/JSStringRef.cpp:
151         (JSStringCreateWithCharacters):
152         (JSStringCreateWithUTF8CString):
153         (JSStringRetain):
154         (JSStringRelease):
155         (JSStringGetUTF8CString):
156         (JSStringIsEqual):
157         * API/JSStringRefCF.cpp:
158         (JSStringCreateWithCFString):
159         JSStringRef operations other than releasing do not need locking.
160
161         * VM/Machine.cpp: Don't include unused JSLock.h.
162
163         * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
164         Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
165         the existing code could cause deadlocks.
166
167         * kjs/Shell.cpp:
168         (functionGC):
169         (main):
170         (jscmain):
171         The test tool uses a per-thread context, so no real locking is required.
172
173         * kjs/collector.h:
174         (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
175         per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
176         migration between threads" by using ProtectedPtr on a background thread.
177         (KJS::Heap::isShared): Keep a shared flag here, as well.
178
179         * kjs/protect.h:
180         (KJS::::ProtectedPtr):
181         (KJS::::~ProtectedPtr):
182         (KJS::::operator):
183         (KJS::operator==):
184         (KJS::operator!=):
185         ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
186         Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
187
188         * kjs/collector.cpp:
189         (KJS::Heap::Heap): Initialize m_isShared.
190         (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
191         in sweep() working.
192         (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
193         so locking is always needed here.
194         (KJS::Heap::registerThread): Ditto.
195         (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
196         instance for a small speedup.
197         (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
198         way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
199         (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
200         m_protectedValues.
201         (KJS::Heap::unprotect): Ditto.
202         (KJS::Heap::markProtectedObjects): Ditto.
203         (KJS::Heap::protectedGlobalObjectCount): Ditto.
204         (KJS::Heap::protectedObjectCount): Ditto.
205         (KJS::Heap::protectedObjectTypeCounts): Ditto.
206
207         * kjs/ustring.cpp:
208         * kjs/ustring.h:
209         Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
210         to be added to many files in JavaScriptGlue, WebCore and WebKit.
211
212         * kjs/JSGlobalObject.cpp:
213         (KJS::JSGlobalObject::init):
214         * API/JSCallbackConstructor.cpp:
215         (KJS::constructJSCallback):
216         * API/JSCallbackFunction.cpp:
217         (KJS::JSCallbackFunction::call):
218         * API/JSCallbackObjectFunctions.h:
219         (KJS::::init):
220         (KJS::::getOwnPropertySlot):
221         (KJS::::put):
222         (KJS::::deleteProperty):
223         (KJS::::construct):
224         (KJS::::hasInstance):
225         (KJS::::call):
226         (KJS::::getPropertyNames):
227         (KJS::::toNumber):
228         (KJS::::toString):
229         (KJS::::staticValueGetter):
230         (KJS::::callbackGetter):
231         * API/JSContextRef.cpp:
232         (JSGlobalContextCreate):
233         (JSGlobalContextRetain):
234         (JSGlobalContextRelease):
235         * API/JSValueRef.cpp:
236         (JSValueIsEqual):
237         (JSValueIsStrictEqual):
238         (JSValueIsInstanceOfConstructor):
239         (JSValueMakeNumber):
240         (JSValueMakeString):
241         (JSValueToNumber):
242         (JSValueToStringCopy):
243         (JSValueToObject):
244         (JSValueProtect):
245         (JSValueUnprotect):
246         * JavaScriptCore.exp:
247         * kjs/PropertyNameArray.h:
248         (KJS::PropertyNameArray::globalData):
249         * kjs/interpreter.cpp:
250         (KJS::Interpreter::checkSyntax):
251         (KJS::Interpreter::evaluate):
252         Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
253
254 2008-07-01  Alexey Proskuryakov  <ap@webkit.org>
255
256         Reviewed by Darin.
257
258         https://bugs.webkit.org/show_bug.cgi?id=19834
259         Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
260
261         Creating a global object with a custom prototype resets it twice (wasteful!).
262         So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
263         the register array.        
264
265         * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
266
267         * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
268         constructor and operator= to ensure that no one attempts to copy this object (for whatever
269         reason, I couldn't make Noncopyable work).
270
271         * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
272         with new[].
273
274         * kjs/JSVariableObject.cpp:
275         (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
276         (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
277         "changing" the value from 0 to 0.
278
279 2008-07-01  Geoffrey Garen  <ggaren@apple.com>
280
281         Reviewed by Oliver Hunt.
282         
283         Removed and/or reordered exception checks in array-style a[n] access.
284         
285         SunSpider says 1.4% faster.
286
287         * VM/Machine.cpp:
288         (KJS::Machine::privateExecute): No need to check for exceptions before
289         calling toString, toNumber and/or get. If the call ends up being observable
290         through toString, valueOf, or a getter, we short-circuit it there, instead.
291         In the op_del_by_val case, I removed the incorrect comment without actually
292         removing the code, since I didn't want to tempt the GCC fates!
293
294         * kjs/JSObject.cpp:
295         (KJS::callDefaultValueFunction): Added exception check to prevent
296         toString and valueOf functions from observing execution after an exception
297         has been thrown. This removes some of the burden of exception checking
298         from the machine.
299
300         (KJS::JSObject::defaultValue): Removed redundant exception check here.
301
302         * kjs/PropertySlot.cpp:
303         (KJS::PropertySlot::functionGetter): Added exception check to prevent
304         getter functions from observing execution after an exception has been
305         thrown. This removes some of the burden of exception checking from the
306         machine.
307
308 2008-07-01  Geoffrey Garen  <ggaren@apple.com>
309
310         Reviewed by Oliver Hunt.
311         
312         Optimized a[n] get and put for cases where n is an immediate unsigned
313         value.
314         
315         SunSpider says 3.5% faster.
316
317 2008-07-01  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
318
319         Reviewed by Darin.
320
321         Bug 19844: JavaScript Switch statement modifies "this"
322         <https://bugs.webkit.org/show_bug.cgi?id=19844>
323
324         Use a temporary when generating code for switch clauses to avoid
325         overwriting 'this' or a local variable.
326
327         * kjs/nodes.cpp:
328         (KJS::CaseBlockNode::emitCodeForBlock):
329
330 2008-07-01  Christian Dywan  <christian@twotoasts.de>
331
332         Gtk+ build fix.
333
334         * kjs/list.cpp: Include "JSCell.h"
335
336 2008-07-01  Kevin McCullough  <kmccullough@apple.com>
337
338         Build fix.
339
340         * JavaScriptCore.xcodeproj/project.pbxproj:
341
342 2008-07-01  Dan Bernstein  <mitz@apple.com>
343
344         Reviewed by Anders Carlsson.
345
346         - Mac release build fix
347
348         * JavaScriptCore.exp:
349
350 2008-07-01  Sam Weinig  <sam@webkit.org>
351
352         Try and fix mac builds.
353
354         * JavaScriptCore.exp:
355
356 2008-07-01  Sam Weinig  <sam@webkit.org>
357
358         Fix non-AllInOne builds.
359
360         * kjs/DateMath.cpp:
361
362 2008-07-01  Sam Weinig  <sam@webkit.org>
363
364         Reviewed by Darin Adler.
365
366         Split JSCell and JSNumberCell class declarations out of JSValue.h
367
368         * GNUmakefile.am:
369         * JavaScriptCore.pri:
370         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
371         * JavaScriptCore.xcodeproj/project.pbxproj:
372         * JavaScriptCoreSources.bkl:
373         * VM/JSPropertyNameIterator.h:
374         * kjs/AllInOneFile.cpp:
375         * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
376         * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
377         (KJS::JSValue::getJSNumber):
378         * kjs/JSNumberCell.cpp:
379         * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
380         * kjs/JSObject.h:
381         * kjs/JSString.cpp:
382         (KJS::jsString):
383         (KJS::jsOwnedString):
384         * kjs/JSString.h:
385         (KJS::JSValue::toThisJSString):
386         * kjs/JSValue.cpp:
387         * kjs/JSValue.h:
388
389 2008-07-01  Anders Carlsson  <andersca@apple.com>
390
391         Build fixes.
392         
393         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
394         * kjs/JSGlobalObject.h:
395         (KJS::JSGlobalObject::addStaticGlobals):
396
397 2008-07-01  Simon Hausmann  <hausmann@webkit.org>
398
399         Build fix, include OwnPtr.h.
400
401         * kjs/RegExpConstructor.h:
402
403 2008-06-30  Geoffrey Garen  <ggaren@apple.com>
404
405         Reviewed by Oliver Hunt.
406         
407         Fixed a global object leak caused by the switch to one register file.
408         
409         Don't unconditionally mark the register file, since that logically
410         makes all global variables GC roots, even when their global object is
411         no longer reachable.
412         
413         Instead, make the global object associated with the register file
414         responsible for marking the register file.
415
416 2008-06-30  Geoffrey Garen  <ggaren@apple.com>
417
418         Reviewed by Oliver Hunt.
419         
420         Removed the "registerBase" abstraction. Since the register file never
421         reallocates, we can keep direct pointers into it, instead of
422         <registerBase, offset> tuples.
423         
424         SunSpider says 0.8% faster.
425         
426 2008-06-30  Oliver Hunt  <oliver@apple.com>
427
428         Reviewed by NOBODY (build fix).
429
430         Fix build by adding all (hopefully) the missing includes.
431
432         * kjs/BooleanPrototype.cpp:
433         * kjs/DateConstructor.cpp:
434         * kjs/ErrorPrototype.cpp:
435         * kjs/FunctionPrototype.cpp:
436         * kjs/NativeErrorConstructor.cpp:
437         * kjs/NumberPrototype.cpp:
438         * kjs/ObjectPrototype.cpp:
439         * kjs/RegExpConstructor.cpp:
440         * kjs/StringConstructor.cpp:
441         * kjs/StringPrototype.cpp:
442
443 2008-06-30  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
444
445         Reviewed by Oliver.
446
447         Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
448         <https://bugs.webkit.org/show_bug.cgi?id=19830>
449
450         Ensure that we do not eliminate a write to a local register when doing
451         peephole optimizations.
452
453         * VM/CodeGenerator.cpp:
454         (KJS::CodeGenerator::emitJumpIfTrue):
455         (KJS::CodeGenerator::emitJumpIfFalse):
456
457 2008-06-30  Sam Weinig  <sam@webkit.org>
458
459         Rubber-stamped by Darin Alder.
460
461         Split InternalFunction into its own header file.
462
463         * API/JSCallbackFunction.h:
464         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
465         * JavaScriptCore.xcodeproj/project.pbxproj:
466         * kjs/ArrayConstructor.h:
467         * kjs/BooleanConstructor.h:
468         * kjs/DateConstructor.h:
469         * kjs/ErrorConstructor.h:
470         * kjs/FunctionConstructor.h:
471         * kjs/FunctionPrototype.h:
472         * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
473         * kjs/JSFunction.h:
474         * kjs/NativeErrorConstructor.h:
475         * kjs/NumberConstructor.h:
476         * kjs/ObjectConstructor.h:
477         * kjs/RegExpConstructor.h:
478         * kjs/StringConstructor.h:
479         * profiler/Profiler.cpp:
480
481 2008-06-30  Sam Weinig  <sam@webkit.org>
482
483         Reviewed by Kevin McCullough.
484
485         Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
486
487         * GNUmakefile.am:
488         * JavaScriptCore.pri:
489         * JavaScriptCore.xcodeproj/project.pbxproj:
490         * JavaScriptCoreSources.bkl:
491         * VM/Instruction.cpp: Removed.
492         * VM/LabelID.cpp: Removed.
493         * VM/Register.cpp: Removed.
494         * VM/RegisterID.cpp: Removed.
495
496 2008-06-30  Sam Weinig  <sam@webkit.org>
497
498         Rubber-stamped (reluctantly) by Kevin McCullough.
499
500         Rename date_object.h/cpp to DateInstance.h/cpp
501
502         * GNUmakefile.am:
503         * JavaScriptCore.pri:
504         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
505         * JavaScriptCore.xcodeproj/project.pbxproj:
506         * JavaScriptCoreSources.bkl:
507         * kjs/AllInOneFile.cpp:
508         * kjs/DateConstructor.cpp:
509         * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
510         * kjs/DateInstance.h: Copied from kjs/date_object.h.
511         * kjs/DatePrototype.cpp:
512         * kjs/DatePrototype.h:
513         * kjs/date_object.cpp: Removed.
514         * kjs/date_object.h: Removed.
515
516 2008-06-30  Sam Weinig  <sam@webkit.org>
517
518         Rubber-stamped by Darin Adler.
519
520         Remove internal.cpp and move its contents to there own .cpp files.
521
522         * GNUmakefile.am:
523         * JavaScriptCore.pri:
524         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
525         * JavaScriptCore.xcodeproj/project.pbxproj:
526         * JavaScriptCoreSources.bkl:
527         * kjs/AllInOneFile.cpp:
528         * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
529         * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
530         * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
531         * kjs/JSString.cpp: Copied from kjs/internal.cpp.
532         * kjs/JSString.h:
533         * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
534         * kjs/NumberConstructor.cpp:
535         * kjs/NumberObject.cpp:
536         (KJS::constructNumber):
537         (KJS::constructNumberFromImmediateNumber):
538         * kjs/internal.cpp: Removed.
539
540 2008-06-30  Adam Roben  <aroben@apple.com>
541
542         Fix <rdar://5954749> Assertion failure due to HashTable's use of
543         operator&
544
545         HashTable was passing &value to constructDeletedValue, which in
546         classes like WebCore::COMPtr would cause an assertion. We now pass
547         value by reference instead of by address so that the HashTraits
548         implementations have more flexibility in constructing the deleted
549         value.
550
551         Reviewed by Ada Chan.
552
553         * VM/CodeGenerator.h: Updated for changes to HashTraits.
554         * wtf/HashTable.h:
555         (WTF::::deleteBucket): Changed to pass bucket by reference instead of
556         by address.
557         (WTF::::checkKey): Ditto.
558         * wtf/HashTraits.h:
559         (WTF::): Updated HashTraits for HashTable change.
560
561 2008-07-01  Alexey Proskuryakov  <ap@webkit.org>
562
563         Reviewed by Cameron Zwarich.
564
565         Make RegisterFile really unmap memory on destruction.
566
567         This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
568
569         * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
570         1/4 of it.
571
572         * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
573         half of WebCore rebuild.
574
575         * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
576
577         * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
578
579 2008-06-30  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
580
581         Rubber-stamped by Oliver.
582
583         Correct the documentation for op_put_by_index.
584
585         * VM/Machine.cpp:
586         (KJS::Machine::privateExecute):
587
588 2008-06-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
589
590         Reviewed by Oliver.
591
592         Bug 19821: Merge the instruction pair (less, jfalse)
593         <https://bugs.webkit.org/show_bug.cgi?id=19821>
594         
595         This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
596         intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
597         regression in regexp-dna.
598
599         * VM/CodeBlock.cpp:
600         (KJS::CodeBlock::dump):
601         * VM/CodeGenerator.cpp:
602         (KJS::CodeGenerator::rewindBinaryOp):
603         (KJS::CodeGenerator::emitJumpIfFalse):
604         * VM/Machine.cpp:
605         (KJS::Machine::privateExecute):
606         * VM/Opcode.cpp:
607         (KJS::):
608         * VM/Opcode.h:
609
610 2008-06-29  Sam Weinig  <sam@webkit.org>
611
612         Fix non-AllInOne builds.
613
614         * kjs/JSObject.cpp:
615         * kjs/JSValue.cpp:
616
617 2008-06-29  Sam Weinig  <sam@webkit.org>
618
619         Build fix for Qt.
620
621         * kjs/DateMath.cpp:
622         * kjs/DatePrototype.cpp:
623
624 2008-06-29  Sam Weinig  <sam@webkit.org>
625
626         Rubber-stamped by Cameron Zwarich.
627
628         Splits ErrorConstructor, ErrorPrototype,  NativeErrorConstructor and
629         NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
630
631         * GNUmakefile.am:
632         * JavaScriptCore.pri:
633         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
634         * JavaScriptCore.xcodeproj/project.pbxproj:
635         * JavaScriptCoreSources.bkl:
636         * kjs/AllInOneFile.cpp:
637         * kjs/ArrayConstructor.cpp:
638         * kjs/ArrayPrototype.cpp:
639         * kjs/BooleanPrototype.cpp:
640         * kjs/DatePrototype.cpp:
641         * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
642         * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
643         * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
644         * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
645         * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
646         * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
647         * kjs/JSGlobalObject.cpp:
648         * kjs/JSObject.cpp:
649         * kjs/JSValue.cpp:
650         * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
651         * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
652         * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
653         * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
654         * kjs/NumberPrototype.cpp:
655         * kjs/RegExpConstructor.cpp:
656         * kjs/RegExpObject.cpp:
657         * kjs/RegExpPrototype.cpp:
658         * kjs/StringPrototype.cpp:
659         * kjs/error_object.cpp: Removed.
660         * kjs/error_object.h: Removed.
661         * kjs/internal.cpp:
662
663 2008-06-29  Sam Weinig  <sam@webkit.org>
664
665         Fix non-AllInOne build.
666
667         * kjs/DateConstructor.cpp:
668         * kjs/DateMath.cpp:
669         * kjs/JSObject.cpp:
670
671 2008-06-29  Sam Weinig  <sam@webkit.org>
672
673         Rubber-stamped by Oliver Hunt.
674
675         Splits DateConstructor and DatePrototype out of date_object.h/cpp
676         Moves shared Date code into DateMath.
677
678         * DerivedSources.make:
679         * GNUmakefile.am:
680         * JavaScriptCore.pri:
681         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
682         * JavaScriptCore.xcodeproj/project.pbxproj:
683         * JavaScriptCoreSources.bkl:
684         * kjs/AllInOneFile.cpp:
685         * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
686         * kjs/DateConstructor.h: Copied from kjs/date_object.h.
687         * kjs/DateMath.cpp:
688         (KJS::ymdhmsToSeconds):
689         (KJS::):
690         (KJS::skipSpacesAndComments):
691         (KJS::findMonth):
692         (KJS::parseDate):
693         (KJS::timeClip):
694         (KJS::formatDate):
695         (KJS::formatDateUTCVariant):
696         (KJS::formatTime):
697         * kjs/DateMath.h:
698         (KJS::gmtoffset):
699         * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
700         * kjs/DatePrototype.h: Copied from kjs/date_object.h.
701         * kjs/JSGlobalObject.cpp:
702         * kjs/JSObject.cpp:
703         * kjs/date_object.cpp:
704         * kjs/date_object.h:
705         * kjs/internal.cpp:
706
707 2008-06-29  Jan Michael Alonzo  <jmalonzo@webkit.org>
708
709         Rubber-stamped by Cameron Zwarich
710
711         Fix Gtk non-AllInOne build
712
713         * GNUmakefile.am: include JSVariableObject.cpp
714         * kjs/RegExpConstructor.cpp: include RegExpObject.h
715         * kjs/RegExpObject.h: forward declare RegExpPrototype
716
717 2008-06-28  Darin Adler  <darin@apple.com>
718
719         Reviewed by Sam and Cameron.
720
721         - fix https://bugs.webkit.org/show_bug.cgi?id=19805
722           Array.concat turns missing array elements into "undefined"
723
724         Test: fast/js/array-holes.html
725
726         * JavaScriptCore.exp: No longer export JSArray::getItem.
727
728         * kjs/ArrayPrototype.cpp:
729         (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
730         JSArray::getItem -- need to handle properties from the prototype chain
731         instead of ignoring them.
732
733         * kjs/JSArray.cpp: Removed getItem.
734         * kjs/JSArray.h: Ditto.
735
736 2008-06-28  Darin Adler  <darin@apple.com>
737
738         Reviewed by Cameron.
739
740         - https://bugs.webkit.org/show_bug.cgi?id=19804
741           optimize access to arrays without "holes"
742
743         SunSpider says 1.8% faster.
744
745         * kjs/JSArray.cpp:
746         (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
747         arrays. Also updated for new location of m_vectorLength.
748         (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
749         (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
750         getOwnPropertySlot to make the hot part faster.
751         (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
752         indices lower than m_fastAccessCutoff. We can do theese with no
753         additional checks or branches.
754         (KJS::JSArray::put): Added a new faster case for indices lower than
755         m_fastAccessCutoff. We can do theese with no additional checks or
756         branches. Moved the maxArrayIndex handling out of this function.
757         Added code to set m_fastAccessCutoff when the very last hole in
758         an array is filled; this is how the cutoff gets set for most arrays.
759         (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
760         in here, to make the hot part of the put function faster.
761         (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
762         when a delete makes a new hole in the array.
763         (KJS::JSArray::getPropertyNames): Updated for new location of
764         m_vectorLength.
765         (KJS::JSArray::increaseVectorLength): Ditto.
766         (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
767         when setLength makes the array smaller.
768         (KJS::JSArray::mark): Updated for new location of m_vectorLength.
769         (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
770         all the holes to the end of the array.
771         (KJS::JSArray::compactForSorting): Ditto.
772         (KJS::JSArray::checkConsistency): Added consistency checks fro
773         m_fastAccessCutoff and updated for the new location of m_vectorLength.
774
775         * kjs/JSArray.h: Added declarations for slow case functions.
776         Replaced m_vectorLength with m_fastAccessCutoff.
777
778 2008-06-28  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
779
780         Reviewed by Sam.
781
782         When executing a native call, check for an exception before writing the
783         return value.
784
785         * VM/Machine.cpp:
786         (KJS::Machine::privateExecute):
787
788 2008-06-28  Mark Rowe  <mrowe@apple.com>
789
790         Build fix.  Flag headers as private or public as is appropriate.
791         These settings were accidentally removed during some project file cleanup.
792
793         * JavaScriptCore.xcodeproj/project.pbxproj:
794
795 2008-06-28  Sam Weinig  <sam@webkit.org>
796
797         Rubber-stamped by Darin Adler.
798
799         Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
800
801         * DerivedSources.make:
802         * GNUmakefile.am:
803         * JavaScriptCore.pri:
804         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
805         * JavaScriptCore.xcodeproj/project.pbxproj:
806         * JavaScriptCoreSources.bkl:
807         * VM/Machine.cpp:
808         * kjs/AllInOneFile.cpp:
809         * kjs/JSGlobalObject.cpp:
810         * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
811         * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
812         * kjs/RegExpObject.cpp:
813         * kjs/RegExpObject.h:
814         * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
815         * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
816         * kjs/StringPrototype.cpp:
817         * kjs/internal.cpp:
818
819 2008-06-28  Sam Weinig  <sam@webkit.org>
820
821         Fix non-AllInOne builds.
822
823         * kjs/StringConstructor.cpp:
824
825 2008-06-28  Sam Weinig  <sam@webkit.org>
826
827         Rubber-stamped by Darin Adler.
828
829         Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
830         StringConstructor and StringPrototype.
831
832         * DerivedSources.make:
833         * GNUmakefile.am:
834         * JavaScriptCore.pri:
835         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
836         * JavaScriptCore.xcodeproj/project.pbxproj:
837         * JavaScriptCoreSources.bkl:
838         * kjs/AllInOneFile.cpp:
839         * kjs/JSGlobalObject.cpp:
840         * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
841         * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
842         * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
843         * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
844         * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
845         * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
846         * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
847         * kjs/internal.cpp:
848         * kjs/string_object.cpp: Removed.
849         * kjs/string_object.h: Removed.
850
851 2008-06-28  Jan Michael Alonzo  <jmalonzo@webkit.org>
852
853         Gtk build fix: JSVariableObject is now part of AllInOne
854
855         * GNUmakefile.am:
856
857 2008-06-28  Darin Adler  <darin@apple.com>
858
859         Reviewed by Oliver.
860
861         - https://bugs.webkit.org/show_bug.cgi?id=19801
862           add a feature so we can tell what regular expressions are taking time
863
864         * pcre/pcre_compile.cpp:
865         (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
866
867         * pcre/pcre_exec.cpp:
868         (jsRegExpExecute): Add hook to time execution.
869         (Histogram::~Histogram): Print a sorted list of what took time.
870         (Histogram::add): Accumulate records of what took time.
871         (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
872         Histogram::add at the right moment and creates the global histogram
873         object.
874
875         * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
876
877         * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
878         any more, but an omissions an earlier version of this patch detected.
879         * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
880         * pcre/pcre_xclass.cpp: Ditto.
881
882 2008-06-28  Sam Weinig  <sam@webkit.org>
883
884         Try and fix the Windows build again.
885
886         * kjs/RegExpObject.cpp:
887         * kjs/date_object.cpp:
888         * kjs/error_object.cpp:
889
890 2008-06-28  Sam Weinig  <sam@webkit.org>
891
892         Rubber-stamped by Darin Adler.
893
894         Remove unused StringConstructorFunction class.
895
896         * kjs/string_object.h:
897
898 2008-06-28  Sam Weinig  <sam@webkit.org>
899
900         Fix windows build.
901
902         * kjs/ArrayPrototype.cpp:
903         * kjs/BooleanPrototype.cpp:
904         * kjs/BooleanPrototype.h:
905         * kjs/FunctionPrototype.cpp:
906         * kjs/JSImmediate.cpp:
907         * kjs/JSObject.cpp:
908         * kjs/MathObject.cpp:
909         * kjs/NumberPrototype.cpp:
910         * kjs/NumberPrototype.h:
911         * kjs/ObjectConstructor.cpp:
912         * kjs/RegExpObject.h:
913         * kjs/error_object.h:
914         * kjs/string_object.cpp:
915
916 2008-06-28  Sam Weinig  <sam@webkit.org>
917
918         Rubber-stamped by Oliver Hunt.
919
920         Splits FunctionConstructor out of FunctionPrototype.h/cpp
921         Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
922         Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
923
924         * API/JSCallbackConstructor.cpp:
925         * API/JSClassRef.cpp:
926         * API/JSObjectRef.cpp:
927         * DerivedSources.make:
928         * GNUmakefile.am:
929         * JavaScriptCore.pri:
930         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
931         * JavaScriptCore.xcodeproj/project.pbxproj:
932         * JavaScriptCoreSources.bkl:
933         * VM/Machine.cpp:
934         * kjs/AllInOneFile.cpp:
935         * kjs/ArrayConstructor.cpp:
936         * kjs/ArrayConstructor.h:
937         * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
938         * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
939         * kjs/FunctionPrototype.cpp:
940         * kjs/FunctionPrototype.h:
941         * kjs/JSFunction.cpp:
942         * kjs/JSGlobalObject.cpp:
943         * kjs/JSImmediate.cpp:
944         * kjs/MathObject.h:
945         * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
946         * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
947         * kjs/NumberObject.cpp:
948         * kjs/NumberObject.h:
949         * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
950         * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
951         * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
952         * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
953         * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
954         * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
955         * kjs/RegExpObject.h:
956         * kjs/Shell.cpp:
957         * kjs/error_object.h:
958         * kjs/internal.cpp:
959         * kjs/nodes.cpp:
960         * kjs/object_object.cpp: Removed.
961         * kjs/object_object.h: Removed.
962         * kjs/string_object.h:
963
964 2008-06-28  Darin Adler  <darin@apple.com>
965
966         Reviewed by Oliver.
967
968         - fix https://bugs.webkit.org/show_bug.cgi?id=19796
969           optimize expressions with ignored results (especially post-increment)
970
971         SunSpider says 0.9% faster.
972
973         * VM/CodeGenerator.h:
974         (KJS::CodeGenerator::tempDestination): Create a new temporary for
975         ignoredResult() too, just as we would for 0.
976         (KJS::CodeGenerator::finalDestination): Use the temporary if the
977         register passed in is ignoredResult() too, just as we would for 0.
978         (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
979         passed in register is ignoredResult(), just as we would for 0.
980         (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
981         register passed in is ignoredResult(). What matters is that we
982         don't want to emit a move. The return value won't be looked at.
983         (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
984         through to the node's emitCode function.
985
986         * VM/RegisterID.h:
987         (KJS::ignoredResult): Added. Special value to indicate the result of
988         a node will be ignored and need not be put in any register.
989
990         * kjs/nodes.cpp:
991         (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
992         (KJS::BooleanNode::emitCode): Ditto.
993         (KJS::NumberNode::emitCode): Ditto.
994         (KJS::StringNode::emitCode): Ditto.
995         (KJS::RegExpNode::emitCode): Ditto.
996         (KJS::ThisNode::emitCode): Ditto.
997         (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
998         the identifier resolves to a local variable.
999         (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
1000         and the object is empty.
1001         (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
1002         nothing for the local constant case, and do a pre-increment in all the
1003         other cases.
1004         (KJS::PostDecResolveNode::emitCode): Ditto.
1005         (KJS::PostIncBracketNode::emitCode): Ditto.
1006         (KJS::PostDecBracketNode::emitCode): Ditto.
1007         (KJS::PostIncDotNode::emitCode): Ditto.
1008         (KJS::PostDecDotNode::emitCode): Ditto.
1009         (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
1010         the expression.
1011         (KJS::VoidNode::emitCode): Ditto.
1012         (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
1013         if the identifier resolves to a local variable, and don't bother generating
1014         a typeof opcode in the other case.
1015         (KJS::TypeOfValueNode::emitCode): Ditto.
1016         (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
1017         the identifier resolves to a local constant.
1018         (KJS::PreDecResolveNode::emitCode): Ditto.
1019         (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
1020         places, because we need to put the result into a register so we can assign
1021         it. At other sites this is taken care of by functions like finalDestination.
1022         (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
1023         expression.
1024         (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
1025         third expressions.
1026         (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
1027         expression.
1028
1029 2008-06-28  Darin Adler  <darin@apple.com>
1030
1031         Reviewed by Oliver.
1032
1033         - https://bugs.webkit.org/show_bug.cgi?id=19787
1034           create most arrays from values in registers rather than with multiple put operations
1035
1036         SunSpider says 0.8% faster.
1037
1038         * VM/CodeBlock.cpp:
1039         (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
1040         * VM/Machine.cpp:
1041         (KJS::Machine::privateExecute): Ditto.
1042
1043         * VM/CodeGenerator.cpp:
1044         (KJS::CodeGenerator::emitNewArray): Added.
1045         * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
1046
1047         * kjs/nodes.cpp:
1048         (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
1049         initialized with as many elements as possible. If the array doesn't have any
1050         holes in it, that's all that's needed. If there are holes, then emit some separate
1051         put operations for the other values in the array and for the length as needed.
1052
1053         * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
1054         iterate through elements and generate code to evaluate them. Now ArrayNode does
1055         not need to be a friend. Also took out some unused PlacementNewAdoptType
1056         constructors.
1057
1058 2008-06-28  Darin Adler  <darin@apple.com>
1059
1060         Reviewed by Oliver.
1061
1062         * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
1063         We no longer mutate the AST in place.
1064
1065 2008-06-28  Jan Michael Alonzo  <jmalonzo@webkit.org>
1066
1067         Reviewed by Oliver Hunt.
1068
1069         Build fix
1070
1071         * VM/Machine.cpp: include stdio.h for printf
1072
1073 2008-06-27  Sam Weinig  <sam@webkit.org>
1074
1075         Reviewed by Oliver Hunt.
1076
1077         Fix platforms that don't use AllInOne.cpp
1078
1079         * kjs/BooleanConstructor.h:
1080         * kjs/BooleanPrototype.h:
1081         * kjs/FunctionPrototype.cpp:
1082
1083 2008-06-27  Sam Weinig  <sam@webkit.org>
1084
1085         Rubber-stamped by Oliver Hunt.
1086
1087         Splits ArrayConstructor out of ArrayPrototype.h/cpp
1088         Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
1089
1090         * GNUmakefile.am:
1091         * JavaScriptCore.pri:
1092         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1093         * JavaScriptCore.xcodeproj/project.pbxproj:
1094         * JavaScriptCoreSources.bkl:
1095         * VM/Machine.cpp:
1096         * kjs/AllInOneFile.cpp:
1097         * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
1098         * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
1099         * kjs/ArrayPrototype.cpp:
1100         * kjs/ArrayPrototype.h:
1101         * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
1102         * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
1103         * kjs/BooleanObject.cpp:
1104         * kjs/BooleanObject.h:
1105         * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
1106         * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
1107         * kjs/CommonIdentifiers.h:
1108         * kjs/FunctionPrototype.cpp:
1109         * kjs/JSArray.cpp:
1110         * kjs/JSGlobalObject.cpp:
1111         * kjs/JSImmediate.cpp:
1112         * kjs/Shell.cpp:
1113         * kjs/internal.cpp:
1114         * kjs/nodes.cpp:
1115         * kjs/string_object.cpp:
1116
1117 2008-06-27  Oliver Hunt  <oliver@apple.com>
1118
1119         Reviewed by Sam.
1120
1121         Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
1122         <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
1123
1124         Adds support for the slow script dialog in squirrelfish.  This requires the addition
1125         of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
1126         same behaviour as their simple jump equivalents but have an additional time out check.
1127
1128         Additional assertions were added to other jump instructions to prevent accidentally
1129         creating loops with jump types that do not support time out checks.
1130
1131         Sunspider does not report a regression, however this appears very sensitive to code
1132         layout and hardware, so i would expect up to a 1% regression on other systems.
1133
1134         Part of this required moving the old timeout logic from JSGlobalObject and into Machine
1135         which is the cause of a number of the larger diff blocks.
1136
1137         * JavaScriptCore.exp:
1138         * VM/CodeBlock.cpp:
1139         (KJS::CodeBlock::dump):
1140         * VM/CodeGenerator.cpp:
1141         (KJS::CodeGenerator::emitJumpIfTrue):
1142         (KJS::CodeGenerator::emitJumpScopes):
1143         * VM/ExceptionHelpers.cpp:
1144         (KJS::InterruptedExecutionError::isWatchdogException):
1145         (KJS::createInterruptedExecutionException):
1146         * VM/ExceptionHelpers.h:
1147         * VM/LabelID.h:
1148         * VM/Machine.cpp:
1149         (KJS::Machine::Machine):
1150         (KJS::Machine::throwException):
1151         (KJS::Machine::resetTimeoutCheck):
1152         (KJS::getCurrentTime):
1153         (KJS::Machine::checkTimeout):
1154         (KJS::Machine::privateExecute):
1155         * VM/Machine.h:
1156         (KJS::Machine::setTimeoutTime):
1157         (KJS::Machine::startTimeoutCheck):
1158         (KJS::Machine::stopTimeoutCheck):
1159         (KJS::Machine::initTimeout):
1160         * VM/Opcode.cpp:
1161         (KJS::):
1162         * VM/Opcode.h:
1163         * kjs/JSGlobalObject.cpp:
1164         (KJS::JSGlobalObject::init):
1165         (KJS::JSGlobalObject::setTimeoutTime):
1166         (KJS::JSGlobalObject::startTimeoutCheck):
1167         * kjs/JSGlobalObject.h:
1168         * kjs/JSObject.h:
1169         * kjs/interpreter.cpp:
1170         (KJS::Interpreter::evaluate):
1171
1172 2008-06-27  Jan Michael Alonzo  <jmalonzo@webkit.org>
1173
1174         Gtk and Qt build fix: Remove RegisterFileStack from the build
1175         scripts.
1176
1177         * GNUmakefile.am:
1178         * JavaScriptCore.pri:
1179
1180 2008-06-27  Adele Peterson  <adele@apple.com>
1181
1182         Reviewed by Geoff.
1183
1184         Build fixes. 
1185
1186         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1187         * VM/RegisterFile.h:
1188         (KJS::RegisterFile::RegisterFile):
1189         * kjs/JSGlobalObject.cpp:
1190         * kjs/collector.cpp:
1191
1192 2008-06-27  Geoffrey Garen  <ggaren@apple.com>
1193
1194         Reviewed by Oliver Hunt.
1195         
1196         One RegisterFile to rule them all!
1197         
1198         SunSpider reports a 0.2% speedup.
1199
1200         This patch removes the RegisterFileStack abstraction and replaces it with
1201         a single register file that
1202         
1203         (a) allocates a fixed storage area, including a fixed area for global
1204         vars, so that no operation may cause the register file to reallocate
1205         
1206         and
1207
1208         (b) swaps between global storage areas when executing code in different 
1209         global objects.
1210         
1211         This patch also changes the layout of the register file so that all call
1212         frames, including call frames for global code, get a header. This is
1213         required to support re-entrant global code. It also just makes things simpler.
1214         
1215         * VM/CodeGenerator.cpp:
1216         (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
1217         that
1218         
1219         (a) global vars don't contribute to a CodeBlock's numLocals count, since
1220         global storage is fixed and allocated at startup
1221         
1222         and
1223         
1224         (b) references to global vars get shifted to elide intermediate stack
1225         between "r" and the global storage area.
1226         
1227         * VM/Machine.cpp:
1228         (KJS::Machine::dumpRegisters): Updated this function to match the new
1229         register file layout, and added the ability to dump exact identifiers
1230         for the different parts of a call frame.
1231         
1232         (KJS::Machine::unwindCallFrame): Updated this function to match the new
1233         register file layout.
1234          
1235         (KJS::Machine::execute): Updated this function to initialize a call frame
1236         header for global code, and to swap global storage areas when switching
1237         to execution in a new global object.
1238         
1239         (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
1240         of registerBase because the register file is always safe for reentry now,
1241         and registerBase never changes.
1242         
1243         * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
1244         to resolve a header dependency problem (a good sign that the enum belonged
1245         in RegisterFile all along!)
1246
1247         * VM/RegisterFile.cpp:
1248         * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
1249         area. This allows us to avoid re-allocting the register file later on.
1250         Instead, we rely on the OS to allocate physical pages to the register
1251         file as necessary.
1252
1253         * VM/RegisterFileStack.cpp: Removed. Tada!
1254         * VM/RegisterFileStack.h: Removed. Tada!
1255
1256         * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
1257         register file layout, greatly simplifying it in the process.
1258
1259         * kjs/JSActivation.h:
1260         * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
1261         since the global object now needs to be able to tear off its registers
1262         just like the activation object.
1263
1264         * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
1265
1266         * kjs/JSGlobalObject.h:
1267         * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
1268         global storage area into and out of the register file.
1269
1270         * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
1271
1272         * kjs/collector.cpp: Renamed markStackObjectConservatively to
1273         markConservatively, since we don't just mark stack objects this way.
1274         
1275         Also, added code to mark the machine's register file.
1276
1277         * kjs/config.h: Moved some platforms #defines from here...
1278         * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
1279         in RegisterFile.h.
1280
1281 2008-06-26  Mark Rowe  <mrowe@apple.com>
1282
1283         Speculative fix for the Windows build.
1284
1285         * kjs/JSImmediate.cpp:
1286
1287 2008-06-26  Mark Rowe  <mrowe@apple.com>
1288
1289         Reviewed by Darin Adler and Geoff Garen.
1290
1291         Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
1292         bogus output in an application that uses JavaScriptCore.
1293
1294         * kjs/CollectorHeapIntrospector.cpp:
1295         (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
1296         * kjs/CollectorHeapIntrospector.h:
1297         * wtf/FastMalloc.cpp: Zero out the statistics.  FastMalloc doesn't track this information at present.
1298         Returning zero for all values is preferable to returning bogus data.
1299
1300 2008-06-26  Darin Adler  <darin@apple.com>
1301
1302         Reviewed by Geoff.
1303
1304         - https://bugs.webkit.org/show_bug.cgi?id=19721
1305           speed up JavaScriptCore by not wrapping strings in objects just
1306           to call functions on them
1307
1308         - optimize UString append and the replace function a bit
1309
1310         SunSpider says 1.8% faster.
1311
1312         * JavaScriptCore.exp: Updated.
1313
1314         * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
1315         because jsString returns a JSString*.
1316
1317         * VM/Machine.cpp:
1318         (KJS::Machine::privateExecute): Removed the toObject call from native
1319         function calls. Also removed code to put the this value into a register.
1320
1321         * kjs/BooleanObject.cpp:
1322         (KJS::booleanProtoFuncToString): Rewrite to handle false and true
1323         separately.
1324
1325         * kjs/FunctionPrototype.cpp:
1326         (KJS::constructFunction): Use single-character append rather than building
1327         a string for each character.
1328         * kjs/JSFunction.cpp:
1329         (KJS::globalFuncUnescape): Ditto.
1330
1331         * kjs/JSImmediate.cpp:
1332         (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
1333         use with an immediate value. To be used instead of toObject when doing a
1334         get on an immediate value.
1335         * kjs/JSImmediate.h: Added prototype.
1336
1337         * kjs/JSObject.cpp:
1338         (KJS::JSObject::toString): Tweaked formatting.
1339
1340         * kjs/JSObject.h:
1341         (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
1342         an object wrapper just to search for properties. This also saves an
1343         unnecessary hash table lookup since the object wrappers themselves don't
1344         have any properties.
1345
1346         * kjs/JSString.h: Added toThisString and toThisJSString.
1347
1348         * kjs/JSValue.cpp:
1349         (KJS::JSCell::toThisString): Added.
1350         (KJS::JSCell::toThisJSString): Added.
1351         (KJS::JSCell::getJSNumber): Added.
1352         (KJS::jsString): Changed return type to JSString*.
1353         (KJS::jsOwnedString): Ditto.
1354
1355         * kjs/JSValue.h:
1356         (KJS::JSValue::toThisString): Added.
1357         (KJS::JSValue::toThisJSString): Added.
1358         (KJS::JSValue::getJSNumber): Added.
1359
1360         * kjs/NumberObject.cpp:
1361         (KJS::NumberObject::getJSNumber): Added.
1362         (KJS::integer_part_noexp): Append C string directly rather than first
1363         turning it into a UString.
1364         (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
1365         is a number rather than isObject(&NumberObject::info). This works for
1366         immediate numbers, number cells, and NumberObject instances.
1367         (KJS::numberProtoFuncToLocaleString): Ditto.
1368         (KJS::numberProtoFuncValueOf): Ditto.
1369         (KJS::numberProtoFuncToFixed): Ditto.
1370         (KJS::numberProtoFuncToExponential): Ditto.
1371         (KJS::numberProtoFuncToPrecision): Ditto.
1372         * kjs/NumberObject.h: Added getJSNumber.
1373
1374         * kjs/PropertySlot.cpp: Tweaked comment.
1375
1376         * kjs/internal.cpp:
1377         (KJS::JSString::toThisString): Added.
1378         (KJS::JSString::toThisJSString): Added.
1379         (KJS::JSString::getOwnPropertySlot): Changed code that searches the
1380         prototype chain to start with the string prototype and not create a
1381         string object.
1382         (KJS::JSNumberCell::toThisString): Added.
1383         (KJS::JSNumberCell::getJSNumber): Added.
1384
1385         * kjs/lookup.cpp:
1386         (KJS::staticFunctionGetter): Moved here, because there's no point in
1387         having a function that's only used for a function pointer be inline.
1388         (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
1389
1390         * kjs/lookup.h:
1391         (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
1392         to have a function that's only used for a function pointer be inline.
1393         (KJS::getStaticFunctionSlot): Changed to get properties from the parent
1394         first before doing any handling of functions. This is the fastest way
1395         to return the function once the initial setup is done.
1396
1397         * kjs/string_object.cpp:
1398         (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
1399         avoiding an unnecessary virtual function call (the call to the type()
1400         function in the implementation of the isString() function).
1401         (KJS::StringObject::toString): Added.
1402         (KJS::StringObject::toThisString): Added.
1403         (KJS::StringObject::toThisJSString): Added.
1404         (KJS::substituteBackreferences): Rewrote to use a appending algorithm
1405         instead of a the old one that tried to replace in place.
1406         (KJS::stringProtoFuncReplace): Merged this function and the replace function.
1407         Replaced the hand-rolled dynamic arrays for source ranges and replacements
1408         with Vector.
1409         (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
1410         Removed the separate valueOf implementation, since it can just share this.
1411         (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
1412         well as StringObject, and is slightly more efficient than the old code too.
1413         (KJS::stringProtoFuncCharCodeAt): Ditto.
1414         (KJS::stringProtoFuncConcat): Ditto.
1415         (KJS::stringProtoFuncIndexOf): Ditto.
1416         (KJS::stringProtoFuncLastIndexOf): Ditto.
1417         (KJS::stringProtoFuncMatch): Ditto.
1418         (KJS::stringProtoFuncSearch): Ditto.
1419         (KJS::stringProtoFuncSlice): Ditto.
1420         (KJS::stringProtoFuncSplit): Ditto.
1421         (KJS::stringProtoFuncSubstr): Ditto.
1422         (KJS::stringProtoFuncSubstring): Ditto.
1423         (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
1424         (KJS::stringProtoFuncToUpperCase): Ditto.
1425         (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
1426         (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
1427         (KJS::stringProtoFuncLocaleCompare): Ditto.
1428         (KJS::stringProtoFuncBig): Use toThisString.
1429         (KJS::stringProtoFuncSmall): Ditto.
1430         (KJS::stringProtoFuncBlink): Ditto.
1431         (KJS::stringProtoFuncBold): Ditto.
1432         (KJS::stringProtoFuncFixed): Ditto.
1433         (KJS::stringProtoFuncItalics): Ditto.
1434         (KJS::stringProtoFuncStrike): Ditto.
1435         (KJS::stringProtoFuncSub): Ditto.
1436         (KJS::stringProtoFuncSup): Ditto.
1437         (KJS::stringProtoFuncFontcolor): Ditto.
1438         (KJS::stringProtoFuncFontsize): Ditto.
1439         (KJS::stringProtoFuncAnchor): Ditto.
1440         (KJS::stringProtoFuncLink): Ditto.
1441
1442         * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
1443
1444         * kjs/ustring.cpp:
1445         (KJS::UString::append): Added a version that takes a character pointer and
1446         size, so we don't have to create a UString just to append to another UString.
1447         * kjs/ustring.h:
1448
1449 2008-06-26  Alexey Proskuryakov  <ap@webkit.org>
1450
1451         Reviewed by Maciej.
1452
1453         Make JSGlobalData per-thread.
1454
1455         No change on SunSpider total.
1456
1457         * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
1458
1459         * kjs/JSGlobalObject.cpp:
1460         (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
1461         want to preserve these somehow to keep legacy behavior in working condition.
1462         (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
1463         when updating JSGlobalObject linked list.
1464
1465         * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
1466         to use JSGlobalData associated with the current object.
1467
1468         * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
1469         Heap::registerAsMainThread() call.
1470
1471         * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
1472         transient, and while newParserObjects may conceptually be such, there is still some node
1473         manipulation going on outside Parser::parse which touches it.
1474
1475         * kjs/JSGlobalData.cpp:
1476         (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
1477         (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
1478
1479         * kjs/collector.cpp:
1480         (KJS::Heap::Heap):
1481         (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
1482         (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
1483         (KJS::Heap::collect): Ditto.
1484         (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
1485         list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
1486         work with the main thread currently anyway.
1487         (KJS::Heap::protectedGlobalObjectCount): Ditto.
1488
1489         * kjs/collector.h: Removed code related to "collect on main thread only" logic.
1490
1491         * JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
1492
1493 2008-06-26  Alexey Proskuryakov  <ap@webkit.org>
1494
1495         Reviewed by Darin.
1496
1497         https://bugs.webkit.org/show_bug.cgi?id=19767
1498         REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
1499
1500         * kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
1501         Made changing balance factor from -1 to +1 work correctly.
1502
1503         * wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
1504         this slightly earlier.
1505
1506 2008-06-25  Timothy Hatcher  <timothy@apple.com>
1507
1508         Fixes an ASSERT in the profiler when starting multiple profiles
1509         with the same name inside the same function/program.
1510
1511         Reviewed by Kevin McCullough.
1512
1513         * profiler/Profile.cpp:
1514         (KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
1515         (KJS::Profile::stopProfiling): Set the current node to the parent,
1516         because we are in a call that will not get a didExecute call.
1517         (KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
1518         account for didExecute not being called for profile.
1519         (KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
1520         (KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
1521         greater than zero, and return early.
1522         * profiler/Profile.h: Added stoppedProfiling().
1523         * profiler/Profiler.cpp:
1524         (KJS::Profiler::findProfile): Removed.
1525         (KJS::Profiler::startProfiling): Don't return early for stopped profiles.
1526         (KJS::Profiler::stopProfiling): Skipp stopped profiles.
1527         (KJS::Profiler::didFinishAllExecution): Code clean-up.
1528         * profiler/Profiler.h: Removed findProfile.
1529
1530 2008-06-25  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1531
1532         Reviewed by Alexey Proskuryakov.
1533
1534         Attempt to fix Windows debug build. The compiler gives a warning when
1535         Structured Exception Handling and destructors are used in the same
1536         function. Using manual locking and unlocking instead of constructors
1537         and destructors should fix the warning.
1538
1539         * kjs/Shell.cpp:
1540         (main):
1541
1542 2008-06-25  Alexey Proskuryakov  <ap@webkit.org>
1543
1544         Forgot to address a review comment about better names for tracked objects, doing it now.
1545
1546         * kjs/JSGlobalData.cpp:
1547         (KJS::JSGlobalData::JSGlobalData):
1548         * kjs/JSGlobalData.h:
1549         * kjs/nodes.cpp:
1550         (KJS::ParserRefCounted::ParserRefCounted):
1551         (KJS::ParserRefCounted::ref):
1552         (KJS::ParserRefCounted::deref):
1553         (KJS::ParserRefCounted::hasOneRef):
1554         (KJS::ParserRefCounted::deleteNewObjects):
1555
1556 2008-06-25  Alexey Proskuryakov  <ap@webkit.org>
1557
1558         Reviewed by Geoff.
1559
1560         Remove more threadInstance() calls.
1561
1562         * kjs/JSFunction.cpp:
1563         (KJS::JSFunction::getParameterName):
1564         (KJS::IndexToNameMap::unMap):
1565         (KJS::Arguments::deleteProperty):
1566         * kjs/JSFunction.h:
1567         Access nullIdentifier without going to thread specific storage.
1568
1569         * JavaScriptCore.exp:
1570         * kjs/JSGlobalData.cpp:
1571         (KJS::JSGlobalData::JSGlobalData):
1572         * kjs/JSGlobalData.h:
1573         * kjs/Parser.cpp:
1574         (KJS::Parser::parse):
1575         * kjs/Parser.h:
1576         (KJS::ParserRefCountedData::ParserRefCountedData):
1577         (KJS::Parser::parse):
1578         * kjs/grammar.y:
1579         * kjs/nodes.cpp:
1580         (KJS::ParserRefCounted::ParserRefCounted):
1581         (KJS::ParserRefCounted::ref):
1582         (KJS::ParserRefCounted::deref):
1583         (KJS::ParserRefCounted::hasOneRef):
1584         (KJS::ParserRefCounted::deleteNewObjects):
1585         (KJS::Node::Node):
1586         (KJS::StatementNode::StatementNode):
1587         (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
1588         (KJS::ConstDeclNode::ConstDeclNode):
1589         (KJS::BlockNode::BlockNode):
1590         (KJS::ForInNode::ForInNode):
1591         (KJS::ScopeNode::ScopeNode):
1592         (KJS::ProgramNode::ProgramNode):
1593         (KJS::ProgramNode::create):
1594         (KJS::EvalNode::EvalNode):
1595         (KJS::EvalNode::create):
1596         (KJS::FunctionBodyNode::FunctionBodyNode):
1597         (KJS::FunctionBodyNode::create):
1598         * kjs/nodes.h:
1599         (KJS::ExpressionNode::):
1600         (KJS::NullNode::):
1601         (KJS::BooleanNode::):
1602         (KJS::NumberNode::):
1603         (KJS::ImmediateNumberNode::):
1604         (KJS::StringNode::):
1605         (KJS::RegExpNode::):
1606         (KJS::ThisNode::):
1607         (KJS::ResolveNode::):
1608         (KJS::ElementNode::):
1609         (KJS::ArrayNode::):
1610         (KJS::PropertyNode::):
1611         (KJS::PropertyListNode::):
1612         (KJS::ObjectLiteralNode::):
1613         (KJS::BracketAccessorNode::):
1614         (KJS::DotAccessorNode::):
1615         (KJS::ArgumentListNode::):
1616         (KJS::ArgumentsNode::):
1617         (KJS::NewExprNode::):
1618         (KJS::EvalFunctionCallNode::):
1619         (KJS::FunctionCallValueNode::):
1620         (KJS::FunctionCallResolveNode::):
1621         (KJS::FunctionCallBracketNode::):
1622         (KJS::FunctionCallDotNode::):
1623         (KJS::PrePostResolveNode::):
1624         (KJS::PostIncResolveNode::):
1625         (KJS::PostDecResolveNode::):
1626         (KJS::PostfixBracketNode::):
1627         (KJS::PostIncBracketNode::):
1628         (KJS::PostDecBracketNode::):
1629         (KJS::PostfixDotNode::):
1630         (KJS::PostIncDotNode::):
1631         (KJS::PostDecDotNode::):
1632         (KJS::PostfixErrorNode::):
1633         (KJS::DeleteResolveNode::):
1634         (KJS::DeleteBracketNode::):
1635         (KJS::DeleteDotNode::):
1636         (KJS::DeleteValueNode::):
1637         (KJS::VoidNode::):
1638         (KJS::TypeOfResolveNode::):
1639         (KJS::TypeOfValueNode::):
1640         (KJS::PreIncResolveNode::):
1641         (KJS::PreDecResolveNode::):
1642         (KJS::PrefixBracketNode::):
1643         (KJS::PreIncBracketNode::):
1644         (KJS::PreDecBracketNode::):
1645         (KJS::PrefixDotNode::):
1646         (KJS::PreIncDotNode::):
1647         (KJS::PreDecDotNode::):
1648         (KJS::PrefixErrorNode::):
1649         (KJS::UnaryOpNode::UnaryOpNode):
1650         (KJS::UnaryPlusNode::):
1651         (KJS::NegateNode::):
1652         (KJS::BitwiseNotNode::):
1653         (KJS::LogicalNotNode::):
1654         (KJS::BinaryOpNode::BinaryOpNode):
1655         (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
1656         (KJS::MultNode::):
1657         (KJS::DivNode::):
1658         (KJS::ModNode::):
1659         (KJS::AddNode::):
1660         (KJS::SubNode::):
1661         (KJS::LeftShiftNode::):
1662         (KJS::RightShiftNode::):
1663         (KJS::UnsignedRightShiftNode::):
1664         (KJS::LessNode::):
1665         (KJS::GreaterNode::):
1666         (KJS::LessEqNode::):
1667         (KJS::GreaterEqNode::):
1668         (KJS::InstanceOfNode::):
1669         (KJS::InNode::):
1670         (KJS::EqualNode::):
1671         (KJS::NotEqualNode::):
1672         (KJS::StrictEqualNode::):
1673         (KJS::NotStrictEqualNode::):
1674         (KJS::BitAndNode::):
1675         (KJS::BitOrNode::):
1676         (KJS::BitXOrNode::):
1677         (KJS::LogicalAndNode::):
1678         (KJS::LogicalOrNode::):
1679         (KJS::ConditionalNode::):
1680         (KJS::ReadModifyResolveNode::):
1681         (KJS::AssignResolveNode::):
1682         (KJS::ReadModifyBracketNode::):
1683         (KJS::AssignBracketNode::):
1684         (KJS::AssignDotNode::):
1685         (KJS::ReadModifyDotNode::):
1686         (KJS::AssignErrorNode::):
1687         (KJS::CommaNode::):
1688         (KJS::VarDeclCommaNode::):
1689         (KJS::ConstStatementNode::):
1690         (KJS::SourceElements::SourceElements):
1691         (KJS::EmptyStatementNode::):
1692         (KJS::DebuggerStatementNode::):
1693         (KJS::ExprStatementNode::):
1694         (KJS::VarStatementNode::):
1695         (KJS::IfNode::):
1696         (KJS::IfElseNode::):
1697         (KJS::DoWhileNode::):
1698         (KJS::WhileNode::):
1699         (KJS::ForNode::):
1700         (KJS::ContinueNode::):
1701         (KJS::BreakNode::):
1702         (KJS::ReturnNode::):
1703         (KJS::WithNode::):
1704         (KJS::LabelNode::):
1705         (KJS::ThrowNode::):
1706         (KJS::TryNode::):
1707         (KJS::ParameterNode::):
1708         (KJS::FuncExprNode::):
1709         (KJS::FuncDeclNode::):
1710         (KJS::CaseClauseNode::):
1711         (KJS::ClauseListNode::):
1712         (KJS::CaseBlockNode::):
1713         (KJS::SwitchNode::):
1714         Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
1715         threadInstance calls.
1716
1717 2008-06-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1718
1719         Reviewed by Alexey Proskuryakov.
1720
1721         Make the JavaScript shell collect the heap from main() instead of
1722         jscmain() to suppress leak messages in debug builds.
1723
1724         * kjs/Shell.cpp:
1725         (main):
1726         (jscmain):
1727
1728 2008-06-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1729
1730         Reviewed by Maciej.
1731
1732         Make the conversion of the pair (less, jtrue) to jless use register
1733         reference counting information for safety instead of requiring callers
1734         to decide whether it is safe.
1735
1736         No changes on SunSpider codegen.
1737
1738         * VM/CodeGenerator.cpp:
1739         (KJS::CodeGenerator::emitJumpIfTrue):
1740         * VM/CodeGenerator.h:
1741         * kjs/nodes.cpp:
1742         (KJS::DoWhileNode::emitCode):
1743         (KJS::WhileNode::emitCode):
1744         (KJS::ForNode::emitCode):
1745         (KJS::CaseBlockNode::emitCodeForBlock):
1746
1747 2008-06-24  Kevin McCullough  <kmccullough@apple.com>
1748
1749         Reviewed by Tim.
1750
1751         <rdar://problem/6031594> JSProfiler: Profiler goes into an infinite
1752         loop sometimes.
1753         <rdar://problem/6031603> JSProfiler: Profiler asserts in debug and
1754         give the wrong times in release
1755
1756         Fixed two issues found by Tim in the same test.
1757
1758         * profiler/Profile.cpp:
1759         (KJS::Profile::removeProfileStart): No longer take profile's time from
1760         all ancestors, but instead attribute it to its parent.  Also add an
1761         Assert to ensure we only delete the child we mean to.
1762         (KJS::Profile::removeProfileEnd): Ditto for profileEnd.
1763         (KJS::Profile::didExecute): Cleaned up the execution order and correctly
1764         attribute all of the parent's time to the new node.
1765         * profiler/ProfileNode.cpp: If this node does not have a startTime it
1766         should not get a giant total time, but instead be 0.
1767         (KJS::ProfileNode::endAndRecordCall):
1768         * profiler/ProfileNode.h:
1769         (KJS::ProfileNode::removeChild): Should reset the sibling pointers since
1770         one of them has been removed.
1771
1772 2008-06-24  Darin Adler  <darin@apple.com>
1773
1774         Reviewed by Cameron.
1775
1776         - fix https://bugs.webkit.org/show_bug.cgi?id=19739
1777           REGRESSION: fast/js/property-getters-and-setters.html fails
1778
1779         * kjs/JSObject.cpp:
1780         (KJS::JSObject::put): Remove an untested optimization I checked in by accident.
1781         The two loops up the prototype chain both need to start from this; instead the
1782         second loop was starting where the first loop left off.
1783
1784 2008-06-24  Steve Falkenburg  <sfalken@apple.com>
1785
1786         Build fix.
1787
1788         * kjs/nodes.cpp:
1789
1790 2008-06-24  Joerg Bornemann  <joerg.bornemann@trolltech.com>
1791
1792         Reviewed by Simon.
1793
1794         For the Qt build on Windows don't depend on the presence of GNU CPP
1795         but use MSVC's preprocessor instead.
1796         dftables accepts a --preprocessor option which is set in pcre.pri for MSVC platforms.
1797
1798         * pcre/dftables: Added support for specifying the preprocessor command
1799         to use via --preprocessor, similar to
1800         WebCore/bindings/scripts/generate-bindings.pl.
1801         * pcre/pcre.pri: Pass --preprocessor='cl /e' to dftables, or more
1802         generally speaking QMAKE_CC /E for the win32-msvc buildspecs.
1803
1804 2008-06-24  Simon Hausmann  <hausmann@webkit.org>
1805
1806         Fix the Qt build, added missing include.
1807
1808         * kjs/PropertySlot.cpp:
1809
1810 2008-06-24  Alexey Proskuryakov  <ap@webkit.org>
1811
1812         Reviewed by Cameron Zwarich.
1813
1814         Make ParserRefCountedCounter actually perform a leak check.
1815
1816         * kjs/nodes.cpp:
1817         (KJS::ParserRefCountedCounter::~ParserRefCountedCounter): Check for leaks in destructor,
1818         not in constructor.
1819         (KJS::ParserRefCountedCounter::increment):
1820         (KJS::ParserRefCountedCounter::decrement):
1821         (KJS::ParserRefCounted::ParserRefCounted):
1822         (KJS::ParserRefCounted::~ParserRefCounted):
1823         While at it, also made counting thread-safe.
1824
1825 2008-06-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1826
1827         Reviewed by Oliver.
1828
1829         Bug 19730: REGRESSION (r34497): Text in alerts in "Leisure suit Larry" is not wrapped
1830         <https://bugs.webkit.org/show_bug.cgi?id=19730>
1831
1832         Do not convert the pair (less, jtrue) to jless when jtrue is a jump
1833         target. An example of this is when the condition of a while loop is a
1834         LogicalOrNode.
1835
1836         * VM/CodeGenerator.cpp:
1837         (KJS::CodeGenerator::emitLabel):
1838
1839 2008-06-20  Ariya Hidayat  <ariya.hidayat@trolltech.com>
1840
1841         Reviewed by Adam Roben.
1842
1843         Fix compile with MinGW.
1844
1845         * kjs/Shell.cpp:
1846         * wtf/Threading.h:
1847         (WTF::atomicIncrement):
1848         (WTF::atomicDecrement):
1849
1850 2008-06-23  Mark Rowe  <mrowe@apple.com>
1851
1852         Reviewed by Oliver Hunt.
1853
1854         Prepration for returning memory to the OS on Windows.  Track whether a portion of a span of memory was returned to the OS.
1855         If it was, ask that it be recommitted before returning it to the application as an allocated region.
1856
1857         * wtf/FastMalloc.cpp:
1858         (WTF::TCMalloc_PageHeap::New):  If the span was decommitted, ask that it be recommitted before returning it.
1859         (WTF::TCMalloc_PageHeap::AllocLarge):  Ditto.
1860         (WTF::TCMalloc_PageHeap::Carve):  When splitting a span, ensure that the decommitted state propogates to the two new spans.
1861         (WTF::TCMalloc_PageHeap::Delete):  When merging a span, ensure that the resulting span is marked as decommitted if any of the
1862         spans being merged were marked as decommitted.
1863         (WTF::TCMalloc_PageHeap::IncrementalScavenge):  Mark as decommitted after releasing the span.
1864         (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Add an assertion to catch a decommitted span being returned to the application
1865         without first being recommitted.
1866         (WTF::TCMalloc_Central_FreeList::Populate): Ditto.
1867         * wtf/TCSystemAlloc.cpp: Stub out TCMalloc_SystemCommit.
1868         * wtf/TCSystemAlloc.h:
1869
1870 2008-06-23  Mark Rowe  <mrowe@apple.com>
1871
1872         Reviewed by Sam Weinig.
1873
1874         Remove the sample member of Span when NO_TCMALLOC_SAMPLES is defined.
1875
1876         * wtf/FastMalloc.cpp:
1877         (WTF::TCMalloc_PageHeap::Delete): Only update Span::sample if NO_TCMALLOC_SAMPLES is not defined.
1878         (WTF::TCMallocStats::do_free):  Ditto.
1879
1880 2008-06-23  Darin Adler  <darin@apple.com>
1881
1882         Reviewed by Geoff.
1883
1884         - work toward https://bugs.webkit.org/show_bug.cgi?id=19721
1885
1886         More preparation toward making functions work on primitive types without
1887         creating wrapper objects. No speedup this time, but prepares for a future
1888         speedup without slowing things down.
1889
1890         SunSpider reports no change.
1891
1892         - Eliminated the implementsCall, callAsFunction and construct virtual
1893           functions from JSObject. Instead, the CallData and ConstructData for
1894           a native function includes a function pointer that the caller can use
1895           directly. Changed all call sites to use CallData and ConstructData.
1896
1897         - Changed the "this" argument to native functions to be a JSValue rather
1898           than a JSObject. This prepares us for passing primitives into these
1899           functions. The conversion to an object now must be done inside the
1900           function. Critically, if it's a function that can be called on a DOM
1901           window object, then we have to be sure to call toThisObject on the
1902           argument before we use it for anything even if it's already an object.
1903
1904         - Eliminated the practice of using constructor objects in the global
1905           object to make objects of the various basic types. Since these
1906           constructors can't be replaced by script, there's no reason to involve
1907           a constructor object at all. Added functions to do the construction
1908           directly.
1909
1910         - Made some more class members private and protected, including virtual
1911           function overrides. This can catch code using unnecessarily slow virtual
1912           function code paths when the type of an object is known statically. If we
1913           later find a new reason use the members outside the class it's easy to
1914           make them public again.
1915
1916         - Moved the declarations of the native implementations for functions out
1917           of header files. These can have internal linkage and be declared inside
1918           the source file.
1919
1920         - Changed PrototypeFunction to take function pointers with the right
1921           arguments to be put directly into CallData. This eliminates the
1922           need to have a separate PrototypeReflexiveFunction, and reveals that the
1923           real purpose of that class included something else specific to eval --
1924           storage of a cached global object. So renamed PrototypeReflexiveFunction
1925           to GlobalEvalFunction.
1926
1927         * API/JSCallbackConstructor.cpp:
1928         (KJS::constructJSCallback):
1929         (KJS::JSCallbackConstructor::getConstructData):
1930         * API/JSCallbackConstructor.h:
1931         * API/JSCallbackFunction.cpp:
1932         (KJS::JSCallbackFunction::implementsHasInstance):
1933         (KJS::JSCallbackFunction::call):
1934         (KJS::JSCallbackFunction::getCallData):
1935         * API/JSCallbackFunction.h:
1936         (KJS::JSCallbackFunction::classInfo):
1937         * API/JSCallbackObject.h:
1938         (KJS::JSCallbackObject::classRef):
1939         (KJS::JSCallbackObject::classInfo):
1940         * API/JSCallbackObjectFunctions.h:
1941         (KJS::::getConstructData):
1942         (KJS::::construct):
1943         (KJS::::getCallData):
1944         (KJS::::call):
1945         * API/JSObjectRef.cpp:
1946         (JSObjectMakeFunction):
1947         (JSObjectIsFunction):
1948         (JSObjectCallAsFunction):
1949         (JSObjectCallAsConstructor):
1950         * JavaScriptCore.exp:
1951         * VM/Machine.cpp:
1952         (KJS::jsTypeStringForValue):
1953         (KJS::Machine::privateExecute):
1954         * kjs/ArrayPrototype.cpp:
1955         (KJS::arrayProtoFuncToString):
1956         (KJS::arrayProtoFuncToLocaleString):
1957         (KJS::arrayProtoFuncJoin):
1958         (KJS::arrayProtoFuncConcat):
1959         (KJS::arrayProtoFuncPop):
1960         (KJS::arrayProtoFuncPush):
1961         (KJS::arrayProtoFuncReverse):
1962         (KJS::arrayProtoFuncShift):
1963         (KJS::arrayProtoFuncSlice):
1964         (KJS::arrayProtoFuncSort):
1965         (KJS::arrayProtoFuncSplice):
1966         (KJS::arrayProtoFuncUnShift):
1967         (KJS::arrayProtoFuncFilter):
1968         (KJS::arrayProtoFuncMap):
1969         (KJS::arrayProtoFuncEvery):
1970         (KJS::arrayProtoFuncForEach):
1971         (KJS::arrayProtoFuncSome):
1972         (KJS::arrayProtoFuncIndexOf):
1973         (KJS::arrayProtoFuncLastIndexOf):
1974         (KJS::ArrayConstructor::ArrayConstructor):
1975         (KJS::constructArrayWithSizeQuirk):
1976         (KJS::constructWithArrayConstructor):
1977         (KJS::ArrayConstructor::getConstructData):
1978         (KJS::callArrayConstructor):
1979         (KJS::ArrayConstructor::getCallData):
1980         * kjs/ArrayPrototype.h:
1981         * kjs/BooleanObject.cpp:
1982         (KJS::booleanProtoFuncToString):
1983         (KJS::booleanProtoFuncValueOf):
1984         (KJS::constructBoolean):
1985         (KJS::constructWithBooleanConstructor):
1986         (KJS::BooleanConstructor::getConstructData):
1987         (KJS::callBooleanConstructor):
1988         (KJS::BooleanConstructor::getCallData):
1989         (KJS::constructBooleanFromImmediateBoolean):
1990         * kjs/BooleanObject.h:
1991         * kjs/CallData.h:
1992         (KJS::):
1993         * kjs/ConstructData.h:
1994         (KJS::):
1995         * kjs/FunctionPrototype.cpp:
1996         (KJS::callFunctionPrototype):
1997         (KJS::FunctionPrototype::getCallData):
1998         (KJS::functionProtoFuncToString):
1999         (KJS::functionProtoFuncApply):
2000         (KJS::functionProtoFuncCall):
2001         (KJS::constructWithFunctionConstructor):
2002         (KJS::FunctionConstructor::getConstructData):
2003         (KJS::callFunctionConstructor):
2004         (KJS::FunctionConstructor::getCallData):
2005         (KJS::constructFunction):
2006         * kjs/FunctionPrototype.h:
2007         * kjs/JSArray.cpp:
2008         (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
2009         (KJS::JSArray::sort):
2010         (KJS::constructEmptyArray):
2011         (KJS::constructArray):
2012         * kjs/JSArray.h:
2013         (KJS::JSArray::classInfo):
2014         * kjs/JSFunction.cpp:
2015         (KJS::JSFunction::call):
2016         (KJS::globalFuncEval):
2017         (KJS::globalFuncParseInt):
2018         (KJS::globalFuncParseFloat):
2019         (KJS::globalFuncIsNaN):
2020         (KJS::globalFuncIsFinite):
2021         (KJS::globalFuncDecodeURI):
2022         (KJS::globalFuncDecodeURIComponent):
2023         (KJS::globalFuncEncodeURI):
2024         (KJS::globalFuncEncodeURIComponent):
2025         (KJS::globalFuncEscape):
2026         (KJS::globalFuncUnescape):
2027         (KJS::globalFuncKJSPrint):
2028         (KJS::PrototypeFunction::PrototypeFunction):
2029         (KJS::PrototypeFunction::getCallData):
2030         (KJS::GlobalEvalFunction::GlobalEvalFunction):
2031         (KJS::GlobalEvalFunction::mark):
2032         * kjs/JSFunction.h:
2033         (KJS::InternalFunction::classInfo):
2034         (KJS::InternalFunction::functionName):
2035         (KJS::JSFunction::classInfo):
2036         (KJS::GlobalEvalFunction::cachedGlobalObject):
2037         * kjs/JSGlobalObject.cpp:
2038         (KJS::JSGlobalObject::reset):
2039         (KJS::JSGlobalObject::mark):
2040         * kjs/JSGlobalObject.h:
2041         (KJS::JSGlobalObject::JSGlobalObject):
2042         (KJS::JSGlobalObject::evalFunction):
2043         * kjs/JSImmediate.cpp:
2044         (KJS::JSImmediate::toObject):
2045         * kjs/JSNotAnObject.cpp:
2046         * kjs/JSNotAnObject.h:
2047         * kjs/JSObject.cpp:
2048         (KJS::JSObject::put):
2049         (KJS::callDefaultValueFunction):
2050         (KJS::JSObject::defaultValue):
2051         (KJS::JSObject::lookupGetter):
2052         (KJS::JSObject::lookupSetter):
2053         (KJS::JSObject::hasInstance):
2054         (KJS::JSObject::fillGetterPropertySlot):
2055         (KJS::Error::create):
2056         (KJS::constructEmptyObject):
2057         * kjs/JSObject.h:
2058         (KJS::GetterSetter::GetterSetter):
2059         (KJS::GetterSetter::getter):
2060         (KJS::GetterSetter::setGetter):
2061         (KJS::GetterSetter::setter):
2062         (KJS::GetterSetter::setSetter):
2063         * kjs/JSValue.cpp:
2064         (KJS::JSCell::deleteProperty):
2065         (KJS::call):
2066         (KJS::construct):
2067         * kjs/JSValue.h:
2068         * kjs/MathObject.cpp:
2069         (KJS::mathProtoFuncAbs):
2070         (KJS::mathProtoFuncACos):
2071         (KJS::mathProtoFuncASin):
2072         (KJS::mathProtoFuncATan):
2073         (KJS::mathProtoFuncATan2):
2074         (KJS::mathProtoFuncCeil):
2075         (KJS::mathProtoFuncCos):
2076         (KJS::mathProtoFuncExp):
2077         (KJS::mathProtoFuncFloor):
2078         (KJS::mathProtoFuncLog):
2079         (KJS::mathProtoFuncMax):
2080         (KJS::mathProtoFuncMin):
2081         (KJS::mathProtoFuncPow):
2082         (KJS::mathProtoFuncRandom):
2083         (KJS::mathProtoFuncRound):
2084         (KJS::mathProtoFuncSin):
2085         (KJS::mathProtoFuncSqrt):
2086         (KJS::mathProtoFuncTan):
2087         * kjs/MathObject.h:
2088         * kjs/NumberObject.cpp:
2089         (KJS::numberProtoFuncToString):
2090         (KJS::numberProtoFuncToLocaleString):
2091         (KJS::numberProtoFuncValueOf):
2092         (KJS::numberProtoFuncToFixed):
2093         (KJS::numberProtoFuncToExponential):
2094         (KJS::numberProtoFuncToPrecision):
2095         (KJS::NumberConstructor::NumberConstructor):
2096         (KJS::constructWithNumberConstructor):
2097         (KJS::NumberConstructor::getConstructData):
2098         (KJS::callNumberConstructor):
2099         (KJS::NumberConstructor::getCallData):
2100         (KJS::constructNumber):
2101         (KJS::constructNumberFromImmediateNumber):
2102         * kjs/NumberObject.h:
2103         (KJS::NumberObject::classInfo):
2104         (KJS::NumberConstructor::classInfo):
2105         * kjs/PropertySlot.cpp:
2106         (KJS::PropertySlot::functionGetter):
2107         * kjs/RegExpObject.cpp:
2108         (KJS::regExpProtoFuncTest):
2109         (KJS::regExpProtoFuncExec):
2110         (KJS::regExpProtoFuncCompile):
2111         (KJS::regExpProtoFuncToString):
2112         (KJS::callRegExpObject):
2113         (KJS::RegExpObject::getCallData):
2114         (KJS::constructRegExp):
2115         (KJS::constructWithRegExpConstructor):
2116         (KJS::RegExpConstructor::getConstructData):
2117         (KJS::callRegExpConstructor):
2118         (KJS::RegExpConstructor::getCallData):
2119         * kjs/RegExpObject.h:
2120         (KJS::RegExpConstructor::classInfo):
2121         * kjs/Shell.cpp:
2122         (GlobalObject::GlobalObject):
2123         (functionPrint):
2124         (functionDebug):
2125         (functionGC):
2126         (functionVersion):
2127         (functionRun):
2128         (functionLoad):
2129         (functionReadline):
2130         (functionQuit):
2131         * kjs/date_object.cpp:
2132         (KJS::gmtoffset):
2133         (KJS::formatLocaleDate):
2134         (KJS::fillStructuresUsingDateArgs):
2135         (KJS::DateInstance::getTime):
2136         (KJS::DateInstance::getUTCTime):
2137         (KJS::DateConstructor::DateConstructor):
2138         (KJS::constructDate):
2139         (KJS::DateConstructor::getConstructData):
2140         (KJS::callDate):
2141         (KJS::DateConstructor::getCallData):
2142         (KJS::dateParse):
2143         (KJS::dateNow):
2144         (KJS::dateUTC):
2145         (KJS::dateProtoFuncToString):
2146         (KJS::dateProtoFuncToUTCString):
2147         (KJS::dateProtoFuncToDateString):
2148         (KJS::dateProtoFuncToTimeString):
2149         (KJS::dateProtoFuncToLocaleString):
2150         (KJS::dateProtoFuncToLocaleDateString):
2151         (KJS::dateProtoFuncToLocaleTimeString):
2152         (KJS::dateProtoFuncValueOf):
2153         (KJS::dateProtoFuncGetTime):
2154         (KJS::dateProtoFuncGetFullYear):
2155         (KJS::dateProtoFuncGetUTCFullYear):
2156         (KJS::dateProtoFuncToGMTString):
2157         (KJS::dateProtoFuncGetMonth):
2158         (KJS::dateProtoFuncGetUTCMonth):
2159         (KJS::dateProtoFuncGetDate):
2160         (KJS::dateProtoFuncGetUTCDate):
2161         (KJS::dateProtoFuncGetDay):
2162         (KJS::dateProtoFuncGetUTCDay):
2163         (KJS::dateProtoFuncGetHours):
2164         (KJS::dateProtoFuncGetUTCHours):
2165         (KJS::dateProtoFuncGetMinutes):
2166         (KJS::dateProtoFuncGetUTCMinutes):
2167         (KJS::dateProtoFuncGetSeconds):
2168         (KJS::dateProtoFuncGetUTCSeconds):
2169         (KJS::dateProtoFuncGetMilliSeconds):
2170         (KJS::dateProtoFuncGetUTCMilliseconds):
2171         (KJS::dateProtoFuncGetTimezoneOffset):
2172         (KJS::dateProtoFuncSetTime):
2173         (KJS::setNewValueFromTimeArgs):
2174         (KJS::setNewValueFromDateArgs):
2175         (KJS::dateProtoFuncSetMilliSeconds):
2176         (KJS::dateProtoFuncSetUTCMilliseconds):
2177         (KJS::dateProtoFuncSetSeconds):
2178         (KJS::dateProtoFuncSetUTCSeconds):
2179         (KJS::dateProtoFuncSetMinutes):
2180         (KJS::dateProtoFuncSetUTCMinutes):
2181         (KJS::dateProtoFuncSetHours):
2182         (KJS::dateProtoFuncSetUTCHours):
2183         (KJS::dateProtoFuncSetDate):
2184         (KJS::dateProtoFuncSetUTCDate):
2185         (KJS::dateProtoFuncSetMonth):
2186         (KJS::dateProtoFuncSetUTCMonth):
2187         (KJS::dateProtoFuncSetFullYear):
2188         (KJS::dateProtoFuncSetUTCFullYear):
2189         (KJS::dateProtoFuncSetYear):
2190         (KJS::dateProtoFuncGetYear):
2191         * kjs/date_object.h:
2192         (KJS::DateInstance::internalNumber):
2193         (KJS::DateInstance::classInfo):
2194         * kjs/error_object.cpp:
2195         (KJS::errorProtoFuncToString):
2196         (KJS::constructError):
2197         (KJS::constructWithErrorConstructor):
2198         (KJS::ErrorConstructor::getConstructData):
2199         (KJS::callErrorConstructor):
2200         (KJS::ErrorConstructor::getCallData):
2201         (KJS::NativeErrorConstructor::construct):
2202         (KJS::constructWithNativeErrorConstructor):
2203         (KJS::NativeErrorConstructor::getConstructData):
2204         (KJS::callNativeErrorConstructor):
2205         (KJS::NativeErrorConstructor::getCallData):
2206         * kjs/error_object.h:
2207         (KJS::NativeErrorConstructor::classInfo):
2208         * kjs/internal.cpp:
2209         (KJS::JSNumberCell::toObject):
2210         (KJS::JSNumberCell::toThisObject):
2211         (KJS::GetterSetter::mark):
2212         (KJS::GetterSetter::toPrimitive):
2213         (KJS::GetterSetter::toBoolean):
2214         (KJS::GetterSetter::toNumber):
2215         (KJS::GetterSetter::toString):
2216         (KJS::GetterSetter::toObject):
2217         (KJS::InternalFunction::InternalFunction):
2218         (KJS::InternalFunction::implementsHasInstance):
2219         * kjs/lookup.h:
2220         (KJS::HashEntry::):
2221         * kjs/nodes.cpp:
2222         (KJS::FuncDeclNode::makeFunction):
2223         (KJS::FuncExprNode::makeFunction):
2224         * kjs/object_object.cpp:
2225         (KJS::objectProtoFuncValueOf):
2226         (KJS::objectProtoFuncHasOwnProperty):
2227         (KJS::objectProtoFuncIsPrototypeOf):
2228         (KJS::objectProtoFuncDefineGetter):
2229         (KJS::objectProtoFuncDefineSetter):
2230         (KJS::objectProtoFuncLookupGetter):
2231         (KJS::objectProtoFuncLookupSetter):
2232         (KJS::objectProtoFuncPropertyIsEnumerable):
2233         (KJS::objectProtoFuncToLocaleString):
2234         (KJS::objectProtoFuncToString):
2235         (KJS::ObjectConstructor::ObjectConstructor):
2236         (KJS::constructObject):
2237         (KJS::constructWithObjectConstructor):
2238         (KJS::ObjectConstructor::getConstructData):
2239         (KJS::callObjectConstructor):
2240         (KJS::ObjectConstructor::getCallData):
2241         * kjs/object_object.h:
2242         * kjs/string_object.cpp:
2243         (KJS::replace):
2244         (KJS::stringProtoFuncToString):
2245         (KJS::stringProtoFuncValueOf):
2246         (KJS::stringProtoFuncCharAt):
2247         (KJS::stringProtoFuncCharCodeAt):
2248         (KJS::stringProtoFuncConcat):
2249         (KJS::stringProtoFuncIndexOf):
2250         (KJS::stringProtoFuncLastIndexOf):
2251         (KJS::stringProtoFuncMatch):
2252         (KJS::stringProtoFuncSearch):
2253         (KJS::stringProtoFuncReplace):
2254         (KJS::stringProtoFuncSlice):
2255         (KJS::stringProtoFuncSplit):
2256         (KJS::stringProtoFuncSubstr):
2257         (KJS::stringProtoFuncSubstring):
2258         (KJS::stringProtoFuncToLowerCase):
2259         (KJS::stringProtoFuncToUpperCase):
2260         (KJS::stringProtoFuncToLocaleLowerCase):
2261         (KJS::stringProtoFuncToLocaleUpperCase):
2262         (KJS::stringProtoFuncLocaleCompare):
2263         (KJS::stringProtoFuncBig):
2264         (KJS::stringProtoFuncSmall):
2265         (KJS::stringProtoFuncBlink):
2266         (KJS::stringProtoFuncBold):
2267         (KJS::stringProtoFuncFixed):
2268         (KJS::stringProtoFuncItalics):
2269         (KJS::stringProtoFuncStrike):
2270         (KJS::stringProtoFuncSub):
2271         (KJS::stringProtoFuncSup):
2272         (KJS::stringProtoFuncFontcolor):
2273         (KJS::stringProtoFuncFontsize):
2274         (KJS::stringProtoFuncAnchor):
2275         (KJS::stringProtoFuncLink):
2276         (KJS::stringFromCharCode):
2277         (KJS::StringConstructor::StringConstructor):
2278         (KJS::constructWithStringConstructor):
2279         (KJS::StringConstructor::getConstructData):
2280         (KJS::callStringConstructor):
2281         (KJS::StringConstructor::getCallData):
2282         * kjs/string_object.h:
2283
2284 2008-06-23  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2285
2286         Reviewed by Oliver.
2287
2288         Bug 19716: REGRESSION (SquirrelFish): Reproducible crash after entering a username at mint.com
2289         <https://bugs.webkit.org/show_bug.cgi?id=19716>
2290
2291         When unwinding callframes for exceptions, check whether the callframe
2292         was created by a reentrant native call to JavaScript after tearing off
2293         the local variables instead of before.
2294
2295         * VM/Machine.cpp:
2296         (KJS::Machine::unwindCallFrame):
2297
2298 2008-06-23  Mark Rowe  <mrowe@apple.com>
2299
2300         Reviewed by Oliver Hunt.
2301
2302         Get testapi passing again in a debug build.
2303
2304         * API/testapi.c:
2305         (main): Update the expected output of calling JSValueMakeString on a function object.
2306
2307 2008-06-21  Mark Rowe  <mrowe@apple.com>
2308
2309         Reviewed by Sam Weinig.
2310
2311         Print a blank line when exiting the jsc interactive mode to ensure that the shell
2312         prompt will start on a new line.
2313
2314         * kjs/Shell.cpp:
2315         (runInteractive):
2316
2317 2008-06-21  Mark Rowe  <mrowe@apple.com>
2318
2319         Rubber-stamped by Sam Weinig.
2320
2321         Tweak the paths of the items in the "tests" group to clean things up a little.
2322
2323         * JavaScriptCore.xcodeproj/project.pbxproj:
2324
2325 2008-06-21  Mark Rowe  <mrowe@apple.com>
2326
2327         Rubber-stamped by Sam Weinig.
2328
2329         Fix jsc to link against libedit.dylib rather than libedit.2.dylib.
2330
2331         * JavaScriptCore.xcodeproj/project.pbxproj:
2332
2333 2008-06-21  Mark Rowe  <mrowe@apple.com>
2334
2335         Reviewed by Sam Weinig.
2336
2337         Copy the JavaScriptCore shell (jsc) into JavaScriptCore.framework so that it will
2338         be included in nightly builds.
2339         https://bugs.webkit.org/show_bug.cgi?id=19691
2340
2341         * JavaScriptCore.xcodeproj/project.pbxproj:
2342
2343 2008-06-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2344
2345         Reviewed by Mark Rowe.
2346
2347         Fix the build for non-Mac Darwin platforms by disabling their support
2348         for readline in the JavaScript shell.
2349
2350         * kjs/config.h:
2351
2352 2008-06-20  Timothy Hatcher  <timothy@apple.com>
2353
2354         Use member function pointers for the Profile::forEach function.
2355         Eliminating a few static functions and simplified things a little.
2356
2357         Reviewed by Alexey Proskuryakov.
2358
2359         * JavaScriptCore.exp: Change the symbol for forEach.
2360         * profiler/Profile.cpp:
2361         (KJS::Profile::forEach): Use a member function pointer.
2362         * profiler/Profile.h:
2363         (KJS::Profile::sortTotalTimeDescending): Pass a function pointer.
2364         (KJS::Profile::sortTotalTimeAscending): Ditto.
2365         (KJS::Profile::sortSelfTimeDescending): Ditto.
2366         (KJS::Profile::sortSelfTimeAscending): Ditto.
2367         (KJS::Profile::sortCallsDescending): Ditto.
2368         * profiler/ProfileNode.h:
2369         (KJS::ProfileNode::sortTotalTimeDescending): No longer static.
2370         (KJS::ProfileNode::sortTotalTimeAscending): Ditto.
2371         (KJS::ProfileNode::sortSelfTimeDescending): Ditto.
2372         (KJS::ProfileNode::sortSelfTimeAscending): Ditto.
2373         (KJS::ProfileNode::sortCallsDescending): Ditto.
2374
2375 2008-06-20  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2376
2377         Reviewed by Oliver.
2378
2379         Remove unused destructors.
2380
2381         * kjs/nodes.cpp:
2382         * kjs/nodes.h:
2383
2384 2008-06-20  Timothy Hatcher  <timothy@apple.com>
2385
2386         Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
2387         and stopping a profile from the Develop menu. Also prevents
2388         inserting an incorrect parent node as the new head after profiling
2389         is stopped from the Develop menu.
2390
2391         Reviewed by Dan Bernstein.
2392
2393         * profiler/Profile.cpp:
2394         (KJS::Profile::stopProfiling): If the current node is already the head
2395         then there is no more need to record future nodes in didExecute.
2396         (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
2397         into here since this was the only caller. When setting the total time
2398         keep any current total time while adding the self time of the head.
2399         (KJS::Profile::setupCurrentNodeAsStopped): Removed.
2400         * profiler/Profile.h: Removed setupCurrentNodeAsStopped.
2401
2402 2008-06-20  Kevin Ollivier  <kevino@theolliviers.com>
2403
2404         !USE(MULTIPLE_THREADS) on Darwin build fix
2405
2406         * kjs/InitializeThreading.cpp:
2407         (KJS::initializeThreading):
2408         * kjs/collector.h:
2409
2410 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
2411
2412         -Leopard Build Fix.
2413
2414         * profiler/Profile.cpp:
2415         (KJS::Profile::removeProfileStart):
2416         (KJS::Profile::removeProfileEnd):
2417
2418 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
2419
2420         Just giving credit.
2421
2422         * ChangeLog:
2423
2424 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
2425
2426         Reviewed by Tim and Dan.
2427
2428         <rdar://problem/6024846> JSProfiler: ASSERT hit in Profiler.
2429         - Because InspectorController can call startProfiling() and
2430         stopProfiling() we cannot assert that console.profile() and
2431         console.profileEnd() will be in the profile tree.
2432
2433         * profiler/Profile.cpp:
2434         (KJS::Profile::removeProfileStart):
2435         (KJS::Profile::removeProfileEnd):
2436
2437 2008-06-20  Kevin McCullough  <kmccullough@apple.com>
2438
2439         Reviewed by Tim.
2440
2441         <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
2442         if profiling is started and finished within the same function. (19230)
2443         - Now we profile one more stack frame up from the last frame to allocate
2444         the time spent in it, if it exists.
2445
2446         * JavaScriptCore.exp:
2447         * VM/Machine.cpp: We need to let the profiler know when the JS program 
2448         has finished since that is what will actually stop the profiler instead
2449         of just calling stopProfiling().
2450         (KJS::Machine::execute):
2451         * profiler/Profile.cpp:
2452         (KJS::Profile::create): Moved from Profile.h since it was getting pretty
2453         long.
2454         (KJS::Profile::Profile): We now have a client, which is a listener who
2455         we will return this profile to, once it has actually finished.
2456         (KJS::Profile::stopProfiling): Instead of fully stopping the profiler
2457         here, we set the flag and keep it profiling in the background.
2458         (KJS::Profile::didFinishAllExecution): This is where the profiler
2459         actually finishes and creates the (idle) node if one should be made.
2460         (KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
2461         needed by the profiler as it runs silently in the background.
2462         (KJS::Profile::removeProfileEnd): Ditto.
2463         (KJS::Profile::willExecute): Don't profile new functions if we have
2464         stopped profiling.
2465         (KJS::Profile::didExecute): Only record one more return as all the
2466         remaining time will be attributed to that function.
2467         (KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
2468         * profiler/Profile.h: Added functions and variables for the above
2469         changes.
2470         (KJS::Profile::client):
2471         * profiler/ProfileNode.h:
2472         (KJS::CallIdentifier::toString): Debug method.
2473         * profiler/Profiler.cpp: Added support for the ProfilerClient.
2474         (KJS::Profiler::startProfiling):
2475         (KJS::Profiler::stopProfiling): No longer return sthe profile.
2476         (KJS::Profiler::didFinishAllExecution): Now returns the profile to the
2477         client instead of stopProfiling.
2478         * profiler/Profiler.h:
2479         (KJS::ProfilerClient::~ProfilerClient): Clients will implement this
2480         interface.
2481
2482 2008-06-19  Ariya Hidayat  <ariya.hidayat@trolltech.com>
2483
2484         Reviewed by Simon.
2485
2486         Surpress compiler warning (int vs unsigned comparison).
2487
2488         * wtf/unicode/qt4/UnicodeQt4.h:
2489         (WTF::Unicode::toLower):
2490
2491 2008-06-19  Ariya Hidayat  <ariya.hidayat@trolltech.com>
2492
2493         Reviewed by Timothy Hatcher.
2494
2495         Introduce compiler define for MinGW, to have COMPILER(MINGW).
2496
2497         * wtf/Platform.h:
2498
2499 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
2500
2501         Reviewed by Geoff.
2502
2503         Make Machine per-JSGlobalData.
2504
2505         * VM/CodeBlock.cpp:
2506         (KJS::CodeBlock::dump):
2507         * VM/CodeGenerator.cpp:
2508         (KJS::CodeGenerator::emitOpcode):
2509         * VM/Machine.cpp:
2510         (KJS::callEval):
2511         (KJS::Machine::unwindCallFrame):
2512         (KJS::Machine::throwException):
2513         (KJS::Machine::execute):
2514         (KJS::Machine::debug):
2515         * VM/Machine.h:
2516         * kjs/DebuggerCallFrame.cpp:
2517         (KJS::DebuggerCallFrame::evaluate):
2518         * kjs/DebuggerCallFrame.h:
2519         (KJS::DebuggerCallFrame::DebuggerCallFrame):
2520         * kjs/ExecState.cpp:
2521         (KJS::ExecState::ExecState):
2522         * kjs/ExecState.h:
2523         (KJS::ExecState::machine):
2524         * kjs/JSFunction.cpp:
2525         (KJS::JSFunction::callAsFunction):
2526         (KJS::JSFunction::argumentsGetter):
2527         (KJS::JSFunction::callerGetter):
2528         (KJS::JSFunction::construct):
2529         (KJS::globalFuncEval):
2530         * kjs/JSGlobalData.cpp:
2531         (KJS::JSGlobalData::JSGlobalData):
2532         * kjs/JSGlobalData.h:
2533         * kjs/interpreter.cpp:
2534         (KJS::Interpreter::evaluate):
2535
2536 2008-06-19  Alp Toker  <alp@nuanti.com>
2537
2538         GTK+/autotools build fix. JSGlobalObject.cpp in now in
2539         AllInOneFile.cpp and shouldn't be built separately.
2540
2541         * GNUmakefile.am:
2542
2543 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
2544
2545         Reviewed by Darin.
2546
2547         Get rid of some threadInstance calls.
2548
2549         * kjs/JSGlobalObject.cpp:
2550         (KJS::JSGlobalObject::init):
2551         * kjs/Parser.cpp:
2552         (KJS::Parser::parse):
2553         * kjs/Shell.cpp:
2554         (jscmain):
2555
2556 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
2557
2558         Reviewed by Sam.
2559
2560         Fix an assertion failure at startup.
2561
2562         * kjs/JSObject.h: (KJS::JSObject::JSObject): Allow jsNull prototype in an assertion (I had
2563         it fixed in a wrong copy of the file, so I wasn't getting the failure).
2564
2565 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
2566
2567         Build fix.
2568
2569         * kjs/collector.cpp:
2570         (KJS::Heap::Heap):
2571         (KJS::allocateBlock):
2572         * kjs/collector.h:
2573         No, #if PLATFORM(UNIX) was not right. I've just moved the unsafe initialization back for now,
2574         as the platforms that use that code path do not use multiple threads yet.
2575
2576 2008-06-19  Alexey Proskuryakov  <ap@webkit.org>
2577
2578         Windows and Qt build fixes.
2579
2580         * kjs/collector.h: 
2581         * kjs/collector.cpp:
2582         (KJS::Heap::Heap):
2583         Wrapped m_pagesize in #if PLATFORM(UNIX), which should better match the sequence of #elifs
2584         in allocateBlock(). Changed MIN_ARRAY_SIZE to be explicitly size_t, as this type is different
2585         on different platforms.
2586
2587 2008-06-17  Alexey Proskuryakov  <ap@webkit.org>
2588
2589         Reviewed by Darin.
2590
2591         Prepare JavaScript heap for being per-thread.
2592
2593         * kjs/ExecState.h: Shuffle includes, making it possible to include ExecState.h in JSValue.h.
2594         (KJS::ExecState::heap): Added an accessor.
2595
2596         * API/JSBase.cpp: (JSGarbageCollect): Collect both shared and per-thread heaps.
2597
2598         * API/JSContextRef.cpp: (JSGlobalContextCreate): When allocating JSGlobalObject, indicate
2599         that it belongs to a shared heap.
2600
2601         * JavaScriptCore.xcodeproj/project.pbxproj:
2602         * kjs/AllInOneFile.cpp:
2603         Moved JSGlobalObject.cpp to AllInOneFile, as a build fix for inlineAllocate magic.
2604
2605         * VM/CodeGenerator.h: (KJS::CodeGenerator::globalExec): Added an accessor (working via
2606         m_scopeChain).
2607
2608         * VM/RegisterFile.h:
2609         (KJS::RegisterFile::mark):
2610         * VM/RegisterFileStack.h:
2611         (KJS::RegisterFileStack::mark):
2612         Made these pseudo-mark functions take Heap*.
2613
2614         * kjs/InitializeThreading.cpp:
2615         (KJS::initializeThreading): Initialize heap introspector.
2616
2617         * kjs/JSGlobalData.h: Added Heap to the structure.
2618
2619         * kjs/JSGlobalData.cpp:
2620         (KJS::JSGlobalData::JSGlobalData): Initialize Heap.
2621         (KJS::JSGlobalData::sharedInstance): Added a method to access shared global data instance
2622         for legacy clients.
2623
2624         * kjs/JSGlobalObject.cpp:
2625         (KJS::JSGlobalObject::~JSGlobalObject): Changed to work with per-thread head; fixed list
2626         maintenance logic.
2627         (KJS::JSGlobalObject::init): Changed to work with per-thread head.
2628         (KJS::JSGlobalObject::put): Assert that a cross-heap operation is not being attempted.
2629         (KJS::JSGlobalObject::reset): Pass ExecState* where now required.
2630         (KJS::JSGlobalObject::mark): Pass the current heap to RegisterFileStack::mark.
2631         (KJS::JSGlobalObject::operator new): Overload operator new to use per-thread or shared heap.
2632         * kjs/JSGlobalObject.h: Removed static s_head member.
2633
2634         * kjs/PropertyMap.h: (KJS::PropertyMap::PropertyMap): Removed unused SavedProperty.
2635
2636         * kjs/collector.h: Turned Collector into an actual object with its own data, renamed to Heap.
2637         (KJS::Heap::initializeHeapIntrospector): Added.
2638         (KJS::Heap::heap): Added a method to determine which heap a JSValue is in, if any.
2639         (KJS::Heap::allocate): Made non-static.
2640         (KJS::Heap::inlineAllocateNumber): Ditto.
2641         (KJS::Heap::markListSet): Ditto.
2642         (KJS::Heap::cellBlock): Ditto.
2643         (KJS::Heap::cellOffset): Ditto.
2644         (KJS::Heap::isCellMarked): Ditto.
2645         (KJS::Heap::markCell): Ditto.
2646         (KJS::Heap::reportExtraMemoryCost): Ditto.
2647         (KJS::CollectorBlock): Added a back-reference to Heap for Heap::heap() method.
2648         (KJS::SmallCellCollectorBlock): Ditto.
2649
2650         * kjs/collector.cpp: Changed MIN_ARRAY_SIZE to a #define to avoid a PIC branch. Removed
2651         main thread related machinery.
2652         (KJS::Heap::Heap): Initialize the newly added data members.
2653         (KJS::allocateBlock): Marked NEVER_INLINE, as this is a rare case that uses a PIC branch.
2654         Moved static pagesize to the class to make it safely initialized.
2655         (KJS::Heap::heapAllocate): Initialize heap back reference after a new block is allocated.
2656         (KJS::Heap::registerThread): Removed introspector initialization, as it is now performed
2657         in InitializeThreading.cpp.
2658         (KJS::Heap::markOtherThreadConservatively): Assert that the "other thread" case only occurs
2659         for legacy clients using a shared heap.
2660         (KJS::Heap::markStackObjectsConservatively): Moved fastMallocForbid/Allow down here, since
2661         it doesn't need to be forbidden during other GC phases.
2662
2663         * kjs/JSImmediate.h:
2664         (KJS::jsUndefined):
2665         (KJS::jsNull):
2666         (KJS::jsBoolean):
2667         Moved from JSvalue.h, to make these usable in files that cannot include JSValue.h (such
2668         as list.h).
2669
2670         * API/JSCallbackObjectFunctions.h:
2671         (KJS::::staticFunctionGetter):
2672         * API/JSClassRef.cpp:
2673         (OpaqueJSClass::prototype):
2674         * API/JSObjectRef.cpp:
2675         (JSObjectMake):
2676         (JSObjectMakeFunctionWithCallback):
2677         (JSObjectMakeConstructor):
2678         (JSObjectMakeFunction):
2679         * API/JSValueRef.cpp:
2680         (JSValueMakeNumber):
2681         (JSValueMakeString):
2682         * JavaScriptCore.exp:
2683         * VM/CodeGenerator.cpp:
2684         (KJS::CodeGenerator::emitLoad):
2685         * VM/JSPropertyNameIterator.cpp:
2686         (KJS::JSPropertyNameIterator::create):
2687         (KJS::JSPropertyNameIterator::next):
2688         * VM/Machine.cpp:
2689         (KJS::jsAddSlowCase):
2690         (KJS::jsAdd):
2691         (KJS::jsTypeStringForValue):
2692         (KJS::scopeChainForCall):
2693         (KJS::Machine::throwException):
2694         (KJS::Machine::execute):
2695         (KJS::Machine::privateExecute):
2696         (KJS::Machine::retrieveArguments):
2697         * kjs/ArrayPrototype.cpp:
2698         (KJS::arrayProtoFuncToString):
2699         (KJS::arrayProtoFuncToLocaleString):
2700         (KJS::arrayProtoFuncJoin):
2701         (KJS::arrayProtoFuncConcat):
2702         (KJS::arrayProtoFuncPop):
2703         (KJS::arrayProtoFuncPush):
2704         (KJS::arrayProtoFuncShift):
2705         (KJS::arrayProtoFuncSlice):
2706         (KJS::arrayProtoFuncSplice):
2707         (KJS::arrayProtoFuncUnShift):
2708         (KJS::arrayProtoFuncFilter):
2709         (KJS::arrayProtoFuncMap):
2710         (KJS::arrayProtoFuncEvery):
2711         (KJS::arrayProtoFuncForEach):
2712         (KJS::arrayProtoFuncSome):
2713         (KJS::arrayProtoFuncIndexOf):
2714         (KJS::arrayProtoFuncLastIndexOf):
2715         (KJS::ArrayConstructor::ArrayConstructor):
2716         (KJS::ArrayConstructor::construct):
2717         (KJS::ArrayConstructor::callAsFunction):
2718         * kjs/BooleanObject.cpp:
2719         (KJS::BooleanPrototype::BooleanPrototype):
2720         (KJS::booleanProtoFuncToString):
2721         (KJS::BooleanConstructor::BooleanConstructor):
2722         (KJS::BooleanConstructor::construct):
2723         * kjs/FunctionPrototype.cpp:
2724         (KJS::FunctionPrototype::FunctionPrototype):
2725         (KJS::functionProtoFuncToString):
2726         (KJS::FunctionConstructor::FunctionConstructor):
2727         (KJS::FunctionConstructor::construct):
2728         * kjs/JSActivation.cpp:
2729         (KJS::JSActivation::createArgumentsObject):
2730         * kjs/JSArray.cpp:
2731         (KJS::JSArray::JSArray):
2732         (KJS::JSArray::lengthGetter):
2733         * kjs/JSFunction.cpp:
2734         (KJS::JSFunction::lengthGetter):
2735         (KJS::JSFunction::construct):
2736         (KJS::Arguments::Arguments):
2737         (KJS::encode):
2738         (KJS::decode):
2739         (KJS::globalFuncParseInt):
2740         (KJS::globalFuncParseFloat):
2741         (KJS::globalFuncEscape):
2742         (KJS::globalFuncUnescape):
2743         (KJS::PrototypeFunction::PrototypeFunction):
2744         (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
2745         * kjs/JSImmediate.cpp:
2746         (KJS::JSImmediate::toObject):
2747         * kjs/JSLock.cpp:
2748         (KJS::JSLock::registerThread):
2749         * kjs/JSObject.cpp:
2750         (KJS::JSObject::put):
2751         (KJS::JSObject::defineGetter):
2752         (KJS::JSObject::defineSetter):
2753         (KJS::Error::create):
2754         * kjs/JSObject.h:
2755         (KJS::JSObject::putDirect):
2756         * kjs/JSString.h:
2757         (KJS::JSString::JSString):
2758         * kjs/JSValue.cpp:
2759         (KJS::JSCell::operator new):
2760         (KJS::jsString):
2761         (KJS::jsOwnedString):
2762         * kjs/JSValue.h:
2763         (KJS::JSNumberCell::operator new):
2764         (KJS::jsNumberCell):
2765         (KJS::jsNaN):
2766         (KJS::jsNumber):
2767         (KJS::JSCell::marked):
2768         (KJS::JSCell::mark):
2769         (KJS::JSValue::toJSNumber):
2770         * kjs/MathObject.cpp:
2771         (KJS::MathObject::getValueProperty):
2772         (KJS::mathProtoFuncAbs):
2773         (KJS::mathProtoFuncACos):
2774         (KJS::mathProtoFuncASin):
2775         (KJS::mathProtoFuncATan):
2776         (KJS::mathProtoFuncATan2):
2777         (KJS::mathProtoFuncCeil):
2778         (KJS::mathProtoFuncCos):
2779         (KJS::mathProtoFuncExp):
2780         (KJS::mathProtoFuncFloor):
2781         (KJS::mathProtoFuncLog):
2782         (KJS::mathProtoFuncMax):
2783         (KJS::mathProtoFuncMin):
2784         (KJS::mathProtoFuncPow):
2785         (KJS::mathProtoFuncRandom):
2786         (KJS::mathProtoFuncRound):
2787         (KJS::mathProtoFuncSin):
2788         (KJS::mathProtoFuncSqrt):
2789         (KJS::mathProtoFuncTan):
2790         * kjs/NumberObject.cpp:
2791         (KJS::NumberPrototype::NumberPrototype):
2792         (KJS::numberProtoFuncToString):
2793         (KJS::numberProtoFuncToLocaleString):
2794         (KJS::numberProtoFuncToFixed):
2795         (KJS::numberProtoFuncToExponential):
2796         (KJS::numberProtoFuncToPrecision):
2797         (KJS::NumberConstructor::NumberConstructor):
2798         (KJS::NumberConstructor::getValueProperty):
2799         (KJS::NumberConstructor::construct):
2800         (KJS::NumberConstructor::callAsFunction):
2801         * kjs/RegExpObject.cpp:
2802         (KJS::RegExpPrototype::RegExpPrototype):
2803         (KJS::regExpProtoFuncToString):
2804         (KJS::RegExpObject::getValueProperty):
2805         (KJS::RegExpConstructor::RegExpConstructor):
2806         (KJS::RegExpMatchesArray::fillArrayInstance):
2807         (KJS::RegExpConstructor::arrayOfMatches):
2808         (KJS::RegExpConstructor::getBackref):
2809         (KJS::RegExpConstructor::getLastParen):
2810         (KJS::RegExpConstructor::getLeftContext):
2811         (KJS::RegExpConstructor::getRightContext):
2812         (KJS::RegExpConstructor::getValueProperty):
2813         (KJS::RegExpConstructor::construct):
2814         * kjs/RegExpObject.h:
2815         * kjs/Shell.cpp:
2816         (GlobalObject::GlobalObject):
2817         (functionGC):
2818         (functionRun):
2819         (functionReadline):
2820         (jscmain):
2821         * kjs/date_object.cpp:
2822         (KJS::formatLocaleDate):
2823         (KJS::DatePrototype::DatePrototype):
2824         (KJS::DateConstructor::DateConstructor):
2825         (KJS::DateConstructor::construct):
2826         (KJS::DateConstructor::callAsFunction):
2827         (KJS::DateFunction::DateFunction):
2828         (KJS::DateFunction::callAsFunction):
2829         (KJS::dateProtoFuncToString):
2830         (KJS::dateProtoFuncToUTCString):
2831         (KJS::dateProtoFuncToDateString):
2832         (KJS::dateProtoFuncToTimeString):
2833         (KJS::dateProtoFuncToLocaleString):
2834         (KJS::dateProtoFuncToLocaleDateString):
2835         (KJS::dateProtoFuncToLocaleTimeString):
2836         (KJS::dateProtoFuncValueOf):
2837         (KJS::dateProtoFuncGetTime):
2838         (KJS::dateProtoFuncGetFullYear):
2839         (KJS::dateProtoFuncGetUTCFullYear):
2840         (KJS::dateProtoFuncToGMTString):
2841         (KJS::dateProtoFuncGetMonth):
2842         (KJS::dateProtoFuncGetUTCMonth):
2843         (KJS::dateProtoFuncGetDate):
2844         (KJS::dateProtoFuncGetUTCDate):
2845         (KJS::dateProtoFuncGetDay):
2846         (KJS::dateProtoFuncGetUTCDay):
2847         (KJS::dateProtoFuncGetHours):
2848         (KJS::dateProtoFuncGetUTCHours):
2849         (KJS::dateProtoFuncGetMinutes):
2850         (KJS::dateProtoFuncGetUTCMinutes):
2851         (KJS::dateProtoFuncGetSeconds):
2852         (KJS::dateProtoFuncGetUTCSeconds):
2853         (KJS::dateProtoFuncGetMilliSeconds):
2854         (KJS::dateProtoFuncGetUTCMilliseconds):
2855         (KJS::dateProtoFuncGetTimezoneOffset):
2856         (KJS::dateProtoFuncSetTime):
2857         (KJS::setNewValueFromTimeArgs):
2858         (KJS::setNewValueFromDateArgs):
2859         (KJS::dateProtoFuncSetYear):
2860         (KJS::dateProtoFuncGetYear):
2861         * kjs/error_object.cpp:
2862         (KJS::ErrorPrototype::ErrorPrototype):
2863         (KJS::errorProtoFuncToString):
2864         (KJS::ErrorConstructor::ErrorConstructor):
2865         (KJS::ErrorConstructor::construct):
2866         (KJS::NativeErrorPrototype::NativeErrorPrototype):
2867         (KJS::NativeErrorConstructor::NativeErrorConstructor):
2868         (KJS::NativeErrorConstructor::construct):
2869         * kjs/identifier.h:
2870         * kjs/internal.cpp:
2871         (KJS::StringObject::create):
2872         (KJS::JSString::lengthGetter):
2873         (KJS::JSString::indexGetter):
2874         (KJS::JSString::indexNumericPropertyGetter):
2875         * kjs/interpreter.cpp:
2876         * kjs/list.cpp:
2877         (KJS::ArgList::slowAppend):
2878         * kjs/list.h:
2879         * kjs/lookup.h:
2880         (KJS::staticFunctionGetter):
2881         (KJS::cacheGlobalObject):
2882         * kjs/nodes.cpp:
2883         (KJS::Node::emitThrowError):
2884         (KJS::StringNode::emitCode):
2885         (KJS::ArrayNode::emitCode):
2886         (KJS::FuncDeclNode::makeFunction):
2887         (KJS::FuncExprNode::makeFunction):
2888         * kjs/nodes.h:
2889         * kjs/object_object.cpp:
2890         (KJS::ObjectPrototype::ObjectPrototype):
2891         (KJS::objectProtoFuncToLocaleString):
2892         (KJS::objectProtoFuncToString):
2893         (KJS::ObjectConstructor::ObjectConstructor):
2894         (KJS::ObjectConstructor::construct):
2895         * kjs/protect.h:
2896         (KJS::gcProtect):
2897         (KJS::gcUnprotect):
2898         * kjs/string_object.cpp:
2899         (KJS::StringObject::StringObject):
2900         (KJS::StringPrototype::StringPrototype):
2901         (KJS::replace):
2902         (KJS::stringProtoFuncCharAt):
2903         (KJS::stringProtoFuncCharCodeAt):
2904         (KJS::stringProtoFuncConcat):
2905         (KJS::stringProtoFuncIndexOf):
2906         (KJS::stringProtoFuncLastIndexOf):
2907         (KJS::stringProtoFuncMatch):
2908         (KJS::stringProtoFuncSearch):
2909         (KJS::stringProtoFuncReplace):
2910         (KJS::stringProtoFuncSlice):
2911         (KJS::stringProtoFuncSplit):
2912         (KJS::stringProtoFuncSubstr):
2913         (KJS::stringProtoFuncSubstring):
2914         (KJS::stringProtoFuncToLowerCase):
2915         (KJS::stringProtoFuncToUpperCase):
2916         (KJS::stringProtoFuncToLocaleLowerCase):
2917         (KJS::stringProtoFuncToLocaleUpperCase):
2918         (KJS::stringProtoFuncLocaleCompare):
2919         (KJS::stringProtoFuncBig):
2920         (KJS::stringProtoFuncSmall):
2921         (KJS::stringProtoFuncBlink):
2922         (KJS::stringProtoFuncBold):
2923         (KJS::stringProtoFuncFixed):
2924         (KJS::stringProtoFuncItalics):
2925         (KJS::stringProtoFuncStrike):
2926         (KJS::stringProtoFuncSub):
2927         (KJS::stringProtoFuncSup):
2928         (KJS::stringProtoFuncFontcolor):
2929         (KJS::stringProtoFuncFontsize):
2930         (KJS::stringProtoFuncAnchor):
2931         (KJS::stringProtoFuncLink):
2932         (KJS::StringConstructor::StringConstructor):
2933         (KJS::StringConstructor::construct):
2934         (KJS::StringConstructor::callAsFunction):
2935         (KJS::StringConstructorFunction::StringConstructorFunction):
2936         (KJS::StringConstructorFunction::callAsFunction):
2937         * kjs/string_object.h:
2938         (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
2939         * kjs/ustring.h:
2940         Updated for the above changes.
2941
2942 2008-06-17  Timothy Hatcher  <timothy@apple.com>
2943
2944         Added a type to DebuggerCallFrame so the under interface can
2945         distinguish anonymous functions and program call frames.
2946
2947         https://bugs.webkit.org/show_bug.cgi?id=19585
2948
2949         Reviewed by Geoff Garen.
2950
2951         * JavaScriptCore.exp: Export the DebuggerCallFrame::type symbol.
2952         * kjs/DebuggerCallFrame.cpp:
2953         (KJS::DebuggerCallFrame::type): Added.
2954         * kjs/DebuggerCallFrame.h:
2955
2956 2008-06-17  Eric Seidel  <eric@webkit.org>
2957
2958         Reviewed by Tim H.
2959         
2960         Remove bogus ASSERT which tripped every time for those who use PAC files.
2961
2962         * kjs/Parser.cpp:
2963         (KJS::Parser::parse):
2964
2965 2008-06-17  Kevin McCullough  <kmccullough@apple.com>
2966
2967         Reviewed by Geoff.
2968
2969         <rdar://problem/5951534> JSProfiler: Don't profile console.profile()
2970         or console.profileEnd()
2971
2972         * profiler/Profile.cpp:
2973         (KJS::Profile::stopProfiling): Moved the creation of the (idle) node to
2974         the Profile (not ProfileNode).  This makes sense since the Profile
2975         should be the one to modify the profile tree.  Also each stopProfiling()
2976         does not need to check if it's the head node anymore.  Also fixed an
2977         oddity where I was using willExecute to create the node.
2978         (KJS::Profile::removeProfileStart): Removes the call to console.profile
2979         that started this profile.
2980         (KJS::Profile::removeProfileEnd): Removes the call to console.profileEnd
2981         that ended this profile.
2982         * profiler/Profile.h:
2983         * profiler/ProfileNode.cpp: Moved the creation of the (idle) node to
2984         the Profile object.
2985         (KJS::ProfileNode::stopProfiling):
2986         * profiler/ProfileNode.h: Added some helper functions and whitespace to
2987         facilitate readability and the removal of profile() and profileEnd()
2988         from the Profile tree.
2989         (KJS::CallIdentifier::operator const char* ):
2990         (KJS::ProfileNode::firstChild):
2991         (KJS::ProfileNode::lastChild):
2992         (KJS::ProfileNode::removeChild):
2993         (KJS::ProfileNode::toString):
2994
2995 2008-06-17  Ariya Hidayat  <ariya.hidayat@trolltech.com>
2996
2997         Rubber stamped by Adam Roben.
2998
2999         Include JSGlobalObject.h to fix the build.
3000
3001         * kjs/ScopeChain.cpp:
3002
3003 2008-06-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3004
3005         Reviewed by Oliver.
3006
3007         Reduce code duplication in emitReadModifyAssignment().
3008
3009         * kjs/nodes.cpp:
3010         (KJS::emitReadModifyAssignment):
3011
3012 2008-06-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3013
3014         Reviewed by Oliver.
3015
3016         Sort includes alphabetically.
3017
3018         * kjs/nodes.cpp:
3019
3020 2008-06-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3021
3022         Reviewed by Maciej.
3023
3024         Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
3025         <https://bugs.webkit.org/show_bug.cgi?id=19596>
3026
3027         When growing SegmentedVector, we start adding segments at the position
3028         of the last segment, overwriting it. The destructor frees allocated
3029         segments starting at the segment of index 1, because the segment of
3030         index 0 is assumed to be the initial inline segment. This causes a leak
3031         of the segment that is referenced by index 0. Modifying grow() so that
3032         it starts adding segments at the position after the last segment fixes
3033         the leak.
3034
3035         Since the initial segment is a special case in the lookup code, this
3036         bug never manifested itself via incorrect results.
3037
3038         * VM/SegmentedVector.h:
3039         (KJS::SegmentedVector::grow):
3040
3041 2008-06-16  Maciej Stachowiak  <mjs@apple.com>
3042
3043         Reviewed by Alexey.
3044         
3045         - removed nearly unused types.h and LocalStorageEntry.h headers
3046
3047         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3048         * JavaScriptCore.xcodeproj/project.pbxproj:
3049         * kjs/ExecState.h:
3050         * kjs/LocalStorageEntry.h: Removed.
3051         * kjs/RegExpObject.cpp:
3052         * kjs/error_object.cpp:
3053         * kjs/grammar.y:
3054         * kjs/nodes.cpp:
3055         * kjs/types.h: Removed.
3056
3057 2008-06-16  Alp Toker  <alp@nuanti.com>
3058
3059         Rubber-stamped by Geoff.
3060
3061         Change c++ to c in minidom and testapi emacs mode line comments.
3062
3063         * API/Node.h:
3064         * API/NodeList.c:
3065         * API/NodeList.h:
3066         * API/testapi.c:
3067
3068 >>>>>>> .r34623
3069 2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
3070
3071         Trying to fix Windows build.
3072
3073         * kjs/PropertyNameArray.h:
3074         * kjs/identifier.cpp:
3075         Include ExecState.h
3076
3077 2008-06-16  Geoffrey Garen  <ggaren@apple.com>
3078
3079         Reviewed by Oliver Hunt.
3080         
3081         Slight cleanup to the SymbolTableEntry class.
3082         
3083         Renamed isEmpty to isNull, since we usually use "empty" to mean "holds
3084         the valid, empty value", and "null" to mean "holds no value".
3085         
3086         Changed an "== 0" to a "!", to match our style guidelines.
3087         
3088         Added some ASSERTs to verify the (possibly questionable) assumption that
3089         all register indexes will have their high two bits set. Also clarified a
3090         comment to make that assumption clear.
3091
3092 2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
3093
3094         Reviewed by Darin.
3095
3096         Initialize functionQueueMutex in a safe manner.
3097
3098         * wtf/MainThread.cpp:
3099         (WTF::functionQueueMutex): Made it an AtomicallyInitializedStatic.
3100
3101         (WTF::dispatchFunctionsFromMainThread):
3102         (WTF::setMainThreadCallbacksPaused):
3103         Assert that the current thread is main, meaning that the callbacksPaused static can be
3104         accessed.
3105
3106 2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
3107
3108         Reviewed by Geoff Garen.
3109
3110         Make Identifier construction use an explicitly passed IdentifierTable.
3111
3112         No change on SunSpider total.
3113
3114         * API/JSCallbackObjectFunctions.h:
3115         (KJS::::getOwnPropertySlot):
3116         (KJS::::put):
3117         (KJS::::deleteProperty):
3118         (KJS::::getPropertyNames):
3119         * API/JSObjectRef.cpp:
3120         (JSObjectMakeFunctionWithCallback):
3121         (JSObjectMakeFunction):
3122         (JSObjectHasProperty):
3123         (JSObjectGetProperty):
3124         (JSObjectSetProperty):
3125         (JSObjectDeleteProperty):
3126         (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
3127         (JSObjectCopyPropertyNames):
3128         * JavaScriptCore.exp:
3129         * VM/CodeGenerator.cpp:
3130         (KJS::CodeGenerator::CodeGenerator):
3131         (KJS::CodeGenerator::registerForLocal):
3132         (KJS::CodeGenerator::isLocal):
3133         (KJS::CodeGenerator::addConstant):
3134         (KJS::CodeGenerator::findScopedProperty):
3135         * VM/CodeGenerator.h:
3136         (KJS::CodeGenerator::globalData):
3137         (KJS::CodeGenerator::propertyNames):
3138         * VM/JSPropertyNameIterator.cpp:
3139         (KJS::JSPropertyNameIterator::create):
3140         * VM/Machine.cpp:
3141         (KJS::Machine::throwException):
3142         (KJS::Machine::privateExecute):
3143         * kjs/ArrayPrototype.cpp:
3144         (KJS::ArrayConstructor::ArrayConstructor):
3145         * kjs/BooleanObject.cpp:
3146         (KJS::BooleanConstructor::BooleanConstructor):
3147         * kjs/FunctionPrototype.cpp:
3148         (KJS::FunctionConstructor::FunctionConstructor):
3149         (KJS::FunctionConstructor::construct):
3150         * kjs/JSArray.cpp:
3151         (KJS::JSArray::inlineGetOwnPropertySlot):
3152         (KJS::JSArray::put):
3153         (KJS::JSArray::deleteProperty):
3154         (KJS::JSArray::getPropertyNames):
3155         * kjs/JSFunction.cpp:
3156         (KJS::Arguments::Arguments):
3157         * kjs/JSGlobalData.cpp:
3158         (KJS::JSGlobalData::JSGlobalData):
3159         * kjs/JSGlobalObject.cpp:
3160         (KJS::JSGlobalObject::reset):
3161         * kjs/JSObject.cpp:
3162         (KJS::JSObject::getOwnPropertySlot):
3163         (KJS::JSObject::put):
3164         (KJS::JSObject::putWithAttributes):
3165         (KJS::JSObject::deleteProperty):
3166         (KJS::JSObject::findPropertyHashEntry):
3167         (KJS::JSObject::getPropertyNames):
3168         (KJS::Error::create):
3169         * kjs/JSVariableObject.cpp:
3170         (KJS::JSVariableObject::getPropertyNames):
3171         * kjs/NumberObject.cpp:
3172         (KJS::NumberConstructor::NumberConstructor):
3173         * kjs/PropertyNameArray.cpp:
3174         (KJS::PropertyNameArray::add):
3175         * kjs/PropertyNameArray.h:
3176         (KJS::PropertyNameArray::PropertyNameArray):
3177         (KJS::PropertyNameArray::addKnownUnique):
3178         * kjs/PropertySlot.h:
3179         (KJS::PropertySlot::getValue):
3180         * kjs/RegExpObject.cpp:
3181         (KJS::RegExpConstructor::RegExpConstructor):
3182         * kjs/ScopeChain.cpp:
3183         (KJS::ScopeChainNode::print):
3184         * kjs/Shell.cpp:
3185         (GlobalObject::GlobalObject):
3186         * kjs/date_object.cpp:
3187         (KJS::DateConstructor::DateConstructor):
3188         * kjs/error_object.cpp:
3189         (KJS::ErrorConstructor::ErrorConstructor):
3190         (KJS::NativeErrorConstructor::NativeErrorConstructor):
3191         * kjs/grammar.y:
3192         * kjs/identifier.cpp:
3193         (KJS::Identifier::add):
3194         (KJS::Identifier::addSlowCase):
3195         * kjs/identifier.h:
3196         (KJS::Identifier::Identifier):
3197         (KJS::Identifier::from):
3198         (KJS::Identifier::equal):
3199         (KJS::Identifier::add):
3200         (KJS::operator==):
3201         (KJS::operator!=):
3202         * kjs/internal.cpp:
3203         (KJS::JSString::getOwnPropertySlot):
3204         * kjs/lexer.cpp:
3205         (KJS::Lexer::Lexer):
3206         (KJS::Lexer::lex):
3207         (KJS::Lexer::makeIdentifier):
3208         * kjs/lexer.h:
3209         * kjs/lookup.cpp:
3210         (KJS::HashTable::createTable):
3211         * kjs/lookup.h:
3212         (KJS::HashTable::initializeIfNeeded):
3213         (KJS::HashTable::entry):
3214         (KJS::getStaticPropertySlot):
3215         (KJS::getStaticFunctionSlot):
3216         (KJS::getStaticValueSlot):
3217         (KJS::lookupPut):
3218         * kjs/object_object.cpp:
3219         (KJS::objectProtoFuncHasOwnProperty):
3220         (KJS::objectProtoFuncDefineGetter):
3221         (KJS::objectProtoFuncDefineSetter):
3222         (KJS::objectProtoFuncLookupGetter):
3223         (KJS::objectProtoFuncLookupSetter):
3224         (KJS::objectProtoFuncPropertyIsEnumerable):
3225         (KJS::ObjectConstructor::ObjectConstructor):
3226         * kjs/string_object.cpp:
3227         (KJS::StringObject::getOwnPropertySlot):
3228         (KJS::StringObject::getPropertyNames):
3229         (KJS::StringConstructor::StringConstructor):
3230         Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
3231         explicit.
3232
3233         * kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
3234         char*, which was incorrect, as that uses the pointer value as a key.
3235
3236 2008-06-16  Thiago Macieira  <tjmaciei@trolltech.com>
3237
3238         Reviewed by Darin.
3239
3240         https://bugs.webkit.org/show_bug.cgi?id=19577
3241
3242         Fix compilation in C++ environments where C99 headers are not present
3243
3244         The stdbool.h header is a C99 feature, defining the "_Bool" type as well as the
3245         "true" and "false" constants. But it's completely unnecessary in C++ as the
3246         language already defines the "bool" type and its two values.
3247
3248         * API/JSBase.h:
3249         * API/JSContextRef.h:
3250         * API/JSObjectRef.h:
3251         * API/JSStringRef.h:
3252         * API/JSValueRef.h:
3253
3254 2008-06-16  Kevin McCullough  <kmccullough@apple.com>
3255
3256         Reviewed by John.
3257
3258         <rdar://problem/6012509> JSProfiler: %s are incorrect if you exclude a
3259         top level node like (idle)
3260
3261         * profiler/Profile.cpp:
3262         (KJS::Profile::focus):
3263         (KJS::Profile::exclude): Subtract the selfTime from the totalTime of the
3264         head since its self time will only be non-zero when one of its children
3265         were excluded. Since the head's totalTime is used to calculate %s when
3266         its totalTime is the same as the sum of all its visible childrens' times
3267         their %s will sum to 100%.
3268
3269 2008-06-16  Kevin McCullough  <kmccullough@apple.com>
3270
3271         Reviewed by Sam Weinig.
3272
3273         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the profiler.
3274
3275         * profiler/Profile.cpp:
3276         (KJS::Profile::willExecute):
3277
3278 2008-06-16  Kevin McCullough  <kmccullough@apple.com>
3279
3280         Reviewed by Sam.
3281
3282         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
3283         profiler.
3284         - Remove the last of the uses of recursion in the profiler.
3285
3286         * JavaScriptCore.exp: Export the new function's signature.
3287         * profiler/Profile.cpp: 
3288         (KJS::calculateVisibleTotalTime): Added a new static method for
3289         recalculating the visibleTotalTime of methods after focus has changed
3290         which are visible.
3291         (KJS::stopProfiling): 
3292         (KJS::Profile::focus): Implemented focus without recursion.
3293         * profiler/Profile.h: Moved implementation into the definition file.
3294         * profiler/ProfileNode.cpp:
3295         (KJS::ProfileNode::traverseNextNodePreOrder): Added an argument for
3296         whether or not to process the children nodes, this allows focus to skip
3297         sub trees which have been set as not visible.
3298         (KJS::ProfileNode::calculateVisibleTotalTime): This function set's a
3299         node's total visible time to the sum of its self time and its children's
3300         total times.
3301         (KJS::ProfileNode::focus): Implemented focus without recursion.
3302         * profiler/ProfileNode.h:
3303         (KJS::CallIdentifier::operator!= ):
3304         (KJS::ProfileNode::setActualTotalTime): Expanded setting the total time
3305         so that focus could modify only the visible total time.
3306         (KJS::ProfileNode::setVisibleTotalTime):
3307
3308 2008-06-16  Christian Dywan  <christian@twotoasts.de>
3309
3310         Reviewed by Sam.
3311
3312         https://bugs.webkit.org/show_bug.cgi?id=19552
3313         JavaScriptCore headers use C++ style comments
3314
3315         Replace all C++ style comments with C style multiline
3316         comments and remove all "mode" lines.
3317
3318         * API/JSBase.h:
3319         * API/JSClassRef.h:
3320         * API/JSContextRef.h:
3321         * API/JSObjectRef.h:
3322         * API/JSStringRef.h:
3323         * API/JSStringRefBSTR.h:
3324         * API/JSStringRefCF.h:
3325         * API/JSValueRef.h:
3326         * API/JavaScript.h:
3327         * API/JavaScriptCore.h:
3328
3329 2008-06-16  Christian Dywan  <christian@twotoasts.de>
3330
3331         Reviewed by Sam.
3332
3333         https://bugs.webkit.org/show_bug.cgi?id=19557
3334         (JavaScriptCore) minidom uses C++ style comments
3335
3336         Use only C style comments in minidom sources
3337
3338         * API/JSNode.c:
3339         (JSNode_appendChild):
3340         (JSNode_removeChild):
3341         * API/JSNode.h:
3342         * API/JSNodeList.c:
3343         (JSNodeList_getProperty):
3344         * API/JSNodeList.h:
3345         * API/Node.c:
3346         * API/Node.h:
3347         * API/NodeList.c:
3348         (NodeList_new):
3349         (NodeList_item):
3350         * API/NodeList.h:
3351         * API/minidom.c:
3352         (createStringWithContentsOfFile):
3353         * wtf/Assertions.h:
3354         * wtf/UnusedParam.h:
3355
3356 2008-06-16  Adriaan de Groot  <groot@kde.org>
3357
3358         Reviewed by Simon.
3359
3360         Fix compilation on Solaris
3361
3362         On some systems, munmap takes a char* instead of a void* (contrary to POSIX and
3363         Single Unix Specification). Since you can always convert from char* to void*
3364         but not vice-versa, do the casting to char*.
3365
3366         * kjs/collector.cpp:
3367         (KJS::allocateBlock):
3368         (KJS::freeBlock):
3369
3370 2008-06-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3371
3372         Reviewed by Maciej.
3373
3374         Make a UnaryOpNode class to reduce boilerplate code for UnaryPlusNode,
3375         NegateNode, BitwiseNotNode, and LogicalNotNode.
3376
3377         * VM/CodeGenerator.h:
3378         (KJS::CodeGenerator::emitToJSNumber):
3379         * kjs/nodes.cpp:
3380         (KJS::UnaryOpNode::emitCode):
3381         * kjs/nodes.h:
3382         (KJS::UnaryOpNode::UnaryOpNode):
3383         (KJS::UnaryPlusNode::):
3384         (KJS::NegateNode::):
3385         (KJS::NegateNode::precedence):
3386         (KJS::BitwiseNotNode::):
3387         (KJS::BitwiseNotNode::precedence):
3388         (KJS::LogicalNotNode::):
3389         (KJS::LogicalNotNode::precedence):
3390
3391 2008-06-16  Jan Michael Alonzo  <jmalonzo@webkit.org>
3392
3393         Gtk build fix
3394
3395         * GNUmakefile.am:
3396
3397 2008-06-15  Darin Adler  <darin@apple.com>
3398
3399         - rename KJS::List to KJS::ArgList
3400
3401         * API/JSCallbackConstructor.cpp:
3402         (KJS::JSCallbackConstructor::construct):
3403         * API/JSCallbackConstructor.h:
3404         * API/JSCallbackFunction.cpp:
3405         (KJS::JSCallbackFunction::callAsFunction):
3406         * API/JSCallbackFunction.h:
3407         * API/JSCallbackObject.h:
3408         * API/JSCallbackObjectFunctions.h:
3409         (KJS::::construct):
3410         (KJS::::callAsFunction):
3411         * API/JSObjectRef.cpp:
3412         (JSObjectMakeFunction):
3413         (JSObjectCallAsFunction):
3414         (JSObjectCallAsConstructor):
3415         * JavaScriptCore.exp:
3416         * VM/Machine.cpp:
3417         (KJS::Machine::execute):
3418         (KJS::Machine::privateExecute):
3419         * VM/Machine.h:
3420         * kjs/ArrayPrototype.cpp:
3421         (KJS::arrayProtoFuncToString):
3422         (KJS::arrayProtoFuncToLocaleString):
3423         (KJS::arrayProtoFuncJoin):
3424         (KJS::arrayProtoFuncConcat):
3425         (KJS::arrayProtoFuncPop):
3426         (KJS::arrayProtoFuncPush):
3427         (KJS::arrayProtoFuncReverse):
3428         (KJS::arrayProtoFuncShift):
3429         (KJS::arrayProtoFuncSlice):
3430         (KJS::arrayProtoFuncSort):
3431         (KJS::arrayProtoFuncSplice):
3432         (KJS::arrayProtoFuncUnShift):
3433         (KJS::arrayProtoFuncFilter):
3434         (KJS::arrayProtoFuncMap):
3435         (KJS::arrayProtoFuncEvery):
3436         (KJS::arrayProtoFuncForEach):
3437         (KJS::arrayProtoFuncSome):
3438         (KJS::arrayProtoFuncIndexOf):
3439         (KJS::arrayProtoFuncLastIndexOf):
3440         (KJS::ArrayConstructor::construct):
3441         (KJS::ArrayConstructor::callAsFunction):
3442         * kjs/ArrayPrototype.h:
3443         * kjs/BooleanObject.cpp:
3444         (KJS::booleanProtoFuncToString):
3445         (KJS::booleanProtoFuncValueOf):
3446         (KJS::BooleanConstructor::construct):
3447         (KJS::BooleanConstructor::callAsFunction):
3448         * kjs/BooleanObject.h:
3449         * kjs/CommonIdentifiers.h:
3450         * kjs/ExecState.h:
3451         (KJS::ExecState::emptyList):
3452         * kjs/FunctionPrototype.cpp:
3453         (KJS::FunctionPrototype::callAsFunction):
3454         (KJS::functionProtoFuncToString):
3455         (KJS::functionProtoFuncApply):
3456         (KJS::functionProtoFuncCall):
3457         (KJS::FunctionConstructor::construct):
3458         (KJS::FunctionConstructor::callAsFunction):
3459         * kjs/FunctionPrototype.h:
3460         * kjs/JSActivation.cpp:
3461         (KJS::JSActivation::createArgumentsObject):
3462         * kjs/JSArray.cpp:
3463         (KJS::JSArray::JSArray):
3464         (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
3465         * kjs/JSArray.h:
3466         * kjs/JSFunction.cpp:
3467         (KJS::JSFunction::callAsFunction):
3468         (KJS::JSFunction::construct):
3469         (KJS::IndexToNameMap::IndexToNameMap):
3470         (KJS::Arguments::Arguments):
3471         (KJS::encode):
3472         (KJS::decode):
3473         (KJS::globalFuncEval):
3474         (KJS::globalFuncParseInt):
3475         (KJS::globalFuncParseFloat):
3476         (KJS::globalFuncIsNaN):
3477         (KJS::globalFuncIsFinite):
3478         (KJS::globalFuncDecodeURI):
3479         (KJS::globalFuncDecodeURIComponent):
3480         (KJS::globalFuncEncodeURI):
3481         (KJS::globalFuncEncodeURIComponent):
3482         (KJS::globalFuncEscape):
3483         (KJS::globalFuncUnescape):
3484         (KJS::globalFuncKJSPrint):
3485         (KJS::PrototypeFunction::callAsFunction):
3486         (KJS::PrototypeReflexiveFunction::callAsFunction):
3487         * kjs/JSFunction.h:
3488         * kjs/JSGlobalData.h:
3489         * kjs/JSImmediate.cpp:
3490         (KJS::JSImmediate::toObject):
3491         * kjs/JSNotAnObject.cpp:
3492         (KJS::JSNotAnObject::construct):
3493         (KJS::JSNotAnObject::callAsFunction):
3494         * kjs/JSNotAnObject.h:
3495         * kjs/JSObject.cpp:
3496         (KJS::JSObject::put):
3497         (KJS::JSObject::construct):
3498         (KJS::JSObject::callAsFunction):
3499         (KJS::Error::create):
3500         * kjs/JSObject.h:
3501         * kjs/MathObject.cpp:
3502         (KJS::mathProtoFuncAbs):
3503         (KJS::mathProtoFuncACos):
3504         (KJS::mathProtoFuncASin):
3505         (KJS::mathProtoFuncATan):
3506         (KJS::mathProtoFuncATan2):
3507         (KJS::mathProtoFuncCeil):
3508         (KJS::mathProtoFuncCos):
3509         (KJS::mathProtoFuncExp):
3510         (KJS::mathProtoFuncFloor):
3511         (KJS::mathProtoFuncLog):
3512         (KJS::mathProtoFuncMax):
3513         (KJS::mathProtoFuncMin):
3514         (KJS::mathProtoFuncPow):
3515         (KJS::mathProtoFuncRandom):
3516         (KJS::mathProtoFuncRound):
3517         (KJS::mathProtoFuncSin):
3518         (KJS::mathProtoFuncSqrt):
3519         (KJS::mathProtoFuncTan):
3520         * kjs/MathObject.h:
3521         * kjs/NumberObject.cpp:
3522         (KJS::numberProtoFuncToString):
3523         (KJS::numberProtoFuncToLocaleString):
3524         (KJS::numberProtoFuncValueOf):
3525         (KJS::numberProtoFuncToFixed):
3526         (KJS::numberProtoFuncToExponential):
3527         (KJS::numberProtoFuncToPrecision):