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