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