JavaScriptCore:
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2007-11-03  David D. Kilzer  <ddkilzer@webkit.org>
2
3         Sort files(...); sections of Xcode project files.
4
5         Rubber-stamped by Darin.
6
7         * JavaScriptCore.xcodeproj/project.pbxproj:
8
9 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
10
11         Reviewed by Oliver.
12         
13         - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
14
15         * kjs/grammar.y:
16         * kjs/nodes.cpp:
17         (KJS::VarDeclNode::optimizeVariableAccess):
18         (KJS::VarDeclNode::getDeclarations):
19         (KJS::VarDeclNode::handleSlowCase):
20         (KJS::VarDeclNode::evaluateSingle):
21         (KJS::VarDeclNode::evaluate):
22         (KJS::VarStatementNode::execute):
23         * kjs/nodes.h:
24         (KJS::VarDeclNode::):
25         (KJS::VarStatementNode::):
26         * kjs/nodes2string.cpp:
27         (KJS::VarDeclNode::streamTo):
28
29 2007-11-03  Alexey Proskuryakov  <ap@webkit.org>
30
31         Reviewed by Darin.
32
33         http://bugs.webkit.org/show_bug.cgi?id=15800
34         REGRESSION (r27303): RegExp leaks
35
36         * kjs/regexp_object.h:
37         (KJS::RegExpImp::setRegExp):
38         (KJS::RegExpImp::regExp):
39         (KJS::RegExpImp::classInfo):
40         * kjs/regexp_object.cpp:
41         (RegExpImp::RegExpImp):
42         (RegExpImp::~RegExpImp):
43         Renamed reg member variable to m_regExp, changed it to use OwnPtr.
44
45 2007-11-02  Maciej Stachowiak  <mjs@apple.com>
46
47         Reviewed by Oliver.
48         
49         - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
50
51         * kjs/grammar.y:
52         * kjs/nodes.cpp:
53         (KJS::statementListPushFIFO):
54         (KJS::statementListGetDeclarations):
55         (KJS::statementListInitializeDeclarationStacks):
56         (KJS::statementListInitializeVariableAccessStack):
57         (KJS::statementListExecute):
58         (KJS::BlockNode::BlockNode):
59         (KJS::FunctionBodyNode::FunctionBodyNode):
60         (KJS::ProgramNode::ProgramNode):
61         * kjs/nodes.h:
62         (KJS::CaseClauseNode::):
63
64 2007-11-02  Darin Adler  <darin@apple.com>
65
66         Reviewed by Maciej.
67
68         - http://bugs.webkit.org/show_bug.cgi?id=15791
69           change property map data structure for less memory use, better speed
70
71         The property map now has an array of indices and a separate array of
72         property map entries. This slightly slows down lookup because of a second
73         memory acess, but makes property maps smaller and faster to iterate in
74         functions like mark().
75
76         SunSpider says this is 1.2% faster, although it makes the bitwise-end test
77         more than 10% slower. To fix that we'll need to optimize global variable lookup.
78
79         * kjs/property_map.cpp:
80         (KJS::PropertyMapEntry::PropertyMapEntry):
81         (KJS::PropertyMapHashTable::entries):
82         (KJS::PropertyMapHashTable::allocationSize):
83         (KJS::SavedProperties::SavedProperties):
84         (KJS::SavedProperties::~SavedProperties):
85         (KJS::PropertyMap::checkConsistency):
86         (KJS::PropertyMap::~PropertyMap):
87         (KJS::PropertyMap::clear):
88         (KJS::PropertyMap::get):
89         (KJS::PropertyMap::getLocation):
90         (KJS::PropertyMap::put):
91         (KJS::PropertyMap::insert):
92         (KJS::PropertyMap::createTable):
93         (KJS::PropertyMap::rehash):
94         (KJS::PropertyMap::remove):
95         (KJS::PropertyMap::mark):
96         (KJS::comparePropertyMapEntryIndices):
97         (KJS::PropertyMap::containsGettersOrSetters):
98         (KJS::PropertyMap::getEnumerablePropertyNames):
99         (KJS::PropertyMap::save):
100         (KJS::PropertyMap::restore):
101         * kjs/property_map.h:
102
103 2007-11-02  Darin Adler  <darin@apple.com>
104
105         Reviewed by Maciej.
106
107         - http://bugs.webkit.org/show_bug.cgi?id=15807
108           HashMap needs a take() function that combines get and remove
109
110         * wtf/HashMap.h: Added take function. Simplistic implementation for now,
111         but still does only one hash table lookup.
112
113         * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
114         a find followed by a remove.
115
116 2007-11-02  David Carson  <dacarson@gmail.com>
117
118         Reviewed by Darin.
119
120         Fix compiler warning "warning: suggest parentheses around && within ||"
121         http://bugs.webkit.org/show_bug.cgi?id=15764
122
123         * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
124
125 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
126
127         Reviewed by Maciej Stachowiak.
128         
129         In preparation for making List a simple stack-allocated Vector:
130
131         Removed all instances of List copying and/or assignment, and made List 
132         inherit from Noncopyable.
133         
134         Functions that used to return a List by copy now take List& out 
135         parameters.
136         
137         Layout tests and JS tests pass.
138
139         * kjs/list.cpp:
140         (KJS::List::slice): Replaced copyTail with a more generic slice 
141         alternative. (JavaScriptCore only calls slice(1), but WebCore calls 
142         slice(2)).
143
144 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
145
146         Reviewed by Maciej Stachowiak.
147
148         Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
149         REGRESSION(r27344): Crash on load at finance.yahoo.com
150         
151         Reverted a small portion of my last check-in. (The speedup and the List 
152         removal are still there, though.)
153         
154         ActivationImp needs to hold a pointer to its function, and mark that 
155         pointer (rather than accessing its function through its ExecState, and 
156         counting on the active scope to mark its function) because a closure 
157         can cause an ActivationImp to outlive its ExecState along with any 
158         active scope.
159
160         * kjs/ExecState.cpp:
161         (KJS::ExecState::ExecState):
162         * kjs/function.cpp:
163         (KJS::FunctionImp::~FunctionImp):
164         (KJS::ActivationImp::ActivationImp):
165         * kjs/function.h:
166         (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
167
168         Also made HashTable a little more crash-happy in debug builds, so 
169         problems like this will show up earlier:
170         
171         * wtf/HashTable.h:
172         (WTF::HashTable::~HashTable):
173
174 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
175
176         Reviewed by Adam Roben.
177         
178         Addressed some of Darin's review comments.
179         
180         Used perl -p, which is the shorthand while(<>) {}.
181         
182         Made sure not to suppress bison's output.
183         
184         Added line to removed bison_out.txt, since this script removes other 
185         intermediate files, too.
186
187         * DerivedSources.make:
188
189 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
190
191         Reviewed by Oliver Hunt.
192         
193         Removed List from ActivationImp, in preparation for making all lists
194         stack-allocated.
195         
196         Tests pass.
197         
198         1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
199
200         * kjs/ExecState.cpp:
201         (KJS::ExecState::ExecState):
202         (KJS::ExecState::~ExecState):
203         * kjs/function.cpp:
204         (KJS::ActivationImp::ActivationImp):
205         (KJS::ActivationImp::createArgumentsObject):
206         * kjs/function.h:
207         (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
208
209 2007-11-01  Adam Roben  <aroben@apple.com>
210
211         Use jsNumberCell instead of jsNumber when converting double constants to JSValues
212
213         This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
214         ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
215
216         It also gets rid of an MSVC warning that we previously had to silence.
217
218         Reviewed by Geoff.
219
220         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
221         back on the "overflow in constant arithmetic" warning.
222         * kjs/number_object.cpp:
223         (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
224         jsNumber.
225
226 2007-10-31  Adam Roben  <aroben@apple.com>
227
228         Windows build fix
229
230         * kjs/ExecState.h:
231
232 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
233
234         Reviewed by Oliver.
235         
236         - shave some cycles off of local storage access for a 1% SunSpider speedup
237         
238         Keep the LocalStorage pointer in the ExecState, instead of getting
239         it from the ActivationImp all the time.
240
241         * kjs/ExecState.cpp:
242         (KJS::ExecState::updateLocalStorage):
243         * kjs/ExecState.h:
244         (KJS::ExecState::localStorage):
245         * kjs/nodes.cpp:
246         (KJS::LocalVarAccessNode::evaluate):
247         (KJS::LocalVarFunctionCallNode::evaluate):
248         (KJS::PostIncLocalVarNode::evaluate):
249         (KJS::PostDecLocalVarNode::evaluate):
250         (KJS::LocalVarTypeOfNode::evaluate):
251         (KJS::PreIncLocalVarNode::evaluate):
252         (KJS::PreDecLocalVarNode::evaluate):
253         (KJS::ReadModifyLocalVarNode::evaluate):
254         (KJS::AssignLocalVarNode::evaluate):
255         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
256
257 2007-10-31  Adam Roben  <aroben@apple.com>
258
259         Fix a crash on launch due to a static initializer race
260
261         We now use fast inline assembler spinlocks which can be statically
262         initialized at compile time.
263
264         As a side benefit, this speeds up SunSpider by 0.4%.
265
266         Reviewed by Oliver.
267
268         * wtf/FastMalloc.cpp:
269         * wtf/TCSpinLock.h:
270         (TCMalloc_SpinLock::Lock):
271         (TCMalloc_SpinLock::Unlock):
272         (TCMalloc_SlowLock):
273         * wtf/TCSystemAlloc.cpp:
274
275 2007-10-31  Kevin McCullough  <kmccullough@apple.com>
276
277         Reviewed by Sam.
278
279         - Corrected spelling.
280
281         * wtf/HashTraits.h:
282
283 2007-10-31  Mark Rowe  <mrowe@apple.com>
284
285         Further Gtk build fixage.
286
287         * kjs/regexp_object.cpp:
288
289 2007-10-31  Mark Rowe  <mrowe@apple.com>
290
291         Gtk build fix.
292
293         * kjs/regexp.h:
294
295 2007-10-31  Darin Adler  <darin@apple.com>
296
297         Reviewed by Maciej.
298
299         - fix http://bugs.webkit.org/show_bug.cgi?id=15749
300           RegExp/RegExpObjectImp cause needless UString creation
301
302         Speeds things up 0.4% according to SunSpider.
303
304         * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
305         because this library doesn't use the real PCRE -- it uses its
306         own PCRE that works on UTF-16.
307
308         * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
309         Use Noncopyable. Change the return value of match.
310         * kjs/regexp.cpp:
311         (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
312         (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
313         (KJS::RegExp::match): Change to return the position as an int and the
314         ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
315
316         * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
317         require a result string.
318         * kjs/regexp_object.cpp:
319         (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
320         (RegExpObjectImp::performMatch): Change so it doesn't return a string.
321         (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
322         the main result with the backreferences; now it doesn't need to take
323         a result parameter.
324         (RegExpObjectImp::getBackref): Minor tweaks.
325         (RegExpObjectImp::getLastParen): Ditto.
326         (RegExpObjectImp::getLeftContext): Ditto.
327         (RegExpObjectImp::getRightContext): Ditto.
328         (RegExpObjectImp::getValueProperty): Change LastMatch case to call
329         getBackref(0) so we don't need a separate getLastMatch function.
330
331         * kjs/string_object.cpp:
332         (KJS::replace): Update to use new performMatch, including merging the
333         matched string section with the other substrings.
334         (KJS::StringProtoFunc::callAsFunction): Update functions to use the
335         new performMatch and match. Also change to use OwnArrayPtr.
336
337 2007-10-31  Oliver Hunt  <oliver@apple.com>
338
339         * kjs/nodes.h: include OwnPtr.h
340
341 2007-10-31  Oliver Hunt  <oliver@apple.com>
342
343         Reviewed by Maciej.
344
345         Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
346
347         * kjs/grammar.y:
348         * kjs/nodes.cpp:
349         (KJS::statementListPushFIFO):
350         (KJS::statementListGetDeclarations):
351         (KJS::statementListInitializeDeclarationStacks):
352         (KJS::statementListInitializeVariableAccessStack):
353         (KJS::statementListExecute):
354         (KJS::BlockNode::optimizeVariableAccess):
355         (KJS::BlockNode::BlockNode):
356         (KJS::BlockNode::getDeclarations):
357         (KJS::BlockNode::execute):
358         (KJS::CaseClauseNode::optimizeVariableAccess):
359         (KJS::CaseClauseNode::getDeclarations):
360         (KJS::CaseClauseNode::evalStatements):
361         (KJS::FunctionBodyNode::initializeDeclarationStacks):
362         (KJS::FunctionBodyNode::optimizeVariableAccess):
363         * kjs/nodes.h:
364         * kjs/nodes2string.cpp:
365         (KJS::statementListStreamTo):
366         (KJS::BlockNode::streamTo):
367         (KJS::CaseClauseNode::streamTo):
368
369 2007-10-30  Mark Rowe  <mrowe@apple.com>
370
371         * kjs/property_map.cpp: Added a missing using directive to fix the build
372         for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
373
374 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
375
376         * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
377         for non-Mac ports.
378
379 2007-10-31  Alexey Proskuryakov  <ap@webkit.org>
380
381         Reviewed by Darin.
382
383         http://bugs.webkit.org/show_bug.cgi?id=11001
384         WebKit doesn't support RegExp.compile method
385
386         Test: fast/js/regexp-compile.html
387
388         * kjs/regexp_object.cpp:
389         (RegExpPrototype::RegExpPrototype):
390         (RegExpProtoFunc::callAsFunction):
391         * kjs/regexp_object.h:
392         (KJS::RegExpProtoFunc::):
393         Added RegExp.compile.
394
395         * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
396
397 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
398
399         Reviewed by Oliver.
400         
401         - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
402         
403         Integer divide sucks. Fortunately, a bunch of shifts and XORs
404         biased towards the high bits is sufficient to provide a good
405         double hash. Besides the SunSpider win, I used the dump statistics
406         mode for both to verify that collisions did not increase and that
407         the longest collision chain is not any longer.
408
409         * kjs/property_map.cpp:
410         (KJS::doubleHash):
411         (KJS::PropertyMap::get):
412         (KJS::PropertyMap::getLocation):
413         (KJS::PropertyMap::put):
414         (KJS::PropertyMap::insert):
415         (KJS::PropertyMap::remove):
416         (KJS::PropertyMap::checkConsistency):
417         * wtf/HashTable.h:
418         (WTF::doubleHash):
419         (WTF::::lookup):
420         (WTF::::lookupForWriting):
421         (WTF::::fullLookupForWriting):
422         (WTF::::add):
423
424 2007-10-30  Adam Roben  <aroben@apple.com>
425
426         * kjs/collector.h: Make HeapType public so it can be used for non-member
427         things like the HeapConstants struct template. Fixes the build on Windows.
428
429 2007-10-30  Adam Roben  <aroben@apple.com>
430
431         Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
432
433         Speeds up SunSpider by 0.4%.
434
435         Reviewed by Steve and Maciej.
436
437         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
438         a warning during LTCG in release builds about double -> float
439         conversion.
440         * wtf/AlwaysInline.h:
441         * wtf/FastMalloc.h:
442
443 2007-10-30  Adam Roben  <aroben@apple.com>
444
445         Use GetCurrentThreadId instead of pthread_self in FastMalloc
446
447         Speeds up SunSpider by 0.3%.
448
449         Reviewed by Steve.
450
451         * wtf/FastMalloc.cpp:
452         (WTF::TCMalloc_ThreadCache::InitTSD):
453         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
454
455 2007-10-30  Adam Roben  <aroben@apple.com>
456
457         Switch to a Win32 critical section implementation of spinlocks
458         
459         Speeds up SunSpider by 0.4%.
460         
461         Reviewed by Steve.
462         
463         * wtf/FastMalloc.cpp:
464         * wtf/TCSpinLock.h:
465         (TCMalloc_SpinLock::TCMalloc_SpinLock):
466         (TCMalloc_SpinLock::Init):
467         (TCMalloc_SpinLock::Finalize):
468         (TCMalloc_SpinLock::Lock):
469         (TCMalloc_SpinLock::Unlock):
470         * wtf/TCSystemAlloc.cpp:
471
472 2007-10-30  Adam Roben  <aroben@apple.com>
473
474         Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
475
476         http://bugs.webkit.org/show_bug.cgi?id=15586
477
478         Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
479
480         Use Win32 TLS functions instead of __declspec(thread), which breaks
481         delay-loading.
482
483         Reviewed by Steve.
484
485         * wtf/FastMalloc.cpp:
486         (WTF::getThreadHeap):
487         (WTF::TCMalloc_ThreadCache::InitModule):
488
489 2007-10-30  Maciej Stachowiak  <mjs@apple.com>
490
491         Reviewed by Oliver.
492         
493         - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
494         http://bugs.webkit.org/show_bug.cgi?id=15772
495         
496         We do this by using a single mark bit per two number cells, and
497         tweaking marking.
498         
499         Besides being an 0.5% win overall, this is a 7.1% win on morph.
500
501         * kjs/collector.cpp:
502         (KJS::):
503         (KJS::Collector::heapAllocate):
504         (KJS::Collector::markStackObjectsConservatively):
505         (KJS::Collector::sweep):
506         * kjs/collector.h:
507         (KJS::SmallCollectorCell::):
508
509 2007-10-30  Geoffrey Garen  <ggaren@apple.com>
510
511         Reviewed by Adam Roben, Sam Weinig.
512         
513         Made conflicts in grammar.y a persistent build failure.
514
515         * DerivedSources.make:
516
517 2007-10-30  Kevin McCullough  <kmccullough@apple.com>
518
519         Reviewed by Adam and Geoff.
520
521         - Added a new cast so all the casts are in the same place.
522
523         * API/APICast.h:
524         (toGlobalRef):
525
526 2007-10-30  Geoffrey Garen  <ggaren@apple.com>
527
528         Reviewed by Darin Adler.
529
530         Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
531         
532         JS tests, including 
533
534             ecma_2/Statements/dowhile-001.js
535             ecma_2/Statements/dowhile-002.js
536             ecma_2/Statements/dowhile-003.js
537             ecma_2/Statements/dowhile-004.js
538             ecma_2/Statements/dowhile-005.js
539             ecma_2/Statements/dowhile-006.js
540             ecma_2/Statements/dowhile-007.js
541             js1_2/statements/do_while.js
542
543         and layout tests, including
544
545             do-while-expression-value.html
546             do-while-semicolon.html
547             do-while-without-semicolon.html
548         
549         pass.
550         
551         * kjs/grammar.y: Use the explicit "error" production, as we do with other
552         automatic semicolon insertions, to disambiguate "do { } while();" from
553         "do { } while()" followed by ";" (the empty statement).
554
555 2007-10-29  Oliver Hunt  <oliver@apple.com>
556
557         Reviewed by Maciej.
558
559         Debranching remaining assignment nodes, and miscellaneous cleanup
560         
561         Split read-modify code paths out of AssignBracketNode and AssignDotNode
562         Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode 
563         and ReadModifyResolveNode evaluate methods
564
565         Leads to a 1% gain in SunSpider.
566
567         * kjs/grammar.y:
568         * kjs/nodes.cpp:
569         (KJS::ReadModifyLocalVarNode::evaluate):
570         (KJS::ReadModifyResolveNode::evaluate):
571         (KJS::AssignDotNode::evaluate):
572         (KJS::ReadModifyDotNode::optimizeVariableAccess):
573         (KJS::ReadModifyDotNode::evaluate):
574         (KJS::AssignBracketNode::evaluate):
575         (KJS::ReadModifyBracketNode::optimizeVariableAccess):
576         (KJS::ReadModifyBracketNode::evaluate):
577         * kjs/nodes.h:
578         (KJS::AssignBracketNode::):
579         (KJS::AssignBracketNode::precedence):
580         (KJS::AssignDotNode::):
581         (KJS::AssignDotNode::precedence):
582         * kjs/nodes2string.cpp:
583         (KJS::ReadModifyBracketNode::streamTo):
584         (KJS::AssignBracketNode::streamTo):
585         (KJS::ReadModifyDotNode::streamTo):
586         (KJS::AssignDotNode::streamTo):
587
588 2007-10-29  Oliver Hunt  <oliver@apple.com>
589
590         Debranching various Node::evaluate implementations
591         
592         Reviewed by Maciej.
593         
594         Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
595         Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
596         
597         Gains 1.6% on SunSpider
598
599         * JavaScriptCore.xcodeproj/project.pbxproj:
600         * kjs/grammar.y:
601         * kjs/nodes.cpp:
602         (KJS::PostIncResolveNode::optimizeVariableAccess):
603         (KJS::PostIncResolveNode::evaluate):
604         (KJS::PostIncLocalVarNode::evaluate):
605         (KJS::PostDecResolveNode::optimizeVariableAccess):
606         (KJS::PostDecResolveNode::evaluate):
607         (KJS::PostDecLocalVarNode::evaluate):
608         (KJS::PostIncBracketNode::evaluate):
609         (KJS::PostDecBracketNode::evaluate):
610         (KJS::PostIncDotNode::evaluate):
611         (KJS::PostDecDotNode::evaluate):
612         (KJS::PreIncResolveNode::optimizeVariableAccess):
613         (KJS::PreIncLocalVarNode::evaluate):
614         (KJS::PreIncResolveNode::evaluate):
615         (KJS::PreDecResolveNode::optimizeVariableAccess):
616         (KJS::PreDecLocalVarNode::evaluate):
617         (KJS::PreDecResolveNode::evaluate):
618         (KJS::PreIncBracketNode::evaluate):
619         (KJS::PreDecBracketNode::evaluate):
620         (KJS::PreIncDotNode::evaluate):
621         (KJS::PreDecDotNode::evaluate):
622         (KJS::ReadModifyResolveNode::optimizeVariableAccess):
623         (KJS::AssignResolveNode::optimizeVariableAccess):
624         (KJS::AssignLocalVarNode::evaluate):
625         (KJS::AssignResolveNode::evaluate):
626         * kjs/nodes.h:
627         (KJS::PostDecResolveNode::):
628         (KJS::PostDecResolveNode::precedence):
629         (KJS::PostDecLocalVarNode::):
630         (KJS::PostfixBracketNode::):
631         (KJS::PostfixBracketNode::precedence):
632         (KJS::PostIncBracketNode::):
633         (KJS::PostIncBracketNode::isIncrement):
634         (KJS::PostDecBracketNode::):
635         (KJS::PostDecBracketNode::isIncrement):
636         (KJS::PostfixDotNode::):
637         (KJS::PostfixDotNode::precedence):
638         (KJS::PostIncDotNode::):
639         (KJS::PostIncDotNode::isIncrement):
640         (KJS::PostDecDotNode::):
641         (KJS::PreIncResolveNode::):
642         (KJS::PreDecResolveNode::):
643         (KJS::PreDecResolveNode::precedence):
644         (KJS::PreDecLocalVarNode::):
645         (KJS::PrefixBracketNode::):
646         (KJS::PrefixBracketNode::precedence):
647         (KJS::PreIncBracketNode::):
648         (KJS::PreIncBracketNode::isIncrement):
649         (KJS::PreDecBracketNode::):
650         (KJS::PreDecBracketNode::isIncrement):
651         (KJS::PrefixDotNode::):
652         (KJS::PrefixDotNode::precedence):
653         (KJS::PreIncDotNode::):
654         (KJS::PreIncDotNode::isIncrement):
655         (KJS::PreDecDotNode::):
656         (KJS::ReadModifyResolveNode::):
657         (KJS::ReadModifyLocalVarNode::):
658         (KJS::AssignResolveNode::):
659         (KJS::AssignResolveNode::precedence):
660         * kjs/nodes2string.cpp:
661         (KJS::PostIncResolveNode::streamTo):
662         (KJS::PostDecResolveNode::streamTo):
663         (KJS::PostfixBracketNode::streamTo):
664         (KJS::PostfixDotNode::streamTo):
665         (KJS::PreIncResolveNode::streamTo):
666         (KJS::PreDecResolveNode::streamTo):
667         (KJS::ReadModifyResolveNode::streamTo):
668         (KJS::AssignResolveNode::streamTo):
669
670 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
671
672         Not reviewed, build fix.
673         
674         - Include Vector.h in a way that actually works.
675
676         * kjs/LocalStorage.h:
677
678 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
679
680         Not reviewed, build fix.
681         
682         - Install LocalStorage.h as a private header.
683
684         * JavaScriptCore.xcodeproj/project.pbxproj:
685
686 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
687
688         Reviewed by Darin.
689         
690         - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
691
692         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
693         * JavaScriptCore.xcodeproj/project.pbxproj:
694         * kjs/LocalStorage.h: Added.
695         (KJS::LocalStorageEntry::LocalStorageEntry):
696         (WTF::):
697         * kjs/function.h:
698         * kjs/nodes.cpp:
699         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
700
701 2007-10-29  Geoffrey Garen  <ggaren@apple.com>
702
703         Reviewed by Oliver Hunt.
704         
705         Some small tweaks that I notice while reviewing Oliver's last patch.
706         
707         Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
708         
709         No change in SunSpider because SunSpider doesn't take the code path that
710         would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
711
712         * kjs/nodes.cpp:
713         (KJS::LocalVarPostfixNode::evaluate):
714         (KJS::TypeOfResolveNode::optimizeVariableAccess):
715         (KJS::LocalVarTypeOfNode::evaluate):
716         (KJS::PrefixResolveNode::optimizeVariableAccess):
717         (KJS::LocalVarPrefixNode::evaluate):
718         (KJS::AssignResolveNode::optimizeVariableAccess):
719         (KJS::LocalVarAssignNode::evaluate):
720         * kjs/nodes.h:
721         (KJS::LocalVarTypeOfNode::):
722         (KJS::PrefixResolveNode::):
723         (KJS::LocalVarPrefixNode::):
724         (KJS::AssignResolveNode::):
725         (KJS::LocalVarAssignNode::):
726
727 2007-10-29  Eric Seidel  <eric@webkit.org>
728
729         Reviewed by Maciej.
730         
731         SunSpider claims this was a 0.7% speedup.
732
733         * kjs/string_object.cpp:
734         (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
735
736 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
737
738         Reviewed by Mark.
739         
740         - re-enable asserts for access to empty or deleted keys
741
742         * wtf/HashTable.h:
743         (WTF::::lookup):
744         (WTF::::lookupForWriting):
745         (WTF::::fullLookupForWriting):
746         (WTF::::add):
747
748 2007-10-29  Eric Seidel  <eric@webkit.org>
749
750         Build fix only, no review.
751
752         * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
753
754 2007-10-29  Mark Rowe  <mrowe@apple.com>
755
756         Gtk build fix.  Move struct declarations into nodes.h.
757
758         * kjs/grammar.y:
759         * kjs/nodes.h:
760
761 2007-10-29  Eric Seidel  <eric@webkit.org>
762
763         Reviewed by darin.
764         
765         Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
766         Make it a compile time error to use toString(ExecState) on a StringInstance
767         
768         SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
769
770         * kjs/internal.h:
771         (KJS::StringImp::getLength):
772         * kjs/string_object.cpp:
773         (KJS::StringInstance::lengthGetter):
774         (KJS::StringInstance::inlineGetOwnPropertySlot):
775         (KJS::StringInstance::getOwnPropertySlot):
776         * kjs/string_object.h:
777
778 2007-10-28  Oliver Hunt  <oliver@apple.com>
779
780         Reviewed by Darin.
781
782         Add nodes to allow Assignment, TypeOf, and prefix operators to 
783         make use of the new optimised local variable look up.
784
785         5% gain on sunspider
786
787         * kjs/nodes.cpp:
788         (KJS::TypeOfResolveNode::optimizeVariableAccess):
789         (KJS::LocalTypeOfAccessNode::evaluate):
790         (KJS::PrefixResolveNode::optimizeVariableAccess):
791         (KJS::PrefixLocalAccessNode::evaluate):
792         (KJS::AssignResolveNode::optimizeVariableAccess):
793         (KJS::AssignLocalAccessNode::evaluate):
794         * kjs/nodes.h:
795         (KJS::TypeOfResolveNode::):
796         (KJS::TypeOfResolveNode::precedence):
797         (KJS::LocalTypeOfAccessNode::):
798         (KJS::PrefixResolveNode::):
799         (KJS::PrefixResolveNode::precedence):
800         (KJS::PrefixLocalAccessNode::):
801         (KJS::AssignResolveNode::):
802         (KJS::AssignLocalAccessNode::):
803
804 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
805
806         Reviewed by Darin.
807         
808         - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
809         http://bugs.webkit.org/show_bug.cgi?id=15748
810         
811         Not a significant speedup or slowdown on SunSpider.
812
813         * kjs/Parser.cpp:
814         (KJS::clearNewNodes):
815         * kjs/Parser.h:
816         * kjs/grammar.y:
817         * kjs/nodes.cpp:
818         (KJS::BlockNode::BlockNode):
819         (KJS::CaseBlockNode::CaseBlockNode):
820         (KJS::FunctionBodyNode::FunctionBodyNode):
821         (KJS::SourceElementsNode::SourceElementsNode):
822         (KJS::ProgramNode::ProgramNode):
823         * kjs/nodes.h:
824         (KJS::ElementNode::):
825         (KJS::ArrayNode::):
826         (KJS::PropertyListNode::):
827         (KJS::ObjectLiteralNode::):
828         (KJS::ArgumentListNode::):
829         (KJS::ArgumentsNode::):
830         (KJS::VarDeclListNode::):
831         (KJS::VarStatementNode::):
832         (KJS::ForNode::):
833         (KJS::ParameterNode::):
834         (KJS::FuncExprNode::):
835         (KJS::FuncDeclNode::):
836         (KJS::SourceElementsNode::):
837         (KJS::CaseClauseNode::):
838         (KJS::ClauseListNode::):
839
840 2007-10-28  Mark Rowe  <mrowe@apple.com>
841
842         Disable assertions in a manner that doesn't break the Qt Windows build.
843
844         * wtf/HashTable.h:
845         (WTF::::lookup):
846         (WTF::::lookupForWriting):
847         (WTF::::fullLookupForWriting):
848
849 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
850
851         Temporarily disabling some ASSERTs I introduced in my last check-in 
852         because of http://bugs.webkit.org/show_bug.cgi?id=15747
853         Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
854
855         * wtf/HashTable.h:
856         (WTF::::lookup):
857         (WTF::::lookupForWriting):
858         (WTF::::fullLookupForWriting):
859         (WTF::::add):
860
861 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
862
863         Reviewed by Darin Adler.
864         
865         Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
866         #ifndef ASSERT_DISABLED is no good!
867         
868         Replaced with #if !ASSERT_DISABLED.
869
870         * wtf/HashTable.h:
871         (WTF::::lookup):
872         (WTF::::lookupForWriting):
873         (WTF::::fullLookupForWriting):
874         (WTF::::add):
875
876 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
877
878         Reviewed by Darin Adler.
879         
880         Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
881         to the AST transfom that replaces slow resolve nodes with fast local 
882         variable alternatives.
883         
884         2.5% speedup on SunSpider.
885         
886         Also added some missing copyright notices.
887         
888         * kjs/nodes.cpp:
889         (KJS::FunctionCallResolveNode::optimizeVariableAccess):
890         (KJS::FunctionCallResolveNode::evaluate):
891         (KJS::LocalVarFunctionCallNode::evaluate):
892         (KJS::PostfixResolveNode::optimizeVariableAccess):
893         (KJS::PostfixResolveNode::evaluate):
894         (KJS::LocalVarPostfixNode::evaluate):
895         (KJS::DeleteResolveNode::optimizeVariableAccess):
896         (KJS::DeleteResolveNode::evaluate):
897         (KJS::LocalVarDeleteNode::evaluate):
898         * kjs/nodes.h:
899         (KJS::FunctionCallResolveNode::):
900         (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
901         (KJS::PostfixResolveNode::):
902         (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
903         (KJS::DeleteResolveNode::):
904         (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
905
906 2007-10-28  Eric Seidel  <eric@webkit.org>
907
908         Reviewed by darin.
909         
910         Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
911         Add virtual keyword to a few virtual functions previously unmarked.
912
913         * kjs/internal.h:
914         (KJS::StringImp::type):
915         (KJS::NumberImp::type):
916         * kjs/ustring.h:
917         (KJS::UString::Rep::deref):
918
919 2007-10-28  Darin Adler  <darin@apple.com>
920
921         - fix "broken everything" from the storage leak fix
922
923         * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
924         * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
925
926 2007-10-28  Darin Adler  <darin@apple.com>
927
928         Reviewed by Adam.
929
930         - turn on unused parameter waring on Mac OS X because it's already on elsewhere
931
932         * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
933
934         * API/JSNode.c:
935         * API/JSNodeList.c:
936         * API/minidom.c:
937         * API/testapi.c:
938         Fixed unused variables by using them or marked them with UNUSED_PARAM.
939
940         * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
941         Removed parameter names to indicate they are unused.
942
943 2007-10-28  Darin Adler  <darin@apple.com>
944
945         Reviewed by Maciej.
946
947         - fix a storage leak where we ref the UString every time we replace
948           a ResolveNode with a LocalVarAccessNode
949
950         * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
951         that takes PlacementNewAdopt.
952
953         * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
954         with PlacementNewAdopt instead of the old value of ident.
955
956         * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
957         takes PlacementNewAdopt.
958
959 2007-10-28  Darin Adler  <darin@apple.com>
960
961         - Windows build fix; get rid of unused parameter
962
963         * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
964         * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
965         The assertions weren't all that helpful.
966
967 2007-10-28  Mark Rowe  <mrowe@apple.com>
968
969         Gtk build fix.  Add include of MathExtras.h.
970
971         * kjs/string_object.cpp:
972
973 2007-10-28  Mark Rowe  <mrowe@apple.com>
974
975         Reviewed by Maciej and Tim.
976
977         Replace uses of isNaN and isInf with isnan and isinf, and
978         remove isNaN and isInf.
979
980         * kjs/config.h: Remove unused HAVE_'s.
981         * kjs/date_object.cpp:
982         (KJS::DateInstance::getTime):
983         (KJS::DateInstance::getUTCTime):
984         (KJS::DateProtoFunc::callAsFunction):
985         (KJS::DateObjectImp::construct):
986         (KJS::DateObjectFuncImp::callAsFunction):
987         * kjs/function.cpp:
988         (KJS::GlobalFuncImp::callAsFunction):
989         * kjs/math_object.cpp:
990         (MathFuncImp::callAsFunction):
991         * kjs/nodes2string.cpp:
992         (KJS::isParserRoundTripNumber):
993         * kjs/number_object.cpp:
994         (NumberProtoFunc::callAsFunction):
995         * kjs/operations.cpp:
996         * kjs/operations.h:
997         * kjs/string_object.cpp:
998         (KJS::StringProtoFunc::callAsFunction):
999         * kjs/ustring.cpp:
1000         (KJS::UString::from):
1001         * kjs/value.cpp:
1002         (KJS::JSValue::toInteger):
1003         (KJS::JSValue::toInt32SlowCase):
1004         (KJS::JSValue::toUInt32SlowCase):
1005
1006 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
1007
1008         Build fix: use the new-fangled missingSymbolMarker().
1009
1010         * kjs/nodes.cpp:
1011         (KJS::ResolveNode::optimizeVariableAccess):
1012         * kjs/nodes.h:
1013         (KJS::LocalVarAccessNode::LocalVarAccessNode):
1014
1015 2007-10-28  Geoffrey Garen  <ggaren@apple.com>
1016
1017         Reviewed by Maciej Stachowiak, Darin Adler.
1018         
1019         Much supporting work done by Maciej Stachowiak, Maks Orlovich, and 
1020         Cameron Zwarich.
1021         
1022         AST transfom to replace slow resolve nodes with fast local variable
1023         alternatives that do direct memory access. Currently, only ResolveNode
1024         provides a fast local variable alternative. 6 others are soon to come.
1025         
1026         16.7% speedup on SunSpider.
1027         
1028         Most of this patch is just scaffolding to support iterating all the 
1029         resolve nodes in the AST through optimizeResolveNodes(). In 
1030         optimizeResolveNodes(), most classes just push their child nodes onto 
1031         the processing stack, while ResolveNodes actually replace themselves in 
1032         the tree with more optimized alternatives, if possible.
1033
1034         Here are the interesting bits:
1035
1036         * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations 
1037         in Node and ResolveNode. This tag allows you to use placement new to 
1038         swap out a base class Node in favor of a subclass copy that holds the
1039         same data. (Without this tag, default initialization would NULL out
1040         RefPtrs, change line numbers, etc.)
1041
1042         * kjs/nodes.cpp:
1043         (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
1044         that the fast path is impossible, to make sure we didn't leave anything
1045         on the table.
1046
1047         (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST 
1048         transformation happens.
1049         
1050         (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
1051         optimization happens.
1052
1053         * kjs/function.h: Added symbolTable() accessor for, for the sake of 
1054         an ASSERT.
1055
1056 2007-10-28  Mark Rowe  <mrowe@apple.com>
1057
1058         Reviewed by Maciej.
1059
1060         Fix "AllInOneFile.o has a global initializer in it".
1061
1062         Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
1063         We can avoid this by moving it inside an inline function.
1064
1065         * kjs/SymbolTable.h:
1066         (KJS::missingSymbolMarker):
1067         * kjs/function.cpp:
1068         (KJS::ActivationImp::getOwnPropertySlot):
1069         (KJS::ActivationImp::put):
1070
1071 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
1072
1073         Reviewed by Mark.
1074         
1075         - Added assertions to protect against adding empty or deleted keys to a HashTable
1076
1077         * wtf/HashTable.h:
1078         (WTF::HashTable::lookup):
1079         (WTF::HashTable::lookupForWriting):
1080         (WTF::HashTable::fullLookupForWriting):
1081         (WTF::HashTable::add):
1082
1083 2007-10-28  Darin Adler  <darin@apple.com>
1084
1085         - fix GTK build
1086
1087         * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
1088         Use isNaN and isInf instead of isnan and isinf.
1089
1090 2007-10-28  Darin Adler  <darin@apple.com>
1091
1092         Reviewed by Maciej.
1093
1094         - http://bugs.webkit.org/show_bug.cgi?id=15735
1095           remove GroupNode to simplify AST and possibly get a modest speedup
1096
1097         This patch removes 4 node types: GroupNode, PropertyNameNode,
1098         FunctionCallParenBracketNode, and FunctionCallParenDotNode.
1099
1100         To remove GroupNode, we add knowledge of precedence to the tree nodes,
1101         and use that when serializing to determine where parentheses are needed.
1102         This means we no longer have to represent parentheses in the tree.
1103
1104         The precedence values are named after productions in the grammar from the
1105         JavaScript standard.
1106
1107         SunSpider says this is an 0.4% speedup.
1108
1109         * kjs/function.h:
1110         * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
1111         serialization, so I moved it to the file that takes care of that.
1112
1113         * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
1114         indicate failure instead of a separate boolean. Got rid of PropertyNameNode
1115         by merging the PropertyName rule into the Property rule (which was easier
1116         than figuring out how to pass the Identifier from one node to another).
1117         Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
1118         and FunctionCallParenDotNode.
1119
1120         * kjs/nodes.h: Removed unused forward declarations and Operator values.
1121         Added Precedence enum, and precedence function to all nodes. Removed
1122         nodeInsideAllParens. Added streamBinaryOperator function for serialization.
1123         Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
1124         Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
1125
1126         * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
1127         (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
1128         of converting it from an Identifier to a jsString then back to a UString
1129         then into an Identifier again!
1130
1131         * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
1132         function for each of Endl, Indent, Unindent, and DotExpr instead of using a
1133         single function with a switch. Added a precedence that you can stream in, to
1134         cause the next node serialized to add parentheses based on that precedence value.
1135         (KJS::operatorString): Moved to the top of the file.
1136         (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
1137         workaround for snprintf, since StringExtras.h takes care of that.
1138         (KJS::operator<<): Made the char and char* versions faster by using UString's
1139         character append functions instead of constructing a UString. Added the logic
1140         to the Node* version to add parentheses if needed.
1141         (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
1142         (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
1143         (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
1144         the bracket.
1145         (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
1146         (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
1147         (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
1148         (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
1149         (KJS::FunctionCallBracketNode::streamTo): Ditto.
1150         (KJS::FunctionCallDotNode::streamTo): Ditto.
1151         (KJS::PostfixBracketNode::streamTo): Ditto.
1152         (KJS::PostfixDotNode::streamTo): Ditto.
1153         (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
1154         (KJS::DeleteBracketNode::streamTo): Use PrecCall.
1155         (KJS::DeleteDotNode::streamTo): Ditto.
1156         (KJS::DeleteValueNode::streamTo): Use PrecUnary.
1157         (KJS::VoidNode::streamTo): Ditto.
1158         (KJS::TypeOfValueNode::streamTo): Ditto.
1159         (KJS::PrefixBracketNode::streamTo): Use PrecCall.
1160         (KJS::PrefixDotNode::streamTo): Ditto.
1161         (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
1162         (KJS::UnaryPlusNode::streamTo): Ditto.
1163         (KJS::NegateNode::streamTo): Ditto.
1164         (KJS::BitwiseNotNode::streamTo): Ditto.
1165         (KJS::LogicalNotNode::streamTo): Ditto.
1166         (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
1167         (KJS::DivNode::streamTo): Ditto.
1168         (KJS::ModNode::streamTo): Ditto.
1169         (KJS::AddNode::streamTo): Ditto.
1170         (KJS::SubNode::streamTo): Ditto.
1171         (KJS::LeftShiftNode::streamTo): Ditto.
1172         (KJS::RightShiftNode::streamTo): Ditto.
1173         (KJS::UnsignedRightShiftNode::streamTo): Ditto.
1174         (KJS::LessNode::streamTo): Ditto.
1175         (KJS::GreaterNode::streamTo): Ditto.
1176         (KJS::LessEqNode::streamTo): Ditto.
1177         (KJS::GreaterEqNode::streamTo): Ditto.
1178         (KJS::InstanceOfNode::streamTo): Ditto.
1179         (KJS::InNode::streamTo): Ditto.
1180         (KJS::EqualNode::streamTo): Ditto.
1181         (KJS::NotEqualNode::streamTo): Ditto.
1182         (KJS::StrictEqualNode::streamTo): Ditto.
1183         (KJS::NotStrictEqualNode::streamTo): Ditto.
1184         (KJS::BitAndNode::streamTo): Ditto.
1185         (KJS::BitXOrNode::streamTo): Ditto.
1186         (KJS::BitOrNode::streamTo): Ditto.
1187         (KJS::LogicalAndNode::streamTo): Ditto.
1188         (KJS::LogicalOrNode::streamTo): Ditto.
1189         (KJS::ConditionalNode::streamTo): Ditto.
1190         (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
1191         (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
1192         the bracket and PrecAssignment for the right side.
1193         (KJS::AssignDotNode::streamTo): Ditto.
1194         (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
1195         and PrecAssignment for the right side.
1196         (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
1197         (KJS::AssignExprNode::streamTo): Use PrecAssignment.
1198
1199 2007-10-28  Kevin Ollivier  <kevino@theolliviers.com>
1200
1201         Define wx port and set wx port USE options.
1202
1203         Reviewed by Adam Roben.
1204
1205         * wtf/Platform.h:
1206
1207 2007-10-28  Mark Rowe  <mrowe@apple.com>
1208
1209         We don't include "config.h" in headers.
1210
1211         * bindings/jni/jni_instance.h:
1212         * kjs/regexp.h:
1213         * wtf/TCPageMap.h:
1214         * wtf/TCSpinLock.h:
1215
1216 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
1217
1218         Rubber stamped by Mark.
1219         
1220         - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
1221
1222         * kjs/SymbolTable.h:
1223         (KJS::SymbolTableIndexHashTraits::emptyValue):
1224         * kjs/function.cpp:
1225         (KJS::ActivationImp::getOwnPropertySlot):
1226         (KJS::ActivationImp::put):
1227
1228 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
1229
1230         Reviewed by Eric.
1231         
1232         - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
1233
1234         * kjs/SymbolTable.h:
1235         (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
1236         (KJS::IdentifierRepHash::equal): ditto
1237         (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
1238         (KJS::SymbolTable): change to a typedef for a HashMap.
1239         * kjs/function.cpp:
1240         (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
1241         (KJS::ActivationImp::deleteProperty): ditto
1242         (KJS::ActivationImp::put): ditto
1243
1244         * kjs/nodes.cpp:
1245         (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
1246         you now have to store a UString::rep, not an identifier.
1247
1248 2007-10-27  Maciej Stachowiak  <mjs@apple.com>
1249
1250         Reviewed by Oliver.
1251         
1252         - numerous HashTable performance improvements
1253         
1254         This does not quite add up to a measurable win on SunSpider, but it allows a
1255         follow-on > 3% improvement and probably helps WebCore too.
1256         
1257         I made the following improvements, among others:
1258         
1259         - Made HashFunctions note whether it is ok to compare a real value with the equal() function
1260         to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
1261         
1262         - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
1263         std::pairs for cases that don't need them. There are now four versions, one for read-only access,
1264         two for writing, and one folded directly into add() (these all were improvments).
1265         
1266         - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
1267         
1268         - Made a special constructor for iterators that knows it points to
1269         a valid filled cell and so skips updating itself.
1270
1271         - Reordered memory accesses in the various lookup functions for better code generation
1272         
1273         - Made simple translators avoid passing a hash code around
1274         
1275         - Other minor tweaks
1276         
1277         * wtf/HashTable.h:
1278         (WTF::):
1279         (WTF::HashTableConstIterator::HashTableConstIterator):
1280         (WTF::HashTableIterator::HashTableIterator):
1281         (WTF::IdentityHashTranslator::translate):
1282         (WTF::HashTable::end):
1283         (WTF::HashTable::lookup):
1284         (WTF::HashTable::lookupForWriting):
1285         (WTF::HashTable::makeKnownGoodIterator):
1286         (WTF::HashTable::makeKnownGoodConstIterator):
1287         (WTF::::lookup):
1288         (WTF::::lookupForWriting):
1289         (WTF::::fullLookupForWriting):
1290         (WTF::::add):
1291         (WTF::::addPassingHashCode):
1292         (WTF::::reinsert):
1293         (WTF::::find):
1294         (WTF::::contains):
1295         * kjs/identifier.cpp:
1296         (WTF::):
1297         * wtf/HashFunctions.h:
1298         (WTF::):
1299         * wtf/HashMap.h:
1300         (WTF::):
1301         (WTF::::get):
1302         * wtf/HashSet.h:
1303         (WTF::):
1304         (WTF::::add):
1305         * wtf/ListHashSet.h:
1306         (WTF::ListHashSetTranslator::translate):
1307
1308 2007-10-27  Darin Adler  <darin@apple.com>
1309
1310         Reviewed by Eric.
1311
1312         - fix ASCIICType.h for some Windows compiles
1313
1314         * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
1315         compiler/library that has the wchar_t that is just a typedef.
1316
1317 2007-10-27  Kevin McCullough  <kmccullough@apple.com>
1318
1319         - BuildFix
1320         - Forgot to change the build step when I changed the filename.
1321
1322         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1323
1324 2007-10-27  Geoffrey Garen  <ggaren@apple.com>
1325
1326         Reviewed by Darin Adler.
1327         
1328         Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
1329         computedHash()"
1330         http://bugs.webkit.org/show_bug.cgi?id=15718
1331
1332         * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a 
1333         hash value. Also changed O(n) strlen to O(1) check for empty string.
1334         (KJS::Identifier::add):
1335
1336         * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
1337         (KJS::UString::UString):
1338         (KJS::UString::operator=):
1339
1340 2007-10-27  Darin Adler  <darin@apple.com>
1341
1342         Reviewed by Eric.
1343
1344         - fix pow on Windows
1345
1346         * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
1347         a "pow" function that does not properly handle the case where arg1 is
1348         NaN and arg2 is 0.
1349
1350         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
1351         specify "::pow" -- just "pow" is fine.
1352
1353 2007-10-27  Darin Adler  <darin@apple.com>
1354
1355         Reviewed by Maciej.
1356
1357         - http://bugs.webkit.org/show_bug.cgi?id=15711
1358           force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
1359
1360         * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
1361
1362         * kjs/object.h: Removed redundant includes.
1363         * kjs/value.h: Ditto.
1364
1365 2007-10-27  Maciej Stachowiak  <mjs@apple.com>
1366
1367         Reviewed by Mark.
1368         
1369         - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
1370         http://bugs.webkit.org/show_bug.cgi?id=15718
1371
1372         * kjs/identifier.cpp:
1373         (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
1374         now that we count on all Identifiers already having one.
1375
1376 2007-10-27  Mark Rowe  <mrowe@apple.com>
1377
1378         Silence a warning.
1379
1380         * kjs/SymbolTable.h:
1381
1382 2007-10-27  Mark Rowe  <mrowe@apple.com>
1383
1384         Gtk build fix.
1385
1386         * kjs/function.h:
1387
1388 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
1389
1390        Rubber stamp by Adam. 
1391
1392         - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
1393         files contain are functions that operate on BSTRs.
1394
1395         * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
1396         * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
1397         * API/JSStringRefCOM.cpp: Removed.
1398         * API/JSStringRefCOM.h: Removed.
1399         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1400
1401 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
1402
1403         Reviewed by Adam.
1404
1405         - Made JSStringCreateWithBSTR capable of handling null BSTRs.
1406
1407         * API/JSStringRefCOM.cpp:
1408         (JSStringCreateWithBSTR):
1409
1410 2007-10-26  Sam Weinig  <sam@webkit.org>
1411
1412         Windows build fix.
1413
1414         * kjs/SymbolTable.h: Add header gaurd.
1415         * kjs/nodes.h: #include "SymbolTable.h"
1416
1417 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1418
1419         Suggested by Anders Carlsson.
1420         
1421         Fixed tyop.
1422
1423         * kjs/function.cpp:
1424         (KJS::ActivationImp::getOwnPropertySlot):
1425
1426 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1427
1428         Suggested by Darin Adler.
1429         
1430         Use computedHash(), which is safer than just directly accessing _hash.
1431
1432         * kjs/lookup.cpp:
1433         (KJS::Lookup::findEntry):
1434         (KJS::Lookup::find):
1435
1436 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1437
1438         Build fix: svn add SymbolTable.h
1439
1440         * kjs/SymbolTable.h: Added.
1441         (KJS::SymbolTable::set):
1442         (KJS::SymbolTable::get):
1443
1444 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1445
1446         Build fix: export SymbolTable.h to WebCore.
1447
1448         * JavaScriptCore.xcodeproj/project.pbxproj:
1449
1450 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1451
1452         Comment tweak suggested by Maciej.
1453
1454         * kjs/function.cpp:
1455         (KJS::ActivationImp::getOwnPropertySlot):
1456
1457 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1458
1459         Reviewed by Maciej Stachowiak.
1460         
1461         Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
1462
1463         * kjs/property_map.cpp: Use a special no branch accessor to the UString's
1464         hash value. Also, return immediately instead of branching to the end
1465         of the loop if the value is not found.
1466         (KJS::PropertyMap::get):
1467         (KJS::PropertyMap::getLocation):
1468         (KJS::PropertyMap::put):
1469         (KJS::PropertyMap::insert):
1470         (KJS::PropertyMap::remove):
1471         (KJS::PropertyMap::checkConsistency):
1472
1473         * kjs/ustring.h:
1474         (KJS::UString::Rep::computedHash): Special no branch accessor to the
1475         UString's hash value. Used when the caller knows that the hash value
1476         has already been computed. (For example, if the caller got the UString
1477         from an Identifier.)
1478
1479 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
1480
1481         Reviewed by Maciej Stachowiak.
1482         
1483         Switched ActivationImp to using a symbol table. For now, though, all
1484         clients take the slow path.
1485         
1486         Net .6% speedup on SunSpider.
1487         
1488         Slowdowns:
1489             - ActivationImp now mallocs in its constructor
1490             - Local variable hits use an extra level of indirection to retrieve 
1491             data
1492             - Local variable misses do two lookups
1493
1494         Speedups:
1495             - Fast initialization of local variables upon function entry
1496
1497         * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
1498         
1499         * kjs/function.cpp:
1500         (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
1501         data that won't fit in a JSCell.
1502         (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for 
1503         lookup.
1504         (KJS::ActivationImp::getOwnPropertySlot): ditto
1505         (KJS::ActivationImp::deleteProperty): ditto
1506         (KJS::ActivationImp::put): ditto
1507         (KJS::ActivationImp::createArgumentsObject): ditto
1508
1509         (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
1510         our properties doesn't try to recursively mark us. (This caused a crash
1511         in earlier testing. Not sure why we haven't run into it before.)
1512
1513         * kjs/nodes.cpp: Functions now build a symbol table the first time 
1514         they're called.
1515         (KJS::VarDeclNode::evaluate):
1516         (KJS::FunctionBodyNode::FunctionBodyNode):
1517         (KJS::FunctionBodyNode::initializeSymbolTable):
1518         (KJS::FunctionBodyNode::processDeclarations):
1519         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1520         (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
1521
1522         * kjs/nodes.h:
1523         (KJS::FunctionBodyNode::symbolTable):
1524
1525         * wtf/Forward.h: Added Vector.
1526
1527 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
1528
1529         - Corrected function name mistake in this changelog.
1530
1531 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
1532         Reviewed by Sam and Steve.
1533
1534         - Added convenience methods for converting between BSTR and JSStringRefs
1535
1536         * API/JSStringRefCOM.cpp: Added.
1537         (JSStringCreateWithBSTR):
1538         (JSStringCopyBSTR):
1539         * API/JSStringRefCOM.h: Added.
1540         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1541
1542 2007-10-26  Mark Rowe  <mrowe@apple.com>
1543
1544         Windows build fix.
1545
1546         * kjs/collector.cpp:
1547         (KJS::Collector::collect):
1548
1549 2007-10-26  Oliver Hunt  <oliver@apple.com>
1550
1551         Reviewed by Maciej.
1552
1553         Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
1554
1555         * kjs/CollectorHeapIntrospector.cpp:
1556         (KJS::CollectorHeapIntrospector::init):
1557         (KJS::CollectorHeapIntrospector::enumerate):
1558         * kjs/CollectorHeapIntrospector.h:
1559         * kjs/collector.cpp:
1560         (KJS::Collector::recordExtraCost):
1561         (KJS::Collector::heapAllocate):
1562         (KJS::Collector::allocate):
1563         (KJS::Collector::allocateNumber):
1564         (KJS::Collector::registerThread):
1565         (KJS::Collector::markStackObjectsConservatively):
1566         (KJS::Collector::markMainThreadOnlyObjects):
1567         (KJS::Collector::sweep):
1568         (KJS::Collector::collect):
1569         * kjs/collector.h:
1570         * kjs/internal.h:
1571         (KJS::NumberImp::operator new):
1572           Force numbers to be allocated in the secondary heap.
1573
1574 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
1575
1576         Reviewed by Oliver.
1577         
1578         - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
1579
1580         * kjs/value.h:
1581         (KJS::JSValue::getUInt32):
1582         (KJS::JSValue::getTruncatedInt32):
1583         (KJS::JSValue::toNumber):
1584         * wtf/PassRefPtr.h:
1585         (WTF::PassRefPtr::~PassRefPtr):
1586         * wtf/RefPtr.h:
1587         (WTF::RefPtr::operator->):
1588
1589 2007-10-26  Mark Rowe  <mrowe@apple.com>
1590
1591         Gtk build fix.
1592
1593         * kjs/ExecState.h:
1594
1595 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
1596
1597         Reviewed by Mark.
1598
1599         - Merge Context class fully into ExecState, since they are always created and used together.
1600
1601         No measurable performance impact but this is a useful cleanup.
1602
1603         * JavaScriptCore.pri:
1604         * kjs/ExecState.cpp:
1605         (KJS::ExecState::ExecState):
1606         (KJS::ExecState::~ExecState):
1607         (KJS::ExecState::mark):
1608         (KJS::ExecState::lexicalInterpreter):
1609         * kjs/ExecState.h:
1610         (KJS::ExecState::dynamicInterpreter):
1611         (KJS::ExecState::setException):
1612         (KJS::ExecState::clearException):
1613         (KJS::ExecState::exception):
1614         (KJS::ExecState::exceptionSlot):
1615         (KJS::ExecState::hadException):
1616         (KJS::ExecState::scopeChain):
1617         (KJS::ExecState::callingExecState):
1618         (KJS::ExecState::propertyNames):
1619         * kjs/collector.cpp:
1620         (KJS::Collector::reportOutOfMemoryToAllInterpreters):
1621         * kjs/function.cpp:
1622         (KJS::FunctionImp::callAsFunction):
1623         (KJS::FunctionImp::argumentsGetter):
1624         (KJS::FunctionImp::callerGetter):
1625         (KJS::GlobalFuncImp::callAsFunction):
1626         * kjs/interpreter.cpp:
1627         (KJS::Interpreter::Interpreter):
1628         (KJS::Interpreter::init):
1629         (KJS::Interpreter::evaluate):
1630         (KJS::Interpreter::mark):
1631         * kjs/interpreter.h:
1632         (KJS::Interpreter::setCurrentExec):
1633         (KJS::Interpreter::currentExec):
1634         * kjs/nodes.cpp:
1635         (KJS::currentSourceId):
1636         (KJS::currentSourceURL):
1637         (KJS::ThisNode::evaluate):
1638         (KJS::ResolveNode::evaluate):
1639         (KJS::FunctionCallResolveNode::evaluate):
1640         (KJS::PostfixResolveNode::evaluate):
1641         (KJS::DeleteResolveNode::evaluate):
1642         (KJS::TypeOfResolveNode::evaluate):
1643         (KJS::PrefixResolveNode::evaluate):
1644         (KJS::AssignResolveNode::evaluate):
1645         (KJS::VarDeclNode::evaluate):
1646         (KJS::DoWhileNode::execute):
1647         (KJS::WhileNode::execute):
1648         (KJS::ForNode::execute):
1649         (KJS::ForInNode::execute):
1650         (KJS::ContinueNode::execute):
1651         (KJS::BreakNode::execute):
1652         (KJS::ReturnNode::execute):
1653         (KJS::WithNode::execute):
1654         (KJS::SwitchNode::execute):
1655         (KJS::LabelNode::execute):
1656         (KJS::TryNode::execute):
1657         (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
1658         (KJS::FunctionBodyNode::processDeclarationsProgramCode):
1659         (KJS::FunctionBodyNode::processDeclarations):
1660         (KJS::FuncDeclNode::makeFunction):
1661         (KJS::FuncExprNode::evaluate):
1662
1663 2007-10-26  Mark Rowe  <mrowe@apple.com>
1664
1665         Windows build fix.
1666
1667         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1668
1669 2007-10-26  Mark Rowe  <mrowe@apple.com>
1670
1671         Gtk build fix.
1672
1673         * JavaScriptCore.pri:
1674         * kjs/ExecState.cpp:
1675
1676 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
1677
1678         Reviewed by Oliver.
1679         
1680         - moved Context class into ExecState.{h,cpp} in preparation for merging 
1681         ExecState and Context classes.
1682
1683         * kjs/ExecState.h: Moved CodeType enum and Context class here in
1684         preparation for merging ExecState and Context.
1685         * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
1686         (KJS::Context::Context):
1687         (KJS::Context::~Context):
1688         (KJS::Context::mark):
1689         * kjs/context.h: Removed.
1690         * kjs/Context.cpp: Removed.
1691         * kjs/function.h: Removed CodeType enum.
1692         * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
1693         * kjs/internal.h: Removed LabelStack.
1694         * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
1695         * kjs/collector.cpp: Fixed includes.
1696         * kjs/function.cpp: ditto
1697         * kjs/internal.cpp: ditto
1698         * kjs/interpreter.cpp: ditto
1699         * kjs/lookup.h: ditto
1700         * kjs/nodes.cpp: ditto
1701
1702 2007-10-26  Mark Rowe  <mrowe@apple.com>
1703
1704         Windows build fix.
1705
1706         * kjs/string_object.cpp:
1707         (KJS::StringObjectFuncImp::callAsFunction):
1708
1709 2007-10-25  Darin Adler  <darin@apple.com>
1710
1711         Reviewed by Maciej.
1712
1713         - http://bugs.webkit.org/show_bug.cgi?id=15703
1714           fix numeric functions -- improve correctness and speed
1715
1716         Gives about 1% gain on SunSpider.
1717
1718         * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
1719         (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
1720         with both immediate and number values.
1721         (KJS::JSValue::toUInt32): Ditto.
1722         * kjs/value.cpp:
1723         (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
1724         differences. One is that it now correctly returns 0 for NaN, and another is that
1725         there's no special case for 0 or infinity, since the general case already handles
1726         those correctly.
1727         (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
1728         check for NaN.
1729         (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
1730         truncation done by the typecast already does the necessary truncation that
1731         roundValue was doing.
1732         (KJS::JSValue::toUInt32SlowCase): Ditto.
1733         (KJS::JSValue::toUInt16): Removed.
1734
1735         * kjs/internal.h: Removed roundValue.
1736         * kjs/internal.cpp: Ditto.
1737
1738         * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
1739         code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
1740
1741         * kjs/date_object.cpp:
1742         (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
1743         toNumber as specified.
1744         (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
1745         with a call to toNumber and timeClip as specified.
1746         (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
1747         where the default behavior of toInt32 (returning 0) was already correct. Replaced
1748         call to roundValue with a call to toNumber as specified.
1749         (KJS::DateObjectFuncImp::callAsFunction): Ditto.
1750
1751         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
1752         cases for the pow function that the library already handles correctly.
1753
1754         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
1755         call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
1756         The real toInteger now returns 0 for NaN. Took out unneeded special case in
1757         ToFixed for undefined; was only needed because our toInteger was wrong. Same
1758         thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
1759
1760         * kjs/string_object.cpp:
1761         (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
1762         cases for undefined that were only needed because toInteger was wrong. Same in
1763         IndexOf, and was able to remove some special cases. In LastIndexOf, used
1764         toIntegerPreserveNaN, but was able to remove some special cases there too.
1765         Changed Substr implementation to preserve correct behavior with the change
1766         to toInteger and match the specification. Also made sure we weren't converting
1767         an out of range double to an int.
1768         (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
1769         toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
1770         no reason to have toUInt16 as a second, less-optimized function that's only
1771         called at this one call site.
1772
1773         * wtf/MathExtras.h: Added trunc function for Windows.
1774
1775 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
1776
1777         Reviewed by Maciej Stachowiak.
1778         
1779         Tweaked the inner hashtable lookup loop to remove a branch in the "not 
1780         found" case. .5% speedup on SunSpider.
1781
1782         * JavaScriptCore.xcodeproj/project.pbxproj:
1783         * wtf/HashTable.h:
1784         (WTF::::lookup):
1785
1786 2007-10-25  Maciej Stachowiak  <mjs@apple.com>
1787
1788         Reviewed by Oliver.
1789
1790         - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
1791
1792         * kjs/nodes.cpp:
1793         (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
1794         adding any value over toNumber() here.
1795         (KJS::valueForReadModifyAssignment): Ditto.
1796         (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
1797         and branches.
1798         (KJS::lessThanEq): Ditto.
1799         * JavaScriptCore.exp: Export new functions as needed.
1800         * kjs/value.h:
1801         (KJS::JSValue::toPrimitive): Fixed formatting.
1802         (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
1803         to number and tells you whether a toPrimitive() conversion with a Number hint
1804         would have given a string.
1805         * kjs/internal.cpp:
1806         (KJS::StringImp::getPrimitiveNumber): Implemented. 
1807         (KJS::NumberImp::getPrimitiveNumber): ditto
1808         (KJS::GetterSetterImp::getPrimitiveNumber): ditto
1809         (KJS::StringImp::toPrimitive): Fixed formatting.
1810         (KJS::NumberImp::toPrimitive): ditto
1811         (KJS::GetterSetterImp::toPrimitive): ditto
1812         * kjs/internal.h:
1813         * kjs/object.cpp:
1814         (KJS::JSObject::getPrimitiveNumber): Implemented.
1815         * kjs/object.h:
1816
1817 2007-10-25  Sam Weinig  <sam@webkit.org>
1818
1819         Reviewed by Adam Roben.
1820
1821         Remove JSStringRefCFHack from windows as it is no longer needed.
1822
1823         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1824
1825 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
1826
1827         Reviewed by Oliver Hunt.
1828         
1829         Rolled out my last patch. It turns out that I needed 2 words, not 1,
1830         so it didn't help.
1831
1832 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
1833
1834         Reviewed by Oliver Hunt.
1835         
1836         Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
1837         Shrink the size of an activation object by 1 word
1838         
1839         This is in preparation for adding a symbol table to the activation 
1840         object.
1841         
1842         The basic strategy here is to rely on the mutual exclusion between
1843         the arguments object pointer and the function pointer (you only need
1844         the latter in order to create the former), and store them in the same 
1845         place. The LazyArgumentsObject class encapsulates this strategy.
1846         
1847         Also inlined the ArgumentsImp constructor, for good measure.
1848         
1849         SunSpider reports no regression. Regression tests pass.
1850
1851         * JavaScriptCore.xcodeproj/project.pbxproj:
1852         * kjs/Context.cpp:
1853         (KJS::Context::~Context):
1854         * kjs/function.cpp:
1855         (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
1856         (KJS::ActivationImp::LazyArgumentsObject::mark):
1857         (KJS::):
1858         (KJS::ActivationImp::argumentsGetter):
1859         (KJS::ActivationImp::mark):
1860         * kjs/function.h:
1861         (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
1862         (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
1863         (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
1864         (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
1865         (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
1866         (KJS::ActivationImp::LazyArgumentsObject::setFunction):
1867         (KJS::ActivationImp::LazyArgumentsObject::function):
1868         (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
1869         (KJS::ActivationImp::LazyArgumentsObject::):
1870         (KJS::ActivationImp::ActivationImp::ActivationImp):
1871         (KJS::ActivationImp::resetArguments):
1872
1873 2007-10-25  Adam Roben  <aroben@apple.com>
1874
1875         Change JavaScriptCore.vcproj to use DerivedSources.make
1876
1877         We were trying to emulate the logic of make in
1878         build-generated-files.sh, but we got it wrong. We now use a
1879         build-generated-files very much like the one that WebCore uses to
1880         invoke make.
1881
1882         We also now only have a Debug configuration of dftables which we build
1883         even when doing a Release build of JavaScriptCore. dftables also no
1884         longer has the "_debug" name suffix.
1885
1886         Changes mostly made by Darin, reviewed by me.
1887
1888         * DerivedSources.make: Add a variable to set the extension used for
1889         the dftables executable.
1890         * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
1891         dftables in Release configurations.
1892         * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
1893         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1894            - Updated include path to point to the new location of the derived
1895              sources.
1896            - Modified pre-build event to pass the right arguments to
1897              build-generated-files.sh and not call dftables directly.
1898            - Added the derived source files to the project.
1899            - Removed grammarWrapper.cpp, which isn't needed now that we're
1900              compiling grammar.cpp directly.
1901         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
1902         Slightly modified from the WebCore version.
1903         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
1904         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
1905             - Changed the output location to match Mac.
1906             - Removed the Release configuration.
1907             - Removed the _debug suffix.
1908
1909 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
1910
1911         Reviewed by Eric Seidel.
1912         
1913         Slightly elaborated the differences between declaration procesing in 
1914         Function Code and Program Code.
1915         
1916         .3% speedup on SunSpider.
1917
1918         * kjs/nodes.cpp:
1919         (KJS::FunctionBodyNode::processDeclarationsFunctionCode): 
1920         (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a 
1921         minimum set of attributes instead of recomputing all the time. Also,
1922         ignore m_parameters, since programs don't have arguments.
1923
1924 2007-10-25  Eric Seidel  <eric@webkit.org>
1925
1926         Reviewed by Maciej.
1927         
1928         More preparation work before adding long-running mode to testkjs.
1929
1930         * kjs/testkjs.cpp:
1931         (TestFunctionImp::callAsFunction):
1932         (prettyPrintScript):
1933         (runWithScripts):
1934         (parseArguments):
1935         (kjsmain):
1936         (fillBufferWithContentsOfFile):
1937
1938 2007-10-25  Eric Seidel  <eric@webkit.org>
1939
1940         Reviewed by Maciej.
1941         
1942         Bring testkjs code out of the dark ages in preparation for more
1943         radical improvements (like long-running testing support!)
1944
1945         * kjs/testkjs.cpp:
1946         (TestFunctionImp::callAsFunction):
1947         (setupInterpreter):
1948         (doIt):
1949         (fillBufferWithContentsOfFile):
1950
1951 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
1952
1953         Reviewed by Maciej Stachowiak.
1954         
1955         Make a fast path for declaration processing inside Function Code.
1956         
1957         Lifted declaration processing code up from individual declaration nodes
1958         and into processDeclarations.
1959         
1960         Broke out processDeclarations into two cases, depending on the type of 
1961         code. This eliminates 2 branches, and facilitates more radical 
1962         divergeance in the future.
1963         
1964         2.5% SunSpider speedup.
1965
1966         * JavaScriptCore.xcodeproj/project.pbxproj:
1967         * kjs/nodes.cpp:
1968         (KJS::FunctionBodyNode::initializeDeclarationStacks):
1969         (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
1970         (KJS::FunctionBodyNode::processDeclarationsProgramCode):
1971         (KJS::FunctionBodyNode::execute):
1972         (KJS::FuncDeclNode::makeFunction):
1973         * kjs/nodes.h:
1974         (KJS::):
1975
1976 2007-10-25  Maciej Stachowiak  <mjs@apple.com>
1977
1978         Reviewed by Adam.
1979         
1980         - add header includes needed on platforms that don't use AllInOneFile.cpp
1981
1982         * API/JSCallbackObject.cpp:
1983         * kjs/Context.cpp:
1984         * kjs/ExecState.cpp:
1985         * kjs/array_instance.cpp:
1986         * kjs/function_object.cpp:
1987         * kjs/interpreter.cpp:
1988         * kjs/nodes.cpp:
1989
1990 2007-10-25  Eric Seidel  <eric@webkit.org>
1991
1992         Reviewed by Geoff.
1993
1994         * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
1995
1996 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
1997
1998         Reviewed by Maciej Stachowiak.
1999         
2000         Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
2001         Re-order declaration initialization to avoid calling hasProperty inside
2002         VarDeclNode::processDeclaration
2003         
2004         .7% speedup on SunSpider.
2005
2006         * kjs/function.h:
2007         * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
2008         other processing of declared symbols, so the order of execution could 
2009         change.
2010
2011         * kjs/nodes.cpp:
2012         (KJS::VarDeclNode::getDeclarations): Added special case for the 
2013         "arguments" property name, explained in the comment.
2014
2015         (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
2016         in the case of function code, since we know the declared symbol
2017         management will resolve conflicts between symbols. Yay!
2018
2019         (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's 
2020         implementation of getDeclarations is non-trivial, we can't take a 
2021         short-cut here any longer -- we need to put the VarDecl node on the 
2022         stack so it gets processed normally.
2023
2024         (KJS::FunctionBodyNode::processDeclarations): Changed the order of 
2025         processing to enforce mutual exclusion rules.
2026
2027         * kjs/nodes.h:
2028         (KJS::DeclarationStacks::DeclarationStacks): Structure includes an 
2029         ExecState now, for fast access to the "arguments" property name.
2030
2031 2007-10-24  Eric Seidel  <eric@webkit.org>
2032
2033         Reviewed by Maciej.
2034         
2035         Add a JSGlobalObject class and remove the InterpreterMap
2036         http://bugs.webkit.org/show_bug.cgi?id=15681
2037         
2038         This required making JSCallbackObject a template class to allow for
2039         JSGlobalObjects with JSCallbackObject functionality.
2040         
2041         SunSpider claims this was a 0.5% speedup.
2042
2043         * API/JSCallbackObject.cpp:
2044         (KJS::):
2045         * API/JSCallbackObject.h:
2046         * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
2047         (KJS::::JSCallbackObject):
2048         (KJS::::init):
2049         (KJS::::~JSCallbackObject):
2050         (KJS::::initializeIfNeeded):
2051         (KJS::::className):
2052         (KJS::::getOwnPropertySlot):
2053         (KJS::::put):
2054         (KJS::::deleteProperty):
2055         (KJS::::implementsConstruct):
2056         (KJS::::construct):
2057         (KJS::::implementsHasInstance):
2058         (KJS::::hasInstance):
2059         (KJS::::implementsCall):
2060         (KJS::::callAsFunction):
2061         (KJS::::getPropertyNames):
2062         (KJS::::toNumber):
2063         (KJS::::toString):
2064         (KJS::::setPrivate):
2065         (KJS::::getPrivate):
2066         (KJS::::inherits):
2067         (KJS::::cachedValueGetter):
2068         (KJS::::staticValueGetter):
2069         (KJS::::staticFunctionGetter):
2070         (KJS::::callbackGetter):
2071         * API/JSClassRef.cpp:
2072         (OpaqueJSClass::prototype):
2073         * API/JSContextRef.cpp:
2074         (JSGlobalContextCreate):
2075         * API/JSObjectRef.cpp:
2076         (JSObjectMake):
2077         (JSObjectGetPrivate):
2078         (JSObjectSetPrivate):
2079         * API/JSValueRef.cpp:
2080         (JSValueIsObjectOfClass):
2081         * JavaScriptCore.exp:
2082         * JavaScriptCore.xcodeproj/project.pbxproj:
2083         * bindings/c/c_utility.cpp:
2084         (KJS::Bindings::convertValueToNPVariant):
2085         * bindings/jni/jni_jsobject.cpp:
2086         * bindings/objc/objc_utility.mm:
2087         (KJS::Bindings::convertValueToObjcValue):
2088         * kjs/Context.cpp:
2089         (KJS::Context::Context):
2090         * kjs/ExecState.cpp:
2091         (KJS::ExecState::lexicalInterpreter):
2092         * kjs/JSGlobalObject.h: Added.
2093         (KJS::JSGlobalObject::JSGlobalObject):
2094         (KJS::JSGlobalObject::isGlobalObject):
2095         (KJS::JSGlobalObject::interpreter):
2096         (KJS::JSGlobalObject::setInterpreter):
2097         * kjs/array_instance.cpp:
2098         * kjs/context.h:
2099         * kjs/function.cpp:
2100         (KJS::FunctionImp::callAsFunction):
2101         (KJS::GlobalFuncImp::callAsFunction):
2102         * kjs/interpreter.cpp:
2103         (KJS::Interpreter::Interpreter):
2104         (KJS::Interpreter::init):
2105         (KJS::Interpreter::~Interpreter):
2106         (KJS::Interpreter::globalObject):
2107         (KJS::Interpreter::initGlobalObject):
2108         (KJS::Interpreter::evaluate):
2109         * kjs/interpreter.h:
2110         * kjs/lookup.h:
2111         (KJS::cacheGlobalObject):
2112         * kjs/object.h:
2113         (KJS::JSObject::isGlobalObject):
2114         * kjs/testkjs.cpp:
2115
2116 2007-10-24  Eric Seidel  <eric@webkit.org>
2117
2118         Build fix for Gtk, no review.
2119
2120         * kjs/collector.cpp: #include "context.h"
2121
2122 2007-10-24  Eric Seidel  <eric@webkit.org>
2123
2124         Reviewed by Maciej.
2125         
2126         Stop checking isOutOfMemory after every allocation, instead let the collector
2127         notify all ExecStates if we ever hit this rare condition.
2128         
2129         SunSpider claims this was a 2.2% speedup.
2130
2131         * kjs/collector.cpp:
2132         (KJS::Collector::collect):
2133         (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2134         * kjs/collector.h:
2135         * kjs/nodes.cpp:
2136         (KJS::TryNode::execute):
2137
2138 2007-10-24  Mark Rowe  <mrowe@apple.com>
2139
2140         Gtk build fix.
2141
2142         * kjs/identifier.h:  Remove extra qualification.
2143
2144 2007-10-24  Geoffrey Garen  <ggaren@apple.com>
2145
2146         Reviewed by Sam Weinig.
2147         
2148         Disable ALWAYS_INLINE in debug builds, since it drives the debugger
2149         crazy.
2150
2151         * wtf/AlwaysInline.h:
2152
2153 2007-10-24  Geoffrey Garen  <ggaren@apple.com>
2154
2155         Reviewed by Sam Weinig.
2156         
2157         Inlined the fast path for creating an Identifier from an Identifier. 
2158         
2159         This is a .4% speedup on SunSpider overall, but as big as a 2.5% 
2160         speedup on certain individual tests. 65% of the Identifiers creating 
2161         by SunSpider are already Identifiers.
2162         
2163         (The main reason I'm making this change is that it resolves a large
2164         regression in a patch I haven't checked in yet.)
2165
2166         * JavaScriptCore.exp:
2167         * kjs/identifier.cpp:
2168         (KJS::Identifier::addSlowCase):
2169         * kjs/identifier.h:
2170         (KJS::Identifier::Identifier::add):
2171
2172 2007-10-24  Lars Knoll  <lars@trolltech.com>
2173
2174         Reviewed by Simon.
2175
2176         some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's.
2177
2178         * bindings/qt/qt_instance.cpp:
2179         (KJS::Bindings::QtInstance::invokeMethod):
2180         * bindings/qt/qt_runtime.cpp:
2181         (KJS::Bindings::convertValueToQVariant):
2182         (KJS::Bindings::QtField::setValueToInstance):
2183
2184 2007-10-24  Oliver Hunt  <oliver@apple.com>
2185
2186         Reviewed by Darin.
2187
2188         Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
2189
2190         * kjs/nodes.cpp:
2191         (KJS::lessThan):
2192         (KJS::lessThanEq):
2193         (KJS::LessNode::evaluate):
2194         (KJS::GreaterNode::evaluate):
2195         (KJS::LessEqNode::evaluate):
2196         (KJS::GreaterEqNode::evaluate):
2197         * kjs/operations.cpp:
2198         * kjs/operations.h:
2199
2200 2007-10-24  Eric Seidel  <eric@webkit.org>
2201
2202         Reviewed by darin.
2203
2204         * kjs/nodes.h:
2205         (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
2206
2207 2007-10-24  Darin Adler  <darin@apple.com>
2208
2209         Reviewed by Eric.
2210
2211         * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
2212         Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
2213
2214 2007-10-24  Darin Adler  <darin@apple.com>
2215
2216         Reviewed by Maciej.
2217
2218         - separate out the code to create a hash table the first time from the code
2219           to rehash
2220
2221         SunSpider claims this was a 0.7% speedup.
2222
2223         * kjs/property_map.cpp:
2224         (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
2225         (KJS::PropertyMap::createTable): Added. For the case where we had no table.
2226         (KJS::PropertyMap::rehash): Removed code needed only in the case where we
2227         had no table.
2228         * kjs/property_map.h: Added createTable.
2229
2230 2007-10-24  Eric Seidel  <eric@webkit.org>
2231
2232         Reviewed by darin.
2233         
2234         Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
2235         which can be represented by JSImmediate.
2236         
2237         SunSpider claims this was a 0.6% speedup.
2238
2239         * kjs/grammar.y:
2240         * kjs/nodes.cpp:
2241         (KJS::NumberNode::evaluate):
2242         (KJS::ImmediateNumberNode::evaluate):
2243         * kjs/nodes.h:
2244         (KJS::Node::):
2245         (KJS::ImmediateNumberNode::):
2246         * kjs/nodes2string.cpp:
2247         (ImmediateNumberNode::streamTo):
2248
2249 2007-10-24  Darin Adler  <darin@apple.com>
2250
2251         Reviewed by Maciej.
2252
2253         - http://bugs.webkit.org/show_bug.cgi?id=15657
2254           change static hash tables to use powers of two for speed
2255
2256         Seems to give 0.7% SunSpider speedup.
2257
2258         * kjs/create_hash_table: Updated to generate new format.
2259         * kjs/lookup.cpp:
2260         (KJS::keysMatch): Took out unneeded typecast.
2261         (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
2262         Replaced the modulus with a bit mask.
2263         (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
2264         their hash -- saves a branch.
2265         (KJS::Lookup::find): Ditto.
2266         * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
2267
2268 2007-10-24  Maciej Stachowiak  <mjs@apple.com>
2269
2270         Reviewed by Darin.
2271         
2272         - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
2273
2274         * kjs/nodes.cpp:
2275         (KJS::DoWhileNode::execute):
2276         (KJS::WhileNode::execute):
2277         (KJS::ForNode::execute):
2278         (KJS::ForInNode::execute):
2279         (KJS::SourceElementsNode::execute):
2280
2281 2007-10-23  Darin Adler  <darin@apple.com>
2282
2283         Reviewed by Maciej.
2284
2285         * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
2286         Changed an && to an & for a 1% gain in SunSpider.
2287
2288 2007-10-23  Oliver Hunt  <oliver@apple.com>
2289
2290         Reviewed by Maciej.
2291
2292         Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
2293
2294         * kjs/nodes.cpp:
2295         (KJS::MultNode::evaluate):
2296         (KJS::DivNode::evaluate):
2297         (KJS::ModNode::evaluate):
2298         (KJS::add):
2299         (KJS::sub):
2300         (KJS::AddNode::evaluate):
2301         (KJS::SubNode::evaluate):
2302         (KJS::valueForReadModifyAssignment):
2303         * kjs/operations.cpp:
2304         * kjs/operations.h:
2305
2306 2007-10-23  Oliver Hunt  <oliver@apple.com>
2307
2308         Reviewed by Maciej.
2309
2310         Separating all of the simple (eg. non-read-modify-write) binary operators
2311         into separate classes in preparation for further JS optimisations.
2312         
2313         Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
2314         no further work.
2315
2316         * JavaScriptCore.xcodeproj/project.pbxproj:
2317         * kjs/grammar.y:
2318         * kjs/nodes.cpp:
2319         (KJS::MultNode::evaluate):
2320         (KJS::DivNode::evaluate):
2321         (KJS::ModNode::evaluate):
2322         (KJS::AddNode::evaluate):
2323         (KJS::SubNode::evaluate):
2324         (KJS::LeftShiftNode::evaluate):
2325         (KJS::RightShiftNode::evaluate):
2326         (KJS::UnsignedRightShiftNode::evaluate):
2327         (KJS::LessNode::evaluate):
2328         (KJS::GreaterNode::evaluate):
2329         (KJS::LessEqNode::evaluate):
2330         (KJS::GreaterEqNode::evaluate):
2331         (KJS::InstanceOfNode::evaluate):
2332         (KJS::InNode::evaluate):
2333         (KJS::EqualNode::evaluate):
2334         (KJS::NotEqualNode::evaluate):
2335         (KJS::StrictEqualNode::evaluate):
2336         (KJS::NotStrictEqualNode::evaluate):
2337         (KJS::BitAndNode::evaluate):
2338         (KJS::BitXOrNode::evaluate):
2339         (KJS::BitOrNode::evaluate):
2340         (KJS::LogicalAndNode::evaluate):
2341         (KJS::LogicalOrNode::evaluate):
2342         * kjs/nodes.h:
2343         (KJS::MultNode::):
2344         (KJS::DivNode::):
2345         (KJS::ModNode::):
2346         (KJS::AddNode::):
2347         (KJS::SubNode::):
2348         (KJS::LeftShiftNode::):
2349         (KJS::RightShiftNode::):
2350         (KJS::UnsignedRightShiftNode::):
2351         (KJS::LessNode::):
2352         (KJS::GreaterNode::):
2353         (KJS::LessEqNode::):
2354         (KJS::GreaterEqNode::):
2355         (KJS::InstanceOfNode::):
2356         (KJS::InNode::):
2357         (KJS::EqualNode::):
2358         (KJS::NotEqualNode::):
2359         (KJS::StrictEqualNode::):
2360         (KJS::NotStrictEqualNode::):
2361         (KJS::BitAndNode::):
2362         (KJS::BitOrNode::):
2363         (KJS::BitXOrNode::):
2364         (KJS::LogicalAndNode::):
2365         (KJS::LogicalOrNode::):
2366         * kjs/nodes2string.cpp:
2367         (MultNode::streamTo):
2368         (DivNode::streamTo):
2369         (ModNode::streamTo):
2370         (AddNode::streamTo):
2371         (SubNode::streamTo):
2372         (LeftShiftNode::streamTo):
2373         (RightShiftNode::streamTo):
2374         (UnsignedRightShiftNode::streamTo):
2375         (LessNode::streamTo):
2376         (GreaterNode::streamTo):
2377         (LessEqNode::streamTo):
2378         (GreaterEqNode::streamTo):
2379         (InstanceOfNode::streamTo):
2380         (InNode::streamTo):
2381         (EqualNode::streamTo):
2382         (NotEqualNode::streamTo):
2383         (StrictEqualNode::streamTo):
2384         (NotStrictEqualNode::streamTo):
2385         (BitAndNode::streamTo):
2386         (BitXOrNode::streamTo):
2387         (BitOrNode::streamTo):
2388         (LogicalAndNode::streamTo):
2389
2390 2007-10-23  Darin Adler  <darin@apple.com>
2391
2392         Reviewed by Maciej.
2393
2394         - fix http://bugs.webkit.org/show_bug.cgi?id=15639
2395           fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
2396
2397         Test: fast/js/math.html
2398
2399         * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
2400         Fix abs to look at the sign bit. Add a special case for values in the range
2401         between -0 and -1 and a special case for ceil and for -0 for floor.
2402
2403 2007-10-23  Darin Adler  <darin@apple.com>
2404
2405         Reviewed by Eric.
2406
2407         - streamline exception handling code for a >1% speed-up of SunSpider
2408
2409         * kjs/nodes.cpp: Changed macros to use functions for everything that's not
2410         part of normal execution. We'll take function call overhead when propagating
2411         an exception or out of memory.
2412         (KJS::createOutOfMemoryCompletion): Added.
2413         (KJS::substitute): Use append instead of the relatively inefficient + operator.
2414         (KJS::Node::rethrowException): Added.
2415         * kjs/nodes.h: Added rethrowException.
2416
2417 2007-10-22  Darin Adler  <darin@apple.com>
2418
2419         Reviewed by Maciej.
2420
2421         - fix http://bugs.webkit.org/show_bug.cgi?id=15636
2422           some JavaScriptCore regression tests are failing due to numeric conversion
2423
2424         This should restore correctness and make speed better too, restoring some
2425         of the optimization we lost in my last check-in.
2426
2427         * kjs/JSImmediate.h:
2428         (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
2429         I used in my patch yesterday.
2430         (KJS::JSImmediate::getTruncatedUInt32): Ditto.
2431
2432         * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
2433         * kjs/internal.cpp:
2434         (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
2435         a way to write this more efficiently for float.
2436         (KJS::NumberImp::getTruncatedInt32): Added.
2437         (KJS::NumberImp::getTruncatedUInt32): Added.
2438
2439         * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
2440         (KJS::JSValue::getUInt32):
2441         (KJS::JSValue::getTruncatedInt32): Added.
2442         (KJS::JSValue::getTruncatedUInt32): Added.
2443         (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
2444         (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
2445         * kjs/value.cpp:
2446         (KJS::JSCell::getTruncatedInt32): Added.
2447         (KJS::JSCell::getTruncatedUInt32): Added.
2448         (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
2449         (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
2450         had left in here.
2451         (KJS::JSValue::toUInt32SlowCase): Ditto.
2452         (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
2453
2454         * JavaScriptCore.exp: Updated.
2455
2456 2007-10-22  Darin Adler  <darin@apple.com>
2457
2458         Reviewed by Geoff.
2459
2460         - fix http://bugs.webkit.org/show_bug.cgi?id=15632
2461           js1_5/Array/array-001.js test failing
2462
2463         One of the JavaScriptCore tests was failing; it failed because of
2464         my change to NumberImp::getUInt32. The incorrect code I copied was
2465         from JSImmediate::getUInt32, and was a pre-existing bug.
2466
2467         This patch fixes correctness, but will surely slow down SunSpider.
2468         We may be able to code this tighter and get the speed back.
2469
2470         * kjs/JSImmediate.h:
2471         (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
2472         reflect the fact that this function only returns true if the value is
2473         accurate (no fractional part, etc.). Changed code so that it returns
2474         false when the value has a fraction.
2475         (KJS::JSImmediate::getUInt32): Ditto.
2476
2477         * kjs/internal.cpp:
2478         (KJS::NumberImp::getInt32): Changed code so that it returns false when
2479         the value has a fraction. Restores the old behavior.
2480         (KJS::NumberImp::getUInt32): Ditto.
2481
2482         * kjs/value.h:
2483         (KJS::JSValue::getInt32): Updated for name change.
2484         (KJS::JSValue::getUInt32): Ditto.
2485         (KJS::JSValue::toInt32): Ditto.
2486         (KJS::JSValue::toUInt32): Ditto.
2487
2488 2007-10-22  Darin Adler  <darin@apple.com>
2489
2490         Reviewed by Brady.
2491
2492         - fix crash seen when running JavaScriptCore tests
2493
2494         * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
2495         Copy and paste error: I accidentally had code here that was
2496         making a copy of the HashMap -- that's illegal inside a mark
2497         function and was unnecessary. The other callsite was modifying
2498         the map as it iterated it, but this function is not.
2499
2500 2007-10-22  Maciej Stachowiak  <mjs@apple.com>
2501
2502         Reviewed by Oliver.
2503         
2504         - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
2505         http://bugs.webkit.org/show_bug.cgi?id=15627
2506
2507         * kjs/JSImmediate.h:
2508         (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
2509         registers since this is very slow.
2510
2511 2007-10-22  Darin Adler  <darin@apple.com>
2512
2513         Reviewed by Eric Seidel.
2514
2515         - http://bugs.webkit.org/show_bug.cgi?id=15617
2516           improve speed of integer conversions
2517
2518         Makes SunSpider 6% faster.
2519
2520         * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
2521         32-bit and 64-bit.
2522         * kjs/value.h:
2523         (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
2524
2525         * kjs/internal.h: Added getInt32.
2526         * kjs/internal.cpp:
2527         (KJS::NumberImp::getInt32): Added.
2528         (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
2529         stolen from JSValue.
2530
2531         * kjs/value.h:
2532         (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
2533         inlined.
2534         (KJS::JSValue::getInt32): Added.
2535         (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
2536         to avoid converting from float to double.
2537         (KJS::JSValue::toInt32): Made inline, separated out the slow case.
2538         (KJS::JSValue::toUInt32): Ditto.
2539         * kjs/value.cpp:
2540         (KJS::JSCell::getInt32): Added.
2541         (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
2542         new getInt32. Added a faster case for in-range numbers.
2543         (KJS::JSValue::toUInt32SlowCase): Ditto.
2544         (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
2545
2546         * JavaScriptCore.exp: Updated for changes.
2547
2548 2007-10-22  Adam Roben  <aroben@apple.com>
2549
2550         Windows build fix
2551
2552         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
2553         warning about implicit conversion to bool.
2554
2555 2007-10-22  Mark Rowe  <mrowe@apple.com>
2556
2557         Gtk build fix.
2558
2559         * kjs/array_instance.cpp:
2560
2561 2007-10-22  Darin Adler  <darin@apple.com>
2562
2563         Reviewed by Maciej.
2564
2565         - http://bugs.webkit.org/show_bug.cgi?id=15606
2566           make cut-off for sparse vs. dense arrays smarter for speed with large arrays
2567
2568         Makes the morph test in SunSpider 26% faster, and the overall
2569         benchmark 3% faster.
2570
2571         This also fixes some small problems we had with the distinction
2572         between nonexistent and undefined values in arrays.
2573
2574         * kjs/array_instance.h: Tweaked formatting and naming.
2575         * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
2576         (KJS::storageSize): Added. Computes the size of the storage given a vector length.
2577         (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
2578         (KJS::isDenseEnoughForVector): Added.
2579         (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
2580         (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
2581         (KJS::ArrayInstance::getItem): Updated for name changes.
2582         (KJS::ArrayInstance::lengthGetter): Ditto.
2583         (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
2584         getOwnPropertySlot to share more code.
2585         (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
2586         (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
2587         array is dense enough. Also keep m_numValuesInVector up to date.
2588         (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
2589         up to date.
2590         (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
2591         for array indices with undefined values.
2592         (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
2593         simplified to only handle getting larger.
2594         (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
2595         zero out the unused part of the vector and to delete the map if it's no longer
2596         needed.
2597         (KJS::ArrayInstance::mark): Tweaked formatting.
2598         (KJS::compareByStringForQSort): Ditto.
2599         (KJS::ArrayInstance::sort): Ditto.
2600         (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2601         Ditto.
2602         (KJS::compareWithCompareFunctionForQSort): Ditto.
2603         (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
2604         undefined values into nonexistent values in some cases.
2605
2606         * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
2607         * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
2608
2609         * JavaScriptCore.pri: Added array_instance.cpp.
2610         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2611         * kjs/AllInOneFile.cpp: Ditto.
2612
2613 2007-10-22  Andrew Wellington  <proton@wiretapped.net>
2614
2615         Reviewed by Mark Rowe.
2616         
2617         Fix for local database support after r26879
2618         Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
2619
2620         * Configurations/JavaScriptCore.xcconfig:
2621
2622 2007-10-22  Simon Hausmann  <hausmann@kde.org>
2623
2624         Reviewed by Alp.
2625
2626         Build fix for the non-qmake builds.
2627
2628         * wtf/Platform.h: Default to enabling the database features unless
2629         otherwise specified. (similar to ENABLE_ICONDATABASE)
2630
2631 2007-10-22  Holger Freyther  <zecke@selfish.org>
2632
2633         Reviewed by Simon Hausmann <hausmann@kde.org>.
2634
2635         * Do not build testkjs as an application bundle. This is
2636         needed for run-javascriptcore-tests on OSX.
2637         * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
2638         * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
2639         as we do not have -rpath on OSX.
2640
2641         * kjs/testkjs.pro:
2642
2643 2007-10-21  Mark Rowe  <mrowe@apple.com>
2644
2645         Reviewed by Alp.
2646
2647         http://bugs.webkit.org/show_bug.cgi?id=15575
2648         Bug 15575: [GTK] Implement threading using GThread
2649
2650         * wtf/Platform.h: Do not enable pthreads for Gtk.
2651
2652 2007-10-21  Mark Rowe  <mrowe@apple.com>
2653
2654         Reviewed by Mitz.
2655
2656         Fix http://bugs.webkit.org/show_bug.cgi?id=15603
2657         Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
2658
2659         * kjs/array_object.cpp:
2660         (KJS::freeStorage): Reinstate null-check that was removed in r26847.
2661
2662 2007-10-21  Darin Adler  <darin@apple.com>
2663
2664         - fix Windows build
2665
2666         * kjs/array_instance.h: Removed unused ExecState parameter.
2667         * kjs/array_object.cpp:
2668         (KJS::ArrayInstance::put): Ditto.
2669         (KJS::ArrayInstance::setLength): Ditto.
2670
2671 2007-10-21  Darin Adler  <darin@apple.com>
2672
2673         * kjs/array_object.cpp: (KJS::ArrayInstance::put):
2674         Add missing assignment that was causing regression test crash.
2675
2676 2007-10-21  Darin Adler  <darin@apple.com>
2677
2678         Reviewed by Maciej.
2679
2680         - http://bugs.webkit.org/show_bug.cgi?id=15585
2681           speed up sparse arrays by using a custom map
2682     
2683         Speeds up SunSpider by 10%.
2684
2685         * kjs/array_object.cpp:
2686         (allocateStorage): Leave room for an additional pointer.
2687         (reallocateStorage): Ditto.
2688         (freeStorage): Ditto.
2689         (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
2690         (ArrayInstance::getItem): Read values from the overflow map if present.
2691         Removed the check of length, since it slows down the common case.
2692         (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
2693         to the property map.
2694         (ArrayInstance::put): Write values into the overflow map as needed.
2695         Also create overflow map when needed.
2696         (ArrayInstance::deleteProperty): Remove values from the overflow map
2697         as appropriate.
2698         (ArrayInstance::getPropertyNames): Add a name for each identifier in
2699         the property map. This is extremely inefficient.
2700         (ArrayInstance::setLength): Remove any values in the overflow map
2701         that are past the new length, as we formerly did with the property map.
2702         (ArrayInstance::mark): Mark any values in the overflow map.
2703         (compareByStringForQSort): Removed unneeded undefined case, since
2704         compactForSorting guarantees we will have no undefined values.
2705         (compareWithCompareFunctionForQSort): Ditto.
2706         (ArrayInstance::compactForSorting): Copy all the values out of the
2707         overflow map and destroy it.
2708
2709         * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
2710         * kjs/property_map.cpp: Ditto.
2711
2712 2007-10-20  Darin Adler  <darin@apple.com>
2713
2714         Reviewed by Maciej.
2715
2716         - http://bugs.webkit.org/show_bug.cgi?id=15579
2717           stop churning identifier reference counts copying Completion objects
2718
2719         * kjs/completion.h: Replace the Identifier with an Identifier*.
2720         * kjs/nodes.cpp:
2721         (ForInNode::execute): Update for change to Completion constructor.
2722         (ContinueNode::execute): Ditto.
2723         (BreakNode::execute): Ditto.
2724
2725 2007-10-20  Mark Rowe  <mrowe@apple.com>
2726
2727         Reviewed by Alp.
2728
2729         Gtk changes needed to enable HTML 5 client-side database storage.
2730
2731         * wtf/Platform.h: Have Gtk use pthreads for now.
2732
2733 2007-10-20  Geoffrey Garen  <ggaren@apple.com>
2734
2735         Reviewed by Maciej Stachowiak.
2736
2737         Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
2738         Store gathered declaration nodes in the function body node.
2739         
2740         This means that you only have to gather the declaration nodes the first 
2741         time the function executes. Performance gain of 2.10% on SunSpider, 
2742         0.90% on command-line JS iBench.
2743
2744         * kjs/nodes.cpp: Split declaration stack initialization code off into 
2745         initializeDeclarationStacks().
2746         (FunctionBodyNode::FunctionBodyNode):
2747         (FunctionBodyNode::initializeDeclarationStacks):
2748         (FunctionBodyNode::processDeclarations):
2749
2750         * kjs/nodes.h: Changed DeclarationStacks structure to hold references, 
2751         since the actual Vectors are now stored either on the stack or in the 
2752         function body node.
2753
2754 2007-10-19  Geoffrey Garen  <ggaren@apple.com>
2755
2756         Reviewed by Darin Adler.
2757         
2758         http://bugs.webkit.org/show_bug.cgi?id=15559
2759         Moved processDeclarations call into FunctionBodyNode::execute
2760
2761         To improve encapsulation, moved processDeclarations call into
2762         FunctionBodyNode::execute. Also marked processDeclarations 
2763         ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup 
2764         on command-line JS iBench.
2765
2766         * kjs/function.cpp:
2767         (KJS::FunctionImp::callAsFunction):
2768         (KJS::GlobalFuncImp::callAsFunction):
2769         * kjs/function.h:
2770         * kjs/interpreter.cpp:
2771         (KJS::Interpreter::evaluate):
2772         * kjs/nodes.cpp:
2773         (FunctionBodyNode::execute):
2774         * kjs/nodes.h:
2775
2776 2007-10-19  Brady Eidson  <beidson@apple.com>
2777
2778         Reviewed by Sam
2779
2780         Queue -> Deque! and small style tweaks
2781
2782         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2783         * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
2784         * wtf/Deque.h: Added.
2785         (WTF::DequeNode::DequeNode):
2786         (WTF::Deque::Deque):
2787         (WTF::Deque::~Deque):
2788         (WTF::Deque::size):
2789         (WTF::Deque::isEmpty):
2790         (WTF::Deque::append):
2791         (WTF::Deque::prepend):
2792         (WTF::Deque::first):
2793         (WTF::Deque::last):
2794         (WTF::Deque::removeFirst):
2795         (WTF::Deque::clear):
2796         * wtf/Queue.h: Removed.
2797
2798
2799 2007-10-19  Brady Eidson <beidson@apple.com>
2800
2801         Reviewed by Oliver
2802
2803         Added a simple LinkedList based Queue to wtf
2804         We can make a better, more sophisticated an efficient one later, but have
2805         needed one for some time, now!
2806
2807         * JavaScriptCore.xcodeproj/project.pbxproj:
2808         * wtf/Queue.h: Added.
2809         (WTF::QueueNode::QueueNode):
2810         (WTF::Queue::Queue):
2811         (WTF::Queue::~Queue):
2812         (WTF::Queue::size):
2813         (WTF::Queue::isEmpty):
2814         (WTF::Queue::append):
2815         (WTF::Queue::prepend):
2816         (WTF::Queue::first):
2817         (WTF::Queue::last):
2818         (WTF::Queue::removeFirst):
2819         (WTF::Queue::clear):
2820
2821 2007-10-19  Nikolas Zimmermann  <zimmermann@kde.org>
2822
2823         Reviewed by Anders.
2824
2825         Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
2826
2827         * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
2828
2829 2007-10-19  Simon Hausmann  <hausmann@kde.org>
2830
2831         Reviewed by Lars.
2832
2833         Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
2834         Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
2835
2836         * wtf/ASCIICType.h:
2837         (WTF::isASCIIAlpha):
2838         (WTF::isASCIIAlphanumeric):
2839         (WTF::isASCIIDigit):
2840         (WTF::isASCIIHexDigit):
2841         (WTF::isASCIILower):
2842         (WTF::isASCIISpace):
2843         (WTF::toASCIILower):
2844         (WTF::toASCIIUpper):
2845
2846 2007-10-19  Simon Hausmann  <hausmann@kde.org>
2847
2848         Reviewed by Lars.
2849
2850         Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
2851
2852         * kjs/config.h:
2853
2854 2007-10-18  Maciej Stachowiak  <mjs@apple.com>
2855
2856         Reviewed by Adam.
2857         
2858         - use __declspec(thread) for fast thread-local storage on Windows
2859         
2860         - 2.2% speedup on sunspider (on Windows)
2861         - 7% speedup on the string section
2862         - 6% speedup on JS iBench
2863         
2864         - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
2865         - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
2866         
2867         
2868         * wtf/FastMalloc.cpp:
2869         (WTF::getThreadHeap):
2870         (WTF::setThreadHeap):
2871         (WTF::TCMalloc_ThreadCache::GetCache):
2872         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
2873         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2874
2875 2007-10-17  Darin Adler  <darin@apple.com>
2876
2877         Reviewed by Mark Rowe.
2878
2879         - fix http://bugs.webkit.org/show_bug.cgi?id=15543
2880           <rdar://problem/5545639> REGRESSION (r26697):
2881           GoogleDocs: Can't create new documents or open existing ones
2882
2883         Test: fast/js/regexp-non-character.html
2884
2885         * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
2886         in the \u sequences -- not needed and actively harmful.
2887
2888 2007-10-17  Anders Carlsson  <andersca@apple.com>
2889
2890         Reviewed by Oliver.
2891
2892         * wtf/Platform.h:
2893         #define USE_PTHREADS on Mac.
2894
2895 2007-10-17  Geoffrey Garen  <ggaren@apple.com>
2896
2897         Reviewed by Darin Adler.
2898         
2899         Merged DeclaredFunctionImp into FunctionImp (the base class) because 
2900         the distinction between the two was unused.
2901         
2902         Removed codeType() from FunctionImp because FunctionImp and its 
2903         subclasses all returned FunctionCode, so it was unused, practically 
2904         speaking.
2905         
2906         Removed a different codeType() from GlobalFuncImp because it was unused.
2907         (Perhaps it was vestigial from a time when GlobalFuncImp used to 
2908         inherit from FunctionImp.)
2909
2910         * bindings/runtime_method.cpp:
2911         * bindings/runtime_method.h:
2912         * kjs/function.cpp:
2913         (KJS::):
2914         (KJS::FunctionImp::FunctionImp):
2915         (KJS::FunctionImp::callAsFunction):
2916         (KJS::FunctionImp::construct):
2917         (KJS::FunctionImp::execute):
2918         (KJS::FunctionImp::processVarDecls):
2919         * kjs/function.h:
2920         (KJS::FunctionImp::implementsConstruct):
2921         (KJS::FunctionImp::scope):
2922         * kjs/function_object.cpp:
2923         (FunctionProtoFunc::callAsFunction):
2924         (FunctionObjectImp::construct):
2925         * kjs/nodes.cpp:
2926         (FuncDeclNode::processFuncDecl):
2927         (FuncExprNode::evaluate):
2928
2929 2007-10-17  Adam Roben  <aroben@apple.com>
2930
2931         Windows build fix part 2.
2932
2933         Fix was by Darin, reviewed by Anders and Adam.
2934
2935         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
2936         FastMallocPCRE.cpp to the project, and let Visual Studio have its way
2937         with the post-build step.
2938         * pcre/pcre.h: Don't DLL export the entry points just because this
2939         is Win32 -- this is an internal copy of PCRE and should be private.
2940         * pcre/pcre_compile.c: Fix an uninitialized variable warning --
2941         there's no real problem but it's better to quiet the compiler by
2942         tweaking the code slightly than turn off the warning entirely.
2943
2944 2007-10-17  Adam Roben  <aroben@apple.com>
2945
2946         Windows build fix.
2947
2948         Reviewed by Anders.
2949
2950         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
2951         some mismatched signed/unsigned comparison warnings.
2952         * pcre/pcre_exec.c:
2953         (match): #if-out some labels that don't seem to exist.
2954
2955 2007-10-17  Mark Rowe  <mrowe@apple.com>
2956
2957         Gtk build fix.
2958
2959         * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
2960         * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
2961         is currently unavailable for UTF-16.
2962
2963 2007-10-16  Darin Adler  <darin@apple.com>
2964
2965         Reviewed by Geoff.
2966
2967         - merged PCRE changes between 6.4 and 6.5
2968
2969         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2970         * JavaScriptCore.xcodeproj/project.pbxproj:
2971         Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
2972         pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
2973         pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
2974
2975         * pcre/AUTHORS:
2976         * pcre/LICENCE:
2977         * pcre/MERGING:
2978         * pcre/dftables.c:
2979         * pcre/pcre-config.h:
2980         * pcre/pcre.h:
2981         * pcre/pcre.pri:
2982         * pcre/pcre_compile.c:
2983         * pcre/pcre_exec.c:
2984         * pcre/pcre_fullinfo.c:
2985         * pcre/pcre_get.c:
2986         * pcre/pcre_internal.h:
2987         * pcre/pcre_maketables.c:
2988         * pcre/pcre_ord2utf8.c:
2989         * pcre/pcre_tables.c:
2990         * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
2991         * pcre/pcre_xclass.c:
2992         * pcre/ucp.h:
2993         * pcre/ucpinternal.h:
2994         * pcre/ucptable.c:
2995         Updated with new versions from the PCRE 6.5 release, merged with changes.
2996
2997         * pcre/pcre_config.c: Removed.
2998         * pcre/pcre_globals.c: Removed.
2999         * pcre/pcre_info.c: Removed.
3000         * pcre/pcre_printint.src: Removed.
3001         * pcre/pcre_refcount.c: Removed.
3002         * pcre/pcre_study.c: Removed.
3003         * pcre/pcre_try_flipped.c: Removed.
3004         * pcre/pcre_ucp_findchar.c: Removed.
3005         * pcre/pcre_version.c: Removed.
3006
3007 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
3008
3009         Reviewed by Darin Adler.
3010
3011         Removed KJS_VERBOSE because it was getting in the way of readability, 
3012         and the messages didn't seem very helpful.
3013
3014         * kjs/function.cpp:
3015         (KJS::FunctionImp::callAsFunction):
3016         (KJS::FunctionImp::passInParameters):
3017         * kjs/lookup.h:
3018         (KJS::lookupPut):
3019         * kjs/object.cpp:
3020         (KJS::JSObject::put):
3021         * kjs/value.h:
3022
3023 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
3024
3025         Reviewed by Darin Adler.
3026         
3027         Removed the Parameter class because it was a redundant wrapper around 
3028         Identifier.
3029
3030         * kjs/function.cpp:
3031         (KJS::FunctionImp::passInParameters):
3032         (KJS::FunctionImp::getParameterName):
3033         * kjs/nodes.cpp:
3034         (FunctionBodyNode::addParam):
3035         * kjs/nodes.h:
3036         (KJS::FunctionBodyNode::):
3037
3038 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
3039
3040         Reviewed by Darin Adler.
3041         
3042         Global replace of assert with ASSERT.
3043
3044 2007-10-16  Adam Roben  <aroben@apple.com>
3045
3046         Make testkjs not delay-load WebKit
3047
3048         Soon, delay-loading WebKit will be impossible (because we will be
3049         using __declspec(thread) for thread-local storage). This change
3050         prepares testkjs for the future.
3051
3052         Reviewed by Sam.
3053
3054         * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
3055         added FindSafari.
3056         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
3057         WebKitInitializer, don't delay-load WebKit.
3058         * kjs/testkjs.cpp: Don't use WebKitInitializer.
3059
3060 2007-10-16  Adam Roben  <aroben@apple.com>
3061
3062         Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
3063
3064         Reviewed by Kevin McCullough.
3065
3066         * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
3067         * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
3068         * JavaScriptCore.vcproj/release.vsprops: Ditto.
3069         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
3070         WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
3071         in the name of icuuc36[_debug].dll.
3072
3073 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
3074
3075         Reviewed by Maciej Stachowiak.
3076         
3077         Re-structured variable and function declaration code.
3078         
3079         Command-line JS iBench shows no regression.
3080         
3081         Here are the changes:
3082
3083         1. Function declarations are now processed at the same time as var 
3084         declarations -- namely, immediately upon entry to an execution context. 
3085         This does not match Firefox, which waits to process a function
3086         declaration until the declaration's containing block executes, but it 
3087         does match IE and the ECMA spec. (10.1.3 states that var and function 
3088         declarations should be processed at the same time -- namely, "On 
3089         entering an execution context." 12.2 states that "A Block does not 
3090         define a new execution scope.")
3091
3092         2. Declaration processing proceeds iteratively now, rather than 
3093         recursively, storing the nodes is finds in stacks. This will later 
3094         facilitate an optimization to hold on to the gathered declaration nodes, 
3095         rather than re-fetching them in every function call. 
3096         [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3097
3098         Modified these tests because they expected the incorrect Mozilla 
3099         behavior described above:
3100
3101         * tests/mozilla/ecma_3/Function/scope-001.js:
3102         * tests/mozilla/js1_5/Scope/regress-184107.js:
3103
3104 2007-10-16  Darin Adler  <darin@apple.com>
3105
3106         - try to fix the GTK build
3107
3108         * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
3109
3110 2007-10-16  Darin Adler  <darin@apple.com>
3111
3112         - try to fix the Windows build
3113
3114         * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
3115         in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
3116
3117 2007-10-16  Darin Adler  <darin@apple.com>
3118
3119         - try to fix the GTK build
3120
3121         * kjs/ustring.cpp: Include ASCIICType.h.
3122
3123 2007-10-16  Darin Adler  <darin@apple.com>
3124
3125         Reviewed by Maciej and Geoff (and looked over by Eric).
3126
3127         - http://bugs.webkit.org/show_bug.cgi?id=15519
3128           eliminate use of <ctype.h> for processing ASCII
3129
3130         * wtf/ASCIICType.h: Added.
3131         * wtf/DisallowCType.h: Added.
3132
3133         * kjs/config.h: Include DisallowCType.h.
3134
3135         * kjs/date_object.cpp:
3136         (KJS::skipSpacesAndComments):
3137         (KJS::findMonth):
3138         (KJS::parseDate):
3139         * kjs/function.cpp:
3140         (KJS::decode):
3141         * kjs/ustring.cpp:
3142         (KJS::UString::toDouble):
3143         Use ASCIICType.h functions instead of ctype.h ones.
3144
3145 2007-10-14  Maciej Stachowiak  <mjs@apple.com>
3146
3147         Reviewed by Darin.
3148
3149         - fixes for "New JavaScript benchmark"
3150         http://bugs.webkit.org/show_bug.cgi?id=15515
3151         
3152         * kjs/testkjs.cpp:
3153         (TestFunctionImp::callAsFunction): Implement "load" for compatibility
3154         with SpiderMonkey.
3155         (TestFunctionImp::): ditto
3156         (doIt): ditto
3157         (kjsmain): Drop useless --> from output.
3158
3159 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3160
3161         Removed unnecessary #include.
3162
3163         * API/JSObjectRef.cpp:
3164
3165 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3166
3167         Double-reverse build fix. My tree was out of date.
3168
3169         * kjs/nodes.cpp:
3170         (NumberNode::evaluate):
3171
3172 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3173
3174         Build fix.
3175
3176         * kjs/nodes.cpp:
3177         (NumberNode::evaluate):
3178
3179 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3180
3181         Reviewed by Darin Adler.
3182         
3183         Removed surprising self-named "hack" that made nested functions 
3184         available as named properties of their containing functions, and placed
3185         containing function objects in the scope chains of nested functions.
3186         
3187         There were a few reasons to remove this "hack:"
3188
3189         1. It contradicted FF, IE, and the ECMA spec.
3190
3191         2. It incurred a performance penalty, since merely parsing a function 
3192         required parsing its body for nested functions (and so on).
3193
3194         3. SVN history contains no explanation for why it was added. It was just
3195         legacy code in a large merge a long, long time ago.
3196
3197         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3198
3199         * kjs/nodes.cpp:
3200         (FuncDeclNode::processFuncDecl):
3201
3202 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3203
3204         Reviewed by Darin Adler.
3205         
3206         Removed the concept of AnonymousCode. It was unused, and it doesn't
3207         exist in the ECMA spec.
3208         
3209         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3210
3211         * kjs/Context.cpp:
3212         (KJS::Context::Context):
3213         * kjs/function.h:
3214         (KJS::):
3215         * kjs/nodes.cpp:
3216         (ReturnNode::execute):
3217
3218 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3219
3220         Reviewed by Darin Adler.
3221         
3222         Made function parameters DontDelete. This matches FF and the vague
3223         description in ECMA 10.1.3. It's also required in order to make
3224         symbol table based lookup of function parameters valid. (If the 
3225         parameters aren't DontDelete, you can't guarantee that you'll find
3226         them later in the symbol table.)
3227
3228         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3229
3230         * kjs/function.cpp:
3231         (KJS::FunctionImp::passInParameters):
3232
3233 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
3234
3235         Reviewed by Maciej Stachowiak.
3236         
3237         Some Vector optimizations. These are especially important when using
3238         Vector as a stack for implementing recursive algorithms iteratively.
3239         
3240         [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3241
3242         1. Added shrink(), which is a version of resize() that you can call
3243         to save a branch / improve code generation and inlining when you know 
3244         that the vector is not getting bigger.
3245         
3246         2. Changed subclassing relationship in VectorBuffer to remove a call to
3247         fastFree() in the destructor for the inlineCapacity != 0 template
3248         specialization. This brings inline Vectors one step closer to true
3249         stack-allocated arrays.
3250         
3251         Also changed abort() to CRASH(), since the latter works better.
3252
3253         * wtf/Vector.h:
3254         (WTF::VectorBufferBase::allocateBuffer):
3255         (WTF::VectorBufferBase::deallocateBuffer):
3256         (WTF::VectorBufferBase::VectorBufferBase):
3257         (WTF::VectorBufferBase::~VectorBufferBase):
3258         (WTF::):
3259         (WTF::VectorBuffer::VectorBuffer):
3260         (WTF::VectorBuffer::~VectorBuffer):
3261         (WTF::VectorBuffer::deallocateBuffer):
3262         (WTF::VectorBuffer::releaseBuffer):
3263         (WTF::Vector::clear):
3264         (WTF::Vector::removeLast):
3265         (WTF::::operator):
3266         (WTF::::fill):
3267         (WTF::::shrink):
3268
3269 2007-10-12  Geoffrey Garen  <ggaren@apple.com>
3270
3271         Reviewed by Maciej Stachowiak.
3272         
3273         Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
3274         Iteration statements sometimes incorrectly evaluate to the empty value 
3275         (KDE r670547). 
3276         
3277         [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3278         
3279         This patch is a merge of KDE r670547, with substantial modification 
3280         for performance.
3281         
3282         It fixes do-while statements to evaluate to a value. (They used
3283         to evaluate to the empty value in all cases.) 
3284
3285         It also fixes SourceElementsNode to maintain the value of abnormal 
3286         completions like "break" and "continue."
3287         
3288         It also re-works the main execution loop in SourceElementsNode so that
3289         it (1) makes a little more sense and (2) avoids unnecessary work. This 
3290         is a .28% speedup on command-line JS iBench.
3291
3292         * kjs/nodes.cpp:
3293         (DoWhileNode::execute):
3294         (SourceElementsNode::execute):
3295
3296 2007-10-15  Simon Hausmann  <hausmann@kde.org>
3297
3298         Reviewed by Lars.
3299
3300         Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
3301
3302         * wtf/HashTraits.h:
3303
3304 2007-10-5  Kevin Ollivier  <kevino@theolliviers.com>
3305  
3306         Reviewed by Adam.
3307         
3308         Add support for MSVC7, and fix cases where PLATFORM(WIN) should
3309         be PLATFORM(WIN_OS) for other ports building on Windows.
3310  
3311         * kjs/DateMath.cpp:
3312         (KJS::getDSTOffsetSimple):
3313         * kjs/JSImmediate.h:
3314         * wtf/Assertions.cpp:
3315         * wtf/Assertions.h:
3316         * wtf/Platform.h:
3317         * wtf/StringExtras.h:
3318         (snprintf):
3319         (vsnprintf):
3320
3321 2007-10-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3322
3323         Reviewed by Darin.
3324
3325         Adds NegateNode optimization from KJS. The relevant revision in KDE
3326         is 666736.
3327
3328         * kjs/grammar.y:
3329         * kjs/nodes.cpp:
3330         (NumberNode::evaluate):
3331         * kjs/nodes.h:
3332         (KJS::Node::):
3333         (KJS::NumberNode::):
3334         * kjs/nodes2string.cpp:
3335         (NumberNode::streamTo):
3336
3337 2007-10-14  Jason Foreman  <jason@threeve.org>
3338
3339         Reviewed by Maciej.
3340
3341         Fix http://bugs.webkit.org/show_bug.cgi?id=15145
3342         
3343         Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
3344         that the property n < intPow10(p) is maintained.
3345
3346         * kjs/number_object.cpp:
3347         (NumberProtoFunc::callAsFunction):
3348
3349 == Rolled over to ChangeLog-2007-10-14 ==