Reviewed by Darin.
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2007-11-27  Anders Carlsson  <andersca@apple.com>
2
3         Reviewed by Darin.
4
5         Add a ValueType typedef.
6         
7         * wtf/Vector.h:
8
9 2007-11-26  Darin Adler  <darin@apple.com>
10
11         Reviewed by Mitz.
12
13         - fix http://bugs.webkit.org/show_bug.cgi?id=16096
14           REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
15
16         Test: fast/js/regexp-overflow.html
17
18         * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
19         Removed a stray "ptr++" that I added by accident when merging the
20         changes between PCRE 6.4 and 6.5. 
21
22 2007-11-26  Geoffrey Garen  <ggaren@apple.com>
23
24         Reviewed by Kevin McCullough.
25         
26         Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not 
27         show variables (can't enumerate ActivationImp properties)
28         
29         Implemented a custom ActivationImp::getPropertyNames, since 
30         ActivationImp now uses a custom property storage mechanism for local
31         variables.
32
33         * kjs/function.cpp:
34         (KJS::ActivationImp::getPropertyNames):
35         * kjs/function.h:
36
37 2007-11-26  Alp Toker  <alp@atoker.com>
38
39         GTK+/Qt/Wx build fix for breakage introduced in r28039.
40
41         * ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
42
43 2007-11-24  Laszlo Gombos  <laszlo.gombos@gmail.com>
44
45         Reviewed by Maciej Stachowiak.
46
47         Fix minor compiler warning (GCC 4.1.3)
48
49         * pcre/pcre_internal.h:
50         * pcre/pcre_ucp_searchfuncs.cpp:
51         (_pcre_ucp_othercase):
52
53 2007-11-25  Mark Rowe  <mrowe@apple.com>
54
55         Reviewed by Dan Bernstein.
56
57         Fix http://bugs.webkit.org/show_bug.cgi?id=16129
58         Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
59
60         * pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
61         to our caller like they expect.
62
63 2007-11-23  Kevin Ollivier  <kevino@theolliviers.com>
64
65         MSVC7 build fix. (rand_s doesn't exist there)
66
67         Reviewed by Adam Roben.
68
69         * kjs/config.h:
70         * wtf/MathExtras.h:
71
72 2007-11-23  Kevin Ollivier  <kevino@theolliviers.com>
73
74         wx build fix. Move WX_PYTHON logic into project build settings,
75         add WebKitLibraries dirs on Win, and explicitly include JSCore 
76         headers in testkjs rather than getting them from a template.
77         (Include dir order of JSCore/WTF and ICU headers is important due  
78         to wtf/unicode/utf8.h.)
79
80         * jscore.bkl:
81
82 2007-11-23  Simon Hausmann  <hausmann@webkit.org>
83
84         Reviewed by George Staikos <staikos@kde.org>.
85
86         Fix make (dist)clean on Windows.
87         
88         OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
89         
90
91         * JavaScriptCore.pri:
92         * pcre/pcre.pri:
93
94 2007-11-22  Simon Hausmann  <hausmann@kde.org>
95
96         Reviewed by George.
97
98         Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
99
100         * JavaScriptCore.pri:
101         * pcre/pcre.pri:
102
103 2007-11-22  Simon Hausmann  <hausmann@kde.org>
104
105         Reviewed by George.
106
107         Centralize the setup for all the extra compilers in a addExtraCompiler function.
108         
109         This allows adding a "generated_files" target that builds all generated files using "make generated_files".
110         For the build inside Qt we do not generate actual rules for the extra compilers but instead
111         do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
112
113         * JavaScriptCore.pri:
114         * pcre/pcre.pri:
115
116 2007-11-20  Mark Rowe  <mrowe@apple.com>
117
118         Reviewed by Tim Hatcher.
119
120         <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
121
122         Fix all warnings emitted by GCC 4.2 when building JavaScriptCore.  This allows builds with
123         -Werror to succeed.  At present they will crash when executed due to code that is not safe
124         under strict aliasing (<rdar://problem/5536806>).
125
126         * Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
127         * kjs/date_object.cpp:
128         (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
129         * kjs/dtoa.cpp:
130         (Bigint::): Tweak formatting to silence warnings.
131         * pcre/pcre_exec.cpp:
132         (match): Tweak formatting to silence warnings
133         * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
134         * wtf/Assertions.h: Ditto.
135
136 2007-11-19  Kevin Ollivier  <kevino@theolliviers.com>
137
138         wx port build fix (wx headers include ctype functions).
139
140         * kjs/config.h:
141
142 2007-11-19  Kevin Ollivier  <kevino@theolliviers.com>
143
144         Remove outdated and unused Windows port files.
145
146         Reviewed by Adam Roben.
147
148         * Makefile.vc: Removed.
149         * README-Win32.txt: Removed.
150
151 2007-11-18  Eric Seidel  <eric@webkit.org>
152
153         Reviewed by Oliver.
154
155         * tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
156
157 2007-11-17  Mark Rowe  <mrowe@apple.com>
158
159         Reviewed by Darin Adler.
160
161         Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
162              <rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
163              http://bugs.webkit.org/show_bug.cgi?id=16033
164
165         Split Interpreter's initialization into two distinct steps:  the creation of the global prototypes
166         and constructors, and storing them on the global object.  This allows JSClassRef's passed to
167         JSGlobalContextCreate to be instantiated with the correct prototype.
168
169         * API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
170         * API/JSCallbackObject.h:
171         * API/JSCallbackObjectFunctions.h:
172         (KJS::::JSCallbackObject):
173         (KJS::::init):
174         * API/JSContextRef.cpp:
175         (JSGlobalContextCreate): Construct and set the interpreter's global object separately.  When globalObjectClass
176         is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
177         prevent any JSObjectInitializeCallback's being invoked before a global object is set.
178         * API/testapi.c:
179         (globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
180         (globalObject_get):
181         (globalObject_set):
182         (main):
183         * API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
184         * JavaScriptCore.exp:
185         * bindings/testbindings.cpp:
186         (main): Update for changes in Interpreter method signatures.
187         * bindings/testbindings.mm:
188         (main): Ditto.
189         * kjs/ExecState.cpp:
190         (KJS::ExecState::ExecState):
191         (KJS::ExecState::mark):
192         (KJS::ExecState::setGlobalObject):
193         * kjs/ExecState.h: Rename scope to m_scopeChain.
194         * kjs/interpreter.cpp:
195         (KJS::Interpreter::Interpreter):
196         (KJS::Interpreter::init):
197         (KJS::Interpreter::globalObject):
198         (KJS::Interpreter::setGlobalObject):
199         (KJS::Interpreter::resetGlobalObjectProperties):
200         (KJS::Interpreter::createObjectsForGlobalObjectProperties):
201         (KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
202         cannot interfere with setting of the global properties.  This prevents a user-written JSClassRef from attempting to
203         call back into JavaScript from the initialization of the global object's members.
204         * kjs/interpreter.h:
205         * kjs/testkjs.cpp:
206         (setupInterpreter): Update for changes in Interpreter method signatures.
207
208 2007-11-17  Mark Rowe  <mrowe@apple.com>
209
210         Reviewed by Sam Weinig.
211
212         Prevent testapi from reporting false leaks.  Clear out local variables pointing at
213         JSObjectRefs to allow their values to be collected.
214
215         * API/testapi.c:
216         (main):
217
218 2007-11-17  Mark Rowe  <mrowe@apple.com>
219
220         Reviewed by Sam Weinig.
221
222         Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
223
224         * API/testapi.c:
225         (main):
226
227 2007-11-17  Alp Toker  <alp@atoker.com>
228
229         Reviewed by Eric.
230
231         http://bugs.webkit.org/show_bug.cgi?id=16032
232         JS minidom is not portable
233
234         Use a plain UTF-8 string instead of a CFString.
235
236         Print to stdout, not stderr like CFShow() would have done, since that
237         behaviour seems unintentional.
238
239         * API/minidom.c:
240         (main):
241
242 2007-11-17  Steve Falkenburg  <sfalken@apple.com>
243
244         Windows build fix.
245
246         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
247
248 2007-11-16  Mark Rowe  <mrowe@apple.com>
249
250         Windows build fix.
251
252         * kjs/lexer.cpp:
253         (KJS::Lexer::record8):
254
255 2007-11-16  Mark Rowe  <mrowe@apple.com>
256
257         Reviewed by Eric.
258
259         Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
260         SunSpider claims this is a 0.7% speedup.
261
262         * kjs/lexer.cpp:
263         (KJS::Lexer::Lexer):
264         (KJS::Lexer::lex):
265         (KJS::Lexer::record8):
266         (KJS::Lexer::record16):
267         (KJS::Lexer::scanRegExp):
268         (KJS::Lexer::clear):
269         (KJS::Lexer::makeIdentifier):
270         (KJS::Lexer::makeUString):
271         * kjs/lexer.h:
272         * kjs/ustring.cpp:
273         (KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
274         * kjs/ustring.h:
275
276 2007-11-16  Adam Roben  <aroben@apple.com>
277
278         Windows build fix
279
280         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
281         and ignore the int -> bool conversion warning.
282
283 2007-11-16  Alexey Proskuryakov  <ap@webkit.org>
284
285         Fix Windows debug build.
286         Rubber-stamped by Eric
287
288         * pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
289         complain about unreachable code.
290
291 2007-11-15  Mark Rowe  <mrowe@apple.com>
292
293         Gtk build fix.
294
295         * kjs/Parser.cpp:
296
297 2007-11-15  Mark Rowe  <mrowe@apple.com>
298
299         Mac build and header search path sanity fix.
300
301         Reviewed by Sam Weinig and Tim Hatcher.
302
303         Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
304         it in JavaScriptCore.xcconfig.  This removes the need to override it on a
305         per-target basis inside the .xcodeproj file.
306
307         * Configurations/Base.xcconfig:
308         * Configurations/JavaScriptCore.xcconfig:
309         * JavaScriptCore.xcodeproj/project.pbxproj:
310
311 2007-11-15  Mark Rowe  <mrowe@apple.com>
312
313         Qt build fix.
314
315         * kjs/Parser.h:
316
317 2007-11-15  Geoffrey Garen  <ggaren@apple.com>
318
319         Reviewed by Eric Seidel.
320
321         Another round of grammar / parsing cleanup.
322         
323         1. Created distinct parser calls for parsing function bodies vs
324         programs. This will help later with optimizing global variable access.
325         
326         2. Turned Parser into a singleton. Cleaned up Lexer's singleton 
327         interface.
328         
329         3. Modified Lexer to free a little more memory when done lexing. (Added
330         FIXMEs for similar issues that I didn't fix.)
331         
332         4. Changed Lexer::makeIdentifier and Lexer::makeUString to start 
333         respecting the arguments passed to them. (No behavior change, but this
334         problem could have caused serious problems for an unsuspecting user of
335         these functions.)
336         
337         5. Removed KJS_DEBUG_MEM because it was bit-rotted.
338         
339         6. Removed Parser::prettyPrint because the same work was simpler to do
340         at the call site.
341         
342         7. Some renames:
343         
344             "Parser::accept" => "Parser::didFinishParsing"
345             "Parser::sid" => "Parser::m_sourceID"
346             "Lexer::doneParsing" => "Lexer::clear"
347             "sid" => "sourceId"
348             "lineno" => "lineNo"
349         
350         * JavaScriptCore.exp:
351         * kjs/Parser.cpp:
352         (KJS::Parser::Parser):
353         (KJS::Parser::parseProgram):
354         (KJS::Parser::parseFunctionBody):
355         (KJS::Parser::parse):
356         (KJS::Parser::didFinishParsing):
357         (KJS::parser):
358         * kjs/Parser.h:
359         (KJS::Parser::sourceId):
360         * kjs/function.cpp:
361         (KJS::GlobalFuncImp::callAsFunction):
362         * kjs/function_object.cpp:
363         (FunctionObjectImp::construct):
364         * kjs/grammar.y:
365         * kjs/interpreter.cpp:
366         (KJS::Interpreter::checkSyntax):
367         (KJS::Interpreter::evaluate):
368         * kjs/interpreter.h:
369         * kjs/lexer.cpp:
370         (kjsyylex):
371         (KJS::lexer):
372         (KJS::Lexer::Lexer):
373         (KJS::Lexer::~Lexer):
374         (KJS::Lexer::scanRegExp):
375         (KJS::Lexer::doneParsing):
376         (KJS::Lexer::makeIdentifier):
377         (KJS::Lexer::makeUString):
378         * kjs/lexer.h:
379         (KJS::Lexer::pattern):
380         (KJS::Lexer::flags):
381         (KJS::Lexer::sawError):
382         * kjs/nodes.cpp:
383         (KJS::Node::Node):
384         (KJS::FunctionBodyNode::FunctionBodyNode):
385         * kjs/nodes.h:
386         * kjs/testkjs.cpp:
387         (prettyPrintScript):
388         (kjsmain):
389         * kjs/ustring.cpp:
390         * kjs/ustring.h:
391
392 2007-11-15  Oliver Hunt  <oliver@apple.com>
393
394         Reviewed by Darin.
395
396         <rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
397         
398         Add a stub node to maintain the Vector of SourceElements until assignment.
399
400         * kjs/grammar.y:
401         * kjs/nodes.h:
402         (KJS::SourceElementsStub::SourceElementsStub):
403         (KJS::SourceElementsStub::append):
404         (KJS::SourceElementsStub::release):
405         (KJS::SourceElementsStub::):
406         (KJS::SourceElementsStub::precedence):
407
408 2007-11-15  Eric Seidel  <eric@webkit.org>
409
410         Reviewed by Sam.
411
412         Abstract most of RMATCH into MatchStack functions.
413         
414         SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
415
416         * pcre/pcre_exec.cpp:
417         (MatchStack::canUseStackBufferForNextFrame):
418         (MatchStack::allocateNextFrame):
419         (MatchStack::pushNewFrame):
420         (MatchStack::frameIsStackAllocated):
421         (MatchStack::popCurrentFrame):
422         (MatchStack::unrollAnyHeapAllocatedFrames):
423         (match):
424
425 2007-11-15  Eric Seidel  <eric@webkit.org>
426
427         Reviewed by Sam.
428
429         Remove RETURN_ERROR, add MatchStack
430         
431         * pcre/pcre_exec.cpp:
432         (MatchStack::MatchStack):
433         (MatchStack::unrollAnyHeapAllocatedFrames):
434         (matchError):
435         (match):
436         
437 2007-11-15  Eric Seidel  <eric@webkit.org>
438
439         Reviewed by Sam.
440
441         Clean up match function to match WebKit style
442
443         * JavaScriptCore.xcodeproj/project.pbxproj:
444         * pcre/pcre_exec.cpp:
445         (match):
446
447 2007-11-15  Steve Falkenburg  <sfalken@apple.com>
448
449         Windows build fix.
450
451         * JavaScriptCore.vcproj/JavaScriptCore.make:
452
453 2007-11-14  Alexey Proskuryakov  <ap@webkit.org>
454
455         Reviewed by Darin.
456
457         http://bugs.webkit.org/show_bug.cgi?id=15982
458         Improve JSString UTF-8 decoding
459
460         * API/JSStringRef.cpp:
461         (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
462
463         * wtf/unicode/UTF8.cpp:
464         (WTF::Unicode::convertUTF16ToUTF8):
465         (WTF::Unicode::convertUTF8ToUTF16):
466         * wtf/unicode/UTF8.h:
467         Made these function names start with a lower case letter.
468
469         * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
470
471         * bindings/c/c_utility.cpp:
472         (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
473         from convertUTF8ToUTF16 in wtf/unicode.
474         (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
475         (KJS::Bindings::identifierFromNPIdentifier): Ditto.
476         * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
477
478 2007-11-14  Sam Weinig  <sam@webkit.org>
479
480         Rubber-stamped by Anders.
481
482         Fix the Xcode project file after it was messed up in r27402.
483
484         * JavaScriptCore.xcodeproj/project.pbxproj:
485
486 2007-11-14  Eric Seidel  <eric@webkit.org>
487
488         Reviewed by Oliver.
489         
490         More PCRE style cleanup.
491
492         * pcre/pcre_compile.cpp:
493         (compile_regex):
494
495 2007-11-14  Adam Roben  <aroben@apple.com>
496
497         Clean up the bison conflict checking script
498
499         Reviewed by Geoff.
500
501         * DerivedSources.make:
502
503 2007-11-14  Eric Seidel  <eric@webkit.org>
504
505         Reviewed by Geoff.
506
507         Another round of PCRE cleanups: inlines
508         
509         SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
510
511         * pcre/pcre_compile.cpp:
512         (jsRegExpCompile):
513         * pcre/pcre_exec.cpp:
514         (match):
515         (jsRegExpExecute):
516         * pcre/pcre_internal.h:
517         (PUT):
518         (GET):
519         (PUT2):
520         (GET2):
521         (isNewline):
522
523 2007-11-14  Eric Seidel  <eric@webkit.org>
524
525         Reviewed by Sam.
526         
527         Give PCRE a (small) bath.
528         Fix some formating and break things off into separate functions
529         http://bugs.webkit.org/show_bug.cgi?id=15993
530
531         * pcre/pcre_compile.cpp:
532         (calculateCompiledPatternLengthAndFlags):
533         (printCompiledRegExp):
534         (returnError):
535         (jsRegExpCompile):
536         * pcre/pcre_internal.h:
537         (compile_data::compile_data):
538
539 2007-11-14  Geoffrey Garen  <ggaren@apple.com>
540
541         Reviewed by Eric Seidel.
542         
543         Cleaned up the JavaScript grammar a bit.
544         
545         1. Changed BlockNode to always hold a child vector (which may be empty),
546         eliminating a few NULL-check branches in the common execution case.
547         
548         2. Changed the Block production to correctly report its starting and 
549         ending line numbers to the debugger. (It used to report its ending line
550         as its starting line.) Also, removed duplicate line-reporting code
551         inside the BlockNode constructor.
552         
553         3. Moved curly braces up from FunctionBody production into parent
554         productions. (I had to move the line number reporting code, too, since
555         it depends on the location of the curly braces.) This matches the ECMA
556         spec more closely, and makes some future changes I plan easier.
557         
558         4. Fixed statementList* convenience functions to deal appropriately with
559         empty Vectors.
560
561         SunSpider reports a small and statistically insignificant speedup.
562
563         * kjs/grammar.y:
564         * kjs/nodes.cpp:
565         (KJS::statementListPushFIFO):
566         (KJS::statementListGetDeclarations):
567         (KJS::statementListInitializeDeclarationStack):
568         (KJS::statementListInitializeVariableAccessStack):
569         (KJS::BlockNode::BlockNode):
570         (KJS::BlockNode::optimizeVariableAccess):
571         (KJS::BlockNode::getDeclarations):
572         (KJS::BlockNode::execute):
573         (KJS::FunctionBodyNode::initializeDeclarationStacks):
574         (KJS::FunctionBodyNode::optimizeVariableAccess):
575
576 2007-11-13  Anders Carlsson  <andersca@apple.com>
577
578         Add RefCounted.h (And remove Shared.h)
579         
580         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
581
582 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
583
584         Build fix.
585
586         * kjs/regexp.h:
587
588 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
589
590         Reviewed by Anders Carlsson.
591
592         Renamed Shared to RefCounted.
593
594         * API/JSClassRef.h:
595         * JavaScriptCore.xcodeproj/project.pbxproj:
596         * kjs/interpreter.h:
597         * kjs/regexp.h:
598         * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
599         (WTF::RefCounted::RefCounted):
600         * wtf/Shared.h: Removed.
601
602 2007-11-13  Adam Roben  <aroben@apple.com>
603
604         Build fix
605
606         Reviewed by Geoff.
607
608         * kjs/regexp.h: Added a missing #include.
609
610 2007-11-13  Geoffrey Garen  <ggaren@apple.com>
611
612         Reviewed by Sam Weinig.
613
614         Moved Shared.h into wtf so it could be used in more places. Deployed
615         Shared in places where JSCore previously had hand-rolled ref-counting
616         classes.
617
618         * API/JSClassRef.cpp:
619         (OpaqueJSClass::OpaqueJSClass):
620         * API/JSClassRef.h:
621         * API/JSObjectRef.cpp:
622         (JSClassRetain):
623         (JSClassRelease):
624         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
625         * JavaScriptCore.xcodeproj/project.pbxproj:
626         * kjs/interpreter.cpp:
627         (KJS::Interpreter::init):
628         * kjs/interpreter.h:
629         * kjs/regexp.cpp:
630         (KJS::RegExp::RegExp):
631         * kjs/regexp.h:
632         * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
633
634 2007-11-13  Eric Seidel  <eric@webkit.org>
635
636         Reviewed by Maciej.
637
638         Add an ASSERT to getTruncatedInt32 to enforce proper usage.
639         Best part about this patch?  It doesn't break the web!
640
641         * kjs/JSImmediate.h:
642         (KJS::JSImmediate::getTruncatedInt32):
643         (KJS::JSImmediate::toDouble):
644         (KJS::JSImmediate::getUInt32):
645
646 2007-11-13  Alexey Proskuryakov  <ap@webkit.org>
647
648         Windows build fix.
649
650         * bindings/c/c_utility.cpp:
651         (KJS::Bindings::convertUTF8ToUTF16):
652         * kjs/ustring.cpp:
653         (KJS::UString::UTF8String):
654         * wtf/unicode/UTF8.cpp:
655         (WTF::Unicode::ConvertUTF8ToUTF16):
656
657 2007-11-13  Darin Adler  <darin@apple.com>
658
659         Reviewed by Geoff.
660
661         - fix http://bugs.webkit.org/show_bug.cgi?id=11231
662           RegExp bug when handling newline characters
663           and a number of other differences between PCRE behvior
664           and JavaScript regular expressions:
665
666           + single-digit sequences like \4 should be treated as octal
667             character constants, unless there is a sufficient number
668             of brackets for them to be treated as backreferences
669
670           + \8 turns into the character "8", not a binary zero character
671             followed by "8" (same for 9)
672
673           + only the first 3 digits should be considered part of an
674             octal character constant (the old behavior was to decode
675             an arbitrarily long sequence and then mask with 0xFF)
676
677           + if \x is followed by anything other than two valid hex digits,
678             then it should simply be treated a the letter "x"; that includes
679             not supporting the \x{41} syntax
680
681           + if \u is followed by anything less than four valid hex digits,
682             then it should simply be treated a the letter "u"
683
684           + an extra "+" should be a syntax error, rather than being treated
685             as the "possessive quantifier"
686
687           + if a "]" character appears immediately after a "[" character that
688             starts a character class, then that's an empty character class,
689             rather than being the start of a character class that includes a
690             "]" character
691
692           + a "$" should not match a terminating newline; we could have gotten
693             PCRE to handle this the way we wanted by passing an appropriate option
694
695         Test: fast/js/regexp-no-extensions.html
696
697         * pcre/pcre_compile.cpp:
698         (check_escape): Check backreferences against bracount to catch both
699         overflows and things that should be treated as octal. Rewrite octal
700         loop to not go on indefinitely. Rewrite both hex loops to match and
701         remove \x{} support.
702         (compile_branch): Restructure loops so that we don't special-case a "]"
703         at the beginning of a character class. Remove code that treated "+" as
704         the possessive quantifier.
705         (jsRegExpCompile): Change the "]" handling here too.
706
707         * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
708         Changed DOLL to remove handling of "terminating newline", a Perl concept
709         which we don't need.
710
711         * tests/mozilla/expected.html: Two tests are fixed now:
712         ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
713         One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
714         was due to a bug (we treated all 1-character numeric escapes as backreferences).
715         The date tests also now both expect success -- whatever was making them fail
716         before was probably due to the time being close to a DST shift; maybe we need
717         to get rid of those tests.
718
719 2007-11-13  Darin Adler  <darin@apple.com>
720
721         * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
722         Remove too-strong assert that was firing constantly and preventing even basic
723         web browsing from working in a debug build. This function is used in many
724         cases where the immediate value is not a number; the assertion could perhaps
725         be added back later with a bit of reorganization.
726
727 2007-11-13  Alp Toker  <alp@atoker.com>
728
729         Build fix for breakage to non-Mac builds introduced in r27746.
730
731         * kjs/ustring.cpp:
732
733 2007-11-13  Eric Seidel  <eric@webkit.org>
734
735         Reviewed by Maciej.
736
737         Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
738
739         * kjs/JSImmediate.h:
740         * kjs/nodes.cpp:
741         (KJS::GreaterNode::inlineEvaluateToBoolean):
742         (KJS::GreaterNode::evaluate):
743         (KJS::LessEqNode::inlineEvaluateToBoolean):
744         (KJS::LessEqNode::evaluate):
745         (KJS::GreaterEqNode::inlineEvaluateToBoolean):
746         (KJS::GreaterEqNode::evaluate):
747         (KJS::InNode::evaluateToBoolean):
748         (KJS::EqualNode::inlineEvaluateToBoolean):
749         (KJS::EqualNode::evaluate):
750         (KJS::NotEqualNode::inlineEvaluateToBoolean):
751         (KJS::NotEqualNode::evaluate):
752         (KJS::StrictEqualNode::inlineEvaluateToBoolean):
753         (KJS::StrictEqualNode::evaluate):
754         (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
755         (KJS::NotStrictEqualNode::evaluate):
756         * kjs/nodes.h:
757
758 2007-11-12  Geoffrey Garen  <ggaren@apple.com>
759
760         Reviewed by Sam Weinig.
761         
762         Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
763         base64 spends 1.1% of total time checking for special Infinity case
764         
765         Use a fast character test instead of calling strncmp.
766         
767         1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
768         Sharks reports only .1%. Who are you going to believe? Huh?
769
770         * kjs/ustring.cpp:
771         (KJS::UString::toDouble):
772
773 2007-11-12  Eric Seidel  <eric@webkit.org>
774
775         Reviewed by Oliver.
776
777         Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
778         Fix a few missing evaluateToBoolean methods
779         Deploy all evaluateTo* functions to more nodes to avoid slowdowns
780         http://bugs.webkit.org/show_bug.cgi?id=15950
781         
782         SunSpider claims this is at least a 1.4% speedup.
783
784         * kjs/JSImmediate.h:
785         (KJS::JSImmediate::getTruncatedInt32):
786         (KJS::JSImmediate::toDouble):
787         (KJS::JSImmediate::getUInt32):
788         * kjs/nodes.cpp:
789         (KJS::ExpressionNode::evaluateToNumber):
790         (KJS::ExpressionNode::evaluateToInt32):
791         (KJS::ExpressionNode::evaluateToUInt32):
792         (KJS::NumberNode::evaluateToInt32):
793         (KJS::NumberNode::evaluateToUInt32):
794         (KJS::ImmediateNumberNode::evaluateToInt32):
795         (KJS::ImmediateNumberNode::evaluateToUInt32):
796         (KJS::ResolveNode::evaluate):
797         (KJS::ResolveNode::evaluateToNumber):
798         (KJS::ResolveNode::evaluateToBoolean):
799         (KJS::ResolveNode::evaluateToInt32):
800         (KJS::ResolveNode::evaluateToUInt32):
801         (KJS::LocalVarAccessNode::evaluateToInt32):
802         (KJS::LocalVarAccessNode::evaluateToUInt32):
803         (KJS::BracketAccessorNode::evaluateToNumber):
804         (KJS::BracketAccessorNode::evaluateToBoolean):
805         (KJS::BracketAccessorNode::evaluateToInt32):
806         (KJS::BracketAccessorNode::evaluateToUInt32):
807         (KJS::DotAccessorNode::inlineEvaluate):
808         (KJS::DotAccessorNode::evaluate):
809         (KJS::DotAccessorNode::evaluateToNumber):
810         (KJS::DotAccessorNode::evaluateToBoolean):
811         (KJS::DotAccessorNode::evaluateToInt32):
812         (KJS::DotAccessorNode::evaluateToUInt32):
813         (KJS::NewExprNode::inlineEvaluate):
814         (KJS::NewExprNode::evaluate):
815         (KJS::NewExprNode::evaluateToNumber):
816         (KJS::NewExprNode::evaluateToBoolean):
817         (KJS::NewExprNode::evaluateToInt32):
818         (KJS::NewExprNode::evaluateToUInt32):
819         (KJS::FunctionCallResolveNode::inlineEvaluate):
820         (KJS::FunctionCallResolveNode::evaluate):
821         (KJS::FunctionCallResolveNode::evaluateToNumber):
822         (KJS::FunctionCallResolveNode::evaluateToBoolean):
823         (KJS::FunctionCallResolveNode::evaluateToInt32):
824         (KJS::FunctionCallResolveNode::evaluateToUInt32):
825         (KJS::LocalVarFunctionCallNode::evaluate):
826         (KJS::LocalVarFunctionCallNode::evaluateToNumber):
827         (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
828         (KJS::LocalVarFunctionCallNode::evaluateToInt32):
829         (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
830         (KJS::FunctionCallDotNode::evaluate):
831         (KJS::FunctionCallDotNode::evaluateToNumber):
832         (KJS::FunctionCallDotNode::evaluateToBoolean):
833         (KJS::FunctionCallDotNode::evaluateToInt32):
834         (KJS::FunctionCallDotNode::evaluateToUInt32):
835         (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
836         (KJS::PostDecLocalVarNode::evaluateToNumber):
837         (KJS::PostDecLocalVarNode::evaluateToBoolean):
838         (KJS::PostDecLocalVarNode::evaluateToInt32):
839         (KJS::PostDecLocalVarNode::evaluateToUInt32):
840         (KJS::typeStringForValue):
841         (KJS::UnaryPlusNode::evaluate):
842         (KJS::UnaryPlusNode::evaluateToBoolean):
843         (KJS::UnaryPlusNode::evaluateToNumber):
844         (KJS::UnaryPlusNode::evaluateToInt32):
845         (KJS::BitwiseNotNode::inlineEvaluateToInt32):
846         (KJS::BitwiseNotNode::evaluate):
847         (KJS::BitwiseNotNode::evaluateToNumber):
848         (KJS::BitwiseNotNode::evaluateToBoolean):
849         (KJS::BitwiseNotNode::evaluateToInt32):
850         (KJS::MultNode::evaluateToBoolean):
851         (KJS::MultNode::evaluateToInt32):
852         (KJS::MultNode::evaluateToUInt32):
853         (KJS::DivNode::evaluateToInt32):
854         (KJS::DivNode::evaluateToUInt32):
855         (KJS::ModNode::evaluateToBoolean):
856         (KJS::ModNode::evaluateToInt32):
857         (KJS::ModNode::evaluateToUInt32):
858         (KJS::AddNode::evaluateToNumber):
859         (KJS::AddNode::evaluateToInt32):
860         (KJS::AddNode::evaluateToUInt32):
861         (KJS::AddNumbersNode::evaluateToInt32):
862         (KJS::AddNumbersNode::evaluateToUInt32):
863         (KJS::SubNode::evaluateToInt32):
864         (KJS::SubNode::evaluateToUInt32):
865         (KJS::LeftShiftNode::inlineEvaluateToInt32):
866         (KJS::LeftShiftNode::evaluate):
867         (KJS::LeftShiftNode::evaluateToNumber):
868         (KJS::LeftShiftNode::evaluateToInt32):
869         (KJS::RightShiftNode::inlineEvaluateToInt32):
870         (KJS::RightShiftNode::evaluate):
871         (KJS::RightShiftNode::evaluateToNumber):
872         (KJS::RightShiftNode::evaluateToInt32):
873         (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
874         (KJS::UnsignedRightShiftNode::evaluate):
875         (KJS::UnsignedRightShiftNode::evaluateToNumber):
876         (KJS::UnsignedRightShiftNode::evaluateToInt32):
877         (KJS::LessNode::inlineEvaluateToBoolean):
878         (KJS::LessNode::evaluate):
879         (KJS::LessNode::evaluateToBoolean):
880         (KJS::LessNumbersNode::inlineEvaluateToBoolean):
881         (KJS::LessNumbersNode::evaluate):
882         (KJS::LessNumbersNode::evaluateToBoolean):
883         (KJS::LessStringsNode::inlineEvaluateToBoolean):
884         (KJS::LessStringsNode::evaluate):
885         (KJS::BitAndNode::evaluate):
886         (KJS::BitAndNode::inlineEvaluateToInt32):
887         (KJS::BitAndNode::evaluateToNumber):
888         (KJS::BitAndNode::evaluateToBoolean):
889         (KJS::BitAndNode::evaluateToInt32):
890         (KJS::BitXOrNode::inlineEvaluateToInt32):
891         (KJS::BitXOrNode::evaluate):
892         (KJS::BitXOrNode::evaluateToNumber):
893         (KJS::BitXOrNode::evaluateToBoolean):
894         (KJS::BitXOrNode::evaluateToInt32):
895         (KJS::BitOrNode::inlineEvaluateToInt32):
896         (KJS::BitOrNode::evaluate):
897         (KJS::BitOrNode::evaluateToNumber):
898         (KJS::BitOrNode::evaluateToBoolean):
899         (KJS::BitOrNode::evaluateToInt32):
900         (KJS::ConditionalNode::evaluateToNumber):
901         (KJS::ConditionalNode::evaluateToInt32):
902         (KJS::ConditionalNode::evaluateToUInt32):
903         (KJS::valueForReadModifyAssignment):
904         (KJS::AssignExprNode::evaluate):
905         (KJS::AssignExprNode::evaluateToBoolean):
906         (KJS::AssignExprNode::evaluateToNumber):
907         (KJS::AssignExprNode::evaluateToInt32):
908         (KJS::VarDeclNode::handleSlowCase):
909         * kjs/nodes.h:
910         (KJS::FunctionCallResolveNode::precedence):
911         (KJS::AddNode::precedence):
912         (KJS::AddNode::):
913         (KJS::LessNumbersNode::):
914         (KJS::LessStringsNode::):
915         * kjs/value.cpp:
916         (KJS::JSValue::toInt32SlowCase):
917         (KJS::JSValue::toUInt32SlowCase):
918         * kjs/value.h:
919         (KJS::JSValue::asCell):
920         (KJS::JSValue::toInt32):
921         (KJS::JSValue::toUInt32):
922
923 2007-11-12  Alexey Proskuryakov  <ap@webkit.org>
924
925         Reviewed by Darin.
926
927         http://bugs.webkit.org/show_bug.cgi?id=15953
928         Add UTF-8 encoding/decoding to WTF
929
930         * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
931         * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
932         parameter. Callers are not interested in getting decoding results in strict mode, so 
933         this allows for bailing out as soon as an error is seen.
934
935         * kjs/function.cpp:
936         (KJS::encode): Updated for new UString::UTF8String() signature.
937
938         * API/JSStringRef.cpp:
939         (JSStringCreateWithCharacters): Disambiguate UChar.
940         (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
941         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
942
943         * wtf/unicode/UTF8.cpp: Added.
944         (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
945         (WTF::Unicode::inlineUTF8SequenceLength):
946         (WTF::Unicode::UTF8SequenceLength):
947         (WTF::Unicode::decodeUTF8Sequence):
948         (WTF::Unicode::):
949         (WTF::Unicode::ConvertUTF16ToUTF8):
950         (WTF::Unicode::isLegalUTF8):
951         (WTF::Unicode::ConvertUTF8ToUTF16):
952         * wtf/unicode/UTF8.h: Added.
953         (WTF::Unicode::):
954         Some code moved from ustring.h, some adapted from unicode.org sources.
955
956         * JavaScriptCore.exp:
957         * JavaScriptCore.pri:
958         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
959         * JavaScriptCore.xcodeproj/project.pbxproj:
960         * JavaScriptCoreSources.bkl:
961         Added UTF8.{h,cpp}
962
963 2007-11-12  Josh Aas  <joshmoz@gmail.com>
964
965         Reviewed by Darin.
966
967         - http://bugs.webkit.org/show_bug.cgi?id=15946
968           add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
969
970         * bindings/npapi.h:
971
972 2007-11-12  Darin Adler  <darin@apple.com>
973
974         Reviewed by Sam.
975
976         - http://bugs.webkit.org/show_bug.cgi?id=15951
977           REGRESSION: assertion failure in regexp match() when running JS tests
978
979         Test: fast/js/regexp-many-brackets.html
980
981         * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
982         the BRANUMBER opcode.
983
984 2007-11-12  Darin Adler  <darin@apple.com>
985
986         Reviewed by Geoff.
987
988         - fix use of prefix and config.h, got rid of a few unneeded things in
989           the PCRE code; no behavior changes
990
991         * API/JSBase.cpp: Added include of config.h.
992         * API/JSCallbackConstructor.cpp: Ditto.
993         * API/JSCallbackFunction.cpp: Ditto.
994         * API/JSCallbackObject.cpp: Ditto.
995         * API/JSClassRef.cpp: Ditto.
996         * API/JSContextRef.cpp: Ditto.
997         * API/JSObjectRef.cpp: Ditto.
998         * API/JSStringRef.cpp: Ditto.
999         * API/JSValueRef.cpp: Ditto.
1000
1001         * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
1002         Moved new/delete macros after includes, as they are in WebCore's prefix.
1003         Removed "config.h".
1004
1005         * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
1006         function. This is needed for PCRE, but not helpful for our use. Also changed
1007         the tables to all be 128 entries long instead of 256, since only the first
1008         128 are ever used.
1009
1010         * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
1011         which was only being used to check hex digits. Changed all uses of TRUE and
1012         FALSE to use the C++ true and false instead.
1013         (check_escape): Just the TRUE/FALSE thing.
1014         (is_counted_repeat): Ditto.
1015         (could_be_empty_branch): Ditto.
1016         (get_othercase_range): Ditto.
1017         (compile_branch): Ditto.
1018         (compile_regex): Ditto.
1019         (is_anchored): Ditto.
1020         (is_startline): Ditto.
1021         (find_firstassertedchar): Ditto.
1022         (jsRegExpCompile): Ditto.
1023
1024         * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
1025         FALSE to use the C++ true and false instead.
1026         (match_ref): Just the TRUE/FALSE thing.
1027         (match): Ditto. Removed some unneeded braces.
1028         (jsRegExpExecute): Just the TRUE/FALSE thing.
1029
1030         * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
1031         of the file instead of the bottom, so they can be used. Also changed the table
1032         sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
1033         Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
1034         be a macro instead of a extern int.
1035
1036         * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
1037
1038         * pcre/pcre_tables.cpp: Made table sizes explicit.
1039
1040         * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
1041
1042 2007-11-12  Adam Roben  <aroben@apple.com>
1043
1044         Build fix
1045
1046         * wtf/FastMalloc.h: Add missing using statement.
1047
1048 2007-11-11  Oliver Hunt  <oliver@apple.com>
1049
1050         Reviewed by Darin.
1051
1052         Add special fastZeroedMalloc function to replace a 
1053         number of fastCalloc calls where one argument was 1.
1054         
1055         This results in a 0.4% progression in SunSpider, more
1056         than making up for the earlier regression caused by 
1057         additional overflow checks.
1058
1059         * JavaScriptCore.exp:
1060         * kjs/array_instance.cpp:
1061         * kjs/property_map.cpp:
1062         * wtf/FastMalloc.cpp:
1063         * wtf/FastMalloc.h:
1064         * wtf/HashTable.h:
1065
1066 2007-11-11  Adam Roben  <aroben@apple.com>
1067
1068         Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
1069
1070         The bug was due to a mismatch between HashMap::remove and
1071         HashTable::checkTableConsistency. HashMap::remove can delete the value
1072         stored in the HashTable (by derefing it), which is not normally
1073         allowed by HashTable. It's OK in this case because the value is about
1074         to be removed from the table, but HashTable wasn't aware of this.
1075
1076         HashMap::remove now performs the consistency check itself before
1077         derefing the value.
1078
1079         Darin noticed that the same bug would occur in HashSet, so I've fixed
1080         it there as well.
1081
1082         Reviewed by Darin.
1083
1084         * wtf/HashMap.h:
1085         (WTF::HashMap::remove): Perform the HashTable consistency check
1086         manually before calling deref.
1087         * wtf/HashSet.h:
1088         (WTF::HashSet::remove): Ditto.
1089         * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
1090         and HashSet can call it.
1091         (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
1092         Added.
1093         (WTF::HashTable::removeAndInvalidate): Added.
1094         (WTF::HashTable::remove):
1095         (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
1096
1097 2007-11-11  Mark Rowe  <mrowe@apple.com>
1098
1099         Build fix.  Use the correct filename case.
1100
1101         * kjs/nodes.h:
1102
1103 2007-11-11  Geoffrey Garen  <ggaren@apple.com>
1104
1105         Reviewed by Sam Weinig.
1106         
1107         Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
1108         15% of string-validate-input.js is spent compiling the same regular expression
1109         
1110         Store a compiled representation of the regular expression in the AST.
1111         
1112         Only a .2% SunSpider speedup overall, but a 10.6% speedup on 
1113         string-validate-input.js.
1114
1115         * kjs/nodes.cpp:
1116         (KJS::RegExpNode::evaluate):
1117         * kjs/nodes.h:
1118         (KJS::RegExpNode::):
1119         * kjs/nodes2string.cpp:
1120         (KJS::RegExpNode::streamTo):
1121         * kjs/regexp.cpp:
1122         (KJS::RegExp::flags):
1123         * kjs/regexp.h:
1124         (KJS::RegExp::pattern):
1125         * kjs/regexp_object.cpp:
1126         (KJS::RegExpObjectImp::construct):
1127         (KJS::RegExpObjectImp::createRegExpImp):
1128         * kjs/regexp_object.h:
1129
1130 2007-11-11  Oliver Hunt  <oliver@apple.com>
1131
1132         Reviewed by Eric.
1133
1134         Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
1135
1136         Unfortunately this is a very slight regression, but is unavoidable.
1137
1138         * wtf/FastMalloc.cpp:
1139
1140 2007-11-10  Eric Seidel  <eric@webkit.org>
1141
1142         Reviewed by darin.
1143         
1144         Add simple type inferencing to the parser, and create custom
1145         AddNode and LessNode subclasses based on inferred types.
1146         http://bugs.webkit.org/show_bug.cgi?id=15884
1147         
1148         SunSpider claims this is at least a 0.5% speedup.
1149
1150         * JavaScriptCore.exp:
1151         * kjs/grammar.y:
1152         * kjs/internal.cpp:
1153         (KJS::NumberImp::getPrimitiveNumber):
1154         (KJS::GetterSetterImp::getPrimitiveNumber):
1155         * kjs/internal.h:
1156         * kjs/lexer.cpp:
1157         (KJS::Lexer::lex):
1158         * kjs/nodes.cpp:
1159         (KJS::Node::Node):
1160         (KJS::StringNode::evaluate):
1161         (KJS::StringNode::evaluateToNumber):
1162         (KJS::StringNode::evaluateToBoolean):
1163         (KJS::RegExpNode::evaluate):
1164         (KJS::UnaryPlusNode::optimizeVariableAccess):
1165         (KJS::AddNode::evaluate):
1166         (KJS::AddNode::evaluateToNumber):
1167         (KJS::AddNumbersNode::inlineEvaluateToNumber):
1168         (KJS::AddNumbersNode::evaluate):
1169         (KJS::AddNumbersNode::evaluateToNumber):
1170         (KJS::AddStringsNode::evaluate):
1171         (KJS::AddStringLeftNode::evaluate):
1172         (KJS::AddStringRightNode::evaluate):
1173         (KJS::lessThan):
1174         (KJS::lessThanEq):
1175         (KJS::LessNumbersNode::evaluate):
1176         (KJS::LessStringsNode::evaluate):
1177         * kjs/nodes.h:
1178         (KJS::ExpressionNode::):
1179         (KJS::RegExpNode::):
1180         (KJS::RegExpNode::precedence):
1181         (KJS::TypeOfResolveNode::):
1182         (KJS::LocalVarTypeOfNode::):
1183         (KJS::UnaryPlusNode::):
1184         (KJS::UnaryPlusNode::precedence):
1185         (KJS::AddNode::):
1186         (KJS::AddNode::precedence):
1187         (KJS::AddNumbersNode::):
1188         (KJS::AddStringLeftNode::):
1189         (KJS::AddStringRightNode::):
1190         (KJS::AddStringsNode::):
1191         (KJS::LessNode::):
1192         (KJS::LessNode::precedence):
1193         (KJS::LessNumbersNode::):
1194         (KJS::LessStringsNode::):
1195         * kjs/nodes2string.cpp:
1196         (KJS::StringNode::streamTo):
1197         * kjs/object.cpp:
1198         * kjs/object.h:
1199         * kjs/value.h:
1200         (KJS::JSValue::getPrimitiveNumber):
1201
1202 2007-11-11  Darin Adler  <darin@apple.com>
1203
1204         - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
1205
1206         * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
1207         Later we can break it into two files.
1208
1209         * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
1210         * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
1211         * pcre/dftables.pro: Take out now-unneeded include paths.
1212         * pcre/pcre_maketables.cpp: Use new instead of malloc.
1213
1214 2007-11-11  Darin Adler  <darin@apple.com>
1215
1216         * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
1217         another include path.
1218
1219 2007-11-11  Darin Adler  <darin@apple.com>
1220
1221         * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
1222         by adding another include path.
1223
1224 2007-11-11  Darin Adler  <darin@apple.com>
1225
1226         Reviewed by Sam.
1227
1228         - http://bugs.webkit.org/show_bug.cgi?id=15924
1229           next round of changes to JSRegExp (formerly PCRE)
1230
1231         This is a combination of converting to C++, tweaking the API, and adding
1232         some additional optimizations.
1233
1234         Future steps will involve getting rid of the use of UTF-8 completely
1235         (we'll use UTF-16 exclusively instead), eliminating more source files,
1236         and some more speed-ups.
1237
1238         SunSpider says the current round is an 0.9% speed-up overall, and a
1239         5.3% speed-up for regexp.
1240
1241         * JavaScriptCore.exp: Updated for new entry points.
1242
1243         * JavaScriptCore.pri:
1244         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1245         * JavaScriptCore.vcproj/dftables/dftables.vcproj:
1246         * JavaScriptCore.xcodeproj/project.pbxproj:
1247         * JavaScriptCoreSources.bkl:
1248         * jscore.bkl:
1249         Updated for new source file names and ForwardingHeaders.
1250
1251         * kjs/regexp.cpp:
1252         (KJS::RegExp::RegExp): Changed to use the error message without calling
1253         strdup on it and to pass the new types and options.
1254         (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
1255         (KJS::RegExp::match): Pass the new types and options.
1256         * kjs/regexp.h: Update type of m_constructionError.
1257
1258         * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
1259         the Google parts, and this isn't the PCRE library, per se.
1260         * pcre/COPYING: Ditto.
1261
1262         * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
1263         (main): Removed unneeded ctype_digit.
1264
1265         * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
1266
1267         * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
1268         Moved a lot of private stuff used only within this file here from pcre_internal.h.
1269         Renumbered the error codes.
1270         (error_text): Use a single string with embedded nulls for the error text (I got
1271         this idea from newer versions of PCRE).
1272         (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
1273         uses with isASCIIDigit.
1274         (is_counted_repeat): Ditto.
1275         (read_repeat_counts): Ditto.
1276         (first_significant_code): Ditto.
1277         (find_fixedlength): Ditto.
1278         (could_be_empty_branch): Ditto.
1279         (compile_branch): Ditto. Also removed some code that handles changing options.
1280         JavaScript doesn't have any of the features that allow options to change.
1281         (compile_regex): Updated for change to options parameter.
1282         (is_anchored): Ditto.
1283         (find_firstassertedchar): Ditto.
1284         (jsRegExpCompile): Changed to take separate flags instead of an options int.
1285         Also changed to call new/delete instead of pcre_malloc/free.
1286         (jsRegExpFree): Ditto.
1287
1288         * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
1289         Added a case that uses computed goto for the opcode loop, but did not turn it on.
1290         Changed the RMATCH macro to handle returns more efficiently by putting the where
1291         pointer in the new frame instead of the old one, allowing us to branch to the
1292         return with a single statement. Switched to new/delete from pcre_malloc/free.
1293         Changed many RRETURN callers to not set the return value since it's already
1294         set correctly. Replaced the rrc variable with an is_match variable. Values other
1295         than "match" and "no match" are now handled differently. This allows us to remove
1296         the code to check for those cases in various rules.
1297         (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
1298         continue statements, or break statements that break out of the outer case use
1299         a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
1300         (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
1301         start_match field from the match block.
1302
1303         * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
1304         in here. Removed various unused types. Converted from JSRegExpChar to UChar.
1305         Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
1306         used in multiple places. Unfortunately we lose the comments for each opcode; we
1307         should find a place to put those back. Removed ctype_digit.
1308
1309         * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
1310         (pcre_maketables): Got rid of the conditional code that allows this to be compiled
1311         in -- it's only used for dftables now (and soon may be obsolete entirely).
1312         Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
1313         loop. Removed ctype_digit.
1314
1315         * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
1316
1317         * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
1318         Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
1319
1320         * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
1321         Updated for other file name changes.
1322
1323         * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
1324
1325         * pcre/ucpinternal.h: Updated header.
1326
1327         * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
1328
1329         * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
1330         & for this operation. Also added an overload that takes an int because that's
1331         useful for PCRE. Later we could optimize for int and overload other functions in
1332         this file; stuck to this simple one for now.
1333
1334         * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
1335         * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
1336
1337         * pcre/LICENCE: Removed.
1338         * pcre/pcre-config.h: Removed.
1339         * wtf/FastMallocPCRE.cpp: Removed.
1340
1341         * pcre/dftables.c: Renamed to cpp.
1342         * pcre/pcre_compile.c: Ditto.
1343         * pcre/pcre_exec.c: Ditto.
1344         * pcre/pcre_maketables.c: Ditto.
1345         * pcre/pcre_ord2utf8.c: Ditto.
1346         * pcre/pcre_tables.c: Ditto.
1347         * pcre/pcre_ucp_searchfuncs.c: Ditto.
1348         * pcre/pcre_xclass.c: Ditto.
1349         * pcre/ucptable.c: Ditto.
1350
1351 2007-11-11  Eric Seidel  <eric@webkit.org>
1352
1353         Reviewed by Oliver.
1354
1355         Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
1356
1357         * kjs/nodes.cpp:
1358         (KJS::ExpressionNode::evaluateToBoolean):
1359         (KJS::LessNode::evaluateToBoolean):
1360         (KJS::GreaterNode::evaluateToBoolean):
1361         (KJS::LessEqNode::evaluateToBoolean):
1362         (KJS::GreaterEqNode::evaluateToBoolean):
1363         (KJS::InstanceOfNode::evaluateToBoolean):
1364         (KJS::InNode::evaluateToBoolean):
1365         (KJS::EqualNode::evaluateToBoolean):
1366         (KJS::NotEqualNode::evaluateToBoolean):
1367         (KJS::StrictEqualNode::evaluateToBoolean):
1368         (KJS::NotStrictEqualNode::evaluateToBoolean):
1369         (KJS::LogicalAndNode::evaluateToBoolean):
1370         (KJS::LogicalOrNode::evaluateToBoolean):
1371         (KJS::ConditionalNode::evaluateToBoolean):
1372
1373 2007-11-10  Darin Adler  <darin@apple.com>
1374
1375         Reviewed by Sam.
1376
1377         - fix http://bugs.webkit.org/show_bug.cgi?id=15927
1378           REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
1379           and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
1380
1381         Test: fast/js/delete-then-put.html
1382
1383         * kjs/property_map.cpp:
1384         (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
1385         (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
1386         problem before.
1387
1388         - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
1389
1390         * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
1391         optimizeForUnnecessaryResult, since the result is used in some cases.
1392
1393 2007-11-10  Adam Roben  <aroben@apple.com>
1394
1395         Windows build fix
1396
1397         Roll out some changes that were (seemingly accidentally) checked in
1398         with r27664.
1399
1400         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1401
1402 2007-11-10  Darin Adler  <darin@apple.com>
1403
1404         Reviewed by Sam.
1405
1406         - http://bugs.webkit.org/show_bug.cgi?id=15915
1407           add an evaluation path for booleans like the one we have for numbers
1408
1409         Gives 1.1% on SunSpider.
1410
1411         * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
1412
1413         * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
1414         down from Node to ExpressionNode. Changed some classes to not inherit from
1415         ExpressionNode where not necessary, and removed unnneeded evaluate functions
1416         as well as evaluate functions that need not be virtual. Call the
1417         optimizeForUnnecessaryResult function on the start of a for loop too.
1418         * kjs/nodes.cpp:
1419         (KJS::ExpressionNode::evaluateToBoolean): Added.
1420         (KJS::FalseNode::evaluate): Added.
1421         (KJS::TrueNode::evaluate): Added.
1422         (KJS::NumberNode::evaluateToBoolean): Added.
1423         (KJS::StringNode::evaluateToBoolean): Added.
1424         (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
1425         (KJS::BracketAccessorNode::evaluateToBoolean): Added.
1426         (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
1427         (KJS::LogicalNotNode::evaluateToBoolean): Added.
1428         (KJS::lessThan): Changed to return bool.
1429         (KJS::lessThanEq): Ditto.
1430         (KJS::LessNode::evaluate): Changed since lessThan returns bool.
1431         (KJS::LessNode::evaluateToBoolean): Added.
1432         (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
1433         (KJS::GreaterNode::evaluateToBoolean): Added.
1434         (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
1435         (KJS::LessEqNode::evaluateToBoolean): Added.
1436         (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
1437         (KJS::GreaterEqNode::evaluateToBoolean): Added.
1438         (KJS::InstanceOfNode::evaluateToBoolean): Added.
1439         (KJS::InNode::evaluateToBoolean): Added.
1440         (KJS::EqualNode::evaluateToBoolean): Added.
1441         (KJS::NotEqualNode::evaluateToBoolean): Added.
1442         (KJS::StrictEqualNode::evaluateToBoolean): Added.
1443         (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
1444         (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
1445         (KJS::IfNode::execute): Ditto.
1446         (KJS::DoWhileNode::execute): Ditto.
1447         (KJS::WhileNode::execute): Ditto.
1448         (KJS::ForNode::execute): Ditto.
1449
1450         * kjs/nodes2string.cpp:
1451         (KJS::FalseNode::streamTo): Added.
1452         (KJS::TrueNode::streamTo): Added.
1453
1454 2007-11-09  Adam Roben  <aroben@apple.com>
1455
1456         Windows build fix
1457
1458         Reviewed by Darin.
1459
1460         * kjs/value.h:
1461         (KJS::jsNumber): Add some explicit casts.
1462
1463 2007-11-08  Darin Adler  <darin@apple.com>
1464
1465         - fix build
1466
1467         * kjs/grammar.y:
1468         * kjs/nodes.h:
1469         * kjs/property_map.cpp:
1470
1471 2007-11-08  Darin Adler  <darin@apple.com>
1472
1473         - roll out accidentally-checked in changes
1474
1475         * kjs/nodes.cpp: Back to previous version.
1476         * kjs/nodes.h: Ditto.
1477         * kjs/grammar.y: Ditto.
1478
1479 2007-11-08  Darin Adler  <darin@apple.com>
1480
1481         Reviewed by Maciej.
1482
1483         - http://bugs.webkit.org/show_bug.cgi?id=15912
1484           fasta spends a lot of time in qsort
1485
1486         * kjs/property_map.cpp:
1487         (KJS::PropertyMap::getEnumerablePropertyNames):
1488         Use insertion sort instead of qsort for small sets of property names.
1489         We can probably do some even-better speedups of for/in, but this nets
1490         0.6% overall and 6.7% on fasta.
1491
1492 2007-11-08  Darin Adler  <darin@apple.com>
1493
1494         Reviewed by Maciej.
1495
1496         - http://bugs.webkit.org/show_bug.cgi?id=15906
1497           getting characters by indexing into a string is very slow
1498
1499         This fixes one source of the slowness -- the conversion to an unused
1500         Identifier as we call the get function from the slot -- but doesn't
1501         fix others, such as the fact that we have to allocate a new UString::Rep
1502         for every single character.
1503
1504         Speeds up string-base64 30%, and at least 0.5% overall.
1505         But does slow down access-fannkuch quite a bit. Might be worth
1506         revisiting in the future to see what we can do about that (although
1507         I did look at a profile for a while).
1508
1509         * kjs/property_slot.h: Add a new marker for "numeric" property slots;
1510         slots where we don't need to pass the identifier to the get function.
1511         (KJS::PropertySlot::getValue): Added code to call the numeric get function.
1512         (KJS::PropertySlot::setCustomNumeric): Added.
1513         * kjs/string_object.cpp:
1514         (KJS::StringInstance::indexGetter): Changed to use substr() instead
1515         of constructing a wholly new UString each time.
1516         (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
1517         takes advantage of setCustomNumeric to avoid creating an Identifier.
1518         (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
1519
1520 2007-11-08  Darin Adler  <darin@apple.com>
1521
1522         Reviewed by Oliver.
1523
1524         - http://bugs.webkit.org/show_bug.cgi?id=15904
1525           more speed-ups possible by tightening up int version of JSImmediate
1526
1527         1% improvement of SunSpider
1528
1529         * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
1530         (KJS::JSImmediate::from): Overload for most numeric types; many types can
1531         do fewer branches and checks.
1532         (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
1533         (KJS::JSImmediate::getTruncatedInt32): Ditto.
1534         (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
1535         between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
1536
1537         * kjs/grammar.y: Update since fromDouble is now just from.
1538         * kjs/nodes.h: Ditto.
1539
1540         * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
1541
1542 2007-11-08  Kevin Ollivier  <kevino@theolliviers.com>
1543
1544         Bakefiles for building JavaScriptCore, needed by wx port.
1545
1546         Reviewed by Mark Rowe.
1547
1548         * JavaScriptCoreSources.bkl: Added.
1549         * jscore.bkl: Added.
1550
1551 2007-11-08  Oliver Hunt  <oliver@apple.com>
1552
1553         Reviewed by Maciej.
1554
1555         Fix regression caused by earlier bitwise and optimisation.  1 & undefined != 1.
1556
1557         The implementation of JSImmediate::areBothImmediateNumbers relies on 
1558         (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having 
1559         a unique result when both immediate values are numbers.
1560
1561         The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
1562         By swapping the value of NumberType and UndefinedType this ceases to be a problem.
1563
1564         * kjs/JSType.h:
1565         (KJS::):
1566
1567 2007-11-08  Darin Adler  <darin@apple.com>
1568
1569         - fix build
1570
1571         * kjs/nodes.h: Add missing parameter name.
1572
1573 2007-11-08  Eric Seidel  <eric@webkit.org>
1574
1575         Reviewed by darin.
1576
1577         Add ExpressionNode subclass of Node, use it.
1578
1579         * kjs/grammar.y:
1580         * kjs/nodes.cpp:
1581         (KJS::ForInNode::ForInNode):
1582         * kjs/nodes.h:
1583         (KJS::ExpressionNode::):
1584         (KJS::NullNode::):
1585         (KJS::NullNode::precedence):
1586         (KJS::BooleanNode::):
1587         (KJS::BooleanNode::precedence):
1588         (KJS::RegExpNode::):
1589         (KJS::RegExpNode::precedence):
1590         (KJS::ThisNode::):
1591         (KJS::ThisNode::precedence):
1592         (KJS::ResolveNode::):
1593         (KJS::ElementNode::):
1594         (KJS::ArrayNode::):
1595         (KJS::PropertyNode::):
1596         (KJS::PropertyNode::precedence):
1597         (KJS::PropertyNode::name):
1598         (KJS::PropertyListNode::):
1599         (KJS::ObjectLiteralNode::):
1600         (KJS::ObjectLiteralNode::precedence):
1601         (KJS::BracketAccessorNode::):
1602         (KJS::DotAccessorNode::):
1603         (KJS::DotAccessorNode::precedence):
1604         (KJS::ArgumentListNode::):
1605         (KJS::ArgumentsNode::):
1606         (KJS::NewExprNode::):
1607         (KJS::NewExprNode::precedence):
1608         (KJS::FunctionCallValueNode::):
1609         (KJS::FunctionCallValueNode::precedence):
1610         (KJS::FunctionCallResolveNode::):
1611         (KJS::FunctionCallBracketNode::):
1612         (KJS::FunctionCallBracketNode::precedence):
1613         (KJS::FunctionCallDotNode::):
1614         (KJS::FunctionCallDotNode::precedence):
1615         (KJS::PrePostResolveNode::):
1616         (KJS::PostfixBracketNode::):
1617         (KJS::PostfixBracketNode::precedence):
1618         (KJS::PostIncBracketNode::):
1619         (KJS::PostIncBracketNode::isIncrement):
1620         (KJS::PostDecBracketNode::):
1621         (KJS::PostDecBracketNode::isIncrement):
1622         (KJS::PostfixDotNode::):
1623         (KJS::PostfixDotNode::precedence):
1624         (KJS::PostIncDotNode::):
1625         (KJS::PostIncDotNode::isIncrement):
1626         (KJS::PostDecDotNode::):
1627         (KJS::PostDecDotNode::isIncrement):
1628         (KJS::PostfixErrorNode::):
1629         (KJS::PostfixErrorNode::precedence):
1630         (KJS::DeleteResolveNode::):
1631         (KJS::DeleteBracketNode::):
1632         (KJS::DeleteBracketNode::precedence):
1633         (KJS::DeleteDotNode::):
1634         (KJS::DeleteDotNode::precedence):
1635         (KJS::DeleteValueNode::):
1636         (KJS::DeleteValueNode::precedence):
1637         (KJS::VoidNode::):
1638         (KJS::VoidNode::precedence):
1639         (KJS::TypeOfResolveNode::):
1640         (KJS::TypeOfValueNode::):
1641         (KJS::PrefixBracketNode::):
1642         (KJS::PrefixBracketNode::precedence):
1643         (KJS::PreIncBracketNode::):
1644         (KJS::PreIncBracketNode::isIncrement):
1645         (KJS::PreDecBracketNode::):
1646         (KJS::PreDecBracketNode::isIncrement):
1647         (KJS::PrefixDotNode::):
1648         (KJS::PrefixDotNode::precedence):
1649         (KJS::PreIncDotNode::):
1650         (KJS::PreIncDotNode::isIncrement):
1651         (KJS::PreDecDotNode::):
1652         (KJS::PreDecDotNode::isIncrement):
1653         (KJS::PrefixErrorNode::):
1654         (KJS::PrefixErrorNode::precedence):
1655         (KJS::UnaryPlusNode::):
1656         (KJS::UnaryPlusNode::precedence):
1657         (KJS::NegateNode::):
1658         (KJS::NegateNode::precedence):
1659         (KJS::BitwiseNotNode::):
1660         (KJS::BitwiseNotNode::precedence):
1661         (KJS::LogicalNotNode::):
1662         (KJS::LogicalNotNode::precedence):
1663         (KJS::AddNode::):
1664         (KJS::AddNode::precedence):
1665         (KJS::LeftShiftNode::):
1666         (KJS::LeftShiftNode::precedence):
1667         (KJS::RightShiftNode::):
1668         (KJS::RightShiftNode::precedence):
1669         (KJS::UnsignedRightShiftNode::):
1670         (KJS::UnsignedRightShiftNode::precedence):
1671         (KJS::LessNode::):
1672         (KJS::LessNode::precedence):
1673         (KJS::GreaterNode::):
1674         (KJS::GreaterNode::precedence):
1675         (KJS::LessEqNode::):
1676         (KJS::LessEqNode::precedence):
1677         (KJS::GreaterEqNode::):
1678         (KJS::GreaterEqNode::precedence):
1679         (KJS::InstanceOfNode::):
1680         (KJS::InstanceOfNode::precedence):
1681         (KJS::InNode::):
1682         (KJS::InNode::precedence):
1683         (KJS::EqualNode::):
1684         (KJS::EqualNode::precedence):
1685         (KJS::NotEqualNode::):
1686         (KJS::NotEqualNode::precedence):
1687         (KJS::StrictEqualNode::):
1688         (KJS::StrictEqualNode::precedence):
1689         (KJS::NotStrictEqualNode::):
1690         (KJS::NotStrictEqualNode::precedence):
1691         (KJS::BitAndNode::):
1692         (KJS::BitAndNode::precedence):
1693         (KJS::BitOrNode::):
1694         (KJS::BitOrNode::precedence):
1695         (KJS::BitXOrNode::):
1696         (KJS::BitXOrNode::precedence):
1697         (KJS::LogicalAndNode::):
1698         (KJS::LogicalAndNode::precedence):
1699         (KJS::LogicalOrNode::):
1700         (KJS::LogicalOrNode::precedence):
1701         (KJS::ConditionalNode::):
1702         (KJS::ConditionalNode::precedence):
1703         (KJS::ReadModifyResolveNode::):
1704         (KJS::ReadModifyResolveNode::precedence):
1705         (KJS::AssignResolveNode::):
1706         (KJS::AssignResolveNode::precedence):
1707         (KJS::ReadModifyBracketNode::):
1708         (KJS::ReadModifyBracketNode::precedence):
1709         (KJS::AssignBracketNode::):
1710         (KJS::AssignBracketNode::precedence):
1711         (KJS::AssignDotNode::):
1712         (KJS::AssignDotNode::precedence):
1713         (KJS::ReadModifyDotNode::):
1714         (KJS::ReadModifyDotNode::precedence):
1715         (KJS::AssignErrorNode::):
1716         (KJS::AssignErrorNode::precedence):
1717         (KJS::CommaNode::):
1718         (KJS::CommaNode::precedence):
1719         (KJS::AssignExprNode::):
1720         (KJS::AssignExprNode::precedence):
1721         (KJS::ExprStatementNode::):
1722         (KJS::IfNode::):
1723         (KJS::DoWhileNode::):
1724         (KJS::WhileNode::):
1725         (KJS::ReturnNode::):
1726         (KJS::WithNode::):
1727         (KJS::ThrowNode::):
1728         (KJS::ParameterNode::):
1729         (KJS::CaseClauseNode::):
1730         (KJS::CaseClauseNode::precedence):
1731         (KJS::ClauseListNode::):
1732         (KJS::SwitchNode::):
1733
1734 2007-11-08  Oliver Hunt  <oliver@apple.com>
1735
1736         Reviewed by Sam.
1737
1738         Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
1739
1740         This only improves bitwise-and performance, as the additional logic required 
1741         for similar code paths on or, xor, and shifting requires additional operations
1742         and branches that negate (and in certain cases, regress) any advantage we might
1743         otherwise receive.
1744
1745         This improves performance on all bitop tests, the cryptography tests, as well as 
1746         the string-base64 and string-unpack-code tests.  No significant degradation on 
1747         any other tests.
1748
1749         * kjs/JSImmediate.h:
1750         (KJS::JSImmediate::areBothImmediateNumbers):
1751         (KJS::JSImmediate::andImmediateNumbers):
1752         * kjs/nodes.cpp:
1753         (KJS::BitAndNode::evaluate):
1754         * kjs/value.h:
1755         (KJS::jsNumberFromAnd):
1756
1757 2007-11-08  Adam Roben  <aroben@apple.com>
1758
1759         Stop using KJS inside of MathExtras.h
1760
1761         Reviewed by Darin.
1762
1763         * wtf/MathExtras.h: Removed an unused header, and a now-unused
1764         forward-declaration.
1765         (wtf_atan2): Use std::numeric_limits intead of KJS.
1766
1767 2007-11-08  Sam Weinig  <sam@webkit.org>
1768
1769         Windows build fix.
1770
1771         * kjs/date_object.cpp:
1772         (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
1773         (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
1774         (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
1775
1776 2007-11-08  Mark Rowe  <mrowe@apple.com>
1777
1778         Gtk build fix.
1779
1780         * kjs/lookup.h: Add missing include.
1781
1782 2007-11-08  Sam Weinig  <sam@webkit.org>
1783
1784         Reviewed by Darin.
1785
1786         Convert JavaScript internal function objects to use one class per
1787         function.  This avoids a switch statement inside what used to be
1788         the shared function classes and will allow Shark to better analyze
1789         the code.
1790
1791         To make this switch, the value property of the HashEntry was changed
1792         to a union of an intptr_t (which is used to continue handle valueGetters)
1793         and function pointer which points to a static constructor for the
1794         individual new function objects.
1795
1796         SunSpider claims this is a 1.0% speedup.
1797
1798         * kjs/array_object.cpp:
1799         (KJS::ArrayPrototype::getOwnPropertySlot):
1800         (KJS::getProperty):
1801         (KJS::ArrayProtoFuncToString::callAsFunction):
1802         (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
1803         (KJS::ArrayProtoFuncJoin::callAsFunction):
1804         (KJS::ArrayProtoFuncConcat::callAsFunction):
1805         (KJS::ArrayProtoFuncPop::callAsFunction):
1806         (KJS::ArrayProtoFuncPush::callAsFunction):
1807         (KJS::ArrayProtoFuncReverse::callAsFunction):
1808         (KJS::ArrayProtoFuncShift::callAsFunction):
1809         (KJS::ArrayProtoFuncSlice::callAsFunction):
1810         (KJS::ArrayProtoFuncSort::callAsFunction):
1811         (KJS::ArrayProtoFuncSplice::callAsFunction):
1812         (KJS::ArrayProtoFuncUnShift::callAsFunction):
1813         (KJS::ArrayProtoFuncFilter::callAsFunction):
1814         (KJS::ArrayProtoFuncMap::callAsFunction):
1815         (KJS::ArrayProtoFuncEvery::callAsFunction):
1816         (KJS::ArrayProtoFuncForEach::callAsFunction):
1817         (KJS::ArrayProtoFuncSome::callAsFunction):
1818         (KJS::ArrayProtoFuncIndexOf::callAsFunction):
1819         (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
1820         * kjs/array_object.h:
1821         (KJS::ArrayPrototype::classInfo):
1822         * kjs/create_hash_table:
1823         * kjs/date_object.cpp:
1824         (KJS::DatePrototype::getOwnPropertySlot):
1825         (KJS::DateProtoFuncToString::callAsFunction):
1826         (KJS::DateProtoFuncToUTCString::callAsFunction):
1827         (KJS::DateProtoFuncToDateString::callAsFunction):
1828         (KJS::DateProtoFuncToTimeString::callAsFunction):
1829         (KJS::DateProtoFuncToLocaleString::callAsFunction):
1830         (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
1831         (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
1832         (KJS::DateProtoFuncValueOf::callAsFunction):
1833         (KJS::DateProtoFuncGetTime::callAsFunction):
1834         (KJS::DateProtoFuncGetFullYear::callAsFunction):
1835         (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
1836         (KJS::DateProtoFuncToGMTString::callAsFunction):
1837         (KJS::DateProtoFuncGetMonth::callAsFunction):
1838         (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
1839         (KJS::DateProtoFuncGetDate::callAsFunction):
1840         (KJS::DateProtoFuncGetUTCDate::callAsFunction):
1841         (KJS::DateProtoFuncGetDay::callAsFunction):
1842         (KJS::DateProtoFuncGetUTCDay::callAsFunction):
1843         (KJS::DateProtoFuncGetHours::callAsFunction):
1844         (KJS::DateProtoFuncGetUTCHours::callAsFunction):
1845         (KJS::DateProtoFuncGetMinutes::callAsFunction):
1846         (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
1847         (KJS::DateProtoFuncGetSeconds::callAsFunction):
1848         (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
1849         (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
1850         (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
1851         (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
1852         (KJS::DateProtoFuncSetTime::callAsFunction):
1853         (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
1854         (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
1855         (KJS::DateProtoFuncSetSeconds::callAsFunction):
1856         (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
1857         (KJS::DateProtoFuncSetMinutes::callAsFunction):
1858         (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
1859         (KJS::DateProtoFuncSetHours::callAsFunction):
1860         (KJS::DateProtoFuncSetUTCHours::callAsFunction):
1861         (KJS::DateProtoFuncSetDate::callAsFunction):
1862         (KJS::DateProtoFuncSetUTCDate::callAsFunction):
1863         (KJS::DateProtoFuncSetMonth::callAsFunction):
1864         (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
1865         (KJS::DateProtoFuncSetFullYear::callAsFunction):
1866         (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
1867         (KJS::DateProtoFuncSetYear::callAsFunction):
1868         (KJS::DateProtoFuncGetYear::callAsFunction):
1869         * kjs/date_object.h:
1870         * kjs/lookup.cpp:
1871         (KJS::Lookup::find):
1872         * kjs/lookup.h:
1873         (KJS::HashEntry::):
1874         (KJS::staticFunctionGetter):
1875         (KJS::staticValueGetter):
1876         (KJS::getStaticPropertySlot):
1877         (KJS::getStaticFunctionSlot):
1878         (KJS::lookupPut):
1879         * kjs/math_object.cpp:
1880         (KJS::MathObjectImp::getOwnPropertySlot):
1881         (KJS::MathProtoFuncAbs::callAsFunction):
1882         (KJS::MathProtoFuncACos::callAsFunction):
1883         (KJS::MathProtoFuncASin::callAsFunction):
1884         (KJS::MathProtoFuncATan::callAsFunction):
1885         (KJS::MathProtoFuncATan2::callAsFunction):
1886         (KJS::MathProtoFuncCeil::callAsFunction):
1887         (KJS::MathProtoFuncCos::callAsFunction):
1888         (KJS::MathProtoFuncExp::callAsFunction):
1889         (KJS::MathProtoFuncFloor::callAsFunction):
1890         (KJS::MathProtoFuncLog::callAsFunction):
1891         (KJS::MathProtoFuncMax::callAsFunction):
1892         (KJS::MathProtoFuncMin::callAsFunction):
1893         (KJS::MathProtoFuncPow::callAsFunction):
1894         (KJS::MathProtoFuncRandom::callAsFunction):
1895         (KJS::MathProtoFuncRound::callAsFunction):
1896         (KJS::MathProtoFuncSin::callAsFunction):
1897         (KJS::MathProtoFuncSqrt::callAsFunction):
1898         (KJS::MathProtoFuncTan::callAsFunction):
1899         * kjs/math_object.h:
1900         (KJS::MathObjectImp::classInfo):
1901         (KJS::MathObjectImp::):
1902         * kjs/string_object.cpp:
1903         (KJS::StringPrototype::getOwnPropertySlot):
1904         (KJS::StringProtoFuncToString::callAsFunction):
1905         (KJS::StringProtoFuncValueOf::callAsFunction):
1906         (KJS::StringProtoFuncCharAt::callAsFunction):
1907         (KJS::StringProtoFuncCharCodeAt::callAsFunction):
1908         (KJS::StringProtoFuncConcat::callAsFunction):
1909         (KJS::StringProtoFuncIndexOf::callAsFunction):
1910         (KJS::StringProtoFuncLastIndexOf::callAsFunction):
1911         (KJS::StringProtoFuncMatch::callAsFunction):
1912         (KJS::StringProtoFuncSearch::callAsFunction):
1913         (KJS::StringProtoFuncReplace::callAsFunction):
1914         (KJS::StringProtoFuncSlice::callAsFunction):
1915         (KJS::StringProtoFuncSplit::callAsFunction):
1916         (KJS::StringProtoFuncSubstr::callAsFunction):
1917         (KJS::StringProtoFuncSubstring::callAsFunction):
1918         (KJS::StringProtoFuncToLowerCase::callAsFunction):
1919         (KJS::StringProtoFuncToUpperCase::callAsFunction):
1920         (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
1921         (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
1922         (KJS::StringProtoFuncLocaleCompare::callAsFunction):
1923         (KJS::StringProtoFuncBig::callAsFunction):
1924         (KJS::StringProtoFuncSmall::callAsFunction):
1925         (KJS::StringProtoFuncBlink::callAsFunction):
1926         (KJS::StringProtoFuncBold::callAsFunction):
1927         (KJS::StringProtoFuncFixed::callAsFunction):
1928         (KJS::StringProtoFuncItalics::callAsFunction):
1929         (KJS::StringProtoFuncStrike::callAsFunction):
1930         (KJS::StringProtoFuncSub::callAsFunction):
1931         (KJS::StringProtoFuncSup::callAsFunction):
1932         (KJS::StringProtoFuncFontcolor::callAsFunction):
1933         (KJS::StringProtoFuncFontsize::callAsFunction):
1934         (KJS::StringProtoFuncAnchor::callAsFunction):
1935         (KJS::StringProtoFuncLink::callAsFunction):
1936         * kjs/string_object.h:
1937
1938 2007-11-08  Adam Roben  <aroben@apple.com>
1939
1940         Windows build fix
1941
1942         Reviewed by Sam and Ada.
1943
1944         * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
1945         the build.
1946
1947 2007-11-08  Adam Roben  <aroben@apple.com>
1948
1949         Fix a precedence warning on Windows
1950
1951         * kjs/JSImmediate.h:
1952         (KJS::JSImmediate::toBoolean):
1953
1954 2007-11-08  Mark Rowe  <mrowe@apple.com>
1955
1956         Build fix for JavaScriptGlue.
1957
1958         * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
1959
1960 2007-11-08  Darin Adler  <darin@apple.com>
1961
1962         - Windows build fix
1963
1964         * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
1965
1966 2007-11-08  Oliver Hunt  <oliver@apple.com>
1967
1968         Reviewed by Darin.
1969
1970         Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
1971
1972         Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
1973         we should now have faster array access, faster immediate to double conversion, and the 
1974         potential to further improve bitwise operators in future.
1975
1976         This also removes the need for unions to avoid strict aliasing problems when extracting 
1977         a value from immediates.
1978
1979         * kjs/JSImmediate.h:
1980         (KJS::):
1981         (KJS::JSImmediate::trueImmediate):
1982         (KJS::JSImmediate::falseImmediate):
1983         (KJS::JSImmediate::undefinedImmediate):
1984         (KJS::JSImmediate::nullImmediate):
1985         (KJS::JSImmediate::toBoolean):
1986         * kjs/value.h:
1987         (KJS::jsNaN):
1988
1989 2007-11-07  Eric Seidel  <eric@webkit.org>
1990
1991         Reviewed by Darin and Oliver.
1992         
1993         Add evaluateToNumber parallel evaluation tree to speed up number operations.
1994         Make ImmediateNumberNode a subclass of NumberNode.
1995         Share evaluate logic between evaluate and evaluateToNumber using inline functions
1996         There is still a lot of improvement to be made here.
1997         
1998         SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
1999         Given the huge win that this prepares us for with simple type inferencing I see the small
2000         regression in base64 being worth the substantial overall improvement.
2001
2002         * kjs/grammar.y:
2003         * kjs/nodes.cpp:
2004         (KJS::Node::evaluateToNumber):
2005         (KJS::NumberNode::evaluate):
2006         (KJS::NumberNode::evaluateToNumber):
2007         (KJS::StringNode::evaluateToNumber):
2008         (KJS::LocalVarAccessNode::inlineEvaluate):
2009         (KJS::LocalVarAccessNode::evaluate):
2010         (KJS::LocalVarAccessNode::evaluateToNumber):
2011         (KJS::BracketAccessorNode::inlineEvaluate):
2012         (KJS::BracketAccessorNode::evaluate):
2013         (KJS::BracketAccessorNode::evaluateToNumber):
2014         (KJS::NegateNode::evaluate):
2015         (KJS::NegateNode::evaluateToNumber):
2016         (KJS::MultNode::inlineEvaluateToNumber):
2017         (KJS::MultNode::evaluate):
2018         (KJS::MultNode::evaluateToNumber):
2019         (KJS::DivNode::inlineEvaluateToNumber):
2020         (KJS::DivNode::evaluate):
2021         (KJS::DivNode::evaluateToNumber):
2022         (KJS::ModNode::inlineEvaluateToNumber):
2023         (KJS::ModNode::evaluate):
2024         (KJS::ModNode::evaluateToNumber):
2025         (KJS::throwOutOfMemoryErrorToNumber):
2026         (KJS::addSlowCaseToNumber):
2027         (KJS::add):
2028         (KJS::addToNumber):
2029         (KJS::AddNode::evaluateToNumber):
2030         (KJS::SubNode::inlineEvaluateToNumber):
2031         (KJS::SubNode::evaluate):
2032         (KJS::SubNode::evaluateToNumber):
2033         (KJS::valueForReadModifyAssignment):
2034         (KJS::ReadModifyLocalVarNode::evaluate):
2035         (KJS::ReadModifyResolveNode::evaluate):
2036         (KJS::ReadModifyDotNode::evaluate):
2037         (KJS::ReadModifyBracketNode::evaluate):
2038         * kjs/nodes.h:
2039         (KJS::Node::):
2040         (KJS::NumberNode::):
2041         (KJS::ImmediateNumberNode::):
2042         (KJS::AddNode::precedence):
2043         * kjs/nodes2string.cpp:
2044         (KJS::NumberNode::streamTo):
2045
2046 2007-11-07  Mark Rowe  <mrowe@apple.com>
2047
2048         Reviewed by Eric.
2049
2050         Fix up initialization after being mangled in r27572, and remove the
2051         ternary expression as extraCost will always be zero for the numeric
2052         heap.
2053
2054         * kjs/collector.cpp:
2055         (KJS::Collector::heapAllocate):
2056
2057 2007-11-07  Mark Rowe  <mrowe@apple.com>
2058
2059         Gtk build fix.
2060
2061         * kjs/regexp_object.cpp:
2062
2063 2007-11-07  Geoffrey Garen  <ggaren@apple.com>
2064
2065         Reviewed by Beth Dakin.
2066         
2067         Eliminated a bogus (though compiled-out) branch in the collector.
2068
2069         * kjs/collector.cpp:
2070         (KJS::Collector::heapAllocate):
2071
2072 2007-11-06  Geoffrey Garen  <ggaren@apple.com>
2073
2074         Reviewed by Darin Adler.
2075         
2076         Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861 
2077         5.8% of string-validate-input.js is spent creating RegExpImps
2078
2079         Put RegExpImp properties into a static hashtable to avoid a slew of
2080         PropertyMap churn when creating a RegExpImp.
2081         
2082         Factored important bits of regular expression implementation out of
2083         RegExpImp (the JS object) and into RegExp (the PCRE wrapper class), 
2084         making RegExp a ref-counted class. (This will help later.)
2085
2086         Removed PCRE_POSIX support because I didn't quite know how to test it 
2087         and keep it working with these changes.
2088         
2089         1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
2090
2091         * kjs/regexp.h: A few interface changes:
2092         1. Renamed "subpatterns()" => "numSubpatterns()"
2093         2. Made flag enumeration private and replaced it with public getters for
2094         specific flags.
2095         3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
2096         4. Made RegExp take a string of flags instead of an int, eliminating 
2097         duplicated flag parsing code elsewhere.
2098
2099         * kjs/regexp_object.cpp:
2100         (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile: 
2101         - Fixed a bug where compile(undefined) would throw an exception. 
2102         - Removed some now-redundant code.
2103         - Used RegExp sharing to eliminate an allocation and a bunch of 
2104         PropertyMap thrash. (Not a big win since compile is a deprecated 
2105         function. I mainly did this to test the plubming.)
2106
2107 2007-11-07  Simon Hausmann  <hausmann@kde.org>
2108
2109         Reviewed by nobody, Qt/Windows build fix.
2110
2111         JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
2112         testkjs.pro, too, where it's included from.
2113
2114         * kjs/testkjs.pro:
2115
2116 2007-11-07  Simon Hausmann  <shausman@trolltech.com>
2117
2118         Reviewed by Lars.
2119
2120         Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
2121
2122         * JavaScriptCore.pri:
2123         * pcre/pcre.pri:
2124
2125 2007-11-07  Lars Knoll  <lars@trolltech.com>
2126
2127         Reviewed by Simon.
2128
2129         fix umemcasecmp
2130         
2131         Pretty embarrassing bug. Has the potential to fix quite a few test failures.
2132
2133         * wtf/unicode/qt4/UnicodeQt4.h:
2134         (WTF::Unicode::umemcasecmp):
2135
2136 2007-11-06  Maciej Stachowiak  <mjs@apple.com>
2137
2138         Reviewed by Eric.        
2139         
2140         - only collect when the heap is full, unless we have lots of extra cost garbage
2141         
2142         1.1% SunSpider speedup.
2143         
2144         This shouldn't hit memory use much since the extra space in those
2145         blocks hangs around either way.
2146
2147         * kjs/collector.cpp:
2148         (KJS::Collector::heapAllocate):
2149         (KJS::Collector::collect): Fix logic error that reversed the sense of collect's 
2150         return value.
2151
2152 2007-11-06  Oliver Hunt  <oliver@apple.com>
2153
2154         Reviewed by Maciej.
2155
2156         Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
2157         
2158         We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
2159         'for (...; ...; ++<var>) ...'.
2160
2161         * kjs/nodes.cpp:
2162         (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
2163         (KJS::PostIncLocalVarNode::evaluate):
2164         (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
2165         (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
2166         (KJS::PostDecLocalVarNode::evaluate):
2167         (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
2168         * kjs/nodes.h:
2169         (KJS::PrePostResolveNode::):
2170         (KJS::PostIncResolveNode::):
2171         (KJS::PostIncLocalVarNode::):
2172         (KJS::PostDecResolveNode::):
2173         (KJS::PostDecLocalVarNode::):
2174         (KJS::PreIncResolveNode::):
2175         (KJS::PreDecResolveNode::):
2176         (KJS::ForNode::ForNode):
2177
2178 2007-11-06  Eric Seidel  <eric@webkit.org>
2179
2180         Reviewed by darin.
2181
2182         This fixes a regressed layout test for string + object
2183         
2184         SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
2185
2186         * kjs/nodes.cpp:
2187         (KJS::add): remove erroneous "fast path" for string + *
2188
2189 2007-11-06  Geoffrey Garen  <ggaren@apple.com>
2190
2191         Reviewed by Eric Seidel.
2192         
2193         Added toJSNumber, a fast path for converting a JSValue to a JS number,
2194         and deployed it in postfix expressions. In the fast case this 
2195         eliminates a call to jsNumber.
2196         
2197         0.4% speedup on SunSpider.
2198
2199         * ChangeLog:
2200         * kjs/nodes.cpp:
2201         (KJS::PostIncResolveNode::evaluate):
2202         (KJS::PostIncLocalVarNode::evaluate):
2203         (KJS::PostDecResolveNode::evaluate):
2204         (KJS::PostDecLocalVarNode::evaluate):
2205         (KJS::PostIncBracketNode::evaluate):
2206         (KJS::PostDecBracketNode::evaluate):
2207         (KJS::PostIncDotNode::evaluate):
2208         (KJS::PostDecDotNode::evaluate):
2209         (KJS::UnaryPlusNode::evaluate):
2210         * kjs/value.h:
2211         (KJS::JSValue::toJSNumber):
2212
2213 2007-11-06  Darin Adler  <darin@apple.com>
2214
2215         Reviewed by Maciej.
2216
2217         - http://bugs.webkit.org/show_bug.cgi?id=15846
2218           REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
2219
2220         There was a mistake in the algorithm used to find an empty slot in the property
2221         map entries vector; when we were putting in a new property value and not overwriting
2222         an existing deleted sentinel, we would enlarge the entries vector, but would not
2223         overwrite the stale data that's in the new part. It was easy to pin this down by
2224         turning on property map consistency checks -- I never would have landed with this
2225         bug if I had run the regression tests once with consistency checks on!
2226
2227         * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
2228         foundDeletedElement is false to always use the item at the end of the entries vector.
2229         Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
2230
2231 2007-11-06  Oliver Hunt  <oliver@apple.com>
2232
2233         RS=Darin.
2234
2235         Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
2236
2237         * kjs/nodes.cpp:
2238         (KJS::add):
2239
2240 2007-11-06  Oliver Hunt  <oliver@apple.com>
2241
2242         Reviewed by Darin.
2243
2244         Replace boolean comparisons in AddNode with mask
2245         comparisons for a 0.2% improvement in sunspider.
2246
2247         * JavaScriptCore.xcodeproj/project.pbxproj:
2248         * kjs/nodes.cpp:
2249         (KJS::add):
2250
2251 2007-11-06  Eric Seidel  <eric@webkit.org>
2252
2253         Reviewed by darin.
2254         
2255         SunSpider claims this is a 1.1% speedup.
2256
2257         * kjs/nodes.cpp:
2258         (KJS::throwOutOfMemoryError): Added, non inline.
2259         (KJS::addSlowCase): renamed from add(), non inline.
2260         (KJS::add): add fast path for String + String, Number + Number and String + *
2261
2262 2007-11-06  Eric Seidel  <eric@webkit.org>
2263
2264         Reviewed by mjs.
2265         
2266         Avoid more UString creation.
2267         
2268         SunSpider claims this is a 0.4% speedup.
2269
2270         * kjs/regexp_object.cpp:
2271         (KJS::RegExpObjectImp::construct): use UString::find(UChar)
2272
2273 2007-11-05  Mark Rowe  <mrowe@apple.com>
2274
2275         Mac build fix.
2276
2277         * kjs/array_object.cpp:
2278         (KJS::ArrayProtoFunc::callAsFunction):
2279
2280 2007-11-05  Adam Roben  <aroben@apple.com>
2281
2282         Windows build fix
2283
2284         * kjs/list.h:
2285
2286 2007-11-05  Mark Rowe  <mrowe@apple.com>
2287
2288         Build fix.  Add missing #include.
2289
2290         * kjs/operations.cpp:
2291
2292 2007-11-05  Eric Seidel  <eric@webkit.org>
2293
2294         Reviewed by mjs.
2295         
2296         Remove another call to toString(exec)
2297         
2298         SunSpider claims this is a 0.5% speedup.
2299
2300         * kjs/operations.cpp:
2301         (KJS::equal): remove another toString
2302
2303 2007-11-05  Eric Seidel  <eric@webkit.org>
2304
2305         * kjs/operations.cpp:
2306         (KJS::equal): correct broken change.
2307
2308 2007-11-05  Eric Seidel  <eric@webkit.org>
2309
2310         Reviewed by mjs.
2311
2312         Remove one more call to toString(exec).
2313         
2314         SunSpider claims this is a 0.7% speedup.
2315
2316         * kjs/operations.cpp:
2317         (KJS::equal): remove a call to toString()
2318
2319 2007-11-05  Mark Rowe  <mrowe@apple.com>
2320
2321         Gtk build fix.
2322
2323         * pcre/pcre.pri:
2324
2325 2007-11-05  Mark Rowe  <mrowe@apple.com>
2326
2327         Gtk build fix.
2328
2329         * kjs/list.cpp:
2330
2331 2007-11-05  Geoffrey Garen  <ggaren@apple.com>
2332
2333         Touched a file to test my new HTTP access.
2334
2335         * kjs/scope_chain.cpp:
2336
2337 2007-11-05  Alp Toker  <alp@atoker.com>
2338
2339         Unreviewed build fix for qmake-based ports.
2340
2341         Someone with a better understanding of qmake still needs to sort out
2342         the INCLUDEPATH/DEPENDPATH mess.
2343
2344         * JavaScriptCore.pri:
2345
2346 2007-11-05  Geoffrey Garen  <ggaren@apple.com>
2347
2348         Reviewed by Darin Adler.
2349         
2350         http://bugs.webkit.org/show_bug.cgi?id=15835
2351
2352         Switched List implementation from a custom heap allocator to an inline
2353         Vector, for a disappointing .5% SunSpider speedup.
2354         
2355         Also renamed List::slice to List::getSlice because "get" is the 
2356         conventional prefix for functions returning a value through an out 
2357         parameter.
2358
2359         * kjs/array_object.cpp:
2360         (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
2361         calls and memory accesses.
2362
2363         * kjs/bool_object.cpp:
2364         (BooleanObjectImp::construct): Removed questionable use of iterator.
2365
2366         * kjs/list.cpp:
2367         * kjs/list.h: New List class, implemented in terms of Vector. Two 
2368         interesting differences:
2369             1. The inline capacity is 8, not 5. Many of the Lists constructed 
2370             during a SunSpider run are larger than 5; almost none are larger
2371             than 8.
2372
2373             2. The growth factor is 4, not 2. Since we can guarantee that Lists
2374             aren't long-lived, we can grow them more aggressively, to avoid
2375             excessive copying.
2376
2377         * kjs/regexp_object.cpp:
2378         (RegExpObjectImp::construct): Removed redundant function calls.
2379
2380         * kjs/string_object.cpp:
2381         (KJS::StringObjectImp::construct): Removed questionable use of iterator.
2382
2383         * wtf/Vector.h:
2384         (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
2385
2386 2007-11-05  Mark Rowe  <mrowe@apple.com>
2387
2388         Reviewed by Alp Toker.
2389
2390         Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
2391
2392         * JavaScriptCore.pri:
2393         * pcre/pcre.pri:
2394
2395 2007-11-04  Darin Adler  <darin@apple.com>
2396
2397         Reviewed by Maciej.
2398
2399         - http://bugs.webkit.org/show_bug.cgi?id=15826
2400           optimize opcode loop and case insensitive ASCII compares for a 30% speedup
2401
2402         SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
2403
2404         * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
2405
2406         * pcre/pcre_compile.c:
2407         (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
2408         added OP_NOT since there was no reason it should not be in here.
2409         (could_be_empty_branch): Ditto.
2410         (compile_branch): Streamlined all the single-character cases; there was a bit of
2411         duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
2412         But in particular, compile to those opcodes when the single character match is
2413         ASCII.
2414         (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
2415
2416         * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
2417         the matchframe, after I discovered that none of them needed to be saved and restored
2418         across recursive match calls. Also eliminated the ignored result field from the
2419         matchframe, since I discovered that rrc ("recursive result code") was already the
2420         exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
2421         statement of the switch instead of doing them before the switch. This removes a
2422         branch from each iteration of the opcode interpreter, just as removal of "op"
2423         removed at least one store from each iteration. Last, but not least, add the
2424         OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
2425         surrogate pair and the letter case can be handled efficiently.
2426
2427 2007-11-04  Darin Adler  <darin@apple.com>
2428
2429         * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
2430
2431 2007-11-03  Darin Adler  <darin@apple.com>
2432
2433         - fix non-Mac builds; remove some more unused PCRE stuff
2434
2435         * pcre/pcre_compile.c:
2436         (compile_branch): Removed branch chain and some unused ESC values.
2437         (compile_regex): Ditto.
2438         (jsRegExpCompile): Ditto.
2439         * pcre/pcre_exec.c:
2440         (match): Removed unused branch targets. Don't use macros any more.
2441         (jsRegExpExecute): More of the same.
2442
2443         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
2444         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2445         * pcre/pcre.pri: Ditto.
2446
2447         * pcre/MERGING: Removed.
2448         * pcre/pcre_fullinfo.c: Removed.
2449         * pcre/pcre_get.c: Removed.
2450         * pcre/pcre_internal.h:
2451         * pcre/ucp.h: Removed.
2452
2453 2007-11-03  Darin Adler  <darin@apple.com>
2454
2455         Reviewed by Maciej.
2456
2457         - http://bugs.webkit.org/show_bug.cgi?id=15821
2458           remove unused PCRE features for speed
2459
2460         A first step toward removing the PCRE features we don't use.
2461         This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
2462         the SunSpider regular expression test.
2463
2464         Replaced the public interface with one that doesn't use the
2465         name PCRE. Removed code we don't need for JavaScript and various
2466         configurations we don't use. This is in preparation for still
2467         more changes in the future. We'll probably switch to C++ and
2468         make some even more significant changes to the regexp engine
2469         to get some additional speed.
2470
2471         There's probably additional unused stuff that I haven't
2472         deleted yet.
2473
2474         This does mean that our PCRE is now a fork, but I think that's
2475         not really a big deal.
2476
2477         * JavaScriptCore.exp: Remove the 5 old entry points and add
2478         the 3 new entry points for WebCore's direct use of the regular
2479         expression engine.
2480
2481         * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
2482         its sense and now there's a USE(POSIX_REGEX) instead, which should
2483         probably not be set by anyone. Maybe later we'll just get rid of it
2484         altogether.
2485
2486         * kjs/regexp.h:
2487         * kjs/regexp.cpp:
2488         (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
2489         defines. Cut down on the number of functions used.
2490         (KJS::RegExp::~RegExp): Ditto.
2491         (KJS::RegExp::match): Ditto.
2492
2493         * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
2494         which are unused.
2495
2496         * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
2497         size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
2498         POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
2499         and JAVASCRIPT. These are all no longer configurable in our copy
2500         of the library.
2501
2502         * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
2503         version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
2504         the include of <stdlib.h>, and most of the constants and
2505         functions defined in this header. Changed the naming scheme to
2506         use a JSRegExp prefix rather than a pcre prefix. In the future,
2507         we'll probably change this to be a C++ header.
2508
2509         * pcre/pcre_compile.c: Removed all unused code branches,
2510         including many whole functions and various byte codes.
2511         Kept changes outside of removal to a minimum.
2512         (check_escape):
2513         (first_significant_code):
2514         (find_fixedlength):
2515         (find_recurse):
2516         (could_be_empty_branch):
2517         (compile_branch):
2518         (compile_regex):
2519         (is_anchored):
2520         (is_startline):
2521         (find_firstassertedchar):
2522         (jsRegExpCompile): Renamed from pcre_compile2 and changed the
2523         parameters around a bit.
2524         (jsRegExpFree): Added.
2525
2526         * pcre/pcre_exec.c: Removed many unused opcodes and variables.
2527         Also started tearing down the NO_RECURSE mechanism since it's
2528         now the default. In some cases there were things in the explicit
2529         frame that could be turned into plain old local variables and
2530         other small like optimizations.
2531         (pchars):
2532         (match_ref):
2533         (match): Changed parameters quite a bit since it's now not used
2534         recursively.
2535         (jsRegExpExecute): Renamed from pcre_exec.
2536
2537         * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
2538         PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
2539         PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
2540         PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
2541         _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
2542         and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
2543
2544         * pcre/pcre_maketables.c: Changed to only compile in dftables.
2545         Also got rid of many of the tables that we don't use.
2546
2547         * pcre/pcre_tables.c: Removed the unused Unicode property tables.
2548
2549         * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
2550         _pcre_ucp_othercase.
2551
2552         * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
2553         for classes based on Unicode properties.
2554
2555         * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
2556         to eliminate this completely, but we need the regular expression
2557         code to be C++ first.
2558
2559         * pcre/pcre_fullinfo.c:
2560         * pcre/pcre_get.c:
2561         * pcre/ucp.h:
2562         Files that are no longer needed. I didn't remove them with this
2563         check-in, because I didn't want to modify all the project files.
2564
2565 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
2566
2567         Reviewed by Sam.
2568         
2569         - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
2570
2571         It turns out that doing this check costs more than it saves.
2572         
2573         * kjs/JSImmediate.h:
2574         (KJS::JSImmediate::fromDouble):
2575
2576 2007-11-03  Sam Weinig  <sam@webkit.org>
2577
2578         Reviewed by Oliver.
2579
2580         Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
2581         The variable had been kept around for binary compatibility, but since nothing
2582         else is there is no point in continuing to keep it around.
2583
2584         * API/JSCallbackConstructor.cpp:
2585         (KJS::):
2586         * API/JSCallbackFunction.cpp:
2587         (KJS::):
2588         * API/JSCallbackObject.cpp:
2589         (KJS::):
2590         * bindings/objc/objc_runtime.mm:
2591         * bindings/runtime_array.cpp:
2592         * bindings/runtime_object.cpp:
2593         * kjs/array_instance.cpp:
2594         (KJS::):
2595         * kjs/array_object.cpp:
2596         (KJS::):
2597         * kjs/bool_object.cpp:
2598         * kjs/date_object.cpp:
2599         (KJS::):
2600         * kjs/error_object.cpp:
2601         * kjs/function.cpp:
2602         (KJS::):
2603         * kjs/internal.cpp:
2604         (KJS::):
2605         * kjs/lookup.h:
2606         * kjs/math_object.cpp:
2607         * kjs/number_object.cpp:
2608         * kjs/object.h:
2609         * kjs/regexp_object.cpp:
2610         * kjs/string_object.cpp:
2611         (KJS::):
2612
2613 2007-11-03  Kevin McCullough  <kmccullough@apple.com>
2614
2615         - Updated testkjs results to make the build bots green until we
2616         can fix the tests that are failing.  The new failures are in DST.
2617
2618         * tests/mozilla/expected.html:
2619
2620 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
2621
2622         Reviewed by Adam.
2623         
2624         - don't print the var twice for ForInNodes with a var declaration
2625
2626         * kjs/nodes2string.cpp:
2627         (KJS::ForInNode::streamTo):
2628
2629 2007-11-03  Darin Adler  <darin@apple.com>
2630
2631         * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
2632         C-incompatible declaration.
2633
2634 2007-11-03  Mark Rowe  <mrowe@apple.com>
2635
2636         Gtk build fix.
2637
2638         * kjs/nodes.cpp:  Add missing include.
2639
2640 2007-11-03  Darin Adler  <darin@apple.com>
2641
2642         Reviewed by Maciej.
2643
2644         - fix http://bugs.webkit.org/show_bug.cgi?id=15814
2645           <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
2646
2647         These changes cause us to match the JavaScript specification and pass the
2648         fast/js/kde/encode_decode_uri.html test.
2649
2650         * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
2651         new strict mode, throwing an exception if there are malformed UTF-16 surrogate
2652         pairs in the text.
2653
2654         * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
2655         * kjs/ustring.cpp:
2656         (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
2657         those might be illegal in some sense, they aren't supposed to get any special
2658         handling in the place where this function is currently used.
2659         (KJS::UString::UTF8String): Added the strictness.
2660
2661 2007-11-03  Darin Adler  <darin@apple.com>
2662
2663         Reviewed by Maciej.
2664
2665         - http://bugs.webkit.org/show_bug.cgi?id=15812
2666           some JavaScript tests (from the Mozilla test suite) are failing
2667
2668         Two or three fixes get 7 more of the Mozilla tests passing.
2669         This gets us down from 61 failing tests to 54.
2670
2671         * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
2672         Made this inline and gave it a more specific type. Some day we should
2673         probably do that for all of these -- might even get a bit of a speed
2674         boost from it.
2675         * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
2676         inline in the header.
2677
2678         * kjs/regexp_object.h:
2679         * kjs/regexp_object.cpp:
2680         (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
2681         switch statement into the RegExpImp object, so they can be shared with
2682         RegExpImp::callAsFunction.
2683         (KJS::RegExpImp::match): Added. Common code used by both test and exec.
2684         (KJS::RegExpImp::test): Added.
2685         (KJS::RegExpImp::exec): Added.
2686         (KJS::RegExpImp::implementsCall): Added.
2687         (KJS::RegExpImp::callAsFunction): Added.
2688         (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
2689         lastInput to null rather than empty string -- we take advantage of the
2690         difference in RegExpImp::match.
2691         (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
2692         just to get at a field like this.
2693
2694         * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
2695         the JavaScript specification. If there are not 4 hex digits after the \u,
2696         then it's processed as if it wasn't an escape sequence at all.
2697
2698         * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
2699         for JavaScript (4 specific Unicode values).
2700         * pcre/pcre_exec.c:
2701         (match): Changed all call sites to use IS_NEWLINE.
2702         (pcre_exec): Ditto.
2703
2704         * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2705
2706 2007-11-03  David D. Kilzer  <ddkilzer@webkit.org>
2707
2708         Sort files(...); sections of Xcode project files.
2709
2710         Rubber-stamped by Darin.
2711
2712         * JavaScriptCore.xcodeproj/project.pbxproj:
2713
2714 2007-11-03  Maciej Stachowiak  <mjs@apple.com>
2715
2716         Reviewed by Oliver.
2717         
2718         - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
2719
2720         * kjs/grammar.y:
2721         * kjs/nodes.cpp:
2722         (KJS::VarDeclNode::optimizeVariableAccess):
2723         (KJS::VarDeclNode::getDeclarations):
2724         (KJS::VarDeclNode::handleSlowCase):
2725         (KJS::VarDeclNode::evaluateSingle):
2726         (KJS::VarDeclNode::evaluate):
2727         (KJS::VarStatementNode::execute):
2728         * kjs/nodes.h:
2729         (KJS::VarDeclNode::):
2730         (KJS::VarStatementNode::):
2731         * kjs/nodes2string.cpp:
2732         (KJS::VarDeclNode::streamTo):
2733
2734 2007-11-03  Alexey Proskuryakov  <ap@webkit.org>
2735
2736         Reviewed by Darin.
2737
2738         http://bugs.webkit.org/show_bug.cgi?id=15800
2739         REGRESSION (r27303): RegExp leaks
2740
2741         * kjs/regexp_object.h:
2742         (KJS::RegExpImp::setRegExp):
2743         (KJS::RegExpImp::regExp):
2744         (KJS::RegExpImp::classInfo):
2745         * kjs/regexp_object.cpp:
2746         (RegExpImp::RegExpImp):
2747         (RegExpImp::~RegExpImp):
2748         Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2749
2750 2007-11-02  Maciej Stachowiak  <mjs@apple.com>
2751
2752         Reviewed by Oliver.
2753         
2754         - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
2755
2756         * kjs/grammar.y:
2757         * kjs/nodes.cpp:
2758         (KJS::statementListPushFIFO):
2759         (KJS::statementListGetDeclarations):
2760         (KJS::statementListInitializeDeclarationStacks):
2761         (KJS::statementListInitializeVariableAccessStack):
2762         (KJS::statementListExecute):
2763         (KJS::BlockNode::BlockNode):
2764         (KJS::FunctionBodyNode::FunctionBodyNode):
2765         (KJS::ProgramNode::ProgramNode):
2766         * kjs/nodes.h:
2767         (KJS::CaseClauseNode::):
2768
2769 2007-11-02  Darin Adler  <darin@apple.com>
2770
2771         Reviewed by Maciej.
2772
2773         - http://bugs.webkit.org/show_bug.cgi?id=15791
2774           change property map data structure for less memory use, better speed
2775
2776         The property map now has an array of indices and a separate array of
2777         property map entries. This slightly slows down lookup because of a second
2778         memory acess, but makes property maps smaller and faster to iterate in
2779         functions like mark().
2780
2781         SunSpider says this is 1.2% faster, although it makes the bitwise-end test
2782         more than 10% slower. To fix that we'll need to optimize global variable lookup.
2783
2784         * kjs/property_map.cpp:
2785         (KJS::PropertyMapEntry::PropertyMapEntry):
2786         (KJS::PropertyMapHashTable::entries):
2787         (KJS::PropertyMapHashTable::allocationSize):
2788         (KJS::SavedProperties::SavedProperties):
2789         (KJS::SavedProperties::~SavedProperties):
2790         (KJS::PropertyMap::checkConsistency):
2791         (KJS::PropertyMap::~PropertyMap):
2792         (KJS::PropertyMap::clear):
2793         (KJS::PropertyMap::get):
2794         (KJS::PropertyMap::getLocation):
2795         (KJS::PropertyMap::put):
2796         (KJS::PropertyMap::insert):
2797         (KJS::PropertyMap::createTable):
2798         (KJS::PropertyMap::rehash):
2799         (KJS::PropertyMap::remove):
2800         (KJS::PropertyMap::mark):
2801         (KJS::comparePropertyMapEntryIndices):
2802         (KJS::PropertyMap::containsGettersOrSetters):
2803         (KJS::PropertyMap::getEnumerablePropertyNames):
2804         (KJS::PropertyMap::save):
2805         (KJS::PropertyMap::restore):
2806         * kjs/property_map.h:
2807
2808 2007-11-02  Darin Adler  <darin@apple.com>
2809
2810         Reviewed by Maciej.
2811
2812         - http://bugs.webkit.org/show_bug.cgi?id=15807
2813           HashMap needs a take() function that combines get and remove
2814
2815         * wtf/HashMap.h: Added take function. Simplistic implementation for now,
2816         but still does only one hash table lookup.
2817
2818         * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
2819         a find followed by a remove.
2820
2821 2007-11-02  David Carson  <dacarson@gmail.com>
2822
2823         Reviewed by Darin.
2824
2825         Fix compiler warning "warning: suggest parentheses around && within ||"
2826         http://bugs.webkit.org/show_bug.cgi?id=15764
2827
2828         * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2829
2830 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2831
2832         Reviewed by Maciej Stachowiak.
2833         
2834         In preparation for making List a simple stack-allocated Vector:
2835
2836         Removed all instances of List copying and/or assignment, and made List 
2837         inherit from Noncopyable.
2838         
2839         Functions that used to return a List by copy now take List& out 
2840         parameters.
2841         
2842         Layout tests and JS tests pass.
2843
2844         * kjs/list.cpp:
2845         (KJS::List::slice): Replaced copyTail with a more generic slice 
2846         alternative. (JavaScriptCore only calls slice(1), but WebCore calls 
2847         slice(2)).
2848
2849 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2850
2851         Reviewed by Maciej Stachowiak.
2852
2853         Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
2854         REGRESSION(r27344): Crash on load at finance.yahoo.com
2855         
2856         Reverted a small portion of my last check-in. (The speedup and the List 
2857         removal are still there, though.)
2858         
2859         ActivationImp needs to hold a pointer to its function, and mark that 
2860         pointer (rather than accessing its function through its ExecState, and 
2861         counting on the active scope to mark its function) because a closure 
2862         can cause an ActivationImp to outlive its ExecState along with any 
2863         active scope.
2864
2865         * kjs/ExecState.cpp:
2866         (KJS::ExecState::ExecState):
2867         * kjs/function.cpp:
2868         (KJS::FunctionImp::~FunctionImp):
2869         (KJS::ActivationImp::ActivationImp):
2870         * kjs/function.h:
2871         (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2872
2873         Also made HashTable a little more crash-happy in debug builds, so 
2874         problems like this will show up earlier:
2875         
2876         * wtf/HashTable.h:
2877         (WTF::HashTable::~HashTable):
2878
2879 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2880
2881         Reviewed by Adam Roben.
2882         
2883         Addressed some of Darin's review comments.
2884         
2885         Used perl -p, which is the shorthand while(<>) {}.
2886         
2887         Made sure not to suppress bison's output.
2888         
2889         Added line to removed bison_out.txt, since this script removes other 
2890         intermediate files, too.
2891
2892         * DerivedSources.make:
2893
2894 2007-11-01  Geoffrey Garen  <ggaren@apple.com>
2895
2896         Reviewed by Oliver Hunt.
2897         
2898         Removed List from ActivationImp, in preparation for making all lists
2899         stack-allocated.
2900         
2901         Tests pass.
2902         
2903         1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
2904
2905         * kjs/ExecState.cpp:
2906         (KJS::ExecState::ExecState):
2907         (KJS::ExecState::~ExecState):
2908         * kjs/function.cpp:
2909         (KJS::ActivationImp::ActivationImp):
2910         (KJS::ActivationImp::createArgumentsObject):
2911         * kjs/function.h:
2912         (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2913
2914 2007-11-01  Adam Roben  <aroben@apple.com>
2915
2916         Use jsNumberCell instead of jsNumber when converting double constants to JSValues
2917
2918         This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
2919         ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
2920
2921         It also gets rid of an MSVC warning that we previously had to silence.
2922
2923         Reviewed by Geoff.
2924
2925         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
2926         back on the "overflow in constant arithmetic" warning.
2927         * kjs/number_object.cpp:
2928         (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
2929         jsNumber.
2930
2931 2007-10-31  Adam Roben  <aroben@apple.com>
2932
2933         Windows build fix
2934
2935         * kjs/ExecState.h:
2936
2937 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
2938
2939         Reviewed by Oliver.
2940         
2941         - shave some cycles off of local storage access for a 1% SunSpider speedup
2942         
2943         Keep the LocalStorage pointer in the ExecState, instead of getting
2944         it from the ActivationImp all the time.
2945
2946         * kjs/ExecState.cpp:
2947         (KJS::ExecState::updateLocalStorage):
2948         * kjs/ExecState.h:
2949         (KJS::ExecState::localStorage):
2950         * kjs/nodes.cpp:
2951         (KJS::LocalVarAccessNode::evaluate):
2952         (KJS::LocalVarFunctionCallNode::evaluate):
2953         (KJS::PostIncLocalVarNode::evaluate):
2954         (KJS::PostDecLocalVarNode::evaluate):
2955         (KJS::LocalVarTypeOfNode::evaluate):
2956         (KJS::PreIncLocalVarNode::evaluate):
2957         (KJS::PreDecLocalVarNode::evaluate):
2958         (KJS::ReadModifyLocalVarNode::evaluate):
2959         (KJS::AssignLocalVarNode::evaluate):
2960         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2961
2962 2007-10-31  Adam Roben  <aroben@apple.com>
2963
2964         Fix a crash on launch due to a static initializer race
2965
2966         We now use fast inline assembler spinlocks which can be statically
2967         initialized at compile time.
2968
2969         As a side benefit, this speeds up SunSpider by 0.4%.
2970
2971         Reviewed by Oliver.
2972
2973         * wtf/FastMalloc.cpp:
2974         * wtf/TCSpinLock.h:
2975         (TCMalloc_SpinLock::Lock):
2976         (TCMalloc_SpinLock::Unlock):
2977         (TCMalloc_SlowLock):
2978         * wtf/TCSystemAlloc.cpp:
2979
2980 2007-10-31  Kevin McCullough  <kmccullough@apple.com>
2981
2982         Reviewed by Sam.
2983
2984         - Corrected spelling.
2985
2986         * wtf/HashTraits.h:
2987
2988 2007-10-31  Mark Rowe  <mrowe@apple.com>
2989
2990         Further Gtk build fixage.
2991
2992         * kjs/regexp_object.cpp:
2993
2994 2007-10-31  Mark Rowe  <mrowe@apple.com>
2995
2996         Gtk build fix.
2997
2998         * kjs/regexp.h:
2999
3000 2007-10-31  Darin Adler  <darin@apple.com>
3001
3002         Reviewed by Maciej.
3003
3004         - fix http://bugs.webkit.org/show_bug.cgi?id=15749
3005           RegExp/RegExpObjectImp cause needless UString creation
3006
3007         Speeds things up 0.4% according to SunSpider.
3008
3009         * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
3010         because this library doesn't use the real PCRE -- it uses its
3011         own PCRE that works on UTF-16.
3012
3013         * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
3014         Use Noncopyable. Change the return value of match.
3015         * kjs/regexp.cpp:
3016         (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
3017         (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
3018         (KJS::RegExp::match): Change to return the position as an int and the
3019         ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
3020
3021         * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
3022         require a result string.
3023         * kjs/regexp_object.cpp:
3024         (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
3025         (RegExpObjectImp::performMatch): Change so it doesn't return a string.
3026         (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
3027         the main result with the backreferences; now it doesn't need to take
3028         a result parameter.
3029         (RegExpObjectImp::getBackref): Minor tweaks.
3030         (RegExpObjectImp::getLastParen): Ditto.
3031         (RegExpObjectImp::getLeftContext): Ditto.
3032         (RegExpObjectImp::getRightContext): Ditto.
3033         (RegExpObjectImp::getValueProperty): Change LastMatch case to call
3034         getBackref(0) so we don't need a separate getLastMatch function.
3035
3036         * kjs/string_object.cpp:
3037         (KJS::replace): Update to use new performMatch, including merging the
3038         matched string section with the other substrings.
3039         (KJS::StringProtoFunc::callAsFunction): Update functions to use the
3040         new performMatch and match. Also change to use OwnArrayPtr.
3041
3042 2007-10-31  Oliver Hunt  <oliver@apple.com>
3043
3044         * kjs/nodes.h: include OwnPtr.h
3045
3046 2007-10-31  Oliver Hunt  <oliver@apple.com>
3047
3048         Reviewed by Maciej.
3049
3050         Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
3051
3052         * kjs/grammar.y:
3053         * kjs/nodes.cpp:
3054         (KJS::statementListPushFIFO):
3055         (KJS::statementListGetDeclarations):
3056         (KJS::statementListInitializeDeclarationStacks):
3057         (KJS::statementListInitializeVariableAccessStack):
3058         (KJS::statementListExecute):
3059         (KJS::BlockNode::optimizeVariableAccess):
3060         (KJS::BlockNode::BlockNode):
3061         (KJS::BlockNode::getDeclarations):
3062         (KJS::BlockNode::execute):
3063         (KJS::CaseClauseNode::optimizeVariableAccess):
3064         (KJS::CaseClauseNode::getDeclarations):
3065         (KJS::CaseClauseNode::evalStatements):
3066         (KJS::FunctionBodyNode::initializeDeclarationStacks):
3067         (KJS::FunctionBodyNode::optimizeVariableAccess):
3068         * kjs/nodes.h:
3069         * kjs/nodes2string.cpp:
3070         (KJS::statementListStreamTo):
3071         (KJS::BlockNode::streamTo):
3072         (KJS::CaseClauseNode::streamTo):
3073
3074 2007-10-30  Mark Rowe  <mrowe@apple.com>
3075
3076         * kjs/property_map.cpp: Added a missing using directive to fix the build
3077         for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
3078
3079 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
3080
3081         * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
3082         for non-Mac ports.
3083
3084 2007-10-31  Alexey Proskuryakov  <ap@webkit.org>
3085
3086         Reviewed by Darin.
3087
3088         http://bugs.webkit.org/show_bug.cgi?id=11001
3089         WebKit doesn't support RegExp.compile method
3090
3091         Test: fast/js/regexp-compile.html
3092
3093         * kjs/regexp_object.cpp:
3094         (RegExpPrototype::RegExpPrototype):
3095         (RegExpProtoFunc::callAsFunction):
3096         * kjs/regexp_object.h:
3097         (KJS::RegExpProtoFunc::):
3098         Added RegExp.compile.
3099
3100         * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
3101
3102 2007-10-31  Maciej Stachowiak  <mjs@apple.com>
3103
3104         Reviewed by Oliver.
3105         
3106         - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
3107         
3108         Integer divide sucks. Fortunately, a bunch of shifts and XORs
3109         biased towards the high bits is sufficient to provide a good
3110         double hash. Besides the SunSpider win, I used the dump statistics
3111         mode for both to verify that collisions did not increase and that
3112         the longest collision chain is not any longer.
3113
3114         * kjs/property_map.cpp:
3115         (KJS::doubleHash):
3116         (KJS::PropertyMap::get):
3117         (KJS::PropertyMap::getLocation):
3118         (KJS::PropertyMap::put):
3119         (KJS::PropertyMap::insert):
3120         (KJS::PropertyMap::remove):
3121         (KJS::PropertyMap::checkConsistency):
3122         * wtf/HashTable.h:
3123         (WTF::doubleHash):
3124         (WTF::::lookup):
3125         (WTF::::lookupForWriting):
3126         (WTF::::fullLookupForWriting):
3127         (WTF::::add):
3128
3129 2007-10-30  Adam Roben  <aroben@apple.com>
3130
3131         * kjs/collector.h: Make HeapType public so it can be used for non-member
3132         things like the HeapConstants struct template. Fixes the build on Windows.
3133
3134 2007-10-30  Adam Roben  <aroben@apple.com>
3135
3136         Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
3137
3138         Speeds up SunSpider by 0.4%.
3139
3140         Reviewed by Steve and Maciej.
3141
3142         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
3143         a warning during LTCG in release builds about double -> float
3144         conversion.
3145         * wtf/AlwaysInline.h:
3146         * wtf/FastMalloc.h:
3147
3148 2007-10-30  Adam Roben  <aroben@apple.com>
3149
3150         Use GetCurrentThreadId instead of pthread_self in FastMalloc
3151
3152         Speeds up SunSpider by 0.3%.
3153
3154         Reviewed by Steve.
3155
3156         * wtf/FastMalloc.cpp:
3157         (WTF::TCMalloc_ThreadCache::InitTSD):
3158         (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3159
3160 2007-10-30  Adam Roben  <aroben@apple.com>
3161
3162         Switch to a Win32 critical section implementation of spinlocks
3163         
3164         Speeds up SunSpider by 0.4%.
3165         
3166         Reviewed by Steve.
3167         
3168         * wtf/FastMalloc.cpp:
3169         * wtf/TCSpinLock.h:
3170         (TCMalloc_SpinLock::TCMalloc_SpinLock):
3171         (TCMalloc_SpinLock::Init):
3172         (TCMalloc_SpinLock::Finalize):
3173         (TCMalloc_SpinLock::Lock):
3174         (TCMalloc_SpinLock::Unlock):
3175         * wtf/TCSystemAlloc.cpp:
3176
3177 2007-10-30  Adam Roben  <aroben@apple.com>
3178
3179         Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
3180
3181         http://bugs.webkit.org/show_bug.cgi?id=15586
3182
3183         Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
3184
3185         Use Win32 TLS functions instead of __declspec(thread), which breaks
3186         delay-loading.
3187
3188         Reviewed by Steve.
3189
3190         * wtf/FastMalloc.cpp:
3191         (WTF::getThreadHeap):
3192         (WTF::TCMalloc_ThreadCache::InitModule):
3193
3194 2007-10-30  Maciej Stachowiak  <mjs@apple.com>
3195
3196         Reviewed by Oliver.
3197         
3198         - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
3199         http://bugs.webkit.org/show_bug.cgi?id=15772
3200         
3201         We do this by using a single mark bit per two number cells, and
3202         tweaking marking.
3203         
3204         Besides being an 0.5% win overall, this is a 7.1% win on morph.
3205
3206         * kjs/collector.cpp:
3207         (KJS::):
3208         (KJS::Collector::heapAllocate):
3209         (KJS::Collector::markStackObjectsConservatively):
3210         (KJS::Collector::sweep):
3211         * kjs/collector.h:
3212         (KJS::SmallCollectorCell::):
3213
3214 2007-10-30  Geoffrey Garen  <ggaren@apple.com>
3215
3216         Reviewed by Adam Roben, Sam Weinig.
3217         
3218         Made conflicts in grammar.y a persistent build failure.
3219
3220         * DerivedSources.make:
3221
3222 2007-10-30  Kevin McCullough  <kmccullough@apple.com>
3223
3224         Reviewed by Adam and Geoff.
3225
3226         - Added a new cast so all the casts are in the same place.
3227
3228         * API/APICast.h:
3229         (toGlobalRef):
3230
3231 2007-10-30  Geoffrey Garen  <ggaren@apple.com>
3232
3233         Reviewed by Darin Adler.
3234
3235         Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
3236         
3237         JS tests, including 
3238
3239             ecma_2/Statements/dowhile-001.js
3240             ecma_2/Statements/dowhile-002.js
3241             ecma_2/Statements/dowhile-003.js
3242             ecma_2/Statements/dowhile-004.js
3243             ecma_2/Statements/dowhile-005.js
3244             ecma_2/Statements/dowhile-006.js
3245             ecma_2/Statements/dowhile-007.js
3246             js1_2/statements/do_while.js
3247
3248         and layout tests, including
3249
3250             do-while-expression-value.html
3251             do-while-semicolon.html
3252             do-while-without-semicolon.html
3253         
3254         pass.
3255         
3256         * kjs/grammar.y: Use the explicit "error" production, as we do with other
3257         automatic semicolon insertions, to disambiguate "do { } while();" from
3258         "do { } while()" followed by ";" (the empty statement).
3259
3260 2007-10-29  Oliver Hunt  <oliver@apple.com>
3261
3262         Reviewed by Maciej.
3263
3264         Debranching remaining assignment nodes, and miscellaneous cleanup
3265         
3266         Split read-modify code paths out of AssignBracketNode and AssignDotNode
3267         Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode 
3268         and ReadModifyResolveNode evaluate methods
3269
3270         Leads to a 1% gain in SunSpider.
3271
3272         * kjs/grammar.y:
3273         * kjs/nodes.cpp:
3274         (KJS::ReadModifyLocalVarNode::evaluate):
3275         (KJS::ReadModifyResolveNode::evaluate):
3276         (KJS::AssignDotNode::evaluate):
3277         (KJS::ReadModifyDotNode::optimizeVariableAccess):
3278         (KJS::ReadModifyDotNode::evaluate):
3279         (KJS::AssignBracketNode::evaluate):
3280         (KJS::ReadModifyBracketNode::optimizeVariableAccess):
3281         (KJS::ReadModifyBracketNode::evaluate):
3282         * kjs/nodes.h:
3283         (KJS::AssignBracketNode::):
3284         (KJS::AssignBracketNode::precedence):
3285         (KJS::AssignDotNode::):
3286         (KJS::AssignDotNode::precedence):
3287         * kjs/nodes2string.cpp:
3288         (KJS::ReadModifyBracketNode::streamTo):
3289         (KJS::AssignBracketNode::streamTo):
3290         (KJS::ReadModifyDotNode::streamTo):
3291         (KJS::AssignDotNode::streamTo):
3292
3293 2007-10-29  Oliver Hunt  <oliver@apple.com>
3294
3295         Debranching various Node::evaluate implementations
3296         
3297         Reviewed by Maciej.
3298         
3299         Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
3300         Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
3301         
3302         Gains 1.6% on SunSpider
3303
3304         * JavaScriptCore.xcodeproj/project.pbxproj:
3305         * kjs/grammar.y:
3306         * kjs/nodes.cpp:
3307         (KJS::PostIncResolveNode::optimizeVariableAccess):
3308         (KJS::PostIncResolveNode::evaluate):
3309         (KJS::PostIncLocalVarNode::evaluate):
3310         (KJS::PostDecResolveNode::optimizeVariableAccess):
3311         (KJS::PostDecResolveNode::evaluate):
3312         (KJS::PostDecLocalVarNode::evaluate):
3313         (KJS::PostIncBracketNode::evaluate):
3314         (KJS::PostDecBracketNode::evaluate):
3315         (KJS::PostIncDotNode::evaluate):
3316         (KJS::PostDecDotNode::evaluate):
3317         (KJS::PreIncResolveNode::optimizeVariableAccess):
3318         (KJS::PreIncLocalVarNode::evaluate):
3319         (KJS::PreIncResolveNode::evaluate):
3320         (KJS::PreDecResolveNode::optimizeVariableAccess):
3321         (KJS::PreDecLocalVarNode::evaluate):
3322         (KJS::PreDecResolveNode::evaluate):
3323         (KJS::PreIncBracketNode::evaluate):
3324         (KJS::PreDecBracketNode::evaluate):
3325         (KJS::PreIncDotNode::evaluate):
3326         (KJS::PreDecDotNode::evaluate):
3327         (KJS::ReadModifyResolveNode::optimizeVariableAccess):
3328         (KJS::AssignResolveNode::optimizeVariableAccess):
3329         (KJS::AssignLocalVarNode::evaluate):
3330         (KJS::AssignResolveNode::evaluate):
3331         * kjs/nodes.h:
3332         (KJS::PostDecResolveNode::):
3333         (KJS::PostDecResolveNode::precedence):
3334         (KJS::PostDecLocalVarNode::):
3335         (KJS::PostfixBracketNode::):
3336         (KJS::PostfixBracketNode::precedence):
3337         (KJS::PostIncBracketNode::):
3338         (KJS::PostIncBracketNode::isIncrement):
3339         (KJS::PostDecBracketNode::):
3340         (KJS::PostDecBracketNode::isIncrement):
3341         (KJS::PostfixDotNode::):
3342         (KJS::PostfixDotNode::precedence):
3343         (KJS::PostIncDotNode::):
3344         (KJS::PostIncDotNode::isIncrement):
3345         (KJS::PostDecDotNode::):
3346         (KJS::PreIncResolveNode::):
3347         (KJS::PreDecResolveNode::):
3348         (KJS::PreDecResolveNode::precedence):
3349         (KJS::PreDecLocalVarNode::):
3350         (KJS::PrefixBracketNode::):
3351         (KJS::PrefixBracketNode::precedence):
3352         (KJS::PreIncBracketNode::):
3353         (KJS::PreIncBracketNode::isIncrement):
3354         (KJS::PreDecBracketNode::):
3355         (KJS::PreDecBracketNode::isIncrement):
3356         (KJS::PrefixDotNode::):
3357         (KJS::PrefixDotNode::precedence):
3358         (KJS::PreIncDotNode::):
3359         (KJS::PreIncDotNode::isIncrement):
3360         (KJS::PreDecDotNode::):
3361         (KJS::ReadModifyResolveNode::):
3362         (KJS::ReadModifyLocalVarNode::):
3363         (KJS::AssignResolveNode::):
3364         (KJS::AssignResolveNode::precedence):
3365         * kjs/nodes2string.cpp:
3366         (KJS::PostIncResolveNode::streamTo):
3367         (KJS::PostDecResolveNode::streamTo):
3368         (KJS::PostfixBracketNode::streamTo):
3369         (KJS::PostfixDotNode::streamTo):
3370         (KJS::PreIncResolveNode::streamTo):
3371         (KJS::PreDecResolveNode::streamTo):
3372         (KJS::ReadModifyResolveNode::streamTo):
3373         (KJS::AssignResolveNode::streamTo):
3374
3375 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
3376
3377         Not reviewed, build fix.
3378         
3379         - Include Vector.h in a way that actually works.
3380
3381         * kjs/LocalStorage.h:
3382
3383 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
3384
3385         Not reviewed, build fix.
3386         
3387         - Install LocalStorage.h as a private header.
3388
3389         * JavaScriptCore.xcodeproj/project.pbxproj:
3390
3391 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
3392
3393         Reviewed by Darin.
3394         
3395         - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
3396
3397         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3398         * JavaScriptCore.xcodeproj/project.pbxproj:
3399         * kjs/LocalStorage.h: Added.
3400         (KJS::LocalStorageEntry::LocalStorageEntry):
3401         (WTF::):
3402         * kjs/function.h:
3403         * kjs/nodes.cpp:
3404         (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
3405
3406 2007-10-29  Geoffrey Garen  <ggaren@apple.com>
3407
3408         Reviewed by Oliver Hunt.
3409         
3410         Some small tweaks that I notice while reviewing Oliver's last patch.
3411         
3412         Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
3413         
3414         No change in SunSpider because SunSpider doesn't take the code path that
3415         would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
3416
3417         * kjs/nodes.cpp:
3418         (KJS::LocalVarPostfixNode::evaluate):
3419         (KJS::TypeOfResolveNode::optimizeVariableAccess):
3420         (KJS::LocalVarTypeOfNode::evaluate):
3421         (KJS::PrefixResolveNode::optimizeVariableAccess):
3422         (KJS::LocalVarPrefixNode::evaluate):
3423         (KJS::AssignResolveNode::optimizeVariableAccess):
3424         (KJS::LocalVarAssignNode::evaluate):
3425         * kjs/nodes.h:
3426         (KJS::LocalVarTypeOfNode::):
3427         (KJS::PrefixResolveNode::):
3428         (KJS::LocalVarPrefixNode::):
3429         (KJS::AssignResolveNode::):
3430         (KJS::LocalVarAssignNode::):
3431
3432 2007-10-29  Eric Seidel  <eric@webkit.org>
3433
3434         Reviewed by Maciej.
3435         
3436         SunSpider claims this was a 0.7% speedup.
3437
3438         * kjs/string_object.cpp:
3439         (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
3440
3441 2007-10-29  Maciej Stachowiak  <mjs@apple.com>
3442
3443         Reviewed by Mark.
3444         
3445         - re-enable asserts for access to empty or deleted keys
3446
3447         * wtf/HashTable.h:
3448         (WTF::::lookup):
3449         (WTF::::lookupForWriting):
3450         (WTF::::fullLookupForWriting):
3451         (WTF::::add):
3452
3453 2007-10-29  Eric Seidel  <eric@webkit.org>
3454
3455         Build fix only, no review.
3456
3457         * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
3458
3459 2007-10-29  Mark Rowe  <mrowe@apple.com>
3460
3461         Gtk build fix.  Move struct declarations into nodes.h.
3462
3463         * kjs/grammar.y:
3464         * kjs/nodes.h:
3465
3466 2007-10-29  Eric Seidel  <eric@webkit.org>
3467
3468         Reviewed by darin.
3469         
3470         Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
3471         Make it a compile time error to use toString(ExecState) on a StringInstance
3472         
3473         SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
3474
3475         * kjs/internal.h:
3476         (KJS::StringImp::getLength):
3477         * kjs/string_object.cpp:
3478         (KJS::StringInstance::lengthGetter):
3479         (KJS::StringInstance::inlineGetOwnPropertySlot):
3480         (KJS::StringInstance::getOwnPropertySlot):
3481         * kjs/string_object.h:
3482
3483 2007-10-28  Oliver Hunt  <oliver@apple.com>
3484
3485         Reviewed by Darin.
3486
3487         Add nodes to allow Assignment, TypeOf, and prefix operators to 
3488         make use of the new optimised local variable look up.
3489
3490         5% gain on sunspider
3491
3492         * kjs/nodes.cpp:
3493         (KJS::TypeOfResolveNode::optimizeVariableAccess):
3494         (KJS::LocalTypeOfAccessNode::evaluate):
3495         (KJS::PrefixResolveNode::optimizeVariableAccess):
3496         (KJS::PrefixLocalAccessNode::evaluate):
3497         (KJS::AssignResolveNode::optimizeVariableAccess):
3498         (KJS::AssignLocalAccessNode::evaluate):
3499         * kjs/nodes.h:
3500         (KJS::TypeOfResolveNode::):
3501         (KJS::TypeOfResolveNode::precedence):
3502         (KJS::LocalTypeOfAccessNode::):
3503         (KJS::PrefixResolveNode::):
3504         (KJS::PrefixResolveNode::precedence):
3505         (KJS::PrefixLocalAccessNode::):
3506         (KJS::AssignResolveNode::):
3507         (KJS::AssignLocalAccessNode::):
3508
3509 2007-10-28  Maciej Stachowiak  <mjs@apple.com>
3510
3511         Reviewed by Darin.
3512         
3513         - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
3514         http://bugs.webkit.org/show_bug.cgi?id=15748
3515         
3516         Not a significant speedup or slowdown on SunSpider.
3517
3518         * kjs/Parser.cpp:
3519         (KJS::clearNewNodes):
3520         * kjs/Parser.h:
3521         * kjs/grammar.y:
3522         * kjs/nodes.cpp:
3523         (KJS::BlockNode::BlockNode):
3524         (KJS::CaseBlockNode::CaseBlockNode):
3525         (KJS::FunctionBodyNode::FunctionBodyNode):
3526         (KJS::SourceElementsNode::SourceElementsNode):
3527         (KJS::ProgramNode::ProgramNode):
3528         * kjs/nodes.h:
3529         (KJS::ElementNode::):
3530         (KJS::ArrayNode::):
3531         (KJS::PropertyListNode::):
3532         (KJS::ObjectLiteralNode::):
3533         (KJS::ArgumentListNode::):
3534         (KJS::ArgumentsNode::):
3535         (KJS::VarDeclListNode::):
3536         (KJS::VarStatementNode::):
3537         (KJS::ForNode::):
3538         (KJS::ParameterNode::):
3539         (KJS::FuncExprNode::):
3540         (KJS::FuncDeclNode::):
3541         (KJS::SourceElementsNode::):
3542         (KJS::CaseClauseNode::):
3543         (KJS::ClauseListNode::):
3544
3545 2007-10-28  Mark Rowe  <mrowe@apple.com>