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