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