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