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