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