Make testapi run as part of the standard JavaScriptCore tests.
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2009-03-23  Oliver Hunt  <oliver@apple.com>
2
3         Reviewed by Geoff Garen.
4
5         Make testapi assertions run in release builds, so that testapi actually
6         works in a release build.
7
8         Many of the testapi assertions have side effects that are necessary, and
9         given testapi is a testing program, perf impact of an assertion is not
10         important, so it makes sense to apply the assertions in release builds
11         anyway.
12
13         * API/tests/testapi.c:
14         (EvilExceptionObject_hasInstance):
15
16 2009-03-23  David Kilzer  <ddkilzer@apple.com>
17
18         Provide JavaScript exception information after slow script timeout
19
20         Reviewed by Oliver Hunt.
21
22         * runtime/Completion.cpp:
23         (JSC::evaluate): Set the exception object as the Completion
24         object's value for slow script timeouts.  This is used in
25         WebCore when reporting the exception.
26         * runtime/ExceptionHelpers.cpp:
27         (JSC::InterruptedExecutionError::toString): Added.  Provides a
28         description message for the exception when it is reported.
29
30 2009-03-23  Gustavo Noronha Silva  <gns@gnome.org> and Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
31
32         Reviewed by Adam Roben.
33
34         https://bugs.webkit.org/show_bug.cgi?id=24674
35         Crashes in !PLATFORM(MAC)'s formatLocaleDate, in very specific situations
36
37         Make sure strftime never returns 2-digits years to avoid ambiguity
38         and a crash. We wrap this new code option in HAVE_LANGINFO_H,
39         since it is apparently not available in all platforms.
40
41         * runtime/DatePrototype.cpp:
42         (JSC::formatLocaleDate):
43         * wtf/Platform.h:
44
45 2009-03-22  Oliver Hunt  <oliver@apple.com>
46
47         Reviewed by Cameron Zwarich.
48
49         Fix exception handling in API
50
51         We can't just use the ExecState exception slot for returning exceptions
52         from class introspection functions provided through the API as many JSC
53         functions will explicitly clear the ExecState exception when returning.
54
55         * API/JSCallbackObjectFunctions.h:
56         (JSC::JSCallbackObject<Base>::getOwnPropertySlot):
57         (JSC::JSCallbackObject<Base>::put):
58         (JSC::JSCallbackObject<Base>::deleteProperty):
59         (JSC::JSCallbackObject<Base>::construct):
60         (JSC::JSCallbackObject<Base>::hasInstance):
61         (JSC::JSCallbackObject<Base>::call):
62         (JSC::JSCallbackObject<Base>::toNumber):
63         (JSC::JSCallbackObject<Base>::toString):
64         (JSC::JSCallbackObject<Base>::staticValueGetter):
65         (JSC::JSCallbackObject<Base>::callbackGetter):
66         * API/tests/testapi.c:
67         (MyObject_hasProperty):
68         (MyObject_getProperty):
69         (MyObject_setProperty):
70         (MyObject_deleteProperty):
71         (MyObject_callAsFunction):
72         (MyObject_callAsConstructor):
73         (MyObject_hasInstance):
74         (EvilExceptionObject_hasInstance):
75         (EvilExceptionObject_convertToType):
76         (EvilExceptionObject_class):
77         (main):
78         * API/tests/testapi.js:
79         (EvilExceptionObject.hasInstance):
80         (EvilExceptionObject.toNumber):
81         (EvilExceptionObject.toStringExplicit):
82
83 2009-03-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
84
85         Reviewed by Oliver Hunt.
86
87         Bug 20049: testapi failure: MyObject - 0 should be NaN but instead is 1.
88         <https://bugs.webkit.org/show_bug.cgi?id=20049>
89         <rdar://problem/6079127>
90
91         In this case, the test is wrong. According to the ECMA spec, subtraction
92         uses ToNumber, not ToPrimitive. Change the test to match the spec.
93
94         * API/tests/testapi.js:
95
96 2009-03-21  Oliver Hunt  <oliver@apple.com>
97
98         Reviewed by Cameron Zwarich.
99
100         Ensure that JSObjectMakeFunction doesn't produce incorrect line numbers.
101
102         Also make test api correctly propagate failures.
103
104         * API/tests/testapi.c:
105         (main):
106         * runtime/FunctionConstructor.cpp:
107         (JSC::constructFunction):
108
109 2009-03-21  Oliver Hunt  <oliver@apple.com>
110
111         Reviewed by Mark Rowe.
112
113         Improve testapi by making it report failures in a way we can pick up
114         from our test scripts.
115
116         * API/tests/testapi.c:
117         (assertEqualsAsBoolean):
118         (assertEqualsAsNumber):
119         (assertEqualsAsUTF8String):
120         (assertEqualsAsCharactersPtr):
121         (main):
122         * API/tests/testapi.js:
123         (pass):
124         (fail):
125         (shouldBe):
126         (shouldThrow):
127
128 2009-03-20  Norbert Leser  <norbert.leser@nokia.com>
129
130         Reviewed by Darin Adler.
131
132         https://bugs.webkit.org/show_bug.cgi?id=24535
133
134         Fixes missing line terminator character (;) after macro call.
135         It is common practice to add the trailing ";" where macros are substituted
136         and not where they are defined with #define.
137         This change is consistent with other macro declarations across webkit,
138         and it also solves compilation failure with symbian compilers. 
139  
140         * runtime/UString.cpp:
141         * wtf/Assertions.h:
142
143 2009-03-20  Geoffrey Garen  <ggaren@apple.com>
144
145         Reviewed by Darin Adler.
146         
147         Fixed a JavaScriptCore crash on the Windows buildbot.
148
149         * bytecompiler/BytecodeGenerator.h: Reduced the AST recursion limit.
150         Apparently, Windows has small stacks.
151
152 2009-03-20  Geoffrey Garen  <ggaren@apple.com>
153
154         Reviewed by Oliver Hunt.
155         
156         A little cleanup in the RegisterFile code.
157         
158         Moved large inline functions out of the class declaration, to make it
159         more readable.
160         
161         Switched over to using the roundUpAllocationSize function to avoid
162         duplicate code and subtle bugs.
163         
164         Renamed m_maxCommitted to m_commitEnd, to match m_end.
165         
166         Renamed allocationSize to commitSize because it's the chunk size for
167         committing memory, not allocating memory.
168         
169         SunSpider reports no change.
170
171         * interpreter/RegisterFile.h:
172         (JSC::RegisterFile::RegisterFile):
173         (JSC::RegisterFile::shrink):
174         (JSC::RegisterFile::grow):
175         * jit/ExecutableAllocator.h:
176         (JSC::roundUpAllocationSize):
177
178 2009-03-19  Geoffrey Garen  <ggaren@apple.com>
179
180         Reviewed by Oliver Hunt.
181         
182         Fixed <rdar://problem/6033712> -- a little bit of hardening in the Collector.
183         
184         SunSpider reports no change. I also verified in the disassembly that
185         we end up with a single compare to constant.
186
187         * runtime/Collector.cpp:
188         (JSC::Heap::heapAllocate):
189
190 2009-03-19  Geoffrey Garen  <ggaren@apple.com>
191
192         Reviewed by Cameron Zwarich and Oliver Hunt.
193
194         Fixed <rdar://problem/6406045> REGRESSION: Stack overflow on PowerPC on
195         fast/workers/use-machine-stack.html (22531)
196
197         Dialed down the re-entry allowance to 64 (from 128).
198         
199         On a 512K stack, this leaves about 64K for other code on the stack while
200         JavaScript is running. Not perfect, but it solves our crash on PPC.
201
202         Different platforms may want to dial this down even more.
203
204         Also, substantially shrunk BytecodeGenerator. Since we allocate one on
205         the stack in order to throw a stack overflow exception -- well, let's
206         just say the old code had an appreciation for irony.
207
208         SunSpider reports no change.
209
210         * bytecompiler/BytecodeGenerator.h:
211         * interpreter/Interpreter.h:
212         (JSC::):
213
214 2009-03-19  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
215
216         Reviewed by Oliver Hunt.
217
218         Bug 24350: REGRESSION: Safari 4 breaks SPAW wysiwyg editor multiple instances
219         <https://bugs.webkit.org/show_bug.cgi?id=24350>
220         <rdar://problem/6674182>
221
222         The SPAW editor's JavaScript assumes that toString() on a function
223         constructed with the Function constructor produces a function with
224         a newline after the opening brace.
225
226         * runtime/FunctionConstructor.cpp:
227         (JSC::constructFunction): Add a newline after the opening brace of the
228         function's source code.
229
230 2009-03-19  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
231
232         Reviewed by Geoff Garen.
233
234         Bug 23771: REGRESSION (r36016): JSObjectHasProperty freezes on global class without kJSClassAttributeNoAutomaticPrototype
235         <https://bugs.webkit.org/show_bug.cgi?id=23771>
236         <rdar://problem/6561016>
237
238         * API/tests/testapi.c:
239         (main): Add a test for this bug.
240         * runtime/JSGlobalObject.cpp:
241         (JSC::JSGlobalObject::resetPrototype): Don't set the prototype of the
242         last object in the prototype chain to the object prototype when the
243         object prototype is already the last object in the prototype chain.
244
245 2009-03-19  Timothy Hatcher  <timothy@apple.com>
246
247         <rdar://problem/6687342> -[WebView scheduleInRunLoop:forMode:] has no affect on timers
248
249         Reviewed by Darin Adler.
250
251         * wtf/Platform.h: Added HAVE_RUNLOOP_TIMER for PLATFORM(MAC).
252
253 2009-03-19  Geoffrey Garen  <ggaren@apple.com>
254
255         Reviewed by Oliver Hunt.
256         
257         Fixed <rdar://problem/6279213> Regular expression run-time complexity
258         limit too low for long inputs (21485)
259         
260         I raised PCRE's "matchLimit" (limit on backtracking) by an order of
261         magnitude. This fixes all the reported examples of timing out on legitimate
262         regular expression matches.
263         
264         In my testing on a Core Duo MacBook Pro, the longest you can get stuck
265         trying to match a string is still under 1s, so this seems like a safe change.
266         
267         I can think of a number of better solutions that are more complicated,
268         but this is a good improvement for now.
269
270         * pcre/pcre_exec.cpp:
271
272 2009-03-19  Geoffrey Garen  <ggaren@apple.com>
273
274         Reviewed by Sam Weinig.
275         
276         Fixed <rdar://problem/6603562> REGRESSION (Safari 4): regular expression
277         pattern size limit lower than Safari 3.2, other browsers, breaks SAP (14873)
278         
279         Bumped the pattern size limit to 1MB, and standardized it between PCRE
280         and WREC. (Empirical testing says that we can easily compile a 1MB regular
281         expression without risking a hang. Other browsers support bigger regular
282         expressions, but also hang.)
283         
284         SunSpider reports no change.
285         
286         I started with a patch posted to Bugzilla by Erik Corry (erikcorry@google.com).
287         
288         * pcre/pcre_internal.h:
289         (put3ByteValue):
290         (get3ByteValue):
291         (put3ByteValueAndAdvance):
292         (putLinkValueAllowZero):
293         (getLinkValueAllowZero): Made PCRE's "LINK_SIZE" (the number of bytes
294         used to record jumps between bytecodes) 3, to accomodate larger potential
295         jumps. Bumped PCRE's "MAX_PATTERN_SIZE" to 1MB. (Technically, at this
296         LINK_SIZE, we can support even larger patterns, but we risk a hang during
297         compilation, and it's not clear that such large patterns are important
298         on the web.)
299
300         * wrec/WREC.cpp:
301         (JSC::WREC::Generator::compileRegExp): Match PCRE's maximum pattern size,
302         to avoid quirks between platforms.
303
304 2009-03-18  Ada Chan  <adachan@apple.com>
305
306         Rolling out r41818 since it broke the windows build.
307         Error: ..\..\runtime\DatePrototype.cpp(30) : fatal error C1083: Cannot open include file: 'langinfo.h': No such file or directory
308
309         * runtime/DatePrototype.cpp:
310         (JSC::formatLocaleDate):
311
312 2009-03-17  Oliver Hunt  <oliver@apple.com>
313
314         Reviewed by Cameron Zwarich.
315
316         <rdar://problem/6692138> REGRESSION (Safari 4): Incorrect function return value when using IE "try ... finally" memory leak work-around (24654)
317         <https://bugs.webkit.org/show_bug.cgi?id=24654>
318
319         If the return value for a function is in a local register we need
320         to copy it before executing any finalisers, otherwise it is possible
321         for the finaliser to clobber the result.
322
323         * bytecompiler/BytecodeGenerator.h:
324         (JSC::BytecodeGenerator::hasFinaliser):
325         * parser/Nodes.cpp:
326         (JSC::ReturnNode::emitBytecode):
327
328 2009-03-17  Kevin Ollivier  <kevino@theolliviers.com>
329
330         Reviewed by Mark Rowe.
331         
332         Move BUILDING_ON_* defines into Platform.h to make them available to other ports.
333         Also tweak the defines so that they work with the default values set by 
334         AvailabilityMacros.h.
335
336         https://bugs.webkit.org/show_bug.cgi?id=24630
337
338         * JavaScriptCorePrefix.h:
339         * wtf/Platform.h:
340
341 2009-03-15  Simon Fraser  <simon.fraser@apple.com>
342
343         Revert r41718 because it broke DumpRenderTree on Tiger.
344
345         * JavaScriptCorePrefix.h:
346         * wtf/Platform.h:
347
348 2009-03-15  Kevin Ollivier  <kevino@theolliviers.com>
349
350         Non-Apple Mac ports build fix. Move defines for the BUILDING_ON_ macros into
351         Platform.h so that they're defined for all ports building on Mac, and tweak
352         the definitions of those macros based on Mark Rowe's suggestions to accomodate
353         cases where the values may not be <= to the .0 release for that version.
354
355         * JavaScriptCorePrefix.h:
356         * wtf/Platform.h:
357
358 2009-03-13  Mark Rowe  <mrowe@apple.com>
359
360         Rubber-stamped by Dan Bernstein.
361
362         Take advantage of the ability of recent versions of Xcode to easily switch the active
363         architecture.
364
365         * Configurations/DebugRelease.xcconfig:
366
367 2009-03-13  Mark Rowe  <mrowe@apple.com>
368
369         Reviewed by David Kilzer.
370
371         Prevent AllInOneFile.cpp and ProfileGenerator.cpp from rebuilding unnecessarily when
372         switching between building in Xcode and via build-webkit.
373
374         build-webkit passes FEATURE_DEFINES to xcodebuild, resulting in it being present in the
375         Derived Sources build settings.  When building in Xcode, this setting isn't present so
376         Xcode reruns the script build phases.  This results in a new version of TracingDtrace.h
377         being generated, and the files that include it being rebuilt.
378
379         * JavaScriptCore.xcodeproj/project.pbxproj:  Don't regenerate TracingDtrace.h if it is
380         already newer than the input file.
381
382 2009-03-13  Norbert Leser  <norbert.leser@nokia.com>
383
384         Reviewed by Darin Adler.
385
386         Resolved name conflict with globally defined tzname in Symbian.
387         Replaced with different name instead of using namespace qualifier
388         (appeared to be less clumsy).
389
390         * runtime/DateMath.cpp:
391
392 2009-03-12  Mark Rowe  <mrowe@apple.com>
393
394         Reviewed by Darin Adler.
395
396         <rdar://problem/6548446> TCMalloc_SystemRelease should use madvise rather than re-mmaping span of pages
397
398         * wtf/FastMalloc.cpp:
399         (WTF::mergeDecommittedStates): If either of the spans has been released to the system, release the other
400         span as well so that the flag in the merged span is accurate.
401         * wtf/Platform.h:
402         * wtf/TCSystemAlloc.cpp: Track decommitted spans when using MADV_FREE_REUSABLE / MADV_FREE_REUSE.
403         (TCMalloc_SystemRelease): Use madvise with MADV_FREE_REUSABLE when it is available.
404         (TCMalloc_SystemCommit): Use madvise with MADV_FREE_REUSE when it is available.
405         * wtf/TCSystemAlloc.h:
406
407 2009-03-12  Adam Treat  <adam.treat@torchmobile.com>
408
409         Reviewed by NOBODY (Build fix).
410
411         Include string.h for strlen usage.
412
413         * wtf/Threading.cpp:
414
415 2009-03-12  David Kilzer  <ddkilzer@apple.com>
416
417         Add NO_RETURN attribute to runInteractive() when not using readline
418
419         Reviewed by Darin Adler.
420
421         * jsc.cpp:
422         (runInteractive): If the readline library is not used, this method
423         will never return, thus the NO_RETURN attribute is needed to prevent
424         a gcc warning.
425
426 2009-03-12  Adam Roben  <aroben@apple.com>
427
428         Adopt setThreadNameInternal on Windows
429
430         Also changed a Windows-only assertion about thread name length to an
431         all-platform log message.
432
433         Reviewed by Adam Treat.
434
435         * wtf/Threading.cpp:
436         (WTF::createThread): Warn if the thread name is longer than 31
437         characters, as Visual Studio will truncate names longer than that
438         length.
439
440         * wtf/ThreadingWin.cpp:
441         (WTF::setThreadNameInternal): Renamed from setThreadName and changed
442         to always operate on the current thread.
443         (WTF::initializeThreading): Changed to use setThreadNameInternal.
444         (WTF::createThreadInternal): Removed call to setThreadName. This is
445         now handled by threadEntryPoint and setThreadNameInternal.
446
447 2009-03-11  David Kilzer  <ddkilzer@apple.com>
448
449         Clarify comments regarding order of FEATURE_DEFINES
450
451         Rubber-stamped by Mark Rowe.
452
453         * Configurations/JavaScriptCore.xcconfig: Added warning about
454         the consequences when FEATURE_DEFINES are not kept in sync.
455
456 2009-03-11  Dan Bernstein  <mitz@apple.com>
457
458         Reviewed by Darin Adler.
459
460         - WTF support for fixing <rdar://problem/3919124> Thai text selection
461           in Safari is incorrect
462
463         * wtf/unicode/icu/UnicodeIcu.h:
464         (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added. Returns
465         whether the character has Unicode line breaking property value SA
466         ("Complex Context").
467         * wtf/unicode/qt4/UnicodeQt4.h:
468         (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added an
469         implementation that always returns false.
470
471 2009-03-11  Darin Adler  <darin@apple.com>
472
473         Reviewed by Mark Rowe.
474
475         Give threads names on platforms with pthread_setname_np.
476
477         * wtf/Threading.cpp:
478         (WTF::NewThreadContext::NewThreadContext): Initialize thread name.
479         (WTF::threadEntryPoint): Call setThreadNameInternal.
480         (WTF::createThread): Pass thread name.
481
482         * wtf/Threading.h: Added new comments, setThreadNameInternal.
483
484         * wtf/ThreadingGtk.cpp:
485         (WTF::setThreadNameInternal): Added. Empty.
486         * wtf/ThreadingNone.cpp:
487         (WTF::setThreadNameInternal): Added. Empty.
488         * wtf/ThreadingPthreads.cpp:
489         (WTF::setThreadNameInternal): Call pthread_setname_np when available.
490         * wtf/ThreadingQt.cpp:
491         (WTF::setThreadNameInternal): Added. Empty.
492         * wtf/ThreadingWin.cpp:
493         (WTF::setThreadNameInternal): Added. Empty.
494
495 2009-03-11  Adam Roben  <aroben@apple.com>
496
497         Change the Windows implementation of ThreadSpecific to use functions
498         instead of extern globals
499
500         This will make it easier to export ThreadSpecific from WebKit.
501
502         Reviewed by John Sullivan.
503
504         * API/JSBase.cpp:
505         (JSEvaluateScript): 
506         Touched this file to force ThreadSpecific.h to be copied into
507         $WebKitOutputDir.
508
509         * wtf/ThreadSpecific.h: Replaced g_tls_key_count with tlsKeyCount()
510         and g_tls_keys with tlsKeys().
511
512         (WTF::::ThreadSpecific):
513         (WTF::::~ThreadSpecific):
514         (WTF::::get):
515         (WTF::::set):
516         (WTF::::destroy):
517         Updated to use the new functions.
518
519         * wtf/ThreadSpecificWin.cpp:
520         (WTF::tlsKeyCount):
521         (WTF::tlsKeys):
522         Added.
523
524         (WTF::ThreadSpecificThreadExit): Changed to use the new functions.
525
526 2009-03-10  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
527
528         Reviewed by Geoff Garen.
529
530         Bug 24291: REGRESSION (r38635): Single line JavaScript comment prevents HTML button click handler execution
531         <https://bugs.webkit.org/show_bug.cgi?id=24291>
532         <rdar://problem/6663472>
533
534         Add an extra newline to the end of the body of the program text constructed
535         by the Function constructor for parsing. This allows single line comments to
536         be handled correctly by the parser.
537
538         * runtime/FunctionConstructor.cpp:
539         (JSC::constructFunction):
540
541 2009-03-09  Oliver Hunt  <oliver@apple.com>
542
543         Reviewed by Gavin Barraclough.
544
545         Bug 24447: REGRESSION (r41508): Google Maps does not complete initialization
546         <rdar://problem/6657774>
547
548         r41508 actually exposed a pre-existing bug where we were not invalidating the result
549         register cache at jump targets.  This causes problems when condition loads occur in an
550         expression -- namely through the ?: and || operators.  This patch corrects these issues
551         by marking the target of all forward jumps as being a jump target, and then clears the
552         result register cache when ever it starts generating code for a targeted instruction.
553
554         I do not believe it is possible to cause this class of failure outside of a single
555         expression, and expressions only provide forward branches, so this should resolve this
556         entire class of bug.  That said i've included a test case that gets as close as possible
557         to hitting this bug with a back branch, to hopefully prevent anyone from introducing the
558         problem in future.
559
560         * assembler/AbstractMacroAssembler.h:
561         (JSC::AbstractMacroAssembler::Label::isUsed):
562         (JSC::AbstractMacroAssembler::Label::used):
563         * assembler/X86Assembler.h:
564         (JSC::X86Assembler::JmpDst::JmpDst):
565         (JSC::X86Assembler::JmpDst::isUsed):
566         (JSC::X86Assembler::JmpDst::used):
567         * jit/JIT.cpp:
568         (JSC::JIT::privateCompileMainPass):
569
570 2009-03-09  David Levin  <levin@chromium.org>
571
572         Reviewed by Darin Adler.
573
574         Bug 23175: String and UString should be able to share a UChar* buffer.
575         <https://bugs.webkit.org/show_bug.cgi?id=23175>
576
577         Add CrossThreadRefCounted.
578
579         * wtf/CrossThreadRefCounted.h: Added.
580         (WTF::CrossThreadRefCounted::create):
581         (WTF::CrossThreadRefCounted::isShared):
582         (WTF::CrossThreadRefCounted::dataAccessMustBeThreadSafe):
583         (WTF::CrossThreadRefCounted::mayBePassedToAnotherThread):
584         (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
585         (WTF::CrossThreadRefCounted::~CrossThreadRefCounted):
586         (WTF::CrossThreadRefCounted::ref):
587         (WTF::CrossThreadRefCounted::deref):
588         (WTF::CrossThreadRefCounted::release):
589         (WTF::CrossThreadRefCounted::copy):
590         (WTF::CrossThreadRefCounted::threadSafeDeref):
591         * wtf/RefCounted.h:
592         * wtf/Threading.h:
593         (WTF::ThreadSafeSharedBase::ThreadSafeSharedBase):
594         (WTF::ThreadSafeSharedBase::derefBase):
595         (WTF::ThreadSafeShared::ThreadSafeShared):
596         (WTF::ThreadSafeShared::deref):
597
598 2009-03-09  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
599
600         Reviewed by George Staikos.
601
602         https://bugs.webkit.org/show_bug.cgi?id=24353
603         Allow to overrule default build options for Qt build.
604
605         * JavaScriptCore.pri: Allow to overrule ENABLE_JIT
606
607 2009-03-08  Oliver Hunt  <oliver@apple.com>
608
609         Reviewed by NOBODY (build fix).
610
611         Build fix.
612
613         * runtime/ArrayPrototype.cpp:
614         (JSC::arrayProtoFuncConcat):
615
616 2009-03-01  Oliver Hunt  <oliver@apple.com>
617
618         Reviewed by Cameron Zwarich.
619
620         Bug 24268: RuntimeArray is not a fully implemented JSArray
621         <https://bugs.webkit.org/show_bug.cgi?id=24268>
622
623         Don't cast a type to JSArray, just because it reportsArray as a supertype
624         in the JS type system.  Doesn't appear feasible to create a testcase
625         unfortunately as setting up the failure conditions requires internal access 
626         to JSC not present in DRT.
627
628         * runtime/ArrayPrototype.cpp:
629         (JSC::arrayProtoFuncConcat):
630
631 2009-03-06  Gavin Barraclough  <barraclough@apple.com>
632
633         Reviewed by Oliver Hunt.
634
635         When preforming an op_mov, preserve any existing register mapping.
636
637         ~0.5% progression on v8 tests x86-64.
638
639         * jit/JIT.cpp:
640         (JSC::JIT::privateCompileMainPass):
641
642 2009-03-05  Simone Fiorentino  <simone.fiorentino@consulenti.fastweb.it>
643
644         Bug 24382: request to add SH4 platform
645
646         <https://bugs.webkit.org/show_bug.cgi?id=24382>
647
648         Reviewed by David Kilzer.
649
650         * wtf/Platform.h: Added support for SH4 platform.
651
652 2009-03-05  Gavin Barraclough  <barraclough@apple.com>
653
654         Reviewed by Oliver Hunt.
655
656         Writes of constant values to SF registers should be made with direct memory
657         writes where possible, rather than moving the value via a hardware register.
658
659         ~3% win on SunSpider tests on x86, ~1.5% win on v8 tests on x86-64.
660
661         * assembler/MacroAssemblerX86_64.h:
662         (JSC::MacroAssemblerX86_64::storePtr):
663         * assembler/X86Assembler.h:
664         (JSC::X86Assembler::movq_i32m):
665         * jit/JIT.cpp:
666         (JSC::JIT::privateCompileMainPass):
667
668 2009-03-05  Mark Rowe  <mrowe@apple.com>
669
670         Fix the build.
671
672         Sprinkle "static" around NumberConstructor.cpp in order to please the compiler.
673
674         * runtime/NumberConstructor.cpp:
675         (JSC::numberConstructorNaNValue):
676         (JSC::numberConstructorNegInfinity):
677         (JSC::numberConstructorPosInfinity):
678         (JSC::numberConstructorMaxValue):
679         (JSC::numberConstructorMinValue):
680
681 2009-03-04  Mark Rowe  <mrowe@apple.com>
682
683         Reviewed by Oliver Hunt.
684
685         <rdar://problem/6354858> FastMallocZone's enumeration code reports fragmented administration space
686
687         The handling of MALLOC_ADMIN_REGION_RANGE_TYPE in FastMalloc's zone was incorrect.  It was attempting
688         to record the memory containing and individual span as an administrative region, when all memory
689         allocated via MetaDataAlloc should in fact be recorded.  This was causing memory regions allocated
690         via MetaDataAlloc to appear as "VM_ALLOCATE ?" in vmmap output.  They are now correctly reported as
691         "MALLOC_OTHER" regions associated with the JavaScriptCore FastMalloc zone.
692
693         Memory is allocated via MetaDataAlloc from two locations: PageHeapAllocator, and TCMalloc_PageMap{2,3}.
694         These two cases are handled differently.
695
696         PageHeapAllocator is extended to keep a linked list of memory regions that it has allocated.  The
697         first object in an allocated region contains the link to the previously allocated region. To record
698         the administrative regions of a PageHeapAllocator we can simply walk the linked list and record
699         each allocated region we encounter.
700
701         TCMalloc_PageMaps allocate memory via MetaDataAlloc to store each level of the radix tree.  To record
702         the administrative regions of a TCMalloc_PageMap we walk the tree and record the storage used for nodes
703         at each position rather than the nodes themselves.
704
705         A small performance improvement is achieved by coalescing adjacent memory regions inside the PageMapMemoryUsageRecorder
706         so that fewer calls in to the range recorder are necessary.  We further reduce the number of calls to the
707         range recorder by aggregating the in-use ranges of a given memory region into a local buffer before recording
708         them with a single call.  A similar approach is also used by AdminRegionRecorder.
709
710         * wtf/FastMalloc.cpp:
711         (WTF::PageHeapAllocator::Init):
712         (WTF::PageHeapAllocator::New):
713         (WTF::PageHeapAllocator::recordAdministrativeRegions):
714         (WTF::TCMallocStats::FreeObjectFinder::isFreeObject):
715         (WTF::TCMallocStats::PageMapMemoryUsageRecorder::~PageMapMemoryUsageRecorder):
716         (WTF::TCMallocStats::PageMapMemoryUsageRecorder::recordPendingRegions):
717         (WTF::TCMallocStats::PageMapMemoryUsageRecorder::visit):
718         (WTF::TCMallocStats::AdminRegionRecorder::AdminRegionRecorder):
719         (WTF::TCMallocStats::AdminRegionRecorder::recordRegion):
720         (WTF::TCMallocStats::AdminRegionRecorder::visit):
721         (WTF::TCMallocStats::AdminRegionRecorder::recordPendingRegions):
722         (WTF::TCMallocStats::AdminRegionRecorder::~AdminRegionRecorder):
723         (WTF::TCMallocStats::FastMallocZone::enumerate):
724         (WTF::TCMallocStats::FastMallocZone::FastMallocZone):
725         (WTF::TCMallocStats::FastMallocZone::init):
726         * wtf/TCPageMap.h:
727         (TCMalloc_PageMap2::visitValues):
728         (TCMalloc_PageMap2::visitAllocations):
729         (TCMalloc_PageMap3::visitValues):
730         (TCMalloc_PageMap3::visitAllocations):
731
732 2009-03-04  Antti Koivisto  <antti@apple.com>
733
734         Reviewed by Dave Hyatt.
735
736         https://bugs.webkit.org/show_bug.cgi?id=24359
737         Repaint throttling mechanism
738         
739         Set ENABLE_REPAINT_THROTTLING to 0 by default.
740
741         * wtf/Platform.h:
742
743 2009-03-03  David Kilzer  <ddkilzer@apple.com>
744
745         <rdar://problem/6581203> WebCore and WebKit should install the same set of headers during installhdrs phase as build phase
746
747         Reviewed by Mark Rowe.
748
749         * Configurations/Base.xcconfig: Defined REAL_PLATFORM_NAME based
750         on PLATFORM_NAME to work around the missing definition on Tiger.
751         Updated HAVE_DTRACE to use REAL_PLATFORM_NAME.
752
753 2009-03-03  Kevin McCullough  <kmccullough@apple.com>
754
755         Reviewed by Oliver Hunt.
756
757         <rdar://problem/6639110> console.profile() doesn't work without a title
758
759         * profiler/Profiler.cpp:
760         (JSC::Profiler::startProfiling): assert if there is not title to ensure
761         we don't start profiling without one.
762
763 2009-03-02  Sam Weinig  <sam@webkit.org>
764
765         Reviewed by Mark Rowe.
766
767         Enable Geolocation (except on Tiger and Leopard).
768
769         * Configurations/JavaScriptCore.xcconfig:
770
771 2009-03-01  David Kilzer  <ddkilzer@apple.com>
772
773         <rdar://problem/6635688> Move HAVE_DTRACE check to Base.xcconfig
774
775         Reviewed by Mark Rowe.
776
777         * Configurations/Base.xcconfig: Set HAVE_DTRACE Xcode variable
778         based on PLATFORM_NAME and MAC_OS_X_VERSION_MAJOR.  Also define
779         it as a preprocessor macro by modifying
780         GCC_PREPROCESSOR_DEFINITIONS.
781         * JavaScriptCore.xcodeproj/project.pbxproj: Changed "Generate
782         DTrace header" script phase to check for HAVE_DTRACE instead of
783         MACOSX_DEPLOYMENT_TARGET.
784         * wtf/Platform.h: Removed definition of HAVE_DTRACE macro since
785         it's defined in Base.xcconfig now.
786
787 2009-03-01  Horia Olaru  <olaru@adobe.com>
788
789         By looking in grammar.y there are only a few types of statement nodes
790         on which the debugger should stop. 
791
792         Removed isBlock and isLoop virtual calls. No need to emit debug hooks in
793         the "statementListEmitCode" method as long as the necessary hooks can be
794         added in each "emitCode".
795
796         https://bugs.webkit.org/show_bug.cgi?id=21073
797
798         Reviewed by Kevin McCullough.
799
800         * parser/Nodes.cpp:
801         (JSC::ConstStatementNode::emitBytecode):
802         (JSC::statementListEmitCode):
803         (JSC::EmptyStatementNode::emitBytecode):
804         (JSC::ExprStatementNode::emitBytecode):
805         (JSC::VarStatementNode::emitBytecode):
806         (JSC::IfNode::emitBytecode):
807         (JSC::IfElseNode::emitBytecode):
808         (JSC::DoWhileNode::emitBytecode):
809         (JSC::WhileNode::emitBytecode):
810         (JSC::ForNode::emitBytecode):
811         (JSC::ForInNode::emitBytecode):
812         (JSC::ContinueNode::emitBytecode):
813         (JSC::BreakNode::emitBytecode):
814         (JSC::ReturnNode::emitBytecode):
815         (JSC::WithNode::emitBytecode):
816         (JSC::SwitchNode::emitBytecode):
817         (JSC::LabelNode::emitBytecode):
818         (JSC::ThrowNode::emitBytecode):
819         (JSC::TryNode::emitBytecode):
820         * parser/Nodes.h:
821
822 2009-02-26  Gavin Barraclough  <barraclough@apple.com>
823
824         Reviewed by Geoff Garen.
825
826         Fix bug #23614.  Switches on double precision values were incorrectly
827         truncating the scrutinee value.  E.g.:
828
829             switch (1.1) { case 1: print("FAIL"); }
830
831         Was resulting in FAIL.
832
833         * interpreter/Interpreter.cpp:
834         (JSC::Interpreter::privateExecute):
835         * jit/JITStubs.cpp:
836         (JSC::JITStubs::cti_op_switch_imm):
837
838 2009-02-26  Gavin Barraclough  <barraclough@apple.com>
839
840         Reviewed by Oliver Hunt.
841
842         Integer Immediate representation need not be canonical in x86 JIT code.
843         On x86-64 we already have loosened the requirement that the int immediate
844         representation in canonical, we should bring x86 into line.
845
846         This patch is a minor (~0.5%) improvement on sunspider & v8-tests, and
847         should reduce memory footoprint (reduces JIT code size).
848
849         * jit/JIT.cpp:
850         (JSC::JIT::compileOpStrictEq):
851         (JSC::JIT::privateCompileSlowCases):
852         * jit/JIT.h:
853         (JSC::JIT::emitJumpIfImmediateNumber):
854         (JSC::JIT::emitJumpIfNotImmediateNumber):
855         * jit/JITArithmetic.cpp:
856         (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
857         (JSC::JIT::compileBinaryArithOp):
858
859 2009-02-26  Carol Szabo  <carol.szabo@nokia.com>
860
861         Reviewed by Darin Adler.
862
863         https://bugs.webkit.org/show_bug.cgi?id=24099
864         ARM Compiler Warnings in pcre_exec.cpp
865
866         * pcre/pcre_exec.cpp:
867         (match):
868
869 2009-02-25  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
870
871         Reviewed by Gavin Barraclough.
872
873         Bug 24086: Regression (r40993): WebKit crashes after logging in to lists.zenbe
874         <https://bugs.webkit.org/show_bug.cgi?id=24086>
875         <rdar://problem/6625111>
876
877         The numeric sort optimization in r40993 generated bytecode for a function
878         without generating JIT code. This breaks an assumption in some parts of
879         the JIT's function calling logic that the presence of a CodeBlock implies
880         the existence of JIT code.
881
882         In order to fix this, we simply generate JIT code whenever we check whether
883         a function is a numeric sort function. This only incurs an additional cost
884         in the case when the function is a numeric sort function, in which case it
885         is not expensive to generate JIT code for it.
886
887         * runtime/ArrayPrototype.cpp:
888         (JSC::isNumericCompareFunction):
889
890 2009-02-25  Geoffrey Garen  <ggaren@apple.com>
891
892         Reviewed by Maciej Stachowiak.
893         
894         Fixed <rdar://problem/6611174> REGRESSION (r36701): Unable to select
895         messages on hotmail (24052)
896         
897         The bug was that for-in enumeration used a cached prototype chain without
898         validating that it was up-to-date.
899         
900         This led me to refactor prototype chain caching so it was easier to work
901         with and harder to get wrong.
902         
903         After a bit of inlining, this patch is performance-neutral on SunSpider
904         and the v8 benchmarks.
905
906         * interpreter/Interpreter.cpp:
907         (JSC::Interpreter::tryCachePutByID):
908         (JSC::Interpreter::tryCacheGetByID):
909         * jit/JITStubs.cpp:
910         (JSC::JITStubs::tryCachePutByID):
911         (JSC::JITStubs::tryCacheGetByID):
912         (JSC::JITStubs::cti_op_get_by_id_proto_list): Use the new refactored goodness. See
913         lines beginning with "-" and smile.
914
915         * runtime/JSGlobalObject.h:
916         (JSC::Structure::prototypeForLookup): A shout out to const.
917
918         * runtime/JSPropertyNameIterator.h:
919         (JSC::JSPropertyNameIterator::next): We can use a pointer comparison to
920         see if our cached structure chain is equal to the object's structure chain,
921         since in the case of a cache hit, we share references to the same structure
922         chain.
923
924         * runtime/Operations.h:
925         (JSC::countPrototypeChainEntriesAndCheckForProxies): Use the new refactored
926         goodness.
927
928         * runtime/PropertyNameArray.h:
929         (JSC::PropertyNameArray::PropertyNameArray):
930         (JSC::PropertyNameArray::setShouldCache):
931         (JSC::PropertyNameArray::shouldCache): Renamed "cacheable" to "shouldCache"
932         to communicate that the client is specifying a recommendation, not a
933         capability.
934         
935         * runtime/Structure.cpp:
936         (JSC::Structure::Structure): No need to initialize a RefPtr.
937         (JSC::Structure::getEnumerablePropertyNames): Moved some code into helper
938         functions.
939
940         (JSC::Structure::prototypeChain): New centralized accessor for a prototype
941         chain. Revalidates on every access, since the objects in the prototype
942         chain may have mutated.
943
944         (JSC::Structure::isValid): Helper function for revalidating a cached
945         prototype chain.
946
947         (JSC::Structure::getEnumerableNamesFromPropertyTable):
948         (JSC::Structure::getEnumerableNamesFromClassInfoTable): Factored out of
949         getEnumerablePropertyNames.
950
951         * runtime/Structure.h:
952
953         * runtime/StructureChain.cpp:
954         (JSC::StructureChain::StructureChain):
955         * runtime/StructureChain.h:
956         (JSC::StructureChain::create): No need for structureChainsAreEqual, since
957         we use pointer equality now. Refactored StructureChain to make a little
958         more sense and eliminate special cases for null prototypes.
959
960 2009-02-25  Steve Falkenburg  <sfalken@apple.com>
961
962         Use timeBeginPeriod to enable timing resolution greater than 16ms in command line jsc for Windows.
963         Allows more accurate reporting of benchmark times via command line jsc.exe. Doesn't affect WebKit's use of JavaScriptCore.
964         
965         Reviewed by Adam Roben.
966
967         * jsc.cpp:
968         (main):
969
970 2009-02-24  Geoffrey Garen  <ggaren@apple.com>
971
972         Build fix?
973
974         * GNUmakefile.am:
975
976 2009-02-24  Mark Rowe  <mrowe@apple.com>
977
978         Reviewed by Oliver Hunt.
979
980         <rdar://problem/6259220> Rename AVAILABLE_AFTER_WEBKIT_VERSION_3_1 (etc.) to match the other macros
981
982         * API/JSBasePrivate.h:
983         * API/JSContextRef.h:
984         * API/JSObjectRef.h:
985         * API/WebKitAvailability.h:
986
987 2009-02-23  Geoffrey Garen  <ggaren@apple.com>
988
989         Reviewed by Sam Weinig.
990
991         Next step in splitting JIT functionality out of the Interpreter class:
992         Moved vptr storage from Interpreter to JSGlobalData, so it could be shared
993         between Interpreter and JITStubs, and moved the *Trampoline JIT stubs
994         into the JITStubs class. Also added a VPtrSet class to encapsulate vptr
995         hacks during JSGlobalData initialization.
996         
997         SunSpider says 0.4% faster. Meh.
998
999         * JavaScriptCore.exp:
1000         * JavaScriptCore.xcodeproj/project.pbxproj:
1001         * interpreter/Interpreter.cpp:
1002         (JSC::Interpreter::Interpreter):
1003         (JSC::Interpreter::tryCacheGetByID):
1004         (JSC::Interpreter::privateExecute):
1005         * interpreter/Interpreter.h:
1006         * jit/JIT.cpp:
1007         (JSC::JIT::privateCompileMainPass):
1008         (JSC::JIT::privateCompile):
1009         (JSC::JIT::privateCompileCTIMachineTrampolines):
1010         * jit/JIT.h:
1011         (JSC::JIT::compileCTIMachineTrampolines):
1012         * jit/JITCall.cpp:
1013         (JSC::JIT::compileOpCall):
1014         (JSC::JIT::compileOpCallSlowCase):
1015         * jit/JITPropertyAccess.cpp:
1016         (JSC::JIT::privateCompilePatchGetArrayLength):
1017         * jit/JITStubs.cpp:
1018         (JSC::JITStubs::JITStubs):
1019         (JSC::JITStubs::tryCacheGetByID):
1020         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
1021         (JSC::JITStubs::cti_op_get_by_val):
1022         (JSC::JITStubs::cti_op_get_by_val_byte_array):
1023         (JSC::JITStubs::cti_op_put_by_val):
1024         (JSC::JITStubs::cti_op_put_by_val_array):
1025         (JSC::JITStubs::cti_op_put_by_val_byte_array):
1026         (JSC::JITStubs::cti_op_is_string):
1027         * jit/JITStubs.h:
1028         (JSC::JITStubs::ctiArrayLengthTrampoline):
1029         (JSC::JITStubs::ctiStringLengthTrampoline):
1030         (JSC::JITStubs::ctiVirtualCallPreLink):
1031         (JSC::JITStubs::ctiVirtualCallLink):
1032         (JSC::JITStubs::ctiVirtualCall):
1033         * runtime/ArrayPrototype.cpp:
1034         (JSC::arrayProtoFuncPop):
1035         (JSC::arrayProtoFuncPush):
1036         * runtime/FunctionPrototype.cpp:
1037         (JSC::functionProtoFuncApply):
1038         * runtime/JSArray.h:
1039         (JSC::isJSArray):
1040         * runtime/JSByteArray.h:
1041         (JSC::asByteArray):
1042         (JSC::isJSByteArray):
1043         * runtime/JSCell.h:
1044         * runtime/JSFunction.h:
1045         * runtime/JSGlobalData.cpp:
1046         (JSC::VPtrSet::VPtrSet):
1047         (JSC::JSGlobalData::JSGlobalData):
1048         (JSC::JSGlobalData::create):
1049         (JSC::JSGlobalData::sharedInstance):
1050         * runtime/JSGlobalData.h:
1051         * runtime/JSString.h:
1052         (JSC::isJSString):
1053         * runtime/Operations.h:
1054         (JSC::jsLess):
1055         (JSC::jsLessEq):
1056         * wrec/WREC.cpp:
1057         (JSC::WREC::Generator::compileRegExp):
1058
1059 2009-02-23  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
1060
1061         Reviewed by Oliver Hunt.
1062
1063         Bug 23787: Allow JIT to generate SSE2 code if using GCC
1064         <https://bugs.webkit.org/show_bug.cgi?id=23787>
1065
1066         GCC version of the cpuid check.
1067
1068         * jit/JITArithmetic.cpp:
1069         (JSC::isSSE2Present): previous assembly code fixed.
1070
1071 2009-02-23  David Levin  <levin@chromium.org>
1072
1073         Reviewed by Alexey Proskuryakov.
1074
1075         Bug 24047: Need to simplify nested if's in WorkerRunLoop::runInMode
1076         <https://bugs.webkit.org/show_bug.cgi?id=24047>
1077
1078         * wtf/MessageQueue.h:
1079         (WTF::MessageQueue::infiniteTime):
1080         Allows for one to call waitForMessageFilteredWithTimeout and wait forever.
1081
1082         (WTF::MessageQueue::alwaysTruePredicate):
1083         (WTF::MessageQueue::waitForMessage):
1084         Made waitForMessage call waitForMessageFilteredWithTimeout, so that there is less
1085         duplicate code.
1086
1087         (WTF::MessageQueue::waitForMessageFilteredWithTimeout):
1088
1089         * wtf/ThreadingQt.cpp:
1090         (WTF::ThreadCondition::timedWait):
1091         * wtf/ThreadingWin.cpp:
1092         (WTF::ThreadCondition::timedWait):
1093         Made these two implementations consistent with the pthread and gtk implementations.
1094         Currently, the time calculations would overflow when passed large values.
1095
1096 2009-02-23  Jeremy Moskovich  <jeremy@chromium.org>
1097
1098         Reviewed by Adam Roben.
1099
1100         https://bugs.webkit.org/show_bug.cgi?id=24096
1101         PLATFORM(MAC)->PLATFORM(CF) since we want to use the CF functions in Chrome on OS X.
1102
1103         * wtf/CurrentTime.cpp:
1104
1105 2009-02-22  Geoffrey Garen  <ggaren@apple.com>
1106
1107         Build fix?
1108
1109         * GNUmakefile.am:
1110
1111 2009-02-22  Geoffrey Garen  <ggaren@apple.com>
1112
1113         Build fix.
1114
1115         * GNUmakefile.am:
1116
1117 2009-02-22  Geoffrey Garen  <ggaren@apple.com>
1118
1119         Reviewed by Sam Weinig.
1120
1121         Next step in splitting JIT functionality out of the Interpreter class:
1122         Created a JITStubs class and renamed Interpreter::cti_* to JITStubs::cti_*.
1123         
1124         Also, moved timeout checking into its own class, located in JSGlobalData,
1125         so both the Interpreter and the JIT could have access to it.
1126
1127         * JavaScriptCore.exp:
1128         * JavaScriptCore.pri:
1129         * JavaScriptCore.scons:
1130         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1131         * JavaScriptCore.xcodeproj/project.pbxproj:
1132         * JavaScriptCoreSources.bkl:
1133         * interpreter/CallFrame.h:
1134         * interpreter/Interpreter.cpp:
1135         (JSC::Interpreter::Interpreter):
1136         (JSC::Interpreter::privateExecute):
1137         * interpreter/Interpreter.h:
1138         * interpreter/Register.h:
1139         * jit/JIT.cpp:
1140         (JSC::):
1141         (JSC::JIT::emitTimeoutCheck):
1142         (JSC::JIT::privateCompileMainPass):
1143         (JSC::JIT::privateCompileSlowCases):
1144         (JSC::JIT::privateCompile):
1145         (JSC::JIT::privateCompileCTIMachineTrampolines):
1146         * jit/JIT.h:
1147         * jit/JITArithmetic.cpp:
1148         (JSC::JIT::compileFastArithSlow_op_lshift):
1149         (JSC::JIT::compileFastArithSlow_op_rshift):
1150         (JSC::JIT::compileFastArithSlow_op_bitand):
1151         (JSC::JIT::compileFastArithSlow_op_mod):
1152         (JSC::JIT::compileFastArith_op_mod):
1153         (JSC::JIT::compileFastArithSlow_op_post_inc):
1154         (JSC::JIT::compileFastArithSlow_op_post_dec):
1155         (JSC::JIT::compileFastArithSlow_op_pre_inc):
1156         (JSC::JIT::compileFastArithSlow_op_pre_dec):
1157         (JSC::JIT::compileFastArith_op_add):
1158         (JSC::JIT::compileFastArith_op_mul):
1159         (JSC::JIT::compileFastArith_op_sub):
1160         (JSC::JIT::compileBinaryArithOpSlowCase):
1161         (JSC::JIT::compileFastArithSlow_op_add):
1162         (JSC::JIT::compileFastArithSlow_op_mul):
1163         * jit/JITCall.cpp:
1164         (JSC::JIT::compileOpCall):
1165         (JSC::JIT::compileOpCallSlowCase):
1166         * jit/JITPropertyAccess.cpp:
1167         (JSC::JIT::compileGetByIdHotPath):
1168         (JSC::JIT::compilePutByIdHotPath):
1169         (JSC::JIT::compileGetByIdSlowCase):
1170         (JSC::JIT::compilePutByIdSlowCase):
1171         (JSC::JIT::privateCompilePutByIdTransition):
1172         (JSC::JIT::patchGetByIdSelf):
1173         (JSC::JIT::patchPutByIdReplace):
1174         (JSC::JIT::privateCompilePatchGetArrayLength):
1175         (JSC::JIT::privateCompileGetByIdSelf):
1176         (JSC::JIT::privateCompileGetByIdProto):
1177         (JSC::JIT::privateCompileGetByIdChain):
1178         (JSC::JIT::privateCompilePutByIdReplace):
1179         * jit/JITStubs.cpp:
1180         (JSC::JITStubs::tryCachePutByID):
1181         (JSC::JITStubs::tryCacheGetByID):
1182         (JSC::JITStubs::cti_op_convert_this):
1183         (JSC::JITStubs::cti_op_end):
1184         (JSC::JITStubs::cti_op_add):
1185         (JSC::JITStubs::cti_op_pre_inc):
1186         (JSC::JITStubs::cti_timeout_check):
1187         (JSC::JITStubs::cti_register_file_check):
1188         (JSC::JITStubs::cti_op_loop_if_less):
1189         (JSC::JITStubs::cti_op_loop_if_lesseq):
1190         (JSC::JITStubs::cti_op_new_object):
1191         (JSC::JITStubs::cti_op_put_by_id_generic):
1192         (JSC::JITStubs::cti_op_get_by_id_generic):
1193         (JSC::JITStubs::cti_op_put_by_id):
1194         (JSC::JITStubs::cti_op_put_by_id_second):
1195         (JSC::JITStubs::cti_op_put_by_id_fail):
1196         (JSC::JITStubs::cti_op_get_by_id):
1197         (JSC::JITStubs::cti_op_get_by_id_second):
1198         (JSC::JITStubs::cti_op_get_by_id_self_fail):
1199         (JSC::JITStubs::cti_op_get_by_id_proto_list):
1200         (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
1201         (JSC::JITStubs::cti_op_get_by_id_proto_fail):
1202         (JSC::JITStubs::cti_op_get_by_id_array_fail):
1203         (JSC::JITStubs::cti_op_get_by_id_string_fail):
1204         (JSC::JITStubs::cti_op_instanceof):
1205         (JSC::JITStubs::cti_op_del_by_id):
1206         (JSC::JITStubs::cti_op_mul):
1207         (JSC::JITStubs::cti_op_new_func):
1208         (JSC::JITStubs::cti_op_call_JSFunction):
1209         (JSC::JITStubs::cti_op_call_arityCheck):
1210         (JSC::JITStubs::cti_vm_dontLazyLinkCall):
1211         (JSC::JITStubs::cti_vm_lazyLinkCall):
1212         (JSC::JITStubs::cti_op_push_activation):
1213         (JSC::JITStubs::cti_op_call_NotJSFunction):
1214         (JSC::JITStubs::cti_op_create_arguments):
1215         (JSC::JITStubs::cti_op_create_arguments_no_params):
1216         (JSC::JITStubs::cti_op_tear_off_activation):
1217         (JSC::JITStubs::cti_op_tear_off_arguments):
1218         (JSC::JITStubs::cti_op_profile_will_call):
1219         (JSC::JITStubs::cti_op_profile_did_call):
1220         (JSC::JITStubs::cti_op_ret_scopeChain):
1221         (JSC::JITStubs::cti_op_new_array):
1222         (JSC::JITStubs::cti_op_resolve):
1223         (JSC::JITStubs::cti_op_construct_JSConstruct):
1224         (JSC::JITStubs::cti_op_construct_NotJSConstruct):
1225         (JSC::JITStubs::cti_op_get_by_val):
1226         (JSC::JITStubs::cti_op_get_by_val_byte_array):
1227         (JSC::JITStubs::cti_op_resolve_func):
1228         (JSC::JITStubs::cti_op_sub):
1229         (JSC::JITStubs::cti_op_put_by_val):
1230         (JSC::JITStubs::cti_op_put_by_val_array):
1231         (JSC::JITStubs::cti_op_put_by_val_byte_array):
1232         (JSC::JITStubs::cti_op_lesseq):
1233         (JSC::JITStubs::cti_op_loop_if_true):
1234         (JSC::JITStubs::cti_op_negate):
1235         (JSC::JITStubs::cti_op_resolve_base):
1236         (JSC::JITStubs::cti_op_resolve_skip):
1237         (JSC::JITStubs::cti_op_resolve_global):
1238         (JSC::JITStubs::cti_op_div):
1239         (JSC::JITStubs::cti_op_pre_dec):
1240         (JSC::JITStubs::cti_op_jless):
1241         (JSC::JITStubs::cti_op_not):
1242         (JSC::JITStubs::cti_op_jtrue):
1243         (JSC::JITStubs::cti_op_post_inc):
1244         (JSC::JITStubs::cti_op_eq):
1245         (JSC::JITStubs::cti_op_lshift):
1246         (JSC::JITStubs::cti_op_bitand):
1247         (JSC::JITStubs::cti_op_rshift):
1248         (JSC::JITStubs::cti_op_bitnot):
1249         (JSC::JITStubs::cti_op_resolve_with_base):
1250         (JSC::JITStubs::cti_op_new_func_exp):
1251         (JSC::JITStubs::cti_op_mod):
1252         (JSC::JITStubs::cti_op_less):
1253         (JSC::JITStubs::cti_op_neq):
1254         (JSC::JITStubs::cti_op_post_dec):
1255         (JSC::JITStubs::cti_op_urshift):
1256         (JSC::JITStubs::cti_op_bitxor):
1257         (JSC::JITStubs::cti_op_new_regexp):
1258         (JSC::JITStubs::cti_op_bitor):
1259         (JSC::JITStubs::cti_op_call_eval):
1260         (JSC::JITStubs::cti_op_throw):
1261         (JSC::JITStubs::cti_op_get_pnames):
1262         (JSC::JITStubs::cti_op_next_pname):
1263         (JSC::JITStubs::cti_op_push_scope):
1264         (JSC::JITStubs::cti_op_pop_scope):
1265         (JSC::JITStubs::cti_op_typeof):
1266         (JSC::JITStubs::cti_op_is_undefined):
1267         (JSC::JITStubs::cti_op_is_boolean):
1268         (JSC::JITStubs::cti_op_is_number):
1269         (JSC::JITStubs::cti_op_is_string):
1270         (JSC::JITStubs::cti_op_is_object):
1271         (JSC::JITStubs::cti_op_is_function):
1272         (JSC::JITStubs::cti_op_stricteq):
1273         (JSC::JITStubs::cti_op_nstricteq):
1274         (JSC::JITStubs::cti_op_to_jsnumber):
1275         (JSC::JITStubs::cti_op_in):
1276         (JSC::JITStubs::cti_op_push_new_scope):
1277         (JSC::JITStubs::cti_op_jmp_scopes):
1278         (JSC::JITStubs::cti_op_put_by_index):
1279         (JSC::JITStubs::cti_op_switch_imm):
1280         (JSC::JITStubs::cti_op_switch_char):
1281         (JSC::JITStubs::cti_op_switch_string):
1282         (JSC::JITStubs::cti_op_del_by_val):
1283         (JSC::JITStubs::cti_op_put_getter):
1284         (JSC::JITStubs::cti_op_put_setter):
1285         (JSC::JITStubs::cti_op_new_error):
1286         (JSC::JITStubs::cti_op_debug):
1287         (JSC::JITStubs::cti_vm_throw):
1288         * jit/JITStubs.h:
1289         (JSC::):
1290         * runtime/JSFunction.h:
1291         * runtime/JSGlobalData.cpp:
1292         (JSC::JSGlobalData::JSGlobalData):
1293         * runtime/JSGlobalData.h:
1294         * runtime/JSGlobalObject.cpp:
1295         * runtime/JSGlobalObject.h:
1296         * runtime/TimeoutChecker.cpp: Copied from interpreter/Interpreter.cpp.
1297         (JSC::TimeoutChecker::TimeoutChecker):
1298         (JSC::TimeoutChecker::reset):
1299         (JSC::TimeoutChecker::didTimeOut):
1300         * runtime/TimeoutChecker.h: Copied from interpreter/Interpreter.h.
1301         (JSC::TimeoutChecker::setTimeoutInterval):
1302         (JSC::TimeoutChecker::ticksUntilNextCheck):
1303         (JSC::TimeoutChecker::start):
1304         (JSC::TimeoutChecker::stop):
1305
1306 2009-02-20  Gustavo Noronha Silva  <gns@gnome.org>
1307
1308         Unreviewed build fix after r41100.
1309
1310         * GNUmakefile.am:
1311
1312 2009-02-20  Oliver Hunt  <oliver@apple.com>
1313
1314         Reviewed by Mark Rowe.
1315
1316         <rdar://problem/6606660> 2==null returns true in 64bit jit
1317
1318         Code for op_eq_null and op_neq_null was incorrectly performing
1319         a 32bit compare, which truncated the type tag from an integer
1320         immediate, leading to incorrect behaviour.
1321
1322         * assembler/MacroAssembler.h:
1323         (JSC::MacroAssembler::setPtr):
1324         * assembler/MacroAssemblerX86_64.h:
1325         (JSC::MacroAssemblerX86_64::setPtr):
1326         * jit/JIT.cpp:
1327         (JSC::JIT::privateCompileMainPass):
1328
1329 2009-02-19  Geoffrey Garen  <ggaren@apple.com>
1330
1331         Reviewed by Gavin Barraclough.
1332         
1333         First step in splitting JIT functionality out of the Interpreter class:
1334         Created JITStubs.h/.cpp, and moved Interpreter::cti_* into JITStubs.cpp.
1335         
1336         Functions that the Interpreter and JITStubs share moved to Operations.h/.cpp.
1337
1338         * GNUmakefile.am:
1339         * JavaScriptCore.pri:
1340         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1341         * JavaScriptCore.xcodeproj/project.pbxproj:
1342         * interpreter/Interpreter.cpp:
1343         (JSC::Interpreter::resolveBase):
1344         (JSC::Interpreter::checkTimeout):
1345         (JSC::Interpreter::privateExecute):
1346         * interpreter/Interpreter.h:
1347         * jit/JITStubs.cpp: Copied from interpreter/Interpreter.cpp.
1348         (JSC::Interpreter::cti_op_resolve_base):
1349         * jit/JITStubs.h: Copied from interpreter/Interpreter.h.
1350         * runtime/Operations.cpp:
1351         (JSC::jsAddSlowCase):
1352         (JSC::jsTypeStringForValue):
1353         (JSC::jsIsObjectType):
1354         (JSC::jsIsFunctionType):
1355         * runtime/Operations.h:
1356         (JSC::jsLess):
1357         (JSC::jsLessEq):
1358         (JSC::jsAdd):
1359         (JSC::cachePrototypeChain):
1360         (JSC::countPrototypeChainEntriesAndCheckForProxies):
1361         (JSC::resolveBase):
1362
1363 2009-02-19  Gavin Barraclough  <barraclough@apple.com>
1364
1365         Reviewed by Oliver Hunt.
1366
1367         Fix for x86-64. Where the JavaScriptCore text segment lies outside
1368         a 2gb range of the heap containing JIT generated code, callbacks
1369         from JIT code to the stub functions in Interpreter will be incorrectly
1370         linked.
1371
1372         No performance impact on Sunspider, 1% regression on v8-tests,
1373         due to a 3% regression on richards.
1374
1375         * assembler/AbstractMacroAssembler.h:
1376         (JSC::AbstractMacroAssembler::Call::Call):
1377         (JSC::AbstractMacroAssembler::Jump::link):
1378         (JSC::AbstractMacroAssembler::Jump::linkTo):
1379         (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
1380         (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
1381         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
1382         (JSC::AbstractMacroAssembler::PatchBuffer::link):
1383         (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
1384         (JSC::AbstractMacroAssembler::differenceBetween):
1385         * assembler/MacroAssembler.h:
1386         (JSC::MacroAssembler::tailRecursiveCall):
1387         (JSC::MacroAssembler::makeTailRecursiveCall):
1388         * assembler/MacroAssemblerX86.h:
1389         (JSC::MacroAssemblerX86::call):
1390         * assembler/MacroAssemblerX86Common.h:
1391         * assembler/MacroAssemblerX86_64.h:
1392         (JSC::MacroAssemblerX86_64::call):
1393         (JSC::MacroAssemblerX86_64::moveWithPatch):
1394         (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
1395         (JSC::MacroAssemblerX86_64::storePtrWithPatch):
1396         * assembler/X86Assembler.h:
1397         (JSC::X86Assembler::jmp_r):
1398         (JSC::X86Assembler::linkJump):
1399         (JSC::X86Assembler::patchJump):
1400         (JSC::X86Assembler::patchCall):
1401         (JSC::X86Assembler::linkCall):
1402         (JSC::X86Assembler::patchAddress):
1403         * interpreter/Interpreter.cpp:
1404         (JSC::Interpreter::tryCTICachePutByID):
1405         * jit/JIT.cpp:
1406         (JSC::JIT::privateCompile):
1407         (JSC::JIT::privateCompileCTIMachineTrampolines):
1408         * jit/JIT.h:
1409         * jit/JITArithmetic.cpp:
1410         (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
1411         (JSC::JIT::compileBinaryArithOp):
1412         * jit/JITPropertyAccess.cpp:
1413         (JSC::JIT::privateCompilePutByIdTransition):
1414         (JSC::JIT::privateCompileGetByIdSelf):
1415         (JSC::JIT::privateCompilePutByIdReplace):
1416
1417 2009-02-18  Geoffrey Garen  <ggaren@apple.com>
1418
1419         Reviewed by Oliver Hunt.
1420         
1421         Simplified .call and .apply in preparation for optimizing them. Also,
1422         a little cleanup.
1423
1424         * runtime/FunctionPrototype.cpp:
1425         (JSC::functionProtoFuncApply):
1426         (JSC::functionProtoFuncCall): No need to do any specific conversion on
1427         'this' -- op_convert_this will do it if necessary.
1428
1429         * runtime/JSImmediate.cpp:
1430         (JSC::JSImmediate::toThisObject): Slightly relaxed the rules on
1431         toThisObject to allow for 'undefined', which can be passed through
1432         .call and .apply.
1433
1434 2009-02-19  David Levin  <levin@chromium.org>
1435
1436         Reviewed by Alexey Proskuryakov.
1437
1438         Bug 23976: MessageQueue needs a way to wait for a message that satisfies an arbitrary criteria.
1439         <https://bugs.webkit.org/show_bug.cgi?id=23976>
1440
1441         * wtf/Deque.h:
1442         (WTF::Deque<T>::findIf):
1443         * wtf/MessageQueue.h:
1444         (WTF::MessageQueue<T>::waitForMessageFiltered):
1445
1446 2009-02-18  David Levin  <levin@chromium.org>
1447
1448         Reviewed by Alexey Proskuryakov.
1449
1450         Bug 23974: Deque::Remove would be a useful method.
1451         <https://bugs.webkit.org/show_bug.cgi?id=23974>
1452
1453         Add Deque::remove and DequeIteratorBase<T>::operator=.
1454
1455         Why was operator= added? Every concrete iterator (DequeIterator..DequeConstReverseIterator)
1456         was calling DequeIteratorBase::assign(), which called Base::operator=(). Base::operator=()
1457         was not implemented. This went unnoticed because the iterator copy code has been unused.
1458
1459         * wtf/Deque.h:
1460         (WTF::Deque<T>::remove):
1461         (WTF::DequeIteratorBase<T>::removeFromIteratorsList):
1462         (WTF::DequeIteratorBase<T>::operator=):
1463         (WTF::DequeIteratorBase<T>::~DequeIteratorBase):
1464
1465 2009-02-18  Gustavo Noronha Silva  <gns@gnome.org>
1466
1467         Reviewed by Holger Freyther.
1468
1469         Fix symbols.filter location, and add other missing files to the
1470         autotools build, so that make dist works.
1471
1472         * GNUmakefile.am:
1473
1474 2009-02-17  Geoffrey Garen  <ggaren@apple.com>
1475
1476         Reviewed by Sam Weinig.
1477         
1478         Fixed failure in js1_5/Regress/regress-168347.js, as seen on the Oliver
1479         bot.
1480         
1481         Technically, both behaviors are OK, but we might as well keep this test
1482         passing.
1483
1484         * runtime/FunctionPrototype.cpp:
1485         (JSC::insertSemicolonIfNeeded): No need to add a trailing semicolon
1486         after a trailing '}', since '}' ends a block, indicating the end of a
1487         statement.
1488
1489 2009-02-17  Geoffrey Garen  <ggaren@apple.com>
1490
1491         Build fix.
1492
1493         * runtime/FunctionPrototype.cpp:
1494
1495 2009-02-17  Oliver Hunt  <oliver@apple.com>
1496
1497         Reviewed by Geoff Garen.
1498
1499         Add assertion to guard against oversized pc relative calls.
1500
1501         * assembler/X86Assembler.h:
1502         (JSC::X86Assembler::link):
1503
1504 2009-02-17  Geoffrey Garen  <ggaren@apple.com>
1505
1506         Reviewed by Sam Weinig.
1507         
1508         Fixed <rdar://problem/6595040> REGRESSION: http://www.amnestyusa.org/
1509         fails to load.
1510         
1511         amnestyusa.org uses the Optimist JavaScript library, which adds event
1512         listeners by concatenating string-ified functions. This is only sure to
1513         be syntactically valid if the string-ified functions end in semicolons.
1514
1515         * parser/Lexer.cpp:
1516         (JSC::Lexer::isWhiteSpace):
1517         * parser/Lexer.h:
1518         (JSC::Lexer::isWhiteSpace):
1519         (JSC::Lexer::isLineTerminator): Added some helper functions for examining
1520         whitespace.
1521
1522         * runtime/FunctionPrototype.cpp:
1523         (JSC::appendSemicolonIfNeeded):
1524         (JSC::functionProtoFuncToString): When string-ifying a function, insert
1525         a semicolon in the last non-whitespace position, if one doesn't already exist.
1526
1527 2009-02-16  Oliver Hunt  <oliver@apple.com>
1528
1529         Reviewed by NOBODY (Build fix).
1530
1531         Roll out r41022 as it breaks qt and gtk builds
1532
1533         * jit/JITArithmetic.cpp:
1534         (JSC::isSSE2Present):
1535
1536 2009-02-16  Sam Weinig  <sam@webkit.org>
1537
1538         Reviewed by Geoffrey Garen.
1539
1540         Fix for <rdar://problem/6468156>
1541         REGRESSION (r36779): Adding link, images, flash in TinyMCE blocks entire page (21382)
1542
1543         No performance regression.
1544
1545         * runtime/Arguments.cpp:
1546         (JSC::Arguments::fillArgList): Add codepath for when the "length" property has been
1547         overridden.
1548
1549 2009-02-16  Mark Rowe  <mrowe@apple.com>
1550
1551         Build fix.
1552
1553         * wtf/FastMalloc.cpp:
1554         (WTF::TCMallocStats::):
1555         (WTF::TCMallocStats::FastMallocZone::FastMallocZone):
1556
1557 2009-02-16  Csaba Osztrogonac  <oszi@inf.u-szeged.hu>
1558
1559         Reviewed by Oliver Hunt.
1560
1561         Bug 23787: Allow JIT to generate SSE2 code if using GCC
1562         <https://bugs.webkit.org/show_bug.cgi?id=23787>
1563
1564         GCC version of the cpuid check.
1565
1566         * jit/JITArithmetic.cpp:
1567         (JSC::isSSE2Present): GCC assembly code added.
1568         6.6% progression on x86 Linux with JIT and WREC on SunSpider if using SSE2 capable machine.
1569
1570 2009-02-13  Adam Treat  <adam.treat@torchmobile.com>
1571
1572         Reviewed by George Staikos.
1573
1574         https://bugs.webkit.org/show_bug.cgi?id=23960
1575         Crash Fix.
1576
1577         Don't depend on 'initializeThreading()' to come before a call to 'isMainThread()'
1578         as QtWebKit only calls 'initializeThreading()' during QWebPage construction.
1579
1580         A client app may well make a call to QWebSettings::iconForUrl() for instance
1581         before creating a QWebPage and that call to QWebSettings triggers an
1582         ASSERT(isMainThread()) deep within WebCore.
1583
1584         * wtf/ThreadingQt.cpp:
1585         (WTF::isMainThread):
1586
1587 2009-02-13  Gavin Barraclough  <barraclough@apple.com>
1588
1589         Reviewed by Darin Adler.
1590
1591         Some data in the instruction stream is potentially uninitialized - fix this.
1592
1593         Change the OperandTypes constructor so that uninitialized memory in the int
1594         is zeroed, and modify the Instruction constructor taking an Opcode so that
1595         if !HAVE(COMPUTED_GOTO) (i.e. when Opcode is an enum, and is potentially only
1596         a byte) it zeros the Instruction first before writing the opcode.
1597
1598         * bytecode/Instruction.h:
1599         (JSC::Instruction::Instruction):
1600         * parser/ResultType.h:
1601         (JSC::OperandTypes::OperandTypes):
1602
1603 2009-02-13  Geoffrey Garen  <ggaren@apple.com>
1604
1605         Build fix for non_JIT platforms.
1606
1607         * bytecode/CodeBlock.h:
1608         (JSC::CodeBlock::setIsNumericCompareFunction):
1609         (JSC::CodeBlock::isNumericCompareFunction):
1610
1611 2009-02-13  Geoffrey Garen  <ggaren@apple.com>
1612
1613         Reviewed by Darin Adler.
1614         
1615         Fixed <rdar://problem/6584057> Optimize sort by JS numeric comparison
1616         function not to run the comparison function
1617         
1618         * bytecode/CodeBlock.cpp:
1619         (JSC::CodeBlock::CodeBlock):
1620         * bytecode/CodeBlock.h:
1621         (JSC::CodeBlock::setIsNumericCompareFunction):
1622         (JSC::CodeBlock::isNumericCompareFunction): Added the ability to track
1623         whether a CodeBlock performs a sort-like numeric comparison.
1624
1625         * bytecompiler/BytecodeGenerator.cpp:
1626         (JSC::BytecodeGenerator::generate): Set the isNumericCompareFunction bit
1627         after compiling.
1628
1629         * parser/Nodes.cpp:
1630         (JSC::FunctionBodyNode::emitBytecode): Fixed a bug that caused us to
1631         codegen an extra return at the end of all functions (eek!), since this
1632         made it harder / weirder to detect the numeric comparison pattern in
1633         bytecode.
1634
1635         * runtime/ArrayPrototype.cpp:
1636         (JSC::arrayProtoFuncSort): Use the isNumericCompareFunction bit to do
1637         a faster sort if we can.
1638
1639         * runtime/FunctionConstructor.cpp:
1640         (JSC::extractFunctionBody):
1641         (JSC::constructFunction):
1642         * runtime/FunctionConstructor.h: Renamed and exported extractFunctionBody for
1643         use in initializing lazyNumericCompareFunction.
1644
1645         * runtime/JSArray.cpp:
1646         (JSC::compareNumbersForQSort):
1647         (JSC::compareByStringPairForQSort):
1648         (JSC::JSArray::sortNumeric):
1649         (JSC::JSArray::sort):
1650         * runtime/JSArray.h: Added a fast numeric sort. Renamed ArrayQSortPair
1651         to be more specific since we do different kinds of qsort now.
1652
1653         * runtime/JSGlobalData.cpp:
1654         (JSC::JSGlobalData::JSGlobalData):
1655         (JSC::JSGlobalData::numericCompareFunction):
1656         (JSC::JSGlobalData::ClientData::~ClientData):
1657         * runtime/JSGlobalData.h: Added helper data for computing the
1658         isNumericCompareFunction bit.
1659
1660 2009-02-13  Darin Adler  <darin@apple.com>
1661
1662         * Configurations/JavaScriptCore.xcconfig: Undo accidental commit of this file.
1663
1664 2009-02-12  Darin Adler  <darin@apple.com>
1665
1666         Reviewed by Oliver Hunt and Alexey Proskuryakov.
1667
1668         Speed up a couple string functions.
1669
1670         * runtime/StringPrototype.cpp:
1671         (JSC::stringProtoFuncIndexOf): Added a fast path for cases where the second
1672         argument is either missing or an integer.
1673         (JSC::stringProtoFuncBig): Use jsNontrivialString since the string is guaranteed
1674         to be 2 or more characters long.
1675         (JSC::stringProtoFuncSmall): Ditto.
1676         (JSC::stringProtoFuncBlink): Ditto.
1677         (JSC::stringProtoFuncBold): Ditto.
1678         (JSC::stringProtoFuncItalics): Ditto.
1679         (JSC::stringProtoFuncStrike): Ditto.
1680         (JSC::stringProtoFuncSub): Ditto.
1681         (JSC::stringProtoFuncSup): Ditto.
1682         (JSC::stringProtoFuncFontcolor): Ditto.
1683         (JSC::stringProtoFuncFontsize): Make the fast path Sam recently added even faster
1684         by avoiding all but the minimum memory allocation.
1685         (JSC::stringProtoFuncAnchor): Use jsNontrivialString.
1686         (JSC::stringProtoFuncLink): Added a fast path.
1687
1688         * runtime/UString.cpp:
1689         (JSC::UString::find): Added a fast path for single-character search strings.
1690
1691 2009-02-13  David Levin  <levin@chromium.org>
1692
1693         Reviewed by Darin Adler.
1694
1695         Bug 23926: Race condition in callOnMainThreadAndWait
1696         <https://bugs.webkit.org/show_bug.cgi?id=23926>
1697
1698         * wtf/MainThread.cpp:
1699         Removed callOnMainThreadAndWait since it isn't used.
1700
1701 2009-02-13  Oliver Hunt  <oliver@apple.com>
1702
1703         Reviewed by Jon Honeycutt.
1704
1705         Math.random is really slow on windows.
1706
1707         Math.random calls WTF::randomNumber which is implemented as
1708         the secure rand_s on windows.  Unfortunately rand_s is an order
1709         of magnitude slower than arc4random.  For this reason I've
1710         added "weakRandomNumber" for use by JavaScript's Math Object.
1711         In the long term we should look at using our own secure PRNG
1712         in place of the system, but this will do for now.
1713
1714         30% win on SunSpider on Windows, resolving most of the remaining
1715         disparity vs. Mac.
1716
1717         * runtime/MathObject.cpp:
1718         (JSC::MathObject::MathObject):
1719         (JSC::mathProtoFuncRandom):
1720         * wtf/RandomNumber.cpp:
1721         (WTF::weakRandomNumber):
1722         (WTF::randomNumber):
1723         * wtf/RandomNumber.h:
1724         * wtf/RandomNumberSeed.h:
1725         (WTF::initializeWeakRandomNumberGenerator):
1726
1727 2009-02-12  Mark Rowe  <mrowe@apple.com>
1728
1729         Fix the build for other platforms.
1730
1731         * wtf/RandomNumber.cpp:
1732         (WTF::randomNumber):
1733
1734 2009-02-12  Gavin Barraclough  <barraclough@apple.com>
1735
1736         Reviewed by Sam Weinig.
1737
1738         Remove (/reduce) use of hard-wired register names from the JIT.
1739         Currently there is no abstraction of registers used in the JIT,
1740         which has a number of negative consequences.  Hard-wiring x86
1741         register names makes the JIT less portable to other platforms,
1742         and prevents us from performing dynamic register allocation to
1743         attempt to maintain more temporary values in machine registers.
1744         (The latter will be more important on x86-64, where we have more
1745         registers to make use of).
1746
1747         Also, remove MacroAssembler::mod32.  This was not providing a
1748         useful abstraction, and was not in keeping with the rest of the
1749         MacroAssembler interface, in having specific register requirements.
1750
1751         * assembler/MacroAssemblerX86Common.h:
1752         * jit/JIT.cpp:
1753         (JSC::JIT::compileOpStrictEq):
1754         (JSC::JIT::emitSlowScriptCheck):
1755         (JSC::JIT::privateCompileMainPass):
1756         (JSC::JIT::privateCompileSlowCases):
1757         (JSC::JIT::privateCompile):
1758         (JSC::JIT::privateCompileCTIMachineTrampolines):
1759         * jit/JIT.h:
1760         * jit/JITArithmetic.cpp:
1761         (JSC::JIT::compileFastArith_op_lshift):
1762         (JSC::JIT::compileFastArithSlow_op_lshift):
1763         (JSC::JIT::compileFastArith_op_rshift):
1764         (JSC::JIT::compileFastArithSlow_op_rshift):
1765         (JSC::JIT::compileFastArith_op_bitand):
1766         (JSC::JIT::compileFastArithSlow_op_bitand):
1767         (JSC::JIT::compileFastArith_op_mod):
1768         (JSC::JIT::compileFastArithSlow_op_mod):
1769         (JSC::JIT::compileFastArith_op_post_inc):
1770         (JSC::JIT::compileFastArithSlow_op_post_inc):
1771         (JSC::JIT::compileFastArith_op_post_dec):
1772         (JSC::JIT::compileFastArithSlow_op_post_dec):
1773         (JSC::JIT::compileFastArith_op_pre_inc):
1774         (JSC::JIT::compileFastArithSlow_op_pre_inc):
1775         (JSC::JIT::compileFastArith_op_pre_dec):
1776         (JSC::JIT::compileFastArithSlow_op_pre_dec):
1777         (JSC::JIT::compileFastArith_op_add):
1778         (JSC::JIT::compileFastArith_op_mul):
1779         (JSC::JIT::compileFastArith_op_sub):
1780         (JSC::JIT::compileBinaryArithOp):
1781         * jit/JITCall.cpp:
1782         (JSC::JIT::compileOpCallInitializeCallFrame):
1783         (JSC::JIT::compileOpCallSetupArgs):
1784         (JSC::JIT::compileOpCallEvalSetupArgs):
1785         (JSC::JIT::compileOpConstructSetupArgs):
1786         (JSC::JIT::compileOpCall):
1787         (JSC::JIT::compileOpCallSlowCase):
1788         * jit/JITInlineMethods.h:
1789         (JSC::JIT::emitGetVirtualRegister):
1790         (JSC::JIT::emitPutVirtualRegister):
1791         (JSC::JIT::emitNakedCall):
1792         (JSC::JIT::restoreArgumentReference):
1793         (JSC::JIT::restoreArgumentReferenceForTrampoline):
1794         * jit/JITPropertyAccess.cpp:
1795         (JSC::JIT::compileGetByIdHotPath):
1796         (JSC::JIT::compilePutByIdHotPath):
1797         (JSC::JIT::compileGetByIdSlowCase):
1798         (JSC::JIT::compilePutByIdSlowCase):
1799         (JSC::JIT::privateCompilePutByIdTransition):
1800         (JSC::JIT::privateCompilePatchGetArrayLength):
1801         (JSC::JIT::privateCompileGetByIdSelf):
1802         (JSC::JIT::privateCompileGetByIdProto):
1803         (JSC::JIT::privateCompileGetByIdSelfList):
1804         (JSC::JIT::privateCompileGetByIdProtoList):
1805         (JSC::JIT::privateCompileGetByIdChainList):
1806         (JSC::JIT::privateCompileGetByIdChain):
1807         (JSC::JIT::privateCompilePutByIdReplace):
1808
1809 2009-02-12  Horia Olaru  <olaru@adobe.com>
1810
1811         Reviewed by Oliver Hunt.
1812
1813         https://bugs.webkit.org/show_bug.cgi?id=23400
1814
1815         When throwing an exception within an eval argument string, the dst parameter was
1816         modified in the functions below and the return value for eval was altered. Changed
1817         the emitNode call in JSC::ThrowNode::emitBytecode to use a temporary register
1818         to store its results instead of dst. The JSC::FunctionCallResolveNode::emitBytecode
1819         would load the function within the dst registry, also altering the result returned
1820         by eval. Replaced it with another temporary.
1821
1822         * parser/Nodes.cpp:
1823         (JSC::FunctionCallResolveNode::emitBytecode):
1824         (JSC::ThrowNode::emitBytecode):
1825
1826 2009-02-12  Sam Weinig  <sam@webkit.org>
1827
1828         Reviewed by Geoffrey Garen.
1829
1830         Speed up String.prototype.fontsize.
1831
1832         * runtime/StringPrototype.cpp:
1833         (JSC::stringProtoFuncFontsize): Specialize for defined/commonly used values.
1834
1835 2009-02-12  Geoffrey Garen  <ggaren@apple.com>
1836
1837         Reviewed by Sam Weinig.
1838         
1839         Correctness fix.
1840
1841         * wtf/RandomNumber.cpp:
1842         (WTF::randomNumber): Divide by the maximum representable value, which
1843         is different on each platform now, to get values between 0 and 1.
1844
1845 2009-02-12  Geoffrey Garen  <ggaren@apple.com>
1846
1847         Build fix.
1848
1849         * wtf/RandomNumber.cpp:
1850         (WTF::randomNumber):
1851
1852 2009-02-12  Geoffrey Garen  <ggaren@apple.com>
1853
1854         Reviewed by Sam Weinig.
1855         
1856         Fixed <rdar://problem/6582048>.
1857
1858         * wtf/RandomNumber.cpp:
1859         (WTF::randomNumber): Make only one call to the random number generator
1860         on platforms where the generator is cryptographically secure. The value
1861         of randomness over and above cryptographically secure randomness is not
1862         clear, and it caused some performance problems.
1863
1864 2009-02-12  Adam Roben  <aroben@apple.com>
1865
1866         Fix lots of Perl warnings when building JavaScriptCoreGenerated on
1867         Windows
1868
1869         Reviewed by John Sullivan.
1870
1871         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
1872         Create the docs/ directory so that we can write bytecode.html into it.
1873         This matches what JavaScriptCore.xcodeproj does.
1874
1875 2009-02-12  Simon Hausmann  <simon.hausmann@nokia.com>
1876
1877         Rubber-stamped by Lars.
1878
1879         Re-enable the JIT in the Qt build with -fno-stack-protector on Linux.
1880
1881         * JavaScriptCore.pri:
1882
1883 2009-02-11  Dmitry Titov  <dimich@chromium.org>
1884
1885         Reviewed by Alexey Proskuryakov.
1886
1887         https://bugs.webkit.org/show_bug.cgi?id=23705
1888         Fix the UI freeze caused by Worker generating a flood of messages.
1889         Measure time we spend in executing posted work items. If too much time is spent
1890         without returning to the run loop, exit and reschedule.
1891
1892         * wtf/MainThread.h:
1893         Added initializeMainThreadPlatform() to initialize low-level mechanism for posting
1894         work items from thread to thread. This removes #ifdefs for WIN and CHROMIUM from platform-independent code.
1895
1896         * wtf/MainThread.cpp:
1897         (WTF::initializeMainThread):
1898         (WTF::dispatchFunctionsFromMainThread):
1899         Instead of dispatching all work items in the queue, dispatch them one by one
1900         and measure elapsed time. After a threshold, reschedule and quit.
1901
1902         (WTF::callOnMainThread):
1903         (WTF::callOnMainThreadAndWait):
1904         Only schedule dispatch if the queue was empty - to avoid many posted messages in the run loop queue.
1905
1906         * wtf/mac/MainThreadMac.mm:
1907         (WTF::scheduleDispatchFunctionsOnMainThread):
1908         Use static instance of the mainThreadCaller instead of allocating and releasing it each time.
1909         (WTF::initializeMainThreadPlatform):
1910         * wtf/gtk/MainThreadChromium.cpp:
1911         (WTF::initializeMainThreadPlatform):
1912         * wtf/gtk/MainThreadGtk.cpp:
1913         (WTF::initializeMainThreadPlatform):
1914         * wtf/qt/MainThreadQt.cpp:
1915         (WTF::initializeMainThreadPlatform):
1916         * wtf/win/MainThreadWin.cpp:
1917         (WTF::initializeMainThreadPlatform):
1918         * wtf/wx/MainThreadWx.cpp:
1919         (WTF::initializeMainThreadPlatform):
1920
1921 2009-02-11  Sam Weinig  <sam@webkit.org>
1922
1923         Reviewed by Gavin Barraclough.
1924
1925         Style cleanup.
1926
1927         * assembler/AbstractMacroAssembler.h:
1928         (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
1929         (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool):
1930         (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
1931         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
1932         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
1933         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
1934         (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
1935         (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
1936         (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
1937         (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
1938         (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
1939         (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
1940         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
1941         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
1942         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
1943         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
1944         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress):
1945         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
1946         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*):
1947         (JSC::AbstractMacroAssembler::PatchBuffer::link):
1948         (JSC::::CodeLocationCommon::labelAtOffset):
1949         (JSC::::CodeLocationCommon::jumpAtOffset):
1950         (JSC::::CodeLocationCommon::callAtOffset):
1951         (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
1952         (JSC::::CodeLocationCommon::dataLabel32AtOffset):
1953
1954 2009-02-11  Sam Weinig  <sam@webkit.org>
1955
1956         Reviewed by Gavin Barraclough.
1957
1958         * assembler/AbstractMacroAssembler.h: Fix comments.
1959
1960 2009-02-11  Alexey Proskuryakov  <ap@webkit.org>
1961
1962         Trying to fix wx build.
1963
1964         * bytecode/JumpTable.h: Include "MacroAssembler.h", not <MacroAssembler.h>.
1965         * jscore.bkl: Added assembler directory to search paths.
1966
1967 2009-02-10  Gavin Barraclough  <barraclough@apple.com>
1968
1969         Build
1970         fix.
1971         (Narrow
1972         changelog
1973         for
1974         dhyatt).
1975
1976         * bytecode/Instruction.h:
1977         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
1978         (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
1979
1980 2009-02-10  Gavin Barraclough  <barraclough@apple.com>
1981
1982         Reviewed by Oliver Hunt.
1983
1984         Reduce use of void* / reinterpret_cast in JIT repatching code,
1985         add strong types for Calls and for the various types of pointers
1986         we retain into the JIT generated instruction stream.
1987
1988         No performance impact.
1989
1990         * assembler/AbstractMacroAssembler.h:
1991         (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr):
1992         (JSC::AbstractMacroAssembler::ImmPtr::asIntptr):
1993         (JSC::AbstractMacroAssembler::Imm32::Imm32):
1994         (JSC::AbstractMacroAssembler::Label::Label):
1995         (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
1996         (JSC::AbstractMacroAssembler::Call::Call):
1997         (JSC::AbstractMacroAssembler::Call::link):
1998         (JSC::AbstractMacroAssembler::Call::linkTo):
1999         (JSC::AbstractMacroAssembler::Jump::Jump):
2000         (JSC::AbstractMacroAssembler::Jump::linkTo):
2001         (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
2002         (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool):
2003         (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
2004         (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel):
2005         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
2006         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
2007         (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
2008         (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
2009         (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
2010         (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
2011         (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
2012         (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
2013         (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
2014         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
2015         (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
2016         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
2017         (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
2018         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress):
2019         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
2020         (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*):
2021         (JSC::AbstractMacroAssembler::PatchBuffer::entry):
2022         (JSC::AbstractMacroAssembler::PatchBuffer::trampolineAt):
2023         (JSC::AbstractMacroAssembler::PatchBuffer::link):
2024         (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
2025         (JSC::AbstractMacroAssembler::PatchBuffer::patch):
2026         (JSC::AbstractMacroAssembler::PatchBuffer::locationOf):
2027         (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset):
2028         (JSC::AbstractMacroAssembler::differenceBetween):
2029         (JSC::::CodeLocationCommon::labelAtOffset):
2030         (JSC::::CodeLocationCommon::jumpAtOffset):
2031         (JSC::::CodeLocationCommon::callAtOffset):
2032         (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
2033         (JSC::::CodeLocationCommon::dataLabel32AtOffset):
2034         * assembler/MacroAssemblerX86Common.h:
2035         (JSC::MacroAssemblerX86Common::call):
2036         * assembler/X86Assembler.h:
2037         (JSC::X86Assembler::getCallReturnOffset):
2038         * bytecode/CodeBlock.h:
2039         (JSC::CallLinkInfo::CallLinkInfo):
2040         (JSC::getStructureStubInfoReturnLocation):
2041         (JSC::getCallLinkInfoReturnLocation):
2042         * bytecode/Instruction.h:
2043         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
2044         (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
2045         * bytecode/JumpTable.h:
2046         (JSC::StringJumpTable::ctiForValue):
2047         (JSC::SimpleJumpTable::ctiForValue):
2048         * bytecode/StructureStubInfo.h:
2049         (JSC::StructureStubInfo::StructureStubInfo):
2050         * bytecompiler/BytecodeGenerator.cpp:
2051         (JSC::BytecodeGenerator::emitCatch):
2052         (JSC::prepareJumpTableForStringSwitch):
2053         * interpreter/Interpreter.cpp:
2054         (JSC::Interpreter::cti_op_get_by_id_self_fail):
2055         (JSC::getPolymorphicAccessStructureListSlot):
2056         (JSC::Interpreter::cti_op_throw):
2057         (JSC::Interpreter::cti_op_switch_imm):
2058         (JSC::Interpreter::cti_op_switch_char):
2059         (JSC::Interpreter::cti_op_switch_string):
2060         (JSC::Interpreter::cti_vm_throw):
2061         * jit/JIT.cpp:
2062         (JSC::ctiSetReturnAddress):
2063         (JSC::ctiPatchCallByReturnAddress):
2064         (JSC::JIT::privateCompile):
2065         (JSC::JIT::privateCompileCTIMachineTrampolines):
2066         * jit/JIT.h:
2067         (JSC::CallRecord::CallRecord):
2068         (JSC::JIT::compileGetByIdSelf):
2069         (JSC::JIT::compileGetByIdProto):
2070         (JSC::JIT::compileGetByIdChain):
2071         (JSC::JIT::compilePutByIdReplace):
2072         (JSC::JIT::compilePutByIdTransition):
2073         (JSC::JIT::compilePatchGetArrayLength):
2074         (JSC::JIT::emitCTICall):
2075         * jit/JITCall.cpp:
2076         (JSC::JIT::unlinkCall):
2077         (JSC::JIT::linkCall):
2078         * jit/JITInlineMethods.h:
2079         (JSC::JIT::emitNakedCall):
2080         (JSC::JIT::emitCTICall_internal):
2081         * jit/JITPropertyAccess.cpp:
2082         (JSC::JIT::compileGetByIdSlowCase):
2083         (JSC::JIT::compilePutByIdSlowCase):
2084         (JSC::JIT::privateCompilePutByIdTransition):
2085         (JSC::JIT::patchGetByIdSelf):
2086         (JSC::JIT::patchPutByIdReplace):
2087         (JSC::JIT::privateCompilePatchGetArrayLength):
2088         (JSC::JIT::privateCompileGetByIdSelf):
2089         (JSC::JIT::privateCompileGetByIdProto):
2090         (JSC::JIT::privateCompileGetByIdSelfList):
2091         (JSC::JIT::privateCompileGetByIdProtoList):
2092         (JSC::JIT::privateCompileGetByIdChainList):
2093         (JSC::JIT::privateCompileGetByIdChain):
2094         (JSC::JIT::privateCompilePutByIdReplace):
2095
2096 2009-02-10  Adam Roben  <aroben@apple.com>
2097
2098         Windows build fix after r40813
2099
2100         * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added profiler/ to the include
2101         path so that Profiler.h can be found.
2102
2103 2009-02-09  Gavin Barraclough  <barraclough@apple.com>
2104
2105         Reviewed by Oliver Hunt.
2106
2107         Provide a class type for a generated block of JIT code.
2108         Also changes the return address -> bytecode index map to
2109         track the return addess as an unsigned offset into the code
2110         instead of a ptrdiff_t in terms of void**s - the latter is
2111         equal to the actual offset / sizeof(void*), making it a
2112         potentially lossy representation.
2113
2114         * JavaScriptCore.xcodeproj/project.pbxproj:
2115         * assembler/AbstractMacroAssembler.h:
2116         (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset):
2117         * assembler/X86Assembler.h:
2118         (JSC::X86Assembler::getCallReturnOffset):
2119         * bytecode/CodeBlock.h:
2120         (JSC::CallReturnOffsetToBytecodeIndex::CallReturnOffsetToBytecodeIndex):
2121         (JSC::getCallReturnOffset):
2122         (JSC::CodeBlock::getBytecodeIndex):
2123         (JSC::CodeBlock::jitCode):
2124         (JSC::CodeBlock::callReturnIndexVector):
2125         * interpreter/Interpreter.cpp:
2126         (JSC::Interpreter::execute):
2127         (JSC::Interpreter::cti_vm_dontLazyLinkCall):
2128         (JSC::Interpreter::cti_vm_lazyLinkCall):
2129         * jit/JIT.cpp:
2130         (JSC::JIT::privateCompile):
2131         * jit/JIT.h:
2132         (JSC::):
2133         * jit/JITCall.cpp:
2134         (JSC::JIT::linkCall):
2135         * jit/JITCode.h: Added.
2136         (JSC::):
2137         (JSC::JITCode::JITCode):
2138         (JSC::JITCode::operator bool):
2139         (JSC::JITCode::addressForCall):
2140         (JSC::JITCode::offsetOf):
2141         (JSC::JITCode::execute):
2142
2143 2009-02-09  John Grabowski  <jrg@chromium.org>
2144
2145         Reviewed by Darin Adler.
2146
2147         https://bugs.webkit.org/show_bug.cgi?id=23856
2148         Change the definition of "main thread" for Chromium on OSX.
2149         It does not match the DARWIN definition.
2150
2151         * wtf/ThreadingPthreads.cpp:
2152         (WTF::initializeThreading):
2153         (WTF::isMainThread):
2154
2155 2009-02-09  Gavin Barraclough  <barraclough@apple.com>
2156
2157         Reviewed by Oliver Hunt.
2158
2159         Minor bugfix, incorrect check meant that subtraction causing integer overflow
2160         would be missed on x86-64 JIT.
2161
2162         * jit/JITArithmetic.cpp:
2163         (JSC::JIT::compileBinaryArithOp):
2164
2165 2009-02-09  Gavin Barraclough  <barraclough@apple.com>
2166
2167         Reviewed by Oliver Hunt.
2168
2169         A more sensible register allocation for x86-64.
2170
2171         When WREC was ported to x86-64 it stuck with the same register allocation as x86.
2172         This requires registers to be reordered on entry into WREC generated code, since
2173         argument passing is different on x86-64 and x86 (regparm(3)).  This patch switches
2174         x86-64 to use a native register allocation, that does not require argument registers
2175         to be reordered.
2176
2177         * wrec/WRECGenerator.cpp:
2178         (JSC::WREC::Generator::generateEnter):
2179         (JSC::WREC::Generator::generateReturnSuccess):
2180         (JSC::WREC::Generator::generateReturnFailure):
2181         * wrec/WRECGenerator.h:
2182
2183 2009-02-05  Adam Roben  <aroben@apple.com>
2184
2185         Build fix
2186
2187         Rubberstamped by Sam Weinig.
2188
2189         * wtf/TypeTraits.h: Include Platform.h, since this header uses macros
2190         defined there.
2191
2192 2009-02-05  Dimitri Glazkov  <dglazkov@chromium.org>
2193
2194         Reviewed by Eric Seidel.
2195
2196         https://bugs.webkit.org/show_bug.cgi?id=23747
2197         Add Chromium threading-related files.
2198
2199         * wtf/MainThread.cpp: Added platform guard to initializeMainThread.
2200         * wtf/chromium/ChromiumThreading.h: Added.
2201         * wtf/chromium/MainThreadChromium.cpp: Added.
2202         (WTF::initializeMainThread):
2203         (WTF::scheduleDispatchFunctionsOnMainThread):
2204
2205 2009-02-05  David Levin  <levin@chromium.org>
2206
2207         Reviewed by Darin Adler.
2208
2209         Bug 23713: COMPILE_ASSERTS should be moved out of TypeTraits.h and into .cpp file
2210         <https://bugs.webkit.org/show_bug.cgi?id=23713>
2211
2212         * GNUmakefile.am:
2213         * JavaScriptCore.pri:
2214         * JavaScriptCore.scons:
2215         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2216         * JavaScriptCore.xcodeproj/project.pbxproj:
2217         * JavaScriptCoreSources.bkl:
2218
2219         * wtf/HashTraits.h:
2220         Remove unnecessary header file that I missed when moving out the type traits form this file.
2221
2222         * wtf/TypeTraits.cpp: Added.
2223         (WTF::):
2224         * wtf/TypeTraits.h:
2225         Moved the compile asserts into TypeTraits.cpp file.
2226
2227 2009-02-04  Gavin Barraclough  <barraclough@apple.com>
2228
2229         Reviewed by Oliver 'the nun' Hunt.
2230
2231         Add -e switch to jsc to enable evaluation of scripts passed on the command line.
2232
2233         * jsc.cpp:
2234         (Script::Script):
2235         (runWithScripts):
2236         (printUsageStatement):
2237         (parseArguments):
2238         (jscmain):
2239
2240 2009-02-04  Gavin Barraclough  <barraclough@apple.com>
2241
2242         Rubber stamped by Sam 'Big Mac' Weinig.
2243
2244         * assembler/AbstractMacroAssembler.h: Copied from assembler/MacroAssembler.h.
2245         * assembler/MacroAssemblerX86.h: Copied from assembler/MacroAssembler.h.
2246         * assembler/MacroAssemblerX86Common.h: Copied from assembler/MacroAssembler.h.
2247         * assembler/MacroAssemblerX86_64.h: Copied from assembler/MacroAssembler.h.
2248
2249 2009-02-04  Gavin Barraclough  <barraclough@apple.com>
2250
2251         Reviewed by Sam Weinig.
2252
2253         This patch tidies up the MacroAssembler, cleaning up the code and refactoring out the
2254         platform-specific parts.  The MacroAssembler gets split up like a beef burger, with the
2255         platform-agnostic data types being the lower bun (in the form of the class AbstractMacroAssembler),
2256         the plaform-specific code generation forming a big meaty patty of methods like 'add32',
2257         'branch32', etc (MacroAssemblerX86), and finally topped off with the bun-lid of the
2258         MacroAssembler class itself, providing covenience methods such as the stack peek & poke,
2259         and backwards branch methods, all of which can be described in a platform independent
2260         way using methods from the base class.  The AbstractMacroAssembler is templated on the
2261         type of the assembler class that will be used for code generation, and the three layers
2262         are held together with the cocktail stick of inheritance.
2263
2264         The above description is a slight simplification since the MacroAssemblerX86 is actually
2265         formed from two layers (in effect giving us a kind on bacon double cheeseburger) - with the
2266         bulk of methods that are common between x86 & x86-64 implemented in MacroAssemblerX86Common,
2267         which forms a base class for MacroAssemblerX86 and MacroAssemblerX86_64 (which add the methods
2268         specific to the given platform).
2269
2270         I'm landing these changes first without splitting the classes across multiple files,
2271         I will follow up with a second patch to split up the file MacroAssembler.h.
2272
2273         * assembler/MacroAssembler.h:
2274         (JSC::AbstractMacroAssembler::):
2275         (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
2276         (JSC::AbstractMacroAssembler::DataLabelPtr::patch):
2277         (JSC::AbstractMacroAssembler::DataLabel32::DataLabel32):
2278         (JSC::AbstractMacroAssembler::DataLabel32::patch):
2279         (JSC::AbstractMacroAssembler::Label::Label):
2280         (JSC::AbstractMacroAssembler::Jump::Jump):
2281         (JSC::AbstractMacroAssembler::Jump::link):
2282         (JSC::AbstractMacroAssembler::Jump::linkTo):
2283         (JSC::AbstractMacroAssembler::Jump::patch):
2284         (JSC::AbstractMacroAssembler::JumpList::link):
2285         (JSC::AbstractMacroAssembler::JumpList::linkTo):
2286         (JSC::AbstractMacroAssembler::PatchBuffer::link):
2287         (JSC::AbstractMacroAssembler::PatchBuffer::addressOf):
2288         (JSC::AbstractMacroAssembler::PatchBuffer::setPtr):
2289         (JSC::AbstractMacroAssembler::size):
2290         (JSC::AbstractMacroAssembler::copyCode):
2291         (JSC::AbstractMacroAssembler::label):
2292         (JSC::AbstractMacroAssembler::align):
2293         (JSC::AbstractMacroAssembler::differenceBetween):
2294         (JSC::MacroAssemblerX86Common::xor32):
2295         (JSC::MacroAssemblerX86Common::load32WithAddressOffsetPatch):
2296         (JSC::MacroAssemblerX86Common::store32WithAddressOffsetPatch):
2297         (JSC::MacroAssemblerX86Common::move):
2298         (JSC::MacroAssemblerX86Common::swap):
2299         (JSC::MacroAssemblerX86Common::signExtend32ToPtr):
2300         (JSC::MacroAssemblerX86Common::zeroExtend32ToPtr):
2301         (JSC::MacroAssemblerX86Common::branch32):
2302         (JSC::MacroAssemblerX86Common::jump):
2303         (JSC::MacroAssemblerX86_64::add32):
2304         (JSC::MacroAssemblerX86_64::sub32):
2305         (JSC::MacroAssemblerX86_64::load32):
2306         (JSC::MacroAssemblerX86_64::store32):
2307         (JSC::MacroAssemblerX86_64::addPtr):
2308         (JSC::MacroAssemblerX86_64::andPtr):
2309         (JSC::MacroAssemblerX86_64::orPtr):
2310         (JSC::MacroAssemblerX86_64::rshiftPtr):
2311         (JSC::MacroAssemblerX86_64::subPtr):
2312         (JSC::MacroAssemblerX86_64::xorPtr):
2313         (JSC::MacroAssemblerX86_64::loadPtr):
2314         (JSC::MacroAssemblerX86_64::loadPtrWithAddressOffsetPatch):
2315         (JSC::MacroAssemblerX86_64::storePtr):
2316         (JSC::MacroAssemblerX86_64::storePtrWithAddressOffsetPatch):
2317         (JSC::MacroAssemblerX86_64::branchPtr):
2318         (JSC::MacroAssemblerX86_64::branchTestPtr):
2319         (JSC::MacroAssemblerX86_64::branchAddPtr):
2320         (JSC::MacroAssemblerX86_64::branchSubPtr):
2321         (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
2322         (JSC::MacroAssemblerX86_64::storePtrWithPatch):
2323         (JSC::MacroAssemblerX86::add32):
2324         (JSC::MacroAssemblerX86::sub32):
2325         (JSC::MacroAssemblerX86::load32):
2326         (JSC::MacroAssemblerX86::store32):
2327         (JSC::MacroAssemblerX86::branch32):
2328         (JSC::MacroAssemblerX86::branchPtrWithPatch):
2329         (JSC::MacroAssemblerX86::storePtrWithPatch):
2330         (JSC::MacroAssembler::pop):
2331         (JSC::MacroAssembler::peek):
2332         (JSC::MacroAssembler::poke):
2333         (JSC::MacroAssembler::branchPtr):
2334         (JSC::MacroAssembler::branch32):
2335         (JSC::MacroAssembler::branch16):
2336         (JSC::MacroAssembler::branchTestPtr):
2337         (JSC::MacroAssembler::addPtr):
2338         (JSC::MacroAssembler::andPtr):
2339         (JSC::MacroAssembler::orPtr):
2340         (JSC::MacroAssembler::rshiftPtr):
2341         (JSC::MacroAssembler::subPtr):
2342         (JSC::MacroAssembler::xorPtr):
2343         (JSC::MacroAssembler::loadPtr):
2344         (JSC::MacroAssembler::loadPtrWithAddressOffsetPatch):
2345         (JSC::MacroAssembler::storePtr):
2346         (JSC::MacroAssembler::storePtrWithAddressOffsetPatch):
2347         (JSC::MacroAssembler::branchAddPtr):
2348         (JSC::MacroAssembler::branchSubPtr):
2349         * jit/JITArithmetic.cpp:
2350         (JSC::JIT::compileBinaryArithOp):
2351
2352 2009-02-04  Alexey Proskuryakov  <ap@webkit.org>
2353
2354         Reviewed by Sam Weinig.
2355
2356         https://bugs.webkit.org/show_bug.cgi?id=23681
2357         Worker tests crash in debug builds if run --singly
2358
2359         The crash happened because worker threads continued running while debug-only static objects
2360         were already being destroyed on main thread.
2361
2362         * runtime/Structure.cpp: Create static debug-only sets in heap, so that they don't get
2363         destroyed.
2364
2365         * wtf/ThreadingPthreads.cpp: Changed assertions to conventional form.
2366
2367 2009-02-03  Gavin Barraclough  <barraclough@apple.com>
2368
2369         Reviewed by Geoff Garen.
2370
2371         https://bugs.webkit.org/show_bug.cgi?id=23715
2372
2373         Simplify MacroAssembler interface, by combining comparison methods.
2374         Seprate operations are combined as follows:
2375             jz32/jnz32/jzPtr/jnzPtr -> branchTest32/branchTestPtr,
2376             j*(Add|Mul|Sub)32/j*(Add|Mul|Sub)Ptr -> branch(Add|Mul|Sub)32/branch(Add|Mul|Sub)Ptr
2377             j*32/j*Ptr (all other two op combparisons) -> branch32/brnachPtr
2378             set*32 -> set32
2379
2380         Also, represent the Scale of BaseIndex addresses as a plain enum (0,1,2,3),
2381         instead of as multiplicands (1,2,4,8).
2382
2383         This patch singificantly reduces replication of code, and increases functionality supported
2384         by the MacroAssembler.  No performance impact.
2385
2386         * assembler/MacroAssembler.h:
2387         (JSC::MacroAssembler::):
2388         (JSC::MacroAssembler::branchPtr):
2389         (JSC::MacroAssembler::branchPtrWithPatch):
2390         (JSC::MacroAssembler::branch32):
2391         (JSC::MacroAssembler::branch16):
2392         (JSC::MacroAssembler::branchTestPtr):
2393         (JSC::MacroAssembler::branchTest32):
2394         (JSC::MacroAssembler::branchAddPtr):
2395         (JSC::MacroAssembler::branchAdd32):
2396         (JSC::MacroAssembler::branchMul32):
2397         (JSC::MacroAssembler::branchSubPtr):
2398         (JSC::MacroAssembler::branchSub32):
2399         (JSC::MacroAssembler::set32):
2400         (JSC::MacroAssembler::setTest32):
2401         * assembler/X86Assembler.h:
2402         (JSC::X86Assembler::):
2403         (JSC::X86Assembler::jccRel32):
2404         (JSC::X86Assembler::setccOpcode):
2405         (JSC::X86Assembler::cmpq_mr):
2406         (JSC::X86Assembler::setcc_r):
2407         (JSC::X86Assembler::sete_r):
2408         (JSC::X86Assembler::setne_r):
2409         (JSC::X86Assembler::jne):
2410         (JSC::X86Assembler::je):
2411         (JSC::X86Assembler::jl):
2412         (JSC::X86Assembler::jb):
2413         (JSC::X86Assembler::jle):
2414         (JSC::X86Assembler::jbe):
2415         (JSC::X86Assembler::jge):
2416         (JSC::X86Assembler::jg):
2417         (JSC::X86Assembler::ja):
2418         (JSC::X86Assembler::jae):
2419         (JSC::X86Assembler::jo):
2420         (JSC::X86Assembler::jp):
2421         (JSC::X86Assembler::js):
2422         (JSC::X86Assembler::jcc):
2423         (JSC::X86Assembler::X86InstructionFormatter::putModRmSib):
2424         * jit/JIT.cpp:
2425         (JSC::JIT::compileOpStrictEq):
2426         (JSC::JIT::emitSlowScriptCheck):
2427         (JSC::JIT::privateCompileMainPass):
2428         (JSC::JIT::privateCompileSlowCases):
2429         (JSC::JIT::privateCompile):
2430         (JSC::JIT::privateCompileCTIMachineTrampolines):
2431         * jit/JITArithmetic.cpp:
2432         (JSC::JIT::compileFastArith_op_lshift):
2433         (JSC::JIT::compileFastArith_op_mod):
2434         (JSC::JIT::compileFastArith_op_post_inc):
2435         (JSC::JIT::compileFastArith_op_post_dec):
2436         (JSC::JIT::compileFastArith_op_pre_inc):
2437         (JSC::JIT::compileFastArith_op_pre_dec):
2438         (JSC::JIT::compileBinaryArithOp):
2439         (JSC::JIT::compileFastArith_op_add):
2440         (JSC::JIT::compileFastArith_op_mul):
2441         * jit/JITCall.cpp:
2442         (JSC::JIT::compileOpCall):
2443         (JSC::JIT::compileOpCallSlowCase):
2444         * jit/JITInlineMethods.h:
2445         (JSC::JIT::checkStructure):
2446         (JSC::JIT::emitJumpIfJSCell):
2447         (JSC::JIT::emitJumpIfNotJSCell):
2448         (JSC::JIT::emitJumpIfImmediateNumber):
2449         (JSC::JIT::emitJumpIfNotImmediateNumber):
2450         (JSC::JIT::emitJumpIfImmediateInteger):
2451         (JSC::JIT::emitJumpIfNotImmediateInteger):
2452         (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
2453         * jit/JITPropertyAccess.cpp:
2454         (JSC::JIT::compileGetByIdHotPath):
2455         (JSC::JIT::compilePutByIdHotPath):
2456         (JSC::JIT::privateCompilePutByIdTransition):
2457         (JSC::JIT::privateCompilePatchGetArrayLength):
2458         (JSC::JIT::privateCompileGetByIdProto):
2459         (JSC::JIT::privateCompileGetByIdProtoList):
2460         (JSC::JIT::privateCompileGetByIdChainList):
2461         (JSC::JIT::privateCompileGetByIdChain):
2462         * runtime/RegExp.cpp:
2463         (JSC::RegExp::match):
2464         * wrec/WRECGenerator.cpp:
2465         (JSC::WREC::Generator::generateEnter):
2466         (JSC::WREC::Generator::generateIncrementIndex):
2467         (JSC::WREC::Generator::generateLoadCharacter):
2468         (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
2469         (JSC::WREC::Generator::generateBackreferenceQuantifier):
2470         (JSC::WREC::Generator::generateNonGreedyQuantifier):
2471         (JSC::WREC::Generator::generateGreedyQuantifier):
2472         (JSC::WREC::Generator::generatePatternCharacterPair):
2473         (JSC::WREC::Generator::generatePatternCharacter):
2474         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
2475         (JSC::WREC::Generator::generateCharacterClassInverted):
2476         (JSC::WREC::Generator::generateAssertionBOL):
2477         (JSC::WREC::Generator::generateAssertionEOL):
2478         (JSC::WREC::Generator::generateAssertionWordBoundary):
2479         (JSC::WREC::Generator::generateBackreference):
2480
2481 2009-02-03  David Hyatt  <hyatt@apple.com>
2482
2483         Fix a bug in Vector's shrinkCapacity method.  It did not properly copy elements into the inline buffer
2484         when shrinking down from a size that was greater than the inline capacity.
2485
2486         Reviewed by Maciej
2487
2488         * wtf/Vector.h:
2489         (WTF::VectorBuffer::VectorBuffer):
2490         (WTF::VectorBuffer::allocateBuffer):
2491
2492 2009-02-03  Simon Hausmann  <simon.hausmann@nokia.com>
2493
2494         Reviewed by Tor Arne Vestbø.
2495
2496         Added accessor for JSByteArray storage.
2497
2498         * runtime/JSByteArray.h:
2499         (JSC::JSByteArray::storage):
2500
2501 2009-02-03  Dmitry Titov  <dimich@chromium.org>
2502
2503         Reviewed by Alexey Proskuryakov.
2504
2505         https://bugs.webkit.org/show_bug.cgi?id=23560
2506         Implement SharedTimer on WorkerRunLoop
2507
2508         * JavaScriptCore.exp:
2509         Forgot to expose ThreadCondition::timedWait() in one of previous patches.
2510
2511 2009-02-02  Oliver Hunt  <oliver@apple.com>
2512
2513         Reviewed by Gavin Barraclough.
2514
2515         <https://bugs.webkit.org/show_bug.cgi?id=21414> REGRESSION: Regular Expressions and character classes, shorthands and ranges
2516         <rdar://problem/6543487>
2517
2518         In certain circumstances when WREC::Generator::generateCharacterClassInvertedRange invokes
2519         itself recursively, it will incorrectly emit (and thus consume) the next single character
2520         match in the current character class.  As WREC uses a binary search this out of sequence
2521         codegen could result in a character match being missed and so cause the regex to produce
2522         incorrect results.
2523
2524         * wrec/WRECGenerator.cpp:
2525         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
2526
2527 2009-02-02  Darin Adler  <darin@apple.com>
2528
2529         Reviewed by Dave Hyatt.
2530
2531         Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
2532         https://bugs.webkit.org/show_bug.cgi?id=23676
2533
2534         * API/JSObjectRef.cpp:
2535         (JSObjectCopyPropertyNames): Use reserveInitialCapacity.
2536         * parser/Lexer.cpp:
2537         (JSC::Lexer::Lexer): Ditto.
2538         (JSC::Lexer::clear): Ditto.
2539
2540         * wtf/Vector.h: Added reserveInitialCapacity, a more efficient version of
2541         reserveCapacity for use when the vector is brand new (still size 0 with no
2542         capacity other than the inline capacity).
2543
2544 2009-01-30  Mark Rowe  <mrowe@apple.com>
2545
2546         Rubber-stamped by Oliver Hunt.
2547
2548         <rdar://problem/6391501> Enable the JIT on Mac OS X x86_64 as it passes all tests.
2549
2550         * wtf/Platform.h:
2551
2552 2009-01-30  Oliver Hunt  <oliver@apple.com>
2553
2554         Reviewed by Mark Rowe and Sam Weinig.
2555
2556         Finally fix load() to propagate exceptions correctly.
2557
2558         * jsc.cpp:
2559         (functionLoad):
2560
2561 2009-01-30  David Levin  <levin@chromium.org>
2562
2563         Reviewed by Darin Adler.
2564
2565         https://bugs.webkit.org/show_bug.cgi?id=23618
2566         Templated worker tasks should be more error proof to use.
2567         Fix Chromium build.
2568
2569         * wtf/TypeTraits.h:
2570         (WTF::IsConvertibleToInteger::IsConvertibleToDouble):
2571         Avoid "possible loss of data" warning when using Microsoft's C++ compiler
2572         by avoiding an implicit conversion of int types to doubles.
2573
2574 2009-01-30  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
2575
2576         Reviewed by Simon Hausmann.
2577
2578         Bug 23580: GNU mode RVCT compilation support
2579         <https://bugs.webkit.org/show_bug.cgi?id=23580>
2580
2581         * pcre/pcre_exec.cpp: Use COMPILER(GCC) instead of __GNUC__.
2582         * wtf/FastMalloc.cpp: Ditto.
2583         (WTF::TCMallocStats::):
2584         * wtf/Platform.h: Don't define COMPILER(GCC) with RVCT --gnu.
2585
2586 2009-01-30  David Levin  <levin@chromium.org>
2587
2588         Reviewed by Alexey Proskuryakov.
2589
2590         Bug 23618: Templated worker tasks should be more error proof to use
2591         <https://bugs.webkit.org/show_bug.cgi?id=23618>
2592
2593         Add the type traits needed for the generic worker tasks
2594         and compile asserts for them.
2595
2596         Add a summary header to the TypeTraits.h file to explain what is in there.
2597
2598         Add a note to explain IsPod's deficiencies.
2599
2600         * wtf/TypeTraits.h:
2601
2602 2009-01-30  David Levin  <levin@chromium.org>
2603
2604         Reviewed by Alexey Proskuryakov.
2605
2606         Bug 23616: Various "template helpers" should be consolidated from isolated files in JavaScriptCore.
2607         <https://bugs.webkit.org/show_bug.cgi?id=23616>
2608
2609         * wtf/TypeTraits.h: Moved RemovePointer, IsPod, IsInteger to this file.
2610
2611         * wtf/OwnPtr.h: Use RemovePointer from TypeTraits.h.
2612         * wtf/RetainPtr.h:  Ditto.
2613
2614         * wtf/HashTraits.h: Use IsInteger from TypeTraits.h.
2615
2616         * wtf/VectorTraits.h: Use IsPod from TypeTraits.h.
2617
2618         * GNUmakefile.am:
2619         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2620         * JavaScriptCore.xcodeproj/project.pbxproj:
2621         Added TypeTraits.h.
2622
2623 2009-01-29  Stephanie Lewis <slewis@apple.com>
2624
2625         RS by Oliver Hunt.
2626
2627         Update the order files.
2628
2629         * JavaScriptCore.order:
2630
2631 2009-01-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2632
2633         Reviewed by Oliver Hunt.
2634
2635         Bug 23551: Crash on page load with profiler enabled and running
2636         <https://bugs.webkit.org/show_bug.cgi?id=23551>
2637         <rdar://problem/6529521>
2638
2639         Interpreter::execute(FunctionBodyNode*, ...) calls Profiler::didExecute()
2640         with a stale CallFrame. If some part of the scope chain has already been
2641         freed, Profiler::didExecute() will crash when attempting to get the lexical
2642         global object. The fix is to make the didExecute() call use the caller's
2643         CallFrame, not the one made for the function call. In this case, the
2644         willExecute() call should also be changed to match.
2645
2646         Since this occurs in the actual inspector JS, it is difficult to reduce.
2647         I couldn't make a layout test.
2648
2649         * interpreter/Interpreter.cpp:
2650         (JSC::Interpreter::execute):
2651
2652 2009-01-28  Sam Weinig  <sam@webkit.org>
2653
2654         Reviewed by Gavin Barraclough.
2655
2656         Fix for <rdar://problem/6525537>
2657         Hang occurs when closing Installer window (iTunes, Aperture)
2658
2659         * JavaScriptCore.exp: Export JSGlobalData::sharedInstance.
2660
2661 2009-01-28  Sam Weinig  <sam@webkit.org>
2662
2663         Reviewed by Geoff Garen.
2664
2665         Initial patch by Mark Rowe.
2666
2667         <rdar://problem/6519356>
2668         REGRESSION (r36006): "out of memory" alert running dromaeo on Windows
2669
2670         Report the cost of the ArrayStorage vector more accurately/often.
2671
2672         * runtime/JSArray.cpp:
2673         (JSC::JSArray::JSArray): Report the extra cost even for a filled array
2674         because JSString using the single character optimization and immediates
2675         wont increase the cost themselves. 
2676         (JSC::JSArray::putSlowCase): Update the cost when increasing the size of
2677         the array.
2678         (JSC::JSArray::increaseVectorLength): Ditto.
2679
2680 2009-01-28  Sam Weinig  <sam@webkit.org>
2681
2682         Reviewed by Geoff Garen.
2683
2684         Fix for <rdar://problem/6129678>
2685         REGRESSION (Safari 3-4): Local variable not accessible from Dashcode console or variables view
2686
2687         Iterating the properties of activation objects accessed through the WebKit debugging
2688         APIs was broken by forced conversion of JSActivation to the global object. To fix this,
2689         we use a proxy activation object that acts more like a normal JSObject.
2690
2691         * debugger/DebuggerActivation.cpp: Added.
2692         (JSC::DebuggerActivation::DebuggerActivation):
2693         (JSC::DebuggerActivation::mark):
2694         (JSC::DebuggerActivation::className):
2695         (JSC::DebuggerActivation::getOwnPropertySlot):
2696         (JSC::DebuggerActivation::put):
2697         (JSC::DebuggerActivation::putWithAttributes):
2698         (JSC::DebuggerActivation::deleteProperty):
2699         (JSC::DebuggerActivation::getPropertyNames):
2700         (JSC::DebuggerActivation::getPropertyAttributes):
2701         (JSC::DebuggerActivation::defineGetter):
2702         (JSC::DebuggerActivation::defineSetter):
2703         (JSC::DebuggerActivation::lookupGetter):
2704         (JSC::DebuggerActivation::lookupSetter):
2705         * debugger/DebuggerActivation.h: Added.
2706         Proxy JSActivation object for Debugging.
2707
2708         * runtime/JSActivation.h:
2709         (JSC::JSActivation::isActivationObject): Added.
2710         * runtime/JSObject.h:
2711         (JSC::JSObject::isActivationObject): Added.
2712
2713 2009-01-28  David Kilzer  <ddkilzer@apple.com>
2714
2715         Bug 23490: Remove initialRefCount argument from RefCounted class
2716
2717         <https://bugs.webkit.org/show_bug.cgi?id=23490>
2718
2719         Reviewed by Darin Adler.
2720
2721         RefCountedBase now always starts with a ref count of 1, so there
2722         is no need to pass the initialRefCount into the class anymore.
2723
2724         * wtf/ByteArray.h:
2725         (WTF::ByteArray::ByteArray): Removed call to RefCounted(1).
2726         * wtf/RefCounted.h:
2727         (WTF::RefCountedBase::RefCountedBase): Changed to start with a
2728         ref count of 1.
2729         (WTF::RefCounted::RefCounted): Removed initialRefCount argument
2730         and removed call to RefCounted(1).
2731
2732 2009-01-26  Adele Peterson  <adele@apple.com>
2733
2734         Build fix.  
2735
2736         * debugger/Debugger.cpp:
2737
2738 2009-01-26  Gavin Barraclough  <barraclough@apple.com>
2739
2740         Reviewed by Darin Adler.
2741
2742         Fixes for eq null & neq null, on 64-bit JIT.
2743         https://bugs.webkit.org/show_bug.cgi?id=23559
2744
2745         This patch degrades 64-bit JIT performance on some benchmarks,
2746         due to the whole not-being-incorrect thing.
2747
2748         * jit/JIT.cpp:
2749         (JSC::JIT::privateCompileMainPass):
2750
2751 2009-01-26  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2752
2753         Reviewed by Gavin Barraclough.
2754
2755         Bug 23552: Dashcode evaluator no longer works after making ExecStates actual call frames
2756         <https://bugs.webkit.org/show_bug.cgi?id=23552>
2757         <rdar://problem/6398839>
2758
2759         * JavaScriptCore.exp:
2760         * debugger/Debugger.cpp:
2761         (JSC::evaluateInGlobalCallFrame): Added so that WebScriptCallFrame can
2762         evaluate JS starting from a global call frame.
2763         * debugger/Debugger.h:
2764
2765 2009-01-25  Mark Rowe  <mrowe@apple.com>
2766
2767         Rubber-stamped by Dan Bernstein.
2768
2769         Improve the consistency of settings in our .xcconfig files.
2770
2771         * Configurations/Base.xcconfig: Enable GCC_OBJC_CALL_CXX_CDTORS to match other projects.
2772
2773 2009-01-25  Darin Adler  <darin@apple.com>
2774
2775         Reviewed by Mark Rowe.
2776
2777         Bug 23352: Turn on more compiler warnings in the Mac build
2778         https://bugs.webkit.org/show_bug.cgi?id=23352
2779
2780         Turn on the following warnings:
2781
2782             -Wcast-qual
2783             -Wextra-tokens
2784             -Wformat=2
2785             -Winit-self
2786             -Wmissing-noreturn
2787             -Wpacked
2788             -Wrendundant-decls
2789
2790         * Configurations/Base.xcconfig: Added the new warnings. Switched to -Wextra instead of
2791         -W for clarity since we don't have to support the older versions of gcc that require the
2792         old -W syntax. Since we now use -Wformat=2, removed -Wformat-security. Also removed
2793         -Wno-format-y2k since we can have that one on now.
2794
2795 2009-01-25  Judit Jasz  <jasy@inf.u-szeged.hu>
2796
2797         Reviewed by Darin Adler.
2798         
2799         Compilation problem fixing 
2800         http://bugs.webkit.org/show_bug.cgi?id=23497
2801
2802         * jit/JITCall.cpp:
2803         (JSC::JIT::compileOpCall): Use JSValuePtr::encode.
2804
2805 2009-01-25  Darin Adler  <darin@apple.com>
2806
2807         Reviewed by Sam Weinig.
2808
2809         Bug 23352: Turn on more compiler warnings in the Mac build
2810         https://bugs.webkit.org/show_bug.cgi?id=23352
2811
2812         Fourth patch: Deal with the last few stray warnings.
2813
2814         * parser/Parser.cpp: Only declare jscyyparse if it's not already declared.
2815         This makes both separate compilation and all-in-one compilation work with the
2816         -Wredundant-decls warning.
2817
2818 2009-01-25  Darin Adler  <darin@apple.com>
2819
2820         Reviewed by Sam Weinig.
2821
2822         Bug 23352: Turn on more compiler warnings in the Mac build
2823         https://bugs.webkit.org/show_bug.cgi?id=23352
2824
2825         Third patch: Use the noreturn attribute on functions that don't
2826         return to prepare for the use of the -Wmissing-noreturn warning.
2827
2828         * jit/JITCall.cpp:
2829         (JSC::unreachable): Added NO_RETURN.
2830         * jsc.cpp:
2831         (functionQuit): Ditto.
2832         (printUsageStatement): Ditto.
2833         * wtf/AlwaysInline.h: Added definition of NO_RETURN.
2834
2835 2009-01-24  Oliver Hunt  <oliver@apple.com>
2836
2837         Reviewed by Maciej Stachowiak.
2838
2839         Force inlining of Lexer::matchPunctuator
2840
2841         2.2% win when parsing jQuery, Mootools, Prototype, etc
2842
2843         * parser/Lexer.h:
2844
2845 2009-01-23  Gavin Barraclough  <barraclough@apple.com>
2846
2847         Reviewed by Geoff Garen.
2848
2849         Fix for <rdar://problem/6126212>
2850         Ensure that callbacks out from the JSC interface are only allowed
2851         to return in reverse-chronological order to that in which they were
2852         made.  If we allow earlier callbacks to return first, then this may
2853         result in setions of the RegisterFile in use by another thread
2854         being trampled.
2855
2856         See uber-comment in JSLock.h for details.
2857
2858         * runtime/JSLock.cpp:
2859         (JSC::JSLock::DropAllLocks::DropAllLocks):
2860         (JSC::JSLock::DropAllLocks::~DropAllLocks):
2861
2862 2009-01-23  Darin Adler  <darin@apple.com>
2863
2864         Try to fix WX build.
2865
2866         * runtime/JSGlobalObjectFunctions.h: Include <wtf/unicode/Unicode.h>
2867         for the definition of UChar.
2868
2869 2009-01-23  Anders Carlsson  <andersca@apple.com>
2870
2871         * Configurations/Base.xcconfig:
2872         GCC 4.0 build fix.
2873         
2874         * runtime/JSNumberCell.h:
2875         64-bit build fix.
2876
2877 2009-01-23  Anders Carlsson  <andersca@apple.com>
2878
2879         Reviewed by Sam Weinig.
2880         
2881         Turn on -Wmissing-prototypes and fix the warnings.
2882         
2883         * API/JSClassRef.cpp:
2884         (clearReferenceToPrototype):
2885         * Configurations/Base.xcconfig:
2886         * runtime/Collector.cpp:
2887         (JSC::getPlatformThreadRegisters):
2888         * runtime/ExceptionHelpers.cpp:
2889         (JSC::createError):
2890         * runtime/JSGlobalObjectFunctions.h:
2891         * runtime/JSNumberCell.h:
2892         * runtime/UString.cpp:
2893         (JSC::initializeStaticBaseString):
2894         (JSC::createRep):
2895         * wtf/FastMalloc.cpp:
2896         * wtf/Threading.cpp:
2897
2898 2009-01-22  Mark Rowe  <mrowe@apple.com>
2899
2900         Rubber-stamped by Anders Carlsson.
2901
2902         Disable GCC_WARN_ABOUT_MISSING_PROTOTYPES temporarily.
2903
2904         Current versions of Xcode only respect it for C and Objective-C files,
2905         and our code doesn't currently compile if it is applied to C++ and
2906         Objective-C++ files.
2907
2908         * Configurations/Base.xcconfig:
2909
2910 2009-01-22  Steve Falkenburg  <sfalken@apple.com>
2911
2912         https://bugs.webkit.org/show_bug.cgi?id=23489
2913         
2914         Return currentTime() in correct units for the two early return cases.
2915
2916         Reviewed by Mark Rowe.
2917
2918         * wtf/CurrentTime.cpp:
2919         (WTF::currentTime):
2920
2921 2009-01-22  Sam Weinig  <sam@webkit.org>
2922
2923         Reviewed by Mark Rowe.
2924
2925         Fix for <rdar://problem/6439247>
2926         FastMalloc allocating an extra 4MB of meta-data on 64-bit
2927
2928         Rely on the fact that on all known x86-64 platforms only use 48 bits of
2929         address space to shrink the initial size of the PageMap from ~4MB to 120K.
2930         For 64-bit we still use a 3-level radix tree, but now each level is only 12
2931         bits wide.
2932
2933         No performance change.
2934
2935         * wtf/FastMalloc.cpp:
2936         (WTF::MapSelector): Add specialization for 64 bit that takes into account the
2937         16 bits of unused address space on x86-64.
2938
2939 2009-01-22  Beth Dakin  <bdakin@apple.com>
2940
2941         Reviewed by Sam Weinig.
2942
2943         Fix for https://bugs.webkit.org/show_bug.cgi?id=23461 LayoutTests/
2944         fast/js/numeric-conversion.html is broken, and corresponding 
2945         <rdar://problem/6514842>
2946
2947         The basic problem here is that parseInt(Infinity) should be NaN, 
2948         but we were returning 0. NaN matches Safari 3.2.1 and Firefox.
2949
2950         * runtime/JSGlobalObjectFunctions.cpp:
2951         (JSC::globalFuncParseInt):
2952
2953 2009-01-22  Oliver Hunt  <oliver@apple.com>
2954
2955         Reviewed by Geoff Garen.
2956
2957         <rdar://problem/6516853> (r39682-r39736) JSFunFuzz: crash on "(function(){({ x2: x }), })()"
2958         <https://bugs.webkit.org/show_bug.cgi?id=23479>
2959
2960         Automatic semicolon insertion was resulting in this being accepted in the initial
2961         nodeless parsing, but subsequent reparsing for code generation would fail, leading
2962         to a crash.  The solution is to ensure that reparsing a function performs parsing
2963         in the same state as the initial parse.  We do this by modifying the saved source
2964         ranges to include rather than exclude the opening and closing braces.
2965
2966         * bytecode/CodeBlock.cpp:
2967         (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): add an assertion for successful recompile
2968         * parser/Lexer.h:
2969         (JSC::Lexer::sourceCode): include rather than exclude braces.
2970         * parser/Nodes.h:
2971         (JSC::FunctionBodyNode::toSourceString):  No need to append braces anymore.
2972
2973 2009-01-22  Dmitry Titov  <dimich@chromium.org>
2974
2975         Reviewed by Alexey Proskuryakov.
2976
2977         https://bugs.webkit.org/show_bug.cgi?id=23373
2978
2979         Implement ThreadCondition::timedWait().
2980         Since we borrow the code for condition variables from other sources,
2981         I did the same for timedWait(). See comments in ThreadingWin.cpp for
2982         rationale and more info.
2983
2984         * wtf/CONTRIBUTORS.pthreads-win32: 
2985         Added. A list of Pthreads-win32 contributors mentioned in their license. The license itself
2986         is included into wtf/ThreadingWin32.cpp.
2987
2988         * wtf/Threading.h:
2989         * wtf/ThreadingWin.cpp:
2990         Additional info and Pthreads-win32 license at the beginning.
2991         (WTF::PlatformCondition::timedWait): new method, derived from Pthreads-win32.
2992         (WTF::PlatformCondition::signal): same
2993         (WTF::ThreadCondition::ThreadCondition):
2994         (WTF::ThreadCondition::~ThreadCondition):
2995         (WTF::ThreadCondition::wait): this now calls PlatformCondition::timedWait.
2996         (WTF::ThreadCondition::timedWait): same
2997         (WTF::ThreadCondition::signal): this now calls PlatformCondition::signal.
2998         (WTF::ThreadCondition::broadcast): same
2999
3000 2009-01-21  Gavin Barraclough  <barraclough@apple.com>
3001
3002         Reviewed by Oliver Hunt.
3003
3004         Fix for https://bugs.webkit.org/show_bug.cgi?id=23469.
3005
3006         We need to check all numbers in integer switches, not just those
3007         represented as integer JSImmediates.
3008
3009         * interpreter/Interpreter.cpp:
3010         (JSC::Interpreter::privateExecute):
3011         (JSC::Interpreter::cti_op_switch_imm):
3012
3013 2009-01-21  Gavin Barraclough  <barraclough@apple.com>
3014
3015         Reviewed by Geoff Garen.
3016
3017         Fix for https://bugs.webkit.org/show_bug.cgi?id=23468.
3018
3019         * interpreter/Interpreter.cpp:
3020         (JSC::Interpreter::privateExecute):
3021
3022 2009-01-21  Alexey Proskuryakov  <ap@webkit.org>
3023
3024         Suggested by Oliver Hunt. Reviewed by Oliver Hunt.
3025
3026         https://bugs.webkit.org/show_bug.cgi?id=23456
3027         Function argument names leak
3028
3029         * parser/Nodes.cpp: (JSC::FunctionBodyNode::~FunctionBodyNode): Destruct parameter names.
3030
3031 2009-01-20  Oliver Hunt  <oliver@apple.com>
3032
3033         Reviewed by NOBODY (Build fix).
3034
3035         Windows build fix
3036
3037         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3038
3039 2009-01-20  Gavin Barraclough  <barraclough@apple.com>
3040
3041         Reviewed by Mark Rowe.
3042
3043         Structure property table deleted offset maps are being leaked.
3044         Probably shouldn't be doing that.
3045
3046         https://bugs.webkit.org/show_bug.cgi?id=23442
3047
3048         * runtime/Structure.cpp:
3049         (JSC::Structure::~Structure):
3050
3051 2009-01-20  Oliver Hunt  <oliver@apple.com>
3052
3053         Reviewed by NOBODY (build fix).
3054
3055         Attempt to fix gtk build
3056
3057         * GNUmakefile.am:
3058
3059 2009-01-20  Darin Adler  <darin@apple.com>
3060
3061         * runtime/StringPrototype.cpp:
3062         (JSC::substituteBackreferences): Add back the initialization to fix the build.
3063
3064 2009-01-20  Darin Adler  <darin@apple.com>
3065
3066         Reviewed by Mark Rowe.
3067
3068         Bug 23352: Turn on more compiler warnings in the Mac build
3069         https://bugs.webkit.org/show_bug.cgi?id=23352
3070
3071         First patch: Fix some simple cases of various warnings.
3072
3073         * pcre/pcre_compile.cpp:
3074         (jsRegExpCompile): Use const_cast to change const-ness.
3075
3076         * runtime/StringPrototype.cpp:
3077         (JSC::substituteBackreferences): Remove unneeded initialization and
3078         use UChar instead of unsigned short for UTF-16 values.
3079
3080         * wtf/dtoa.cpp:
3081         (WTF::strtod): Use const_cast to change const-ness.
3082
3083 2009-01-20  Oliver Hunt  <oliver@apple.com>
3084
3085         Reviewed by NOBODY (build fix).
3086
3087         Whoops, remove runtime/ByteArray references from .pri and .scons builds, update .bkl
3088
3089         * JavaScriptCore.pri:
3090         * JavaScriptCore.scons:
3091         * JavaScriptCoreSources.bkl:
3092
3093 2009-01-20  Oliver Hunt  <oliver@apple.com>
3094
3095         RS=Dan Bernstein.
3096
3097         Move runtime/ByteArray to wtf/ByteArray
3098
3099         * GNUmakefile.am:
3100         * JavaScriptCore.exp:
3101         * JavaScriptCore.pri:
3102         * JavaScriptCore.scons:
3103         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3104         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3105         * JavaScriptCore.xcodeproj/project.pbxproj:
3106         * runtime/JSByteArray.cpp:
3107         * runtime/JSByteArray.h:
3108         * wtf/ByteArray.cpp: Renamed from JavaScriptCore/runtime/ByteArray.cpp.
3109         (WTF::ByteArray::create):
3110         * wtf/ByteArray.h: Renamed from JavaScriptCore/runtime/ByteArray.h.
3111         (WTF::ByteArray::length):
3112         (WTF::ByteArray::set):
3113         (WTF::ByteArray::get):
3114         (WTF::ByteArray::data):
3115         (WTF::ByteArray::deref):
3116         (WTF::ByteArray::ByteArray):
3117
3118 2009-01-19  Sam Weinig  <sam@webkit.org>
3119
3120         Rubber-stamped by Gavin Barraclough.
3121
3122         Remove temporary operator-> from JSValuePtr.
3123
3124         * API/JSCallbackFunction.cpp:
3125         (JSC::JSCallbackFunction::call):
3126         * API/JSCallbackObjectFunctions.h:
3127         (JSC::::call):
3128         (JSC::::toNumber):
3129         (JSC::::toString):
3130         * API/JSObjectRef.cpp:
3131         (JSObjectSetPrototype):
3132         * API/JSValueRef.cpp:
3133         (JSValueGetType):
3134         (JSValueIsUndefined):
3135         (JSValueIsNull):
3136         (JSValueIsBoolean):
3137         (JSValueIsNumber):
3138         (JSValueIsString):
3139         (JSValueIsObject):
3140         (JSValueIsObjectOfClass):
3141         (JSValueToBoolean):
3142         (JSValueToNumber):
3143         (JSValueToStringCopy):
3144         (JSValueToObject):
3145         * bytecode/CodeBlock.cpp:
3146         (JSC::valueToSourceString):
3147         (JSC::CodeBlock::mark):
3148         * bytecode/CodeBlock.h:
3149         (JSC::CodeBlock::isKnownNotImmediate):
3150         * bytecompiler/BytecodeGenerator.cpp:
3151         (JSC::BytecodeGenerator::emitEqualityOp):
3152         (JSC::keyForImmediateSwitch):
3153         * interpreter/Interpreter.cpp:
3154         (JSC::jsLess):
3155         (JSC::jsLessEq):
3156         (JSC::jsAddSlowCase):
3157         (JSC::jsAdd):
3158         (JSC::jsTypeStringForValue):
3159         (JSC::jsIsObjectType):
3160         (JSC::jsIsFunctionType):
3161         (JSC::isNotObject):
3162         (JSC::Interpreter::callEval):
3163         (JSC::Interpreter::throwException):
3164         (JSC::cachePrototypeChain):
3165         (JSC::Interpreter::tryCachePutByID):
3166         (JSC::countPrototypeChainEntriesAndCheckForProxies):
3167         (JSC::Interpreter::tryCacheGetByID):
3168         (JSC::Interpreter::privateExecute):
3169         (JSC::Interpreter::tryCTICachePutByID):
3170         (JSC::Interpreter::tryCTICacheGetByID):
3171         (JSC::Interpreter::cti_op_convert_this):
3172         (JSC::Interpreter::cti_op_add):
3173         (JSC::Interpreter::cti_op_pre_inc):
3174         (JSC::Interpreter::cti_op_put_by_id_generic):
3175         (JSC::Interpreter::cti_op_get_by_id_generic):
3176         (JSC::Interpreter::cti_op_put_by_id):
3177         (JSC::Interpreter::cti_op_put_by_id_second):
3178         (JSC::Interpreter::cti_op_put_by_id_fail):
3179         (JSC::Interpreter::cti_op_get_by_id):
3180         (JSC::Interpreter::cti_op_get_by_id_second):
3181         (JSC::Interpreter::cti_op_get_by_id_self_fail):
3182         (JSC::Interpreter::cti_op_get_by_id_proto_list):
3183         (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
3184         (JSC::Interpreter::cti_op_get_by_id_proto_fail):
3185         (JSC::Interpreter::cti_op_get_by_id_array_fail):
3186         (JSC::Interpreter::cti_op_get_by_id_string_fail):
3187         (JSC::Interpreter::cti_op_instanceof):
3188         (JSC::Interpreter::cti_op_del_by_id):
3189         (JSC::Interpreter::cti_op_mul):
3190         (JSC::Interpreter::cti_op_call_JSFunction):
3191         (JSC::Interpreter::cti_op_call_NotJSFunction):
3192         (JSC::Interpreter::cti_op_construct_JSConstruct):
3193         (JSC::Interpreter::cti_op_construct_NotJSConstruct):
3194         (JSC::Interpreter::cti_op_get_by_val):
3195         (JSC::Interpreter::cti_op_get_by_val_byte_array):
3196         (JSC::Interpreter::cti_op_sub):
3197         (JSC::Interpreter::cti_op_put_by_val):
3198         (JSC::Interpreter::cti_op_put_by_val_array):
3199         (JSC::Interpreter::cti_op_put_by_val_byte_array):
3200         (JSC::Interpreter::cti_op_loop_if_true):
3201         (JSC::Interpreter::cti_op_negate):
3202         (JSC::Interpreter::cti_op_div):
3203         (JSC::Interpreter::cti_op_pre_dec):
3204         (JSC::Interpreter::cti_op_not):
3205         (JSC::Interpreter::cti_op_jtrue):
3206         (JSC::Interpreter::cti_op_post_inc):
3207         (JSC::Interpreter::cti_op_lshift):
3208         (JSC::Interpreter::cti_op_bitand):
3209         (JSC::Interpreter::cti_op_rshift):
3210         (JSC::Interpreter::cti_op_bitnot):
3211         (JSC::Interpreter::cti_op_mod):
3212         (JSC::Interpreter::cti_op_post_dec):
3213         (JSC::Interpreter::cti_op_urshift):
3214         (JSC::Interpreter::cti_op_bitxor):
3215         (JSC::Interpreter::cti_op_bitor):
3216         (JSC::Interpreter::cti_op_push_scope):
3217         (JSC::Interpreter::cti_op_is_undefined):
3218         (JSC::Interpreter::cti_op_is_boolean):
3219         (JSC::Interpreter::cti_op_is_number):
3220         (JSC::Interpreter::cti_op_to_jsnumber):
3221         (JSC::Interpreter::cti_op_in):
3222         (JSC::Interpreter::cti_op_put_by_index):
3223         (JSC::Interpreter::cti_op_switch_imm):
3224         (JSC::Interpreter::cti_op_switch_char):
3225         (JSC::Interpreter::cti_op_switch_string):
3226         (JSC::Interpreter::cti_op_del_by_val):
3227         (JSC::Interpreter::cti_op_put_getter):
3228         (JSC::Interpreter::cti_op_put_setter):
3229         (JSC::Interpreter::cti_op_new_error):
3230         * interpreter/Interpreter.h:
3231         (JSC::Interpreter::isJSArray):
3232         (JSC::Interpreter::isJSString):
3233         (JSC::Interpreter::isJSByteArray):
3234         * interpreter/Register.h:
3235         (JSC::Register::marked):
3236         (JSC::Register::mark):
3237         * jit/JITInlineMethods.h:
3238         (JSC::JIT::getConstantOperandImmediateInt):
3239         (JSC::JIT::isOperandConstantImmediateInt):
3240         * jsc.cpp:
3241         (functionPrint):
3242         (functionDebug):
3243         (functionRun):
3244         (functionLoad):
3245         (runWithScripts):
3246         (runInteractive):
3247         * parser/Nodes.cpp:
3248         (JSC::processClauseList):
3249         * profiler/ProfileGenerator.cpp:
3250         (JSC::ProfileGenerator::addParentForConsoleStart):
3251         * profiler/Profiler.cpp:
3252         (JSC::Profiler::createCallIdentifier):
3253         * runtime/ArrayConstructor.cpp:
3254         (JSC::constructArrayWithSizeQuirk):
3255         * runtime/ArrayPrototype.cpp:
3256         (JSC::arrayProtoFuncToString):
3257         (JSC::arrayProtoFuncToLocaleString):
3258         (JSC::arrayProtoFuncJoin):
3259         (JSC::arrayProtoFuncConcat):
3260         (JSC::arrayProtoFuncPop):
3261         (JSC::arrayProtoFuncPush):
3262         (JSC::arrayProtoFuncReverse):
3263         (JSC::arrayProtoFuncShift):
3264         (JSC::arrayProtoFuncSlice):
3265         (JSC::arrayProtoFuncSort):
3266         (JSC::arrayProtoFuncSplice):
3267         (JSC::arrayProtoFuncUnShift):
3268         (JSC::arrayProtoFuncFilter):
3269         (JSC::arrayProtoFuncMap):
3270         (JSC::arrayProtoFuncEvery):
3271         (JSC::arrayProtoFuncForEach):
3272         (JSC::arrayProtoFuncSome):
3273         (JSC::arrayProtoFuncIndexOf):
3274         (JSC::arrayProtoFuncLastIndexOf):
3275         * runtime/BooleanConstructor.cpp:
3276         (JSC::constructBoolean):
3277         (JSC::callBooleanConstructor):
3278         * runtime/BooleanPrototype.cpp:
3279         (JSC::booleanProtoFuncToString):
3280         (JSC::booleanProtoFuncValueOf):
3281         * runtime/Collector.cpp:
3282         (JSC::Heap::protect):
3283         (JSC::Heap::unprotect):
3284         (JSC::Heap::heap):
3285         (JSC::Heap::collect):
3286         (JSC::typeName):
3287         * runtime/Completion.cpp:
3288         (JSC::evaluate):
3289         * runtime/DateConstructor.cpp:
3290         (JSC::constructDate):
3291         (JSC::dateParse):
3292         (JSC::dateUTC):
3293         * runtime/DateInstance.h:
3294         (JSC::DateInstance::internalNumber):
3295         * runtime/DatePrototype.cpp:
3296         (JSC::formatLocaleDate):
3297         (JSC::fillStructuresUsingTimeArgs):
3298         (JSC::fillStructuresUsingDateArgs):
3299         (JSC::dateProtoFuncToString):
3300         (JSC::dateProtoFuncToUTCString):
3301         (JSC::dateProtoFuncToDateString):
3302         (JSC::dateProtoFuncToTimeString):
3303         (JSC::dateProtoFuncToLocaleString):
3304         (JSC::dateProtoFuncToLocaleDateString):
3305         (JSC::dateProtoFuncToLocaleTimeString):
3306         (JSC::dateProtoFuncGetTime):
3307         (JSC::dateProtoFuncGetFullYear):
3308         (JSC::dateProtoFuncGetUTCFullYear):
3309         (JSC::dateProtoFuncToGMTString):
3310         (JSC::dateProtoFuncGetMonth):
3311         (JSC::dateProtoFuncGetUTCMonth):
3312         (JSC::dateProtoFuncGetDate):
3313         (JSC::dateProtoFuncGetUTCDate):
3314         (JSC::dateProtoFuncGetDay):
3315         (JSC::dateProtoFuncGetUTCDay):
3316         (JSC::dateProtoFuncGetHours):
3317         (JSC::dateProtoFuncGetUTCHours):
3318         (JSC::dateProtoFuncGetMinutes):
3319         (JSC::dateProtoFuncGetUTCMinutes):
3320         (JSC::dateProtoFuncGetSeconds):
3321         (JSC::dateProtoFuncGetUTCSeconds):
3322         (JSC::dateProtoFuncGetMilliSeconds):
3323         (JSC::dateProtoFuncGetUTCMilliseconds):
3324         (JSC::dateProtoFuncGetTimezoneOffset):
3325         (JSC::dateProtoFuncSetTime):
3326         (JSC::setNewValueFromTimeArgs):
3327         (JSC::setNewValueFromDateArgs):
3328         (JSC::dateProtoFuncSetYear):
3329         (JSC::dateProtoFuncGetYear):
3330         * runtime/ErrorConstructor.cpp:
3331         (JSC::constructError):
3332         * runtime/ErrorPrototype.cpp:
3333         (JSC::errorProtoFuncToString):
3334         * runtime/ExceptionHelpers.cpp:
3335         (JSC::createError):
3336         (JSC::createErrorMessage):
3337         * runtime/FunctionConstructor.cpp:
3338         (JSC::constructFunction):
3339         * runtime/FunctionPrototype.cpp:
3340         (JSC::functionProtoFuncToString):
3341         (JSC::functionProtoFuncApply):
3342         (JSC::functionProtoFuncCall):
3343         * runtime/GetterSetter.cpp:
3344         (JSC::GetterSetter::toObject):
3345         * runtime/JSActivation.cpp:
3346         (JSC::JSActivation::getOwnPropertySlot):
3347         * runtime/JSArray.cpp:
3348         (JSC::JSArray::put):
3349         (JSC::JSArray::mark):
3350         (JSC::JSArray::sort):
3351         (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
3352         (JSC::JSArray::compactForSorting):
3353         * runtime/JSByteArray.h:
3354         (JSC::JSByteArray::setIndex):
3355         * runtime/JSCell.h:
3356         (JSC::asCell):
3357         * runtime/JSFunction.cpp:
3358         (JSC::JSFunction::call):
3359         (JSC::JSFunction::construct):
3360         * runtime/JSGlobalObject.cpp:
3361         (JSC::markIfNeeded):
3362         (JSC::lastInPrototypeChain):
3363         * runtime/JSGlobalObjectFunctions.cpp:
3364         (JSC::encode):
3365         (JSC::decode):
3366         (JSC::globalFuncEval):
3367         (JSC::globalFuncParseInt):
3368         (JSC::globalFuncParseFloat):
3369         (JSC::globalFuncIsNaN):
3370         (JSC::globalFuncIsFinite):
3371         (JSC::globalFuncEscape):
3372         (JSC::globalFuncUnescape):
3373         (JSC::globalFuncJSCPrint):
3374         * runtime/JSImmediate.cpp:
3375         (JSC::JSImmediate::toThisObject):
3376         (JSC::JSImmediate::toObject):
3377         (JSC::JSImmediate::prototype):
3378         (JSC::JSImmediate::toString):
3379         * runtime/JSImmediate.h:
3380         * runtime/JSObject.cpp:
3381         (JSC::JSObject::mark):
3382         (JSC::JSObject::put):
3383         (JSC::callDefaultValueFunction):
3384         (JSC::JSObject::getPrimitiveNumber):
3385         (JSC::JSObject::defineGetter):
3386         (JSC::JSObject::defineSetter):
3387         (JSC::JSObject::lookupGetter):
3388         (JSC::JSObject::lookupSetter):
3389         (JSC::JSObject::hasInstance):
3390         (JSC::JSObject::toNumber):
3391         (JSC::JSObject::toString):
3392         * runtime/JSObject.h:
3393         (JSC::JSObject::JSObject):
3394         (JSC::JSObject::inlineGetOwnPropertySlot):
3395         (JSC::JSObject::getOwnPropertySlotForWrite):
3396         (JSC::JSObject::getPropertySlot):
3397         (JSC::JSValuePtr::get):
3398         * runtime/JSPropertyNameIterator.h:
3399         (JSC::JSPropertyNameIterator::create):
3400         * runtime/JSString.cpp:
3401         (JSC::JSString::getOwnPropertySlot):
3402         * runtime/JSValue.h:
3403         * runtime/JSWrapperObject.cpp:
3404         (JSC::JSWrapperObject::mark):
3405         * runtime/JSWrapperObject.h:
3406         (JSC::JSWrapperObject::setInternalValue):
3407         * runtime/MathObject.cpp:
3408         (JSC::mathProtoFuncAbs):
3409         (JSC::mathProtoFuncACos):
3410         (JSC::mathProtoFuncASin):
3411         (JSC::mathProtoFuncATan):
3412         (JSC::mathProtoFuncATan2):
3413         (JSC::mathProtoFuncCeil):
3414         (JSC::mathProtoFuncCos):
3415         (JSC::mathProtoFuncExp):
3416         (JSC::mathProtoFuncFloor):
3417         (JSC::mathProtoFuncLog):
3418         (JSC::mathProtoFuncMax):
3419         (JSC::mathProtoFuncMin):
3420         (JSC::mathProtoFuncPow):
3421         (JSC::mathProtoFuncRound):
3422         (JSC::mathProtoFuncSin):
3423         (JSC::mathProtoFuncSqrt):
3424         (JSC::mathProtoFuncTan):
3425         * runtime/NativeErrorConstructor.cpp:
3426         (JSC::NativeErrorConstructor::NativeErrorConstructor):
3427         (JSC::NativeErrorConstructor::construct):
3428         * runtime/NumberConstructor.cpp:
3429         (JSC::constructWithNumberConstructor):
3430         (JSC::callNumberConstructor):
3431         * runtime/NumberPrototype.cpp:
3432         (JSC::numberProtoFuncToString):
3433         (JSC::numberProtoFuncToLocaleString):
3434         (JSC::numberProtoFuncValueOf):
3435         (JSC::numberProtoFuncToFixed):
3436         (JSC::numberProtoFuncToExponential):
3437         (JSC::numberProtoFuncToPrecision):
3438         * runtime/ObjectConstructor.cpp:
3439         (JSC::constructObject):
3440         * runtime/ObjectPrototype.cpp:
3441         (JSC::objectProtoFuncValueOf):
3442         (JSC::objectProtoFuncHasOwnProperty):
3443         (JSC::objectProtoFuncIsPrototypeOf):
3444         (JSC::objectProtoFuncDefineGetter):
3445         (JSC::objectProtoFuncDefineSetter):
3446         (JSC::objectProtoFuncLookupGetter):
3447         (JSC::objectProtoFuncLookupSetter):
3448         (JSC::objectProtoFuncPropertyIsEnumerable):
3449         (JSC::objectProtoFuncToLocaleString):
3450         (JSC::objectProtoFuncToString):
3451         * runtime/Operations.h:
3452         (JSC::JSValuePtr::equalSlowCaseInline):
3453         (JSC::JSValuePtr::strictEqual):
3454         (JSC::JSValuePtr::strictEqualSlowCaseInline):
3455         * runtime/Protect.h:
3456         (JSC::gcProtect):
3457         (JSC::gcUnprotect):
3458         * runtime/RegExpConstructor.cpp:
3459         (JSC::setRegExpConstructorInput):
3460         (JSC::setRegExpConstructorMultiline):
3461         (JSC::constructRegExp):
3462         * runtime/RegExpObject.cpp:
3463         (JSC::setRegExpObjectLastIndex):
3464         (JSC::RegExpObject::match):
3465         * runtime/RegExpPrototype.cpp:
3466         (JSC::regExpProtoFuncTest):
3467         (JSC::regExpProtoFuncExec):
3468         (JSC::regExpProtoFuncCompile):
3469         (JSC::regExpProtoFuncToString):
3470         * runtime/StringConstructor.cpp:
3471         (JSC::stringFromCharCodeSlowCase):
3472         (JSC::stringFromCharCode):
3473         (JSC::constructWithStringConstructor):
3474         (JSC::callStringConstructor):
3475         * runtime/StringPrototype.cpp:
3476         (JSC::stringProtoFuncReplace):
3477         (JSC::stringProtoFuncToString):
3478         (JSC::stringProtoFuncCharAt):
3479         (JSC::stringProtoFuncCharCodeAt):
3480         (JSC::stringProtoFuncConcat):
3481         (JSC::stringProtoFuncIndexOf):
3482         (JSC::stringProtoFuncLastIndexOf):
3483         (JSC::stringProtoFuncMatch):
3484         (JSC::stringProtoFuncSearch):
3485         (JSC::stringProtoFuncSlice):
3486         (JSC::stringProtoFuncSplit):
3487         (JSC::stringProtoFuncSubstr):
3488         (JSC::stringProtoFuncSubstring):
3489         (JSC::stringProtoFuncToLowerCase):
3490         (JSC::stringProtoFuncToUpperCase):
3491         (JSC::stringProtoFuncLocaleCompare):
3492         (JSC::stringProtoFuncBig):
3493         (JSC::stringProtoFuncSmall):
3494         (JSC::stringProtoFuncBlink):
3495         (JSC::stringProtoFuncBold):
3496         (JSC::stringProtoFuncFixed):
3497         (JSC::stringProtoFuncItalics):
3498         (JSC::stringProtoFuncStrike):
3499         (JSC::stringProtoFuncSub):
3500         (JSC::stringProtoFuncSup):
3501         (JSC::stringProtoFuncFontcolor):
3502         (JSC::stringProtoFuncFontsize):
3503         (JSC::stringProtoFuncAnchor):
3504         (JSC::stringProtoFuncLink):
3505         * runtime/Structure.cpp:
3506         (JSC::Structure::Structure):
3507         (JSC::Structure::getEnumerablePropertyNames):
3508         (JSC::Structure::createCachedPrototypeChain):
3509         * runtime/Structure.h:
3510         (JSC::Structure::mark):
3511         * runtime/StructureChain.cpp:
3512         (JSC::StructureChain::StructureChain):
3513
3514 2009-01-19  Darin Adler  <darin@apple.com>
3515
3516         Reviewed by Sam Weinig.
3517
3518         Bug 23409: REGRESSION: RegExp 'replace()' function improperly processes '$$'
3519         <https://bugs.webkit.org/show_bug.cgi?id=23409>
3520         <rdar://problem/6505723>
3521
3522         Test: fast/js/string-replace-3.html
3523
3524         * runtime/StringPrototype.cpp:
3525         (JSC::substituteBackreferences): Remove code that adds an extra $ -- not sure
3526         how this ever worked.
3527
3528 2009-01-16  Gavin Barraclough  <barraclough@apple.com>
3529
3530         Reviewed by Oliver Hunt.
3531
3532         On x86-64 jit, cache JSImmedate::TagMask & JSImmedate::TagTypeNumber in
3533         registers, save reloading them every time they're used.
3534
3535         Draws x86-64 jit performance close to that of i386 jit.
3536
3537         * assembler/MacroAssembler.h:
3538         (JSC::MacroAssembler::subPtr):
3539         (JSC::MacroAssembler::jnzPtr):
3540         (JSC::MacroAssembler::jzPtr):
3541         * jit/JIT.cpp:
3542         (JSC::JIT::privateCompileMainPass):
3543         * jit/JIT.h:
3544         * jit/JITArithmetic.cpp:
3545         (JSC::JIT::compileBinaryArithOpSlowCase):
3546         * jit/JITInlineMethods.h:
3547         (JSC::JIT::emitJumpIfJSCell):