- fix GTK build
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2007-10-28  Darin Adler  <darin@apple.com>
2
3         - fix GTK build
4
5         * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
6         Use isNaN and isInf instead of isnan and isinf.
7
8 2007-10-28  Darin Adler  <darin@apple.com>
9
10         Reviewed by Maciej.
11
12         - http://bugs.webkit.org/show_bug.cgi?id=15735
13           remove GroupNode to simplify AST and possibly get a modest speedup
14
15         This patch removes 4 node types: GroupNode, PropertyNameNode,
16         FunctionCallParenBracketNode, and FunctionCallParenDotNode.
17
18         To remove GroupNode, we add knowledge of precedence to the tree nodes,
19         and use that when serializing to determine where parentheses are needed.
20         This means we no longer have to represent parentheses in the tree.
21
22         The precedence values are named after productions in the grammar from the
23         JavaScript standard.
24
25         SunSpider says this is an 0.4% speedup.
26
27         * kjs/function.h:
28         * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
29         serialization, so I moved it to the file that takes care of that.
30
31         * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
32         indicate failure instead of a separate boolean. Got rid of PropertyNameNode
33         by merging the PropertyName rule into the Property rule (which was easier
34         than figuring out how to pass the Identifier from one node to another).
35         Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
36         and FunctionCallParenDotNode.
37
38         * kjs/nodes.h: Removed unused forward declarations and Operator values.
39         Added Precedence enum, and precedence function to all nodes. Removed
40         nodeInsideAllParens. Added streamBinaryOperator function for serialization.
41         Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
42         Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
43
44         * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
45         (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
46         of converting it from an Identifier to a jsString then back to a UString
47         then into an Identifier again!
48
49         * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
50         function for each of Endl, Indent, Unindent, and DotExpr instead of using a
51         single function with a switch. Added a precedence that you can stream in, to
52         cause the next node serialized to add parentheses based on that precedence value.
53         (KJS::operatorString): Moved to the top of the file.
54         (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
55         workaround for snprintf, since StringExtras.h takes care of that.
56         (KJS::operator<<): Made the char and char* versions faster by using UString's
57         character append functions instead of constructing a UString. Added the logic
58         to the Node* version to add parentheses if needed.
59         (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
60         (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
61         (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
62         the bracket.
63         (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
64         (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
65         (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
66         (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
67         (KJS::FunctionCallBracketNode::streamTo): Ditto.
68         (KJS::FunctionCallDotNode::streamTo): Ditto.
69         (KJS::PostfixBracketNode::streamTo): Ditto.
70         (KJS::PostfixDotNode::streamTo): Ditto.
71         (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
72         (KJS::DeleteBracketNode::streamTo): Use PrecCall.
73         (KJS::DeleteDotNode::streamTo): Ditto.
74         (KJS::DeleteValueNode::streamTo): Use PrecUnary.
75         (KJS::VoidNode::streamTo): Ditto.
76         (KJS::TypeOfValueNode::streamTo): Ditto.
77         (KJS::PrefixBracketNode::streamTo): Use PrecCall.
78         (KJS::PrefixDotNode::streamTo): Ditto.
79         (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
80         (KJS::UnaryPlusNode::streamTo): Ditto.
81         (KJS::NegateNode::streamTo): Ditto.
82         (KJS::BitwiseNotNode::streamTo): Ditto.
83         (KJS::LogicalNotNode::streamTo): Ditto.
84         (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
85         (KJS::DivNode::streamTo): Ditto.
86         (KJS::ModNode::streamTo): Ditto.
87         (KJS::AddNode::streamTo): Ditto.
88         (KJS::SubNode::streamTo): Ditto.
89         (KJS::LeftShiftNode::streamTo): Ditto.
90         (KJS::RightShiftNode::streamTo): Ditto.
91         (KJS::UnsignedRightShiftNode::streamTo): Ditto.
92         (KJS::LessNode::streamTo): Ditto.
93         (KJS::GreaterNode::streamTo): Ditto.
94         (KJS::LessEqNode::streamTo): Ditto.
95         (KJS::GreaterEqNode::streamTo): Ditto.
96         (KJS::InstanceOfNode::streamTo): Ditto.
97         (KJS::InNode::streamTo): Ditto.
98         (KJS::EqualNode::streamTo): Ditto.
99         (KJS::NotEqualNode::streamTo): Ditto.
100         (KJS::StrictEqualNode::streamTo): Ditto.
101         (KJS::NotStrictEqualNode::streamTo): Ditto.
102         (KJS::BitAndNode::streamTo): Ditto.
103         (KJS::BitXOrNode::streamTo): Ditto.
104         (KJS::BitOrNode::streamTo): Ditto.
105         (KJS::LogicalAndNode::streamTo): Ditto.
106         (KJS::LogicalOrNode::streamTo): Ditto.
107         (KJS::ConditionalNode::streamTo): Ditto.
108         (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
109         (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
110         the bracket and PrecAssignment for the right side.
111         (KJS::AssignDotNode::streamTo): Ditto.
112         (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
113         and PrecAssignment for the right side.
114         (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
115         (KJS::AssignExprNode::streamTo): Use PrecAssignment.
116
117 2007-10-28  Kevin Ollivier  <kevino@theolliviers.com>
118
119         Define wx port and set wx port USE options.
120
121         Reviewed by Adam Roben.
122
123         * wtf/Platform.h:
124
125 2007-10-28  Mark Rowe  <mrowe@apple.com>
126
127         We don't include "config.h" in headers.
128
129         * bindings/jni/jni_instance.h:
130         * kjs/regexp.h:
131         * wtf/TCPageMap.h:
132         * wtf/TCSpinLock.h:
133
134 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
135
136         Rubber stamped by Mark.
137         
138         - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
139
140         * kjs/SymbolTable.h:
141         (KJS::SymbolTableIndexHashTraits::emptyValue):
142         * kjs/function.cpp:
143         (KJS::ActivationImp::getOwnPropertySlot):
144         (KJS::ActivationImp::put):
145
146 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
147
148         Reviewed by Eric.
149         
150         - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
151
152         * kjs/SymbolTable.h:
153         (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
154         (KJS::IdentifierRepHash::equal): ditto
155         (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
156         (KJS::SymbolTable): change to a typedef for a HashMap.
157         * kjs/function.cpp:
158         (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
159         (KJS::ActivationImp::deleteProperty): ditto
160         (KJS::ActivationImp::put): ditto
161
162         * kjs/nodes.cpp:
163         (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
164         you now have to store a UString::rep, not an identifier.
165
166 2007-10-27  Maciej Stachowiak  <mjs@apple.com>
167
168         Reviewed by Oliver.
169         
170         - numerous HashTable performance improvements
171         
172         This does not quite add up to a measurable win on SunSpider, but it allows a
173         follow-on > 3% improvement and probably helps WebCore too.
174         
175         I made the following improvements, among others:
176         
177         - Made HashFunctions note whether it is ok to compare a real value with the equal() function
178         to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
179         
180         - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
181         std::pairs for cases that don't need them. There are now four versions, one for read-only access,
182         two for writing, and one folded directly into add() (these all were improvments).
183         
184         - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
185         
186         - Made a special constructor for iterators that knows it points to
187         a valid filled cell and so skips updating itself.
188
189         - Reordered memory accesses in the various lookup functions for better code generation
190         
191         - Made simple translators avoid passing a hash code around
192         
193         - Other minor tweaks
194         
195         * wtf/HashTable.h:
196         (WTF::):
197         (WTF::HashTableConstIterator::HashTableConstIterator):
198         (WTF::HashTableIterator::HashTableIterator):
199         (WTF::IdentityHashTranslator::translate):
200         (WTF::HashTable::end):
201         (WTF::HashTable::lookup):
202         (WTF::HashTable::lookupForWriting):
203         (WTF::HashTable::makeKnownGoodIterator):
204         (WTF::HashTable::makeKnownGoodConstIterator):
205         (WTF::::lookup):
206         (WTF::::lookupForWriting):
207         (WTF::::fullLookupForWriting):
208         (WTF::::add):
209         (WTF::::addPassingHashCode):
210         (WTF::::reinsert):
211         (WTF::::find):
212         (WTF::::contains):
213         * kjs/identifier.cpp:
214         (WTF::):
215         * wtf/HashFunctions.h:
216         (WTF::):
217         * wtf/HashMap.h:
218         (WTF::):
219         (WTF::::get):
220         * wtf/HashSet.h:
221         (WTF::):
222         (WTF::::add):
223         * wtf/ListHashSet.h:
224         (WTF::ListHashSetTranslator::translate):
225
226 2007-10-27  Darin Adler  <darin@apple.com>
227
228         Reviewed by Eric.
229
230         - fix ASCIICType.h for some Windows compiles
231
232         * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
233         compiler/library that has the wchar_t that is just a typedef.
234
235 2007-10-27  Kevin McCullough  <kmccullough@apple.com>
236
237         - BuildFix
238         - Forgot to change the build step when I changed the filename.
239
240         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
241
242 2007-10-27  Geoffrey Garen  <ggaren@apple.com>
243
244         Reviewed by Darin Adler.
245         
246         Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
247         computedHash()"
248         http://bugs.webkit.org/show_bug.cgi?id=15718
249
250         * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a 
251         hash value. Also changed O(n) strlen to O(1) check for empty string.
252         (KJS::Identifier::add):
253
254         * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
255         (KJS::UString::UString):
256         (KJS::UString::operator=):
257
258 2007-10-27  Darin Adler  <darin@apple.com>
259
260         Reviewed by Eric.
261
262         - fix pow on Windows
263
264         * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
265         a "pow" function that does not properly handle the case where arg1 is
266         NaN and arg2 is 0.
267
268         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
269         specify "::pow" -- just "pow" is fine.
270
271 2007-10-27  Darin Adler  <darin@apple.com>
272
273         Reviewed by Maciej.
274
275         - http://bugs.webkit.org/show_bug.cgi?id=15711
276           force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
277
278         * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
279
280         * kjs/object.h: Removed redundant includes.
281         * kjs/value.h: Ditto.
282
283 2007-10-27  Maciej Stachowiak  <mjs@apple.com>
284
285         Reviewed by Mark.
286         
287         - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
288         http://bugs.webkit.org/show_bug.cgi?id=15718
289
290         * kjs/identifier.cpp:
291         (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
292         now that we count on all Identifiers already having one.
293
294 2007-10-27  Mark Rowe  <mrowe@apple.com>
295
296         Silence a warning.
297
298         * kjs/SymbolTable.h:
299
300 2007-10-27  Mark Rowe  <mrowe@apple.com>
301
302         Gtk build fix.
303
304         * kjs/function.h:
305
306 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
307
308        Rubber stamp by Adam. 
309
310         - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
311         files contain are functions that operate on BSTRs.
312
313         * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
314         * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
315         * API/JSStringRefCOM.cpp: Removed.
316         * API/JSStringRefCOM.h: Removed.
317         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
318
319 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
320
321         Reviewed by Adam.
322
323         - Made JSStringCreateWithBSTR capable of handling null BSTRs.
324
325         * API/JSStringRefCOM.cpp:
326         (JSStringCreateWithBSTR):
327
328 2007-10-26  Sam Weinig  <sam@webkit.org>
329
330         Windows build fix.
331
332         * kjs/SymbolTable.h: Add header gaurd.
333         * kjs/nodes.h: #include "SymbolTable.h"
334
335 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
336
337         Suggested by Anders Carlsson.
338         
339         Fixed tyop.
340
341         * kjs/function.cpp:
342         (KJS::ActivationImp::getOwnPropertySlot):
343
344 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
345
346         Suggested by Darin Adler.
347         
348         Use computedHash(), which is safer than just directly accessing _hash.
349
350         * kjs/lookup.cpp:
351         (KJS::Lookup::findEntry):
352         (KJS::Lookup::find):
353
354 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
355
356         Build fix: svn add SymbolTable.h
357
358         * kjs/SymbolTable.h: Added.
359         (KJS::SymbolTable::set):
360         (KJS::SymbolTable::get):
361
362 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
363
364         Build fix: export SymbolTable.h to WebCore.
365
366         * JavaScriptCore.xcodeproj/project.pbxproj:
367
368 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
369
370         Comment tweak suggested by Maciej.
371
372         * kjs/function.cpp:
373         (KJS::ActivationImp::getOwnPropertySlot):
374
375 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
376
377         Reviewed by Maciej Stachowiak.
378         
379         Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
380
381         * kjs/property_map.cpp: Use a special no branch accessor to the UString's
382         hash value. Also, return immediately instead of branching to the end
383         of the loop if the value is not found.
384         (KJS::PropertyMap::get):
385         (KJS::PropertyMap::getLocation):
386         (KJS::PropertyMap::put):
387         (KJS::PropertyMap::insert):
388         (KJS::PropertyMap::remove):
389         (KJS::PropertyMap::checkConsistency):
390
391         * kjs/ustring.h:
392         (KJS::UString::Rep::computedHash): Special no branch accessor to the
393         UString's hash value. Used when the caller knows that the hash value
394         has already been computed. (For example, if the caller got the UString
395         from an Identifier.)
396
397 2007-10-26  Geoffrey Garen  <ggaren@apple.com>
398
399         Reviewed by Maciej Stachowiak.
400         
401         Switched ActivationImp to using a symbol table. For now, though, all
402         clients take the slow path.
403         
404         Net .6% speedup on SunSpider.
405         
406         Slowdowns:
407             - ActivationImp now mallocs in its constructor
408             - Local variable hits use an extra level of indirection to retrieve 
409             data
410             - Local variable misses do two lookups
411
412         Speedups:
413             - Fast initialization of local variables upon function entry
414
415         * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
416         
417         * kjs/function.cpp:
418         (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
419         data that won't fit in a JSCell.
420         (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for 
421         lookup.
422         (KJS::ActivationImp::getOwnPropertySlot): ditto
423         (KJS::ActivationImp::deleteProperty): ditto
424         (KJS::ActivationImp::put): ditto
425         (KJS::ActivationImp::createArgumentsObject): ditto
426
427         (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
428         our properties doesn't try to recursively mark us. (This caused a crash
429         in earlier testing. Not sure why we haven't run into it before.)
430
431         * kjs/nodes.cpp: Functions now build a symbol table the first time 
432         they're called.
433         (KJS::VarDeclNode::evaluate):
434         (KJS::FunctionBodyNode::FunctionBodyNode):
435         (KJS::FunctionBodyNode::initializeSymbolTable):
436         (KJS::FunctionBodyNode::processDeclarations):
437         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
438         (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
439
440         * kjs/nodes.h:
441         (KJS::FunctionBodyNode::symbolTable):
442
443         * wtf/Forward.h: Added Vector.
444
445 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
446
447         - Corrected function name mistake in this changelog.
448
449 2007-10-26  Kevin McCullough  <kmccullough@apple.com>
450         Reviewed by Sam and Steve.
451
452         - Added convenience methods for converting between BSTR and JSStringRefs
453
454         * API/JSStringRefCOM.cpp: Added.
455         (JSStringCreateWithBSTR):
456         (JSStringCopyBSTR):
457         * API/JSStringRefCOM.h: Added.
458         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
459
460 2007-10-26  Mark Rowe  <mrowe@apple.com>
461
462         Windows build fix.
463
464         * kjs/collector.cpp:
465         (KJS::Collector::collect):
466
467 2007-10-26  Oliver Hunt  <oliver@apple.com>
468
469         Reviewed by Maciej.
470
471         Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
472
473         * kjs/CollectorHeapIntrospector.cpp:
474         (KJS::CollectorHeapIntrospector::init):
475         (KJS::CollectorHeapIntrospector::enumerate):
476         * kjs/CollectorHeapIntrospector.h:
477         * kjs/collector.cpp:
478         (KJS::Collector::recordExtraCost):
479         (KJS::Collector::heapAllocate):
480         (KJS::Collector::allocate):
481         (KJS::Collector::allocateNumber):
482         (KJS::Collector::registerThread):
483         (KJS::Collector::markStackObjectsConservatively):
484         (KJS::Collector::markMainThreadOnlyObjects):
485         (KJS::Collector::sweep):
486         (KJS::Collector::collect):
487         * kjs/collector.h:
488         * kjs/internal.h:
489         (KJS::NumberImp::operator new):
490           Force numbers to be allocated in the secondary heap.
491
492 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
493
494         Reviewed by Oliver.
495         
496         - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
497
498         * kjs/value.h:
499         (KJS::JSValue::getUInt32):
500         (KJS::JSValue::getTruncatedInt32):
501         (KJS::JSValue::toNumber):
502         * wtf/PassRefPtr.h:
503         (WTF::PassRefPtr::~PassRefPtr):
504         * wtf/RefPtr.h:
505         (WTF::RefPtr::operator->):
506
507 2007-10-26  Mark Rowe  <mrowe@apple.com>
508
509         Gtk build fix.
510
511         * kjs/ExecState.h:
512
513 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
514
515         Reviewed by Mark.
516
517         - Merge Context class fully into ExecState, since they are always created and used together.
518
519         No measurable performance impact but this is a useful cleanup.
520
521         * JavaScriptCore.pri:
522         * kjs/ExecState.cpp:
523         (KJS::ExecState::ExecState):
524         (KJS::ExecState::~ExecState):
525         (KJS::ExecState::mark):
526         (KJS::ExecState::lexicalInterpreter):
527         * kjs/ExecState.h:
528         (KJS::ExecState::dynamicInterpreter):
529         (KJS::ExecState::setException):
530         (KJS::ExecState::clearException):
531         (KJS::ExecState::exception):
532         (KJS::ExecState::exceptionSlot):
533         (KJS::ExecState::hadException):
534         (KJS::ExecState::scopeChain):
535         (KJS::ExecState::callingExecState):
536         (KJS::ExecState::propertyNames):
537         * kjs/collector.cpp:
538         (KJS::Collector::reportOutOfMemoryToAllInterpreters):
539         * kjs/function.cpp:
540         (KJS::FunctionImp::callAsFunction):
541         (KJS::FunctionImp::argumentsGetter):
542         (KJS::FunctionImp::callerGetter):
543         (KJS::GlobalFuncImp::callAsFunction):
544         * kjs/interpreter.cpp:
545         (KJS::Interpreter::Interpreter):
546         (KJS::Interpreter::init):
547         (KJS::Interpreter::evaluate):
548         (KJS::Interpreter::mark):
549         * kjs/interpreter.h:
550         (KJS::Interpreter::setCurrentExec):
551         (KJS::Interpreter::currentExec):
552         * kjs/nodes.cpp:
553         (KJS::currentSourceId):
554         (KJS::currentSourceURL):
555         (KJS::ThisNode::evaluate):
556         (KJS::ResolveNode::evaluate):
557         (KJS::FunctionCallResolveNode::evaluate):
558         (KJS::PostfixResolveNode::evaluate):
559         (KJS::DeleteResolveNode::evaluate):
560         (KJS::TypeOfResolveNode::evaluate):
561         (KJS::PrefixResolveNode::evaluate):
562         (KJS::AssignResolveNode::evaluate):
563         (KJS::VarDeclNode::evaluate):
564         (KJS::DoWhileNode::execute):
565         (KJS::WhileNode::execute):
566         (KJS::ForNode::execute):
567         (KJS::ForInNode::execute):
568         (KJS::ContinueNode::execute):
569         (KJS::BreakNode::execute):
570         (KJS::ReturnNode::execute):
571         (KJS::WithNode::execute):
572         (KJS::SwitchNode::execute):
573         (KJS::LabelNode::execute):
574         (KJS::TryNode::execute):
575         (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
576         (KJS::FunctionBodyNode::processDeclarationsProgramCode):
577         (KJS::FunctionBodyNode::processDeclarations):
578         (KJS::FuncDeclNode::makeFunction):
579         (KJS::FuncExprNode::evaluate):
580
581 2007-10-26  Mark Rowe  <mrowe@apple.com>
582
583         Windows build fix.
584
585         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
586
587 2007-10-26  Mark Rowe  <mrowe@apple.com>
588
589         Gtk build fix.
590
591         * JavaScriptCore.pri:
592         * kjs/ExecState.cpp:
593
594 2007-10-26  Maciej Stachowiak  <mjs@apple.com>
595
596         Reviewed by Oliver.
597         
598         - moved Context class into ExecState.{h,cpp} in preparation for merging 
599         ExecState and Context classes.
600
601         * kjs/ExecState.h: Moved CodeType enum and Context class here in
602         preparation for merging ExecState and Context.
603         * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
604         (KJS::Context::Context):
605         (KJS::Context::~Context):
606         (KJS::Context::mark):
607         * kjs/context.h: Removed.
608         * kjs/Context.cpp: Removed.
609         * kjs/function.h: Removed CodeType enum.
610         * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
611         * kjs/internal.h: Removed LabelStack.
612         * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
613         * kjs/collector.cpp: Fixed includes.
614         * kjs/function.cpp: ditto
615         * kjs/internal.cpp: ditto
616         * kjs/interpreter.cpp: ditto
617         * kjs/lookup.h: ditto
618         * kjs/nodes.cpp: ditto
619
620 2007-10-26  Mark Rowe  <mrowe@apple.com>
621
622         Windows build fix.
623
624         * kjs/string_object.cpp:
625         (KJS::StringObjectFuncImp::callAsFunction):
626
627 2007-10-25  Darin Adler  <darin@apple.com>
628
629         Reviewed by Maciej.
630
631         - http://bugs.webkit.org/show_bug.cgi?id=15703
632           fix numeric functions -- improve correctness and speed
633
634         Gives about 1% gain on SunSpider.
635
636         * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
637         (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
638         with both immediate and number values.
639         (KJS::JSValue::toUInt32): Ditto.
640         * kjs/value.cpp:
641         (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
642         differences. One is that it now correctly returns 0 for NaN, and another is that
643         there's no special case for 0 or infinity, since the general case already handles
644         those correctly.
645         (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
646         check for NaN.
647         (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
648         truncation done by the typecast already does the necessary truncation that
649         roundValue was doing.
650         (KJS::JSValue::toUInt32SlowCase): Ditto.
651         (KJS::JSValue::toUInt16): Removed.
652
653         * kjs/internal.h: Removed roundValue.
654         * kjs/internal.cpp: Ditto.
655
656         * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
657         code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
658
659         * kjs/date_object.cpp:
660         (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
661         toNumber as specified.
662         (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
663         with a call to toNumber and timeClip as specified.
664         (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
665         where the default behavior of toInt32 (returning 0) was already correct. Replaced
666         call to roundValue with a call to toNumber as specified.
667         (KJS::DateObjectFuncImp::callAsFunction): Ditto.
668
669         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
670         cases for the pow function that the library already handles correctly.
671
672         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
673         call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
674         The real toInteger now returns 0 for NaN. Took out unneeded special case in
675         ToFixed for undefined; was only needed because our toInteger was wrong. Same
676         thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
677
678         * kjs/string_object.cpp:
679         (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
680         cases for undefined that were only needed because toInteger was wrong. Same in
681         IndexOf, and was able to remove some special cases. In LastIndexOf, used
682         toIntegerPreserveNaN, but was able to remove some special cases there too.
683         Changed Substr implementation to preserve correct behavior with the change
684         to toInteger and match the specification. Also made sure we weren't converting
685         an out of range double to an int.
686         (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
687         toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
688         no reason to have toUInt16 as a second, less-optimized function that's only
689         called at this one call site.
690
691         * wtf/MathExtras.h: Added trunc function for Windows.
692
693 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
694
695         Reviewed by Maciej Stachowiak.
696         
697         Tweaked the inner hashtable lookup loop to remove a branch in the "not 
698         found" case. .5% speedup on SunSpider.
699
700         * JavaScriptCore.xcodeproj/project.pbxproj:
701         * wtf/HashTable.h:
702         (WTF::::lookup):
703
704 2007-10-25  Maciej Stachowiak  <mjs@apple.com>
705
706         Reviewed by Oliver.
707
708         - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
709
710         * kjs/nodes.cpp:
711         (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
712         adding any value over toNumber() here.
713         (KJS::valueForReadModifyAssignment): Ditto.
714         (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
715         and branches.
716         (KJS::lessThanEq): Ditto.
717         * JavaScriptCore.exp: Export new functions as needed.
718         * kjs/value.h:
719         (KJS::JSValue::toPrimitive): Fixed formatting.
720         (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
721         to number and tells you whether a toPrimitive() conversion with a Number hint
722         would have given a string.
723         * kjs/internal.cpp:
724         (KJS::StringImp::getPrimitiveNumber): Implemented. 
725         (KJS::NumberImp::getPrimitiveNumber): ditto
726         (KJS::GetterSetterImp::getPrimitiveNumber): ditto
727         (KJS::StringImp::toPrimitive): Fixed formatting.
728         (KJS::NumberImp::toPrimitive): ditto
729         (KJS::GetterSetterImp::toPrimitive): ditto
730         * kjs/internal.h:
731         * kjs/object.cpp:
732         (KJS::JSObject::getPrimitiveNumber): Implemented.
733         * kjs/object.h:
734
735 2007-10-25  Sam Weinig  <sam@webkit.org>
736
737         Reviewed by Adam Roben.
738
739         Remove JSStringRefCFHack from windows as it is no longer needed.
740
741         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
742
743 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
744
745         Reviewed by Oliver Hunt.
746         
747         Rolled out my last patch. It turns out that I needed 2 words, not 1,
748         so it didn't help.
749
750 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
751
752         Reviewed by Oliver Hunt.
753         
754         Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
755         Shrink the size of an activation object by 1 word
756         
757         This is in preparation for adding a symbol table to the activation 
758         object.
759         
760         The basic strategy here is to rely on the mutual exclusion between
761         the arguments object pointer and the function pointer (you only need
762         the latter in order to create the former), and store them in the same 
763         place. The LazyArgumentsObject class encapsulates this strategy.
764         
765         Also inlined the ArgumentsImp constructor, for good measure.
766         
767         SunSpider reports no regression. Regression tests pass.
768
769         * JavaScriptCore.xcodeproj/project.pbxproj:
770         * kjs/Context.cpp:
771         (KJS::Context::~Context):
772         * kjs/function.cpp:
773         (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
774         (KJS::ActivationImp::LazyArgumentsObject::mark):
775         (KJS::):
776         (KJS::ActivationImp::argumentsGetter):
777         (KJS::ActivationImp::mark):
778         * kjs/function.h:
779         (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
780         (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
781         (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
782         (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
783         (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
784         (KJS::ActivationImp::LazyArgumentsObject::setFunction):
785         (KJS::ActivationImp::LazyArgumentsObject::function):
786         (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
787         (KJS::ActivationImp::LazyArgumentsObject::):
788         (KJS::ActivationImp::ActivationImp::ActivationImp):
789         (KJS::ActivationImp::resetArguments):
790
791 2007-10-25  Adam Roben  <aroben@apple.com>
792
793         Change JavaScriptCore.vcproj to use DerivedSources.make
794
795         We were trying to emulate the logic of make in
796         build-generated-files.sh, but we got it wrong. We now use a
797         build-generated-files very much like the one that WebCore uses to
798         invoke make.
799
800         We also now only have a Debug configuration of dftables which we build
801         even when doing a Release build of JavaScriptCore. dftables also no
802         longer has the "_debug" name suffix.
803
804         Changes mostly made by Darin, reviewed by me.
805
806         * DerivedSources.make: Add a variable to set the extension used for
807         the dftables executable.
808         * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
809         dftables in Release configurations.
810         * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
811         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
812            - Updated include path to point to the new location of the derived
813              sources.
814            - Modified pre-build event to pass the right arguments to
815              build-generated-files.sh and not call dftables directly.
816            - Added the derived source files to the project.
817            - Removed grammarWrapper.cpp, which isn't needed now that we're
818              compiling grammar.cpp directly.
819         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
820         Slightly modified from the WebCore version.
821         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
822         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
823             - Changed the output location to match Mac.
824             - Removed the Release configuration.
825             - Removed the _debug suffix.
826
827 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
828
829         Reviewed by Eric Seidel.
830         
831         Slightly elaborated the differences between declaration procesing in 
832         Function Code and Program Code.
833         
834         .3% speedup on SunSpider.
835
836         * kjs/nodes.cpp:
837         (KJS::FunctionBodyNode::processDeclarationsFunctionCode): 
838         (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a 
839         minimum set of attributes instead of recomputing all the time. Also,
840         ignore m_parameters, since programs don't have arguments.
841
842 2007-10-25  Eric Seidel  <eric@webkit.org>
843
844         Reviewed by Maciej.
845         
846         More preparation work before adding long-running mode to testkjs.
847
848         * kjs/testkjs.cpp:
849         (TestFunctionImp::callAsFunction):
850         (prettyPrintScript):
851         (runWithScripts):
852         (parseArguments):
853         (kjsmain):
854         (fillBufferWithContentsOfFile):
855
856 2007-10-25  Eric Seidel  <eric@webkit.org>
857
858         Reviewed by Maciej.
859         
860         Bring testkjs code out of the dark ages in preparation for more
861         radical improvements (like long-running testing support!)
862
863         * kjs/testkjs.cpp:
864         (TestFunctionImp::callAsFunction):
865         (setupInterpreter):
866         (doIt):
867         (fillBufferWithContentsOfFile):
868
869 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
870
871         Reviewed by Maciej Stachowiak.
872         
873         Make a fast path for declaration processing inside Function Code.
874         
875         Lifted declaration processing code up from individual declaration nodes
876         and into processDeclarations.
877         
878         Broke out processDeclarations into two cases, depending on the type of 
879         code. This eliminates 2 branches, and facilitates more radical 
880         divergeance in the future.
881         
882         2.5% SunSpider speedup.
883
884         * JavaScriptCore.xcodeproj/project.pbxproj:
885         * kjs/nodes.cpp:
886         (KJS::FunctionBodyNode::initializeDeclarationStacks):
887         (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
888         (KJS::FunctionBodyNode::processDeclarationsProgramCode):
889         (KJS::FunctionBodyNode::execute):
890         (KJS::FuncDeclNode::makeFunction):
891         * kjs/nodes.h:
892         (KJS::):
893
894 2007-10-25  Maciej Stachowiak  <mjs@apple.com>
895
896         Reviewed by Adam.
897         
898         - add header includes needed on platforms that don't use AllInOneFile.cpp
899
900         * API/JSCallbackObject.cpp:
901         * kjs/Context.cpp:
902         * kjs/ExecState.cpp:
903         * kjs/array_instance.cpp:
904         * kjs/function_object.cpp:
905         * kjs/interpreter.cpp:
906         * kjs/nodes.cpp:
907
908 2007-10-25  Eric Seidel  <eric@webkit.org>
909
910         Reviewed by Geoff.
911
912         * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
913
914 2007-10-25  Geoffrey Garen  <ggaren@apple.com>
915
916         Reviewed by Maciej Stachowiak.
917         
918         Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
919         Re-order declaration initialization to avoid calling hasProperty inside
920         VarDeclNode::processDeclaration
921         
922         .7% speedup on SunSpider.
923
924         * kjs/function.h:
925         * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
926         other processing of declared symbols, so the order of execution could 
927         change.
928
929         * kjs/nodes.cpp:
930         (KJS::VarDeclNode::getDeclarations): Added special case for the 
931         "arguments" property name, explained in the comment.
932
933         (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
934         in the case of function code, since we know the declared symbol
935         management will resolve conflicts between symbols. Yay!
936
937         (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's 
938         implementation of getDeclarations is non-trivial, we can't take a 
939         short-cut here any longer -- we need to put the VarDecl node on the 
940         stack so it gets processed normally.
941
942         (KJS::FunctionBodyNode::processDeclarations): Changed the order of 
943         processing to enforce mutual exclusion rules.
944
945         * kjs/nodes.h:
946         (KJS::DeclarationStacks::DeclarationStacks): Structure includes an 
947         ExecState now, for fast access to the "arguments" property name.
948
949 2007-10-24  Eric Seidel  <eric@webkit.org>
950
951         Reviewed by Maciej.
952         
953         Add a JSGlobalObject class and remove the InterpreterMap
954         http://bugs.webkit.org/show_bug.cgi?id=15681
955         
956         This required making JSCallbackObject a template class to allow for
957         JSGlobalObjects with JSCallbackObject functionality.
958         
959         SunSpider claims this was a 0.5% speedup.
960
961         * API/JSCallbackObject.cpp:
962         (KJS::):
963         * API/JSCallbackObject.h:
964         * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
965         (KJS::::JSCallbackObject):
966         (KJS::::init):
967         (KJS::::~JSCallbackObject):
968         (KJS::::initializeIfNeeded):
969         (KJS::::className):
970         (KJS::::getOwnPropertySlot):
971         (KJS::::put):
972         (KJS::::deleteProperty):
973         (KJS::::implementsConstruct):
974         (KJS::::construct):
975         (KJS::::implementsHasInstance):
976         (KJS::::hasInstance):
977         (KJS::::implementsCall):
978         (KJS::::callAsFunction):
979         (KJS::::getPropertyNames):
980         (KJS::::toNumber):
981         (KJS::::toString):
982         (KJS::::setPrivate):
983         (KJS::::getPrivate):
984         (KJS::::inherits):
985         (KJS::::cachedValueGetter):
986         (KJS::::staticValueGetter):
987         (KJS::::staticFunctionGetter):
988         (KJS::::callbackGetter):
989         * API/JSClassRef.cpp:
990         (OpaqueJSClass::prototype):
991         * API/JSContextRef.cpp:
992         (JSGlobalContextCreate):
993         * API/JSObjectRef.cpp:
994         (JSObjectMake):
995         (JSObjectGetPrivate):
996         (JSObjectSetPrivate):
997         * API/JSValueRef.cpp:
998         (JSValueIsObjectOfClass):
999         * JavaScriptCore.exp:
1000         * JavaScriptCore.xcodeproj/project.pbxproj:
1001         * bindings/c/c_utility.cpp:
1002         (KJS::Bindings::convertValueToNPVariant):
1003         * bindings/jni/jni_jsobject.cpp:
1004         * bindings/objc/objc_utility.mm:
1005         (KJS::Bindings::convertValueToObjcValue):
1006         * kjs/Context.cpp:
1007         (KJS::Context::Context):
1008         * kjs/ExecState.cpp:
1009         (KJS::ExecState::lexicalInterpreter):
1010         * kjs/JSGlobalObject.h: Added.
1011         (KJS::JSGlobalObject::JSGlobalObject):
1012         (KJS::JSGlobalObject::isGlobalObject):
1013         (KJS::JSGlobalObject::interpreter):
1014         (KJS::JSGlobalObject::setInterpreter):
1015         * kjs/array_instance.cpp:
1016         * kjs/context.h:
1017         * kjs/function.cpp:
1018         (KJS::FunctionImp::callAsFunction):
1019         (KJS::GlobalFuncImp::callAsFunction):
1020         * kjs/interpreter.cpp:
1021         (KJS::Interpreter::Interpreter):
1022         (KJS::Interpreter::init):
1023         (KJS::Interpreter::~Interpreter):
1024         (KJS::Interpreter::globalObject):
1025         (KJS::Interpreter::initGlobalObject):
1026         (KJS::Interpreter::evaluate):
1027         * kjs/interpreter.h:
1028         * kjs/lookup.h:
1029         (KJS::cacheGlobalObject):
1030         * kjs/object.h:
1031         (KJS::JSObject::isGlobalObject):
1032         * kjs/testkjs.cpp:
1033
1034 2007-10-24  Eric Seidel  <eric@webkit.org>
1035
1036         Build fix for Gtk, no review.
1037
1038         * kjs/collector.cpp: #include "context.h"
1039
1040 2007-10-24  Eric Seidel  <eric@webkit.org>
1041
1042         Reviewed by Maciej.
1043         
1044         Stop checking isOutOfMemory after every allocation, instead let the collector
1045         notify all ExecStates if we ever hit this rare condition.
1046         
1047         SunSpider claims this was a 2.2% speedup.
1048
1049         * kjs/collector.cpp:
1050         (KJS::Collector::collect):
1051         (KJS::Collector::reportOutOfMemoryToAllInterpreters):
1052         * kjs/collector.h:
1053         * kjs/nodes.cpp:
1054         (KJS::TryNode::execute):
1055
1056 2007-10-24  Mark Rowe  <mrowe@apple.com>
1057
1058         Gtk build fix.
1059
1060         * kjs/identifier.h:  Remove extra qualification.
1061
1062 2007-10-24  Geoffrey Garen  <ggaren@apple.com>
1063
1064         Reviewed by Sam Weinig.
1065         
1066         Disable ALWAYS_INLINE in debug builds, since it drives the debugger
1067         crazy.
1068
1069         * wtf/AlwaysInline.h:
1070
1071 2007-10-24  Geoffrey Garen  <ggaren@apple.com>
1072
1073         Reviewed by Sam Weinig.
1074         
1075         Inlined the fast path for creating an Identifier from an Identifier. 
1076         
1077         This is a .4% speedup on SunSpider overall, but as big as a 2.5% 
1078         speedup on certain individual tests. 65% of the Identifiers creating 
1079         by SunSpider are already Identifiers.
1080         
1081         (The main reason I'm making this change is that it resolves a large
1082         regression in a patch I haven't checked in yet.)
1083
1084         * JavaScriptCore.exp:
1085         * kjs/identifier.cpp:
1086         (KJS::Identifier::addSlowCase):
1087         * kjs/identifier.h:
1088         (KJS::Identifier::Identifier::add):
1089
1090 2007-10-24  Lars Knoll  <lars@trolltech.com>
1091
1092         Reviewed by Simon.
1093
1094         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.
1095
1096         * bindings/qt/qt_instance.cpp:
1097         (KJS::Bindings::QtInstance::invokeMethod):
1098         * bindings/qt/qt_runtime.cpp:
1099         (KJS::Bindings::convertValueToQVariant):
1100         (KJS::Bindings::QtField::setValueToInstance):
1101
1102 2007-10-24  Oliver Hunt  <oliver@apple.com>
1103
1104         Reviewed by Darin.
1105
1106         Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
1107
1108         * kjs/nodes.cpp:
1109         (KJS::lessThan):
1110         (KJS::lessThanEq):
1111         (KJS::LessNode::evaluate):
1112         (KJS::GreaterNode::evaluate):
1113         (KJS::LessEqNode::evaluate):
1114         (KJS::GreaterEqNode::evaluate):
1115         * kjs/operations.cpp:
1116         * kjs/operations.h:
1117
1118 2007-10-24  Eric Seidel  <eric@webkit.org>
1119
1120         Reviewed by darin.
1121
1122         * kjs/nodes.h:
1123         (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
1124
1125 2007-10-24  Darin Adler  <darin@apple.com>
1126
1127         Reviewed by Eric.
1128
1129         * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
1130         Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
1131
1132 2007-10-24  Darin Adler  <darin@apple.com>
1133
1134         Reviewed by Maciej.
1135
1136         - separate out the code to create a hash table the first time from the code
1137           to rehash
1138
1139         SunSpider claims this was a 0.7% speedup.
1140
1141         * kjs/property_map.cpp:
1142         (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
1143         (KJS::PropertyMap::createTable): Added. For the case where we had no table.
1144         (KJS::PropertyMap::rehash): Removed code needed only in the case where we
1145         had no table.
1146         * kjs/property_map.h: Added createTable.
1147
1148 2007-10-24  Eric Seidel  <eric@webkit.org>
1149
1150         Reviewed by darin.
1151         
1152         Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
1153         which can be represented by JSImmediate.
1154         
1155         SunSpider claims this was a 0.6% speedup.
1156
1157         * kjs/grammar.y:
1158         * kjs/nodes.cpp:
1159         (KJS::NumberNode::evaluate):
1160         (KJS::ImmediateNumberNode::evaluate):
1161         * kjs/nodes.h:
1162         (KJS::Node::):
1163         (KJS::ImmediateNumberNode::):
1164         * kjs/nodes2string.cpp:
1165         (ImmediateNumberNode::streamTo):
1166
1167 2007-10-24  Darin Adler  <darin@apple.com>
1168
1169         Reviewed by Maciej.
1170
1171         - http://bugs.webkit.org/show_bug.cgi?id=15657
1172           change static hash tables to use powers of two for speed
1173
1174         Seems to give 0.7% SunSpider speedup.
1175
1176         * kjs/create_hash_table: Updated to generate new format.
1177         * kjs/lookup.cpp:
1178         (KJS::keysMatch): Took out unneeded typecast.
1179         (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
1180         Replaced the modulus with a bit mask.
1181         (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
1182         their hash -- saves a branch.
1183         (KJS::Lookup::find): Ditto.
1184         * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
1185
1186 2007-10-24  Maciej Stachowiak  <mjs@apple.com>
1187
1188         Reviewed by Darin.
1189         
1190         - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
1191
1192         * kjs/nodes.cpp:
1193         (KJS::DoWhileNode::execute):
1194         (KJS::WhileNode::execute):
1195         (KJS::ForNode::execute):
1196         (KJS::ForInNode::execute):
1197         (KJS::SourceElementsNode::execute):
1198
1199 2007-10-23  Darin Adler  <darin@apple.com>
1200
1201         Reviewed by Maciej.
1202
1203         * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
1204         Changed an && to an & for a 1% gain in SunSpider.
1205
1206 2007-10-23  Oliver Hunt  <oliver@apple.com>
1207
1208         Reviewed by Maciej.
1209
1210         Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
1211
1212         * kjs/nodes.cpp:
1213         (KJS::MultNode::evaluate):
1214         (KJS::DivNode::evaluate):
1215         (KJS::ModNode::evaluate):
1216         (KJS::add):
1217         (KJS::sub):
1218         (KJS::AddNode::evaluate):
1219         (KJS::SubNode::evaluate):
1220         (KJS::valueForReadModifyAssignment):
1221         * kjs/operations.cpp:
1222         * kjs/operations.h:
1223
1224 2007-10-23  Oliver Hunt  <oliver@apple.com>
1225
1226         Reviewed by Maciej.
1227
1228         Separating all of the simple (eg. non-read-modify-write) binary operators
1229         into separate classes in preparation for further JS optimisations.
1230         
1231         Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
1232         no further work.
1233
1234         * JavaScriptCore.xcodeproj/project.pbxproj:
1235         * kjs/grammar.y:
1236         * kjs/nodes.cpp:
1237         (KJS::MultNode::evaluate):
1238         (KJS::DivNode::evaluate):
1239         (KJS::ModNode::evaluate):
1240         (KJS::AddNode::evaluate):
1241         (KJS::SubNode::evaluate):
1242         (KJS::LeftShiftNode::evaluate):
1243         (KJS::RightShiftNode::evaluate):
1244         (KJS::UnsignedRightShiftNode::evaluate):
1245         (KJS::LessNode::evaluate):
1246         (KJS::GreaterNode::evaluate):
1247         (KJS::LessEqNode::evaluate):
1248         (KJS::GreaterEqNode::evaluate):
1249         (KJS::InstanceOfNode::evaluate):
1250         (KJS::InNode::evaluate):
1251         (KJS::EqualNode::evaluate):
1252         (KJS::NotEqualNode::evaluate):
1253         (KJS::StrictEqualNode::evaluate):
1254         (KJS::NotStrictEqualNode::evaluate):
1255         (KJS::BitAndNode::evaluate):
1256         (KJS::BitXOrNode::evaluate):
1257         (KJS::BitOrNode::evaluate):
1258         (KJS::LogicalAndNode::evaluate):
1259         (KJS::LogicalOrNode::evaluate):
1260         * kjs/nodes.h:
1261         (KJS::MultNode::):
1262         (KJS::DivNode::):
1263         (KJS::ModNode::):
1264         (KJS::AddNode::):
1265         (KJS::SubNode::):
1266         (KJS::LeftShiftNode::):
1267         (KJS::RightShiftNode::):
1268         (KJS::UnsignedRightShiftNode::):
1269         (KJS::LessNode::):
1270         (KJS::GreaterNode::):
1271         (KJS::LessEqNode::):
1272         (KJS::GreaterEqNode::):
1273         (KJS::InstanceOfNode::):
1274         (KJS::InNode::):
1275         (KJS::EqualNode::):
1276         (KJS::NotEqualNode::):
1277         (KJS::StrictEqualNode::):
1278         (KJS::NotStrictEqualNode::):
1279         (KJS::BitAndNode::):
1280         (KJS::BitOrNode::):
1281         (KJS::BitXOrNode::):
1282         (KJS::LogicalAndNode::):
1283         (KJS::LogicalOrNode::):
1284         * kjs/nodes2string.cpp:
1285         (MultNode::streamTo):
1286         (DivNode::streamTo):
1287         (ModNode::streamTo):
1288         (AddNode::streamTo):
1289         (SubNode::streamTo):
1290         (LeftShiftNode::streamTo):
1291         (RightShiftNode::streamTo):
1292         (UnsignedRightShiftNode::streamTo):
1293         (LessNode::streamTo):
1294         (GreaterNode::streamTo):
1295         (LessEqNode::streamTo):
1296         (GreaterEqNode::streamTo):
1297         (InstanceOfNode::streamTo):
1298         (InNode::streamTo):
1299         (EqualNode::streamTo):
1300         (NotEqualNode::streamTo):
1301         (StrictEqualNode::streamTo):
1302         (NotStrictEqualNode::streamTo):
1303         (BitAndNode::streamTo):
1304         (BitXOrNode::streamTo):
1305         (BitOrNode::streamTo):
1306         (LogicalAndNode::streamTo):
1307
1308 2007-10-23  Darin Adler  <darin@apple.com>
1309
1310         Reviewed by Maciej.
1311
1312         - fix http://bugs.webkit.org/show_bug.cgi?id=15639
1313           fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
1314
1315         Test: fast/js/math.html
1316
1317         * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
1318         Fix abs to look at the sign bit. Add a special case for values in the range
1319         between -0 and -1 and a special case for ceil and for -0 for floor.
1320
1321 2007-10-23  Darin Adler  <darin@apple.com>
1322
1323         Reviewed by Eric.
1324
1325         - streamline exception handling code for a >1% speed-up of SunSpider
1326
1327         * kjs/nodes.cpp: Changed macros to use functions for everything that's not
1328         part of normal execution. We'll take function call overhead when propagating
1329         an exception or out of memory.
1330         (KJS::createOutOfMemoryCompletion): Added.
1331         (KJS::substitute): Use append instead of the relatively inefficient + operator.
1332         (KJS::Node::rethrowException): Added.
1333         * kjs/nodes.h: Added rethrowException.
1334
1335 2007-10-22  Darin Adler  <darin@apple.com>
1336
1337         Reviewed by Maciej.
1338
1339         - fix http://bugs.webkit.org/show_bug.cgi?id=15636
1340           some JavaScriptCore regression tests are failing due to numeric conversion
1341
1342         This should restore correctness and make speed better too, restoring some
1343         of the optimization we lost in my last check-in.
1344
1345         * kjs/JSImmediate.h:
1346         (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
1347         I used in my patch yesterday.
1348         (KJS::JSImmediate::getTruncatedUInt32): Ditto.
1349
1350         * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
1351         * kjs/internal.cpp:
1352         (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
1353         a way to write this more efficiently for float.
1354         (KJS::NumberImp::getTruncatedInt32): Added.
1355         (KJS::NumberImp::getTruncatedUInt32): Added.
1356
1357         * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
1358         (KJS::JSValue::getUInt32):
1359         (KJS::JSValue::getTruncatedInt32): Added.
1360         (KJS::JSValue::getTruncatedUInt32): Added.
1361         (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
1362         (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
1363         * kjs/value.cpp:
1364         (KJS::JSCell::getTruncatedInt32): Added.
1365         (KJS::JSCell::getTruncatedUInt32): Added.
1366         (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
1367         (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
1368         had left in here.
1369         (KJS::JSValue::toUInt32SlowCase): Ditto.
1370         (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
1371
1372         * JavaScriptCore.exp: Updated.
1373
1374 2007-10-22  Darin Adler  <darin@apple.com>
1375
1376         Reviewed by Geoff.
1377
1378         - fix http://bugs.webkit.org/show_bug.cgi?id=15632
1379           js1_5/Array/array-001.js test failing
1380
1381         One of the JavaScriptCore tests was failing; it failed because of
1382         my change to NumberImp::getUInt32. The incorrect code I copied was
1383         from JSImmediate::getUInt32, and was a pre-existing bug.
1384
1385         This patch fixes correctness, but will surely slow down SunSpider.
1386         We may be able to code this tighter and get the speed back.
1387
1388         * kjs/JSImmediate.h:
1389         (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
1390         reflect the fact that this function only returns true if the value is
1391         accurate (no fractional part, etc.). Changed code so that it returns
1392         false when the value has a fraction.
1393         (KJS::JSImmediate::getUInt32): Ditto.
1394
1395         * kjs/internal.cpp:
1396         (KJS::NumberImp::getInt32): Changed code so that it returns false when
1397         the value has a fraction. Restores the old behavior.
1398         (KJS::NumberImp::getUInt32): Ditto.
1399
1400         * kjs/value.h:
1401         (KJS::JSValue::getInt32): Updated for name change.
1402         (KJS::JSValue::getUInt32): Ditto.
1403         (KJS::JSValue::toInt32): Ditto.
1404         (KJS::JSValue::toUInt32): Ditto.
1405
1406 2007-10-22  Darin Adler  <darin@apple.com>
1407
1408         Reviewed by Brady.
1409
1410         - fix crash seen when running JavaScriptCore tests
1411
1412         * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
1413         Copy and paste error: I accidentally had code here that was
1414         making a copy of the HashMap -- that's illegal inside a mark
1415         function and was unnecessary. The other callsite was modifying
1416         the map as it iterated it, but this function is not.
1417
1418 2007-10-22  Maciej Stachowiak  <mjs@apple.com>
1419
1420         Reviewed by Oliver.
1421         
1422         - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
1423         http://bugs.webkit.org/show_bug.cgi?id=15627
1424
1425         * kjs/JSImmediate.h:
1426         (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
1427         registers since this is very slow.
1428
1429 2007-10-22  Darin Adler  <darin@apple.com>
1430
1431         Reviewed by Eric Seidel.
1432
1433         - http://bugs.webkit.org/show_bug.cgi?id=15617
1434           improve speed of integer conversions
1435
1436         Makes SunSpider 6% faster.
1437
1438         * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
1439         32-bit and 64-bit.
1440         * kjs/value.h:
1441         (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
1442
1443         * kjs/internal.h: Added getInt32.
1444         * kjs/internal.cpp:
1445         (KJS::NumberImp::getInt32): Added.
1446         (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
1447         stolen from JSValue.
1448
1449         * kjs/value.h:
1450         (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
1451         inlined.
1452         (KJS::JSValue::getInt32): Added.
1453         (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
1454         to avoid converting from float to double.
1455         (KJS::JSValue::toInt32): Made inline, separated out the slow case.
1456         (KJS::JSValue::toUInt32): Ditto.
1457         * kjs/value.cpp:
1458         (KJS::JSCell::getInt32): Added.
1459         (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
1460         new getInt32. Added a faster case for in-range numbers.
1461         (KJS::JSValue::toUInt32SlowCase): Ditto.
1462         (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
1463
1464         * JavaScriptCore.exp: Updated for changes.
1465
1466 2007-10-22  Adam Roben  <aroben@apple.com>
1467
1468         Windows build fix
1469
1470         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
1471         warning about implicit conversion to bool.
1472
1473 2007-10-22  Mark Rowe  <mrowe@apple.com>
1474
1475         Gtk build fix.
1476
1477         * kjs/array_instance.cpp:
1478
1479 2007-10-22  Darin Adler  <darin@apple.com>
1480
1481         Reviewed by Maciej.
1482
1483         - http://bugs.webkit.org/show_bug.cgi?id=15606
1484           make cut-off for sparse vs. dense arrays smarter for speed with large arrays
1485
1486         Makes the morph test in SunSpider 26% faster, and the overall
1487         benchmark 3% faster.
1488
1489         This also fixes some small problems we had with the distinction
1490         between nonexistent and undefined values in arrays.
1491
1492         * kjs/array_instance.h: Tweaked formatting and naming.
1493         * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
1494         (KJS::storageSize): Added. Computes the size of the storage given a vector length.
1495         (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
1496         (KJS::isDenseEnoughForVector): Added.
1497         (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
1498         (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
1499         (KJS::ArrayInstance::getItem): Updated for name changes.
1500         (KJS::ArrayInstance::lengthGetter): Ditto.
1501         (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
1502         getOwnPropertySlot to share more code.
1503         (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
1504         (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
1505         array is dense enough. Also keep m_numValuesInVector up to date.
1506         (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
1507         up to date.
1508         (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
1509         for array indices with undefined values.
1510         (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
1511         simplified to only handle getting larger.
1512         (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
1513         zero out the unused part of the vector and to delete the map if it's no longer
1514         needed.
1515         (KJS::ArrayInstance::mark): Tweaked formatting.
1516         (KJS::compareByStringForQSort): Ditto.
1517         (KJS::ArrayInstance::sort): Ditto.
1518         (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
1519         Ditto.
1520         (KJS::compareWithCompareFunctionForQSort): Ditto.
1521         (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
1522         undefined values into nonexistent values in some cases.
1523
1524         * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
1525         * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
1526
1527         * JavaScriptCore.pri: Added array_instance.cpp.
1528         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
1529         * kjs/AllInOneFile.cpp: Ditto.
1530
1531 2007-10-22  Andrew Wellington  <proton@wiretapped.net>
1532
1533         Reviewed by Mark Rowe.
1534         
1535         Fix for local database support after r26879
1536         Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
1537
1538         * Configurations/JavaScriptCore.xcconfig:
1539
1540 2007-10-22  Simon Hausmann  <hausmann@kde.org>
1541
1542         Reviewed by Alp.
1543
1544         Build fix for the non-qmake builds.
1545
1546         * wtf/Platform.h: Default to enabling the database features unless
1547         otherwise specified. (similar to ENABLE_ICONDATABASE)
1548
1549 2007-10-22  Holger Freyther  <zecke@selfish.org>
1550
1551         Reviewed by Simon Hausmann <hausmann@kde.org>.
1552
1553         * Do not build testkjs as an application bundle. This is
1554         needed for run-javascriptcore-tests on OSX.
1555         * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
1556         * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
1557         as we do not have -rpath on OSX.
1558
1559         * kjs/testkjs.pro:
1560
1561 2007-10-21  Mark Rowe  <mrowe@apple.com>
1562
1563         Reviewed by Alp.
1564
1565         http://bugs.webkit.org/show_bug.cgi?id=15575
1566         Bug 15575: [GTK] Implement threading using GThread
1567
1568         * wtf/Platform.h: Do not enable pthreads for Gtk.
1569
1570 2007-10-21  Mark Rowe  <mrowe@apple.com>
1571
1572         Reviewed by Mitz.
1573
1574         Fix http://bugs.webkit.org/show_bug.cgi?id=15603
1575         Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
1576
1577         * kjs/array_object.cpp:
1578         (KJS::freeStorage): Reinstate null-check that was removed in r26847.
1579
1580 2007-10-21  Darin Adler  <darin@apple.com>
1581
1582         - fix Windows build
1583
1584         * kjs/array_instance.h: Removed unused ExecState parameter.
1585         * kjs/array_object.cpp:
1586         (KJS::ArrayInstance::put): Ditto.
1587         (KJS::ArrayInstance::setLength): Ditto.
1588
1589 2007-10-21  Darin Adler  <darin@apple.com>
1590
1591         * kjs/array_object.cpp: (KJS::ArrayInstance::put):
1592         Add missing assignment that was causing regression test crash.
1593
1594 2007-10-21  Darin Adler  <darin@apple.com>
1595
1596         Reviewed by Maciej.
1597
1598         - http://bugs.webkit.org/show_bug.cgi?id=15585
1599           speed up sparse arrays by using a custom map
1600     
1601         Speeds up SunSpider by 10%.
1602
1603         * kjs/array_object.cpp:
1604         (allocateStorage): Leave room for an additional pointer.
1605         (reallocateStorage): Ditto.
1606         (freeStorage): Ditto.
1607         (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
1608         (ArrayInstance::getItem): Read values from the overflow map if present.
1609         Removed the check of length, since it slows down the common case.
1610         (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
1611         to the property map.
1612         (ArrayInstance::put): Write values into the overflow map as needed.
1613         Also create overflow map when needed.
1614         (ArrayInstance::deleteProperty): Remove values from the overflow map
1615         as appropriate.
1616         (ArrayInstance::getPropertyNames): Add a name for each identifier in
1617         the property map. This is extremely inefficient.
1618         (ArrayInstance::setLength): Remove any values in the overflow map
1619         that are past the new length, as we formerly did with the property map.
1620         (ArrayInstance::mark): Mark any values in the overflow map.
1621         (compareByStringForQSort): Removed unneeded undefined case, since
1622         compactForSorting guarantees we will have no undefined values.
1623         (compareWithCompareFunctionForQSort): Ditto.
1624         (ArrayInstance::compactForSorting): Copy all the values out of the
1625         overflow map and destroy it.
1626
1627         * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
1628         * kjs/property_map.cpp: Ditto.
1629
1630 2007-10-20  Darin Adler  <darin@apple.com>
1631
1632         Reviewed by Maciej.
1633
1634         - http://bugs.webkit.org/show_bug.cgi?id=15579
1635           stop churning identifier reference counts copying Completion objects
1636
1637         * kjs/completion.h: Replace the Identifier with an Identifier*.
1638         * kjs/nodes.cpp:
1639         (ForInNode::execute): Update for change to Completion constructor.
1640         (ContinueNode::execute): Ditto.
1641         (BreakNode::execute): Ditto.
1642
1643 2007-10-20  Mark Rowe  <mrowe@apple.com>
1644
1645         Reviewed by Alp.
1646
1647         Gtk changes needed to enable HTML 5 client-side database storage.
1648
1649         * wtf/Platform.h: Have Gtk use pthreads for now.
1650
1651 2007-10-20  Geoffrey Garen  <ggaren@apple.com>
1652
1653         Reviewed by Maciej Stachowiak.
1654
1655         Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
1656         Store gathered declaration nodes in the function body node.
1657         
1658         This means that you only have to gather the declaration nodes the first 
1659         time the function executes. Performance gain of 2.10% on SunSpider, 
1660         0.90% on command-line JS iBench.
1661
1662         * kjs/nodes.cpp: Split declaration stack initialization code off into 
1663         initializeDeclarationStacks().
1664         (FunctionBodyNode::FunctionBodyNode):
1665         (FunctionBodyNode::initializeDeclarationStacks):
1666         (FunctionBodyNode::processDeclarations):
1667
1668         * kjs/nodes.h: Changed DeclarationStacks structure to hold references, 
1669         since the actual Vectors are now stored either on the stack or in the 
1670         function body node.
1671
1672 2007-10-19  Geoffrey Garen  <ggaren@apple.com>
1673
1674         Reviewed by Darin Adler.
1675         
1676         http://bugs.webkit.org/show_bug.cgi?id=15559
1677         Moved processDeclarations call into FunctionBodyNode::execute
1678
1679         To improve encapsulation, moved processDeclarations call into
1680         FunctionBodyNode::execute. Also marked processDeclarations 
1681         ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup 
1682         on command-line JS iBench.
1683
1684         * kjs/function.cpp:
1685         (KJS::FunctionImp::callAsFunction):
1686         (KJS::GlobalFuncImp::callAsFunction):
1687         * kjs/function.h:
1688         * kjs/interpreter.cpp:
1689         (KJS::Interpreter::evaluate):
1690         * kjs/nodes.cpp:
1691         (FunctionBodyNode::execute):
1692         * kjs/nodes.h:
1693
1694 2007-10-19  Brady Eidson  <beidson@apple.com>
1695
1696         Reviewed by Sam
1697
1698         Queue -> Deque! and small style tweaks
1699
1700         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
1701         * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
1702         * wtf/Deque.h: Added.
1703         (WTF::DequeNode::DequeNode):
1704         (WTF::Deque::Deque):
1705         (WTF::Deque::~Deque):
1706         (WTF::Deque::size):
1707         (WTF::Deque::isEmpty):
1708         (WTF::Deque::append):
1709         (WTF::Deque::prepend):
1710         (WTF::Deque::first):
1711         (WTF::Deque::last):
1712         (WTF::Deque::removeFirst):
1713         (WTF::Deque::clear):
1714         * wtf/Queue.h: Removed.
1715
1716
1717 2007-10-19  Brady Eidson <beidson@apple.com>
1718
1719         Reviewed by Oliver
1720
1721         Added a simple LinkedList based Queue to wtf
1722         We can make a better, more sophisticated an efficient one later, but have
1723         needed one for some time, now!
1724
1725         * JavaScriptCore.xcodeproj/project.pbxproj:
1726         * wtf/Queue.h: Added.
1727         (WTF::QueueNode::QueueNode):
1728         (WTF::Queue::Queue):
1729         (WTF::Queue::~Queue):
1730         (WTF::Queue::size):
1731         (WTF::Queue::isEmpty):
1732         (WTF::Queue::append):
1733         (WTF::Queue::prepend):
1734         (WTF::Queue::first):
1735         (WTF::Queue::last):
1736         (WTF::Queue::removeFirst):
1737         (WTF::Queue::clear):
1738
1739 2007-10-19  Nikolas Zimmermann  <zimmermann@kde.org>
1740
1741         Reviewed by Anders.
1742
1743         Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
1744
1745         * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
1746
1747 2007-10-19  Simon Hausmann  <hausmann@kde.org>
1748
1749         Reviewed by Lars.
1750
1751         Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
1752         Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
1753
1754         * wtf/ASCIICType.h:
1755         (WTF::isASCIIAlpha):
1756         (WTF::isASCIIAlphanumeric):
1757         (WTF::isASCIIDigit):
1758         (WTF::isASCIIHexDigit):
1759         (WTF::isASCIILower):
1760         (WTF::isASCIISpace):
1761         (WTF::toASCIILower):
1762         (WTF::toASCIIUpper):
1763
1764 2007-10-19  Simon Hausmann  <hausmann@kde.org>
1765
1766         Reviewed by Lars.
1767
1768         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.
1769
1770         * kjs/config.h:
1771
1772 2007-10-18  Maciej Stachowiak  <mjs@apple.com>
1773
1774         Reviewed by Adam.
1775         
1776         - use __declspec(thread) for fast thread-local storage on Windows
1777         
1778         - 2.2% speedup on sunspider (on Windows)
1779         - 7% speedup on the string section
1780         - 6% speedup on JS iBench
1781         
1782         - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
1783         - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
1784         
1785         
1786         * wtf/FastMalloc.cpp:
1787         (WTF::getThreadHeap):
1788         (WTF::setThreadHeap):
1789         (WTF::TCMalloc_ThreadCache::GetCache):
1790         (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
1791         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
1792
1793 2007-10-17  Darin Adler  <darin@apple.com>
1794
1795         Reviewed by Mark Rowe.
1796
1797         - fix http://bugs.webkit.org/show_bug.cgi?id=15543
1798           <rdar://problem/5545639> REGRESSION (r26697):
1799           GoogleDocs: Can't create new documents or open existing ones
1800
1801         Test: fast/js/regexp-non-character.html
1802
1803         * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
1804         in the \u sequences -- not needed and actively harmful.
1805
1806 2007-10-17  Anders Carlsson  <andersca@apple.com>
1807
1808         Reviewed by Oliver.
1809
1810         * wtf/Platform.h:
1811         #define USE_PTHREADS on Mac.
1812
1813 2007-10-17  Geoffrey Garen  <ggaren@apple.com>
1814
1815         Reviewed by Darin Adler.
1816         
1817         Merged DeclaredFunctionImp into FunctionImp (the base class) because 
1818         the distinction between the two was unused.
1819         
1820         Removed codeType() from FunctionImp because FunctionImp and its 
1821         subclasses all returned FunctionCode, so it was unused, practically 
1822         speaking.
1823         
1824         Removed a different codeType() from GlobalFuncImp because it was unused.
1825         (Perhaps it was vestigial from a time when GlobalFuncImp used to 
1826         inherit from FunctionImp.)
1827
1828         * bindings/runtime_method.cpp:
1829         * bindings/runtime_method.h:
1830         * kjs/function.cpp:
1831         (KJS::):
1832         (KJS::FunctionImp::FunctionImp):
1833         (KJS::FunctionImp::callAsFunction):
1834         (KJS::FunctionImp::construct):
1835         (KJS::FunctionImp::execute):
1836         (KJS::FunctionImp::processVarDecls):
1837         * kjs/function.h:
1838         (KJS::FunctionImp::implementsConstruct):
1839         (KJS::FunctionImp::scope):
1840         * kjs/function_object.cpp:
1841         (FunctionProtoFunc::callAsFunction):
1842         (FunctionObjectImp::construct):
1843         * kjs/nodes.cpp:
1844         (FuncDeclNode::processFuncDecl):
1845         (FuncExprNode::evaluate):
1846
1847 2007-10-17  Adam Roben  <aroben@apple.com>
1848
1849         Windows build fix part 2.
1850
1851         Fix was by Darin, reviewed by Anders and Adam.
1852
1853         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
1854         FastMallocPCRE.cpp to the project, and let Visual Studio have its way
1855         with the post-build step.
1856         * pcre/pcre.h: Don't DLL export the entry points just because this
1857         is Win32 -- this is an internal copy of PCRE and should be private.
1858         * pcre/pcre_compile.c: Fix an uninitialized variable warning --
1859         there's no real problem but it's better to quiet the compiler by
1860         tweaking the code slightly than turn off the warning entirely.
1861
1862 2007-10-17  Adam Roben  <aroben@apple.com>
1863
1864         Windows build fix.
1865
1866         Reviewed by Anders.
1867
1868         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
1869         some mismatched signed/unsigned comparison warnings.
1870         * pcre/pcre_exec.c:
1871         (match): #if-out some labels that don't seem to exist.
1872
1873 2007-10-17  Mark Rowe  <mrowe@apple.com>
1874
1875         Gtk build fix.
1876
1877         * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
1878         * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
1879         is currently unavailable for UTF-16.
1880
1881 2007-10-16  Darin Adler  <darin@apple.com>
1882
1883         Reviewed by Geoff.
1884
1885         - merged PCRE changes between 6.4 and 6.5
1886
1887         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1888         * JavaScriptCore.xcodeproj/project.pbxproj:
1889         Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
1890         pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
1891         pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
1892
1893         * pcre/AUTHORS:
1894         * pcre/LICENCE:
1895         * pcre/MERGING:
1896         * pcre/dftables.c:
1897         * pcre/pcre-config.h:
1898         * pcre/pcre.h:
1899         * pcre/pcre.pri:
1900         * pcre/pcre_compile.c:
1901         * pcre/pcre_exec.c:
1902         * pcre/pcre_fullinfo.c:
1903         * pcre/pcre_get.c:
1904         * pcre/pcre_internal.h:
1905         * pcre/pcre_maketables.c:
1906         * pcre/pcre_ord2utf8.c:
1907         * pcre/pcre_tables.c:
1908         * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
1909         * pcre/pcre_xclass.c:
1910         * pcre/ucp.h:
1911         * pcre/ucpinternal.h:
1912         * pcre/ucptable.c:
1913         Updated with new versions from the PCRE 6.5 release, merged with changes.
1914
1915         * pcre/pcre_config.c: Removed.
1916         * pcre/pcre_globals.c: Removed.
1917         * pcre/pcre_info.c: Removed.
1918         * pcre/pcre_printint.src: Removed.
1919         * pcre/pcre_refcount.c: Removed.
1920         * pcre/pcre_study.c: Removed.
1921         * pcre/pcre_try_flipped.c: Removed.
1922         * pcre/pcre_ucp_findchar.c: Removed.
1923         * pcre/pcre_version.c: Removed.
1924
1925 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1926
1927         Reviewed by Darin Adler.
1928
1929         Removed KJS_VERBOSE because it was getting in the way of readability, 
1930         and the messages didn't seem very helpful.
1931
1932         * kjs/function.cpp:
1933         (KJS::FunctionImp::callAsFunction):
1934         (KJS::FunctionImp::passInParameters):
1935         * kjs/lookup.h:
1936         (KJS::lookupPut):
1937         * kjs/object.cpp:
1938         (KJS::JSObject::put):
1939         * kjs/value.h:
1940
1941 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1942
1943         Reviewed by Darin Adler.
1944         
1945         Removed the Parameter class because it was a redundant wrapper around 
1946         Identifier.
1947
1948         * kjs/function.cpp:
1949         (KJS::FunctionImp::passInParameters):
1950         (KJS::FunctionImp::getParameterName):
1951         * kjs/nodes.cpp:
1952         (FunctionBodyNode::addParam):
1953         * kjs/nodes.h:
1954         (KJS::FunctionBodyNode::):
1955
1956 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1957
1958         Reviewed by Darin Adler.
1959         
1960         Global replace of assert with ASSERT.
1961
1962 2007-10-16  Adam Roben  <aroben@apple.com>
1963
1964         Make testkjs not delay-load WebKit
1965
1966         Soon, delay-loading WebKit will be impossible (because we will be
1967         using __declspec(thread) for thread-local storage). This change
1968         prepares testkjs for the future.
1969
1970         Reviewed by Sam.
1971
1972         * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
1973         added FindSafari.
1974         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
1975         WebKitInitializer, don't delay-load WebKit.
1976         * kjs/testkjs.cpp: Don't use WebKitInitializer.
1977
1978 2007-10-16  Adam Roben  <aroben@apple.com>
1979
1980         Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
1981
1982         Reviewed by Kevin McCullough.
1983
1984         * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
1985         * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
1986         * JavaScriptCore.vcproj/release.vsprops: Ditto.
1987         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
1988         WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
1989         in the name of icuuc36[_debug].dll.
1990
1991 2007-10-16  Geoffrey Garen  <ggaren@apple.com>
1992
1993         Reviewed by Maciej Stachowiak.
1994         
1995         Re-structured variable and function declaration code.
1996         
1997         Command-line JS iBench shows no regression.
1998         
1999         Here are the changes:
2000
2001         1. Function declarations are now processed at the same time as var 
2002         declarations -- namely, immediately upon entry to an execution context. 
2003         This does not match Firefox, which waits to process a function
2004         declaration until the declaration's containing block executes, but it 
2005         does match IE and the ECMA spec. (10.1.3 states that var and function 
2006         declarations should be processed at the same time -- namely, "On 
2007         entering an execution context." 12.2 states that "A Block does not 
2008         define a new execution scope.")
2009
2010         2. Declaration processing proceeds iteratively now, rather than 
2011         recursively, storing the nodes is finds in stacks. This will later 
2012         facilitate an optimization to hold on to the gathered declaration nodes, 
2013         rather than re-fetching them in every function call. 
2014         [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
2015
2016         Modified these tests because they expected the incorrect Mozilla 
2017         behavior described above:
2018
2019         * tests/mozilla/ecma_3/Function/scope-001.js:
2020         * tests/mozilla/js1_5/Scope/regress-184107.js:
2021
2022 2007-10-16  Darin Adler  <darin@apple.com>
2023
2024         - try to fix the GTK build
2025
2026         * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
2027
2028 2007-10-16  Darin Adler  <darin@apple.com>
2029
2030         - try to fix the Windows build
2031
2032         * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
2033         in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
2034
2035 2007-10-16  Darin Adler  <darin@apple.com>
2036
2037         - try to fix the GTK build
2038
2039         * kjs/ustring.cpp: Include ASCIICType.h.
2040
2041 2007-10-16  Darin Adler  <darin@apple.com>
2042
2043         Reviewed by Maciej and Geoff (and looked over by Eric).
2044
2045         - http://bugs.webkit.org/show_bug.cgi?id=15519
2046           eliminate use of <ctype.h> for processing ASCII
2047
2048         * wtf/ASCIICType.h: Added.
2049         * wtf/DisallowCType.h: Added.
2050
2051         * kjs/config.h: Include DisallowCType.h.
2052
2053         * kjs/date_object.cpp:
2054         (KJS::skipSpacesAndComments):
2055         (KJS::findMonth):
2056         (KJS::parseDate):
2057         * kjs/function.cpp:
2058         (KJS::decode):
2059         * kjs/ustring.cpp:
2060         (KJS::UString::toDouble):
2061         Use ASCIICType.h functions instead of ctype.h ones.
2062
2063 2007-10-14  Maciej Stachowiak  <mjs@apple.com>
2064
2065         Reviewed by Darin.
2066
2067         - fixes for "New JavaScript benchmark"
2068         http://bugs.webkit.org/show_bug.cgi?id=15515
2069         
2070         * kjs/testkjs.cpp:
2071         (TestFunctionImp::callAsFunction): Implement "load" for compatibility
2072         with SpiderMonkey.
2073         (TestFunctionImp::): ditto
2074         (doIt): ditto
2075         (kjsmain): Drop useless --> from output.
2076
2077 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2078
2079         Removed unnecessary #include.
2080
2081         * API/JSObjectRef.cpp:
2082
2083 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2084
2085         Double-reverse build fix. My tree was out of date.
2086
2087         * kjs/nodes.cpp:
2088         (NumberNode::evaluate):
2089
2090 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2091
2092         Build fix.
2093
2094         * kjs/nodes.cpp:
2095         (NumberNode::evaluate):
2096
2097 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2098
2099         Reviewed by Darin Adler.
2100         
2101         Removed surprising self-named "hack" that made nested functions 
2102         available as named properties of their containing functions, and placed
2103         containing function objects in the scope chains of nested functions.
2104         
2105         There were a few reasons to remove this "hack:"
2106
2107         1. It contradicted FF, IE, and the ECMA spec.
2108
2109         2. It incurred a performance penalty, since merely parsing a function 
2110         required parsing its body for nested functions (and so on).
2111
2112         3. SVN history contains no explanation for why it was added. It was just
2113         legacy code in a large merge a long, long time ago.
2114
2115         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
2116
2117         * kjs/nodes.cpp:
2118         (FuncDeclNode::processFuncDecl):
2119
2120 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2121
2122         Reviewed by Darin Adler.
2123         
2124         Removed the concept of AnonymousCode. It was unused, and it doesn't
2125         exist in the ECMA spec.
2126         
2127         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
2128
2129         * kjs/Context.cpp:
2130         (KJS::Context::Context):
2131         * kjs/function.h:
2132         (KJS::):
2133         * kjs/nodes.cpp:
2134         (ReturnNode::execute):
2135
2136 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2137
2138         Reviewed by Darin Adler.
2139         
2140         Made function parameters DontDelete. This matches FF and the vague
2141         description in ECMA 10.1.3. It's also required in order to make
2142         symbol table based lookup of function parameters valid. (If the 
2143         parameters aren't DontDelete, you can't guarantee that you'll find
2144         them later in the symbol table.)
2145
2146         [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
2147
2148         * kjs/function.cpp:
2149         (KJS::FunctionImp::passInParameters):
2150
2151 2007-10-15  Geoffrey Garen  <ggaren@apple.com>
2152
2153         Reviewed by Maciej Stachowiak.
2154         
2155         Some Vector optimizations. These are especially important when using
2156         Vector as a stack for implementing recursive algorithms iteratively.
2157         
2158         [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
2159
2160         1. Added shrink(), which is a version of resize() that you can call
2161         to save a branch / improve code generation and inlining when you know 
2162         that the vector is not getting bigger.
2163         
2164         2. Changed subclassing relationship in VectorBuffer to remove a call to
2165         fastFree() in the destructor for the inlineCapacity != 0 template
2166         specialization. This brings inline Vectors one step closer to true
2167         stack-allocated arrays.
2168         
2169         Also changed abort() to CRASH(), since the latter works better.
2170
2171         * wtf/Vector.h:
2172         (WTF::VectorBufferBase::allocateBuffer):
2173         (WTF::VectorBufferBase::deallocateBuffer):
2174         (WTF::VectorBufferBase::VectorBufferBase):
2175         (WTF::VectorBufferBase::~VectorBufferBase):
2176         (WTF::):
2177         (WTF::VectorBuffer::VectorBuffer):
2178         (WTF::VectorBuffer::~VectorBuffer):
2179         (WTF::VectorBuffer::deallocateBuffer):
2180         (WTF::VectorBuffer::releaseBuffer):
2181         (WTF::Vector::clear):
2182         (WTF::Vector::removeLast):
2183         (WTF::::operator):
2184         (WTF::::fill):
2185         (WTF::::shrink):
2186
2187 2007-10-12  Geoffrey Garen  <ggaren@apple.com>
2188
2189         Reviewed by Maciej Stachowiak.
2190         
2191         Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
2192         Iteration statements sometimes incorrectly evaluate to the empty value 
2193         (KDE r670547). 
2194         
2195         [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
2196         
2197         This patch is a merge of KDE r670547, with substantial modification 
2198         for performance.
2199         
2200         It fixes do-while statements to evaluate to a value. (They used
2201         to evaluate to the empty value in all cases.) 
2202
2203         It also fixes SourceElementsNode to maintain the value of abnormal 
2204         completions like "break" and "continue."
2205         
2206         It also re-works the main execution loop in SourceElementsNode so that
2207         it (1) makes a little more sense and (2) avoids unnecessary work. This 
2208         is a .28% speedup on command-line JS iBench.
2209
2210         * kjs/nodes.cpp:
2211         (DoWhileNode::execute):
2212         (SourceElementsNode::execute):
2213
2214 2007-10-15  Simon Hausmann  <hausmann@kde.org>
2215
2216         Reviewed by Lars.
2217
2218         Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
2219
2220         * wtf/HashTraits.h:
2221
2222 2007-10-5  Kevin Ollivier  <kevino@theolliviers.com>
2223  
2224         Reviewed by Adam.
2225         
2226         Add support for MSVC7, and fix cases where PLATFORM(WIN) should
2227         be PLATFORM(WIN_OS) for other ports building on Windows.
2228  
2229         * kjs/DateMath.cpp:
2230         (KJS::getDSTOffsetSimple):
2231         * kjs/JSImmediate.h:
2232         * wtf/Assertions.cpp:
2233         * wtf/Assertions.h:
2234         * wtf/Platform.h:
2235         * wtf/StringExtras.h:
2236         (snprintf):
2237         (vsnprintf):
2238
2239 2007-10-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2240
2241         Reviewed by Darin.
2242
2243         Adds NegateNode optimization from KJS. The relevant revision in KDE
2244         is 666736.
2245
2246         * kjs/grammar.y:
2247         * kjs/nodes.cpp:
2248         (NumberNode::evaluate):
2249         * kjs/nodes.h:
2250         (KJS::Node::):
2251         (KJS::NumberNode::):
2252         * kjs/nodes2string.cpp:
2253         (NumberNode::streamTo):
2254
2255 2007-10-14  Jason Foreman  <jason@threeve.org>
2256
2257         Reviewed by Maciej.
2258
2259         Fix http://bugs.webkit.org/show_bug.cgi?id=15145
2260         
2261         Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
2262         that the property n < intPow10(p) is maintained.
2263
2264         * kjs/number_object.cpp:
2265         (NumberProtoFunc::callAsFunction):
2266
2267 == Rolled over to ChangeLog-2007-10-14 ==