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