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