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