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