7f3a476bbe978a10561c1b5ab23eeb5d66223b10
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2008-12-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2
3         Rubber-stamped by Alexey Proskuryakov.
4
5         Revert r39509, because kjsyydebug is used in the generated code if YYDEBUG is 1.
6
7         * parser/Grammar.y:
8
9 2008-12-29  Oliver Hunt  <oliver@apple.com>
10
11         Reviewed by NOBODY (Build fix).
12
13         Tiger build fix.
14
15         * wtf/RandomNumber.cpp:
16
17 2008-12-29  Oliver Hunt  <oliver@apple.com>
18
19         Reviewed by Mark Rowe.
20
21         <rdar://problem/6358108> Insecure randomness in Math.random() leads to user tracking
22
23         Switch to arc4random on PLATFORM(DARWIN), this is ~1.5x slower than random(), but the
24         it is still so fast that there is no fathomable way it could be a bottleneck for anything.
25
26         randomNumber is called in two places
27           * During form submission where it is called once per form
28           * Math.random in JSC.  For this difference to show up you have to be looping on
29             a cached local copy of random, for a large (>10000) calls.
30
31         No change in SunSpider.
32
33         * wtf/RandomNumber.cpp:
34         (WTF::randomNumber):
35         * wtf/RandomNumberSeed.h:
36         (WTF::initializeRandomNumberGenerator):
37
38 2008-12-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
39
40         Rubber-stamped by Sam Weinig.
41
42         Remove unused kjsyydebug #define.
43
44         * parser/Grammar.y:
45
46 2008-12-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
47
48         Reviewed by Oliver Hunt and Sam Weinig.
49
50         Bug 23029: REGRESSION (r39337): jsfunfuzz generates identical test files
51         <https://bugs.webkit.org/show_bug.cgi?id=23029>
52         <rdar://problem/6469185>
53
54         The unification of random number generation in r39337 resulted in random()
55         being initialized on Darwin, but rand() actually being used. Fix this by
56         making randomNumber() use random() instead of rand() on Darwin.
57
58         * wtf/RandomNumber.cpp:
59         (WTF::randomNumber):
60
61 2008-12-29  Sam Weinig  <sam@webkit.org>
62
63         Fix buildbots.
64
65         * runtime/Structure.cpp:
66
67 2008-12-29  Sam Weinig  <sam@webkit.org>
68
69         Reviewed by Oliver Hunt.
70
71         Patch for https://bugs.webkit.org/show_bug.cgi?id=23026
72         Move the deleted offsets vector into the PropertyMap
73
74         Saves 3 words per Structure.
75
76         * runtime/PropertyMapHashTable.h:
77         * runtime/Structure.cpp:
78         (JSC::Structure::addPropertyTransition):
79         (JSC::Structure::changePrototypeTransition):
80         (JSC::Structure::getterSetterTransition):
81         (JSC::Structure::toDictionaryTransition):
82         (JSC::Structure::fromDictionaryTransition):
83         (JSC::Structure::copyPropertyTable):
84         (JSC::Structure::put):
85         (JSC::Structure::remove):
86         (JSC::Structure::rehashPropertyMapHashTable):
87         * runtime/Structure.h:
88         (JSC::Structure::propertyStorageSize):
89
90 2008-12-29  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
91
92         Reviewed by Oliver Hunt.
93
94         Change code using m_body.get() as a boolean to take advantage of the 
95         implicit conversion of RefPtr to boolean.
96
97         * runtime/JSFunction.cpp:
98         (JSC::JSFunction::~JSFunction):
99
100 2008-12-28  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
101
102         Reviewed by Oliver Hunt.
103
104         Bug 22840: REGRESSION (r38349): Gmail doesn't load with profiling enabled
105         <https://bugs.webkit.org/show_bug.cgi?id=22840>
106         <rdar://problem/6468077>
107
108         * bytecompiler/BytecodeGenerator.cpp:
109         (JSC::BytecodeGenerator::emitNewArray): Add an assertion that the range
110         of registers passed to op_new_array is sequential.
111         (JSC::BytecodeGenerator::emitCall): Correct the relocation of registers
112         when emitting profiler hooks so that registers aren't leaked. Also, add
113         an assertion that the 'this' register is always ref'd (because it is),
114         remove the needless protection of the 'this' register when relocating,
115         and add an assertion that the range of registers passed to op_call for
116         function call arguments is sequential.
117         (JSC::BytecodeGenerator::emitConstruct): Correct the relocation of
118         registers when emitting profiler hooks so that registers aren't leaked.
119         Also, add an assertion that the range of registers passed to op_construct
120         for function call arguments is sequential.
121
122 2008-12-26  Mark Rowe  <mrowe@apple.com>
123
124         Reviewed by Alexey Proskuryakov.
125
126         <rdar://problem/6467376> Race condition in WTF::currentThread can lead to a thread using two different identifiers during its lifetime
127
128         If a newly-created thread calls WTF::currentThread() before WTF::createThread calls establishIdentifierForPthreadHandle
129         then more than one identifier will be used for the same thread.  We can avoid this by adding some extra synchronization
130         during thread creation that delays the execution of the thread function until the thread identifier has been set up, and
131         an assertion to catch this problem should it reappear in the future.
132
133         * wtf/Threading.cpp: Added.
134         (WTF::NewThreadContext::NewThreadContext):
135         (WTF::threadEntryPoint):
136         (WTF::createThread): Add cross-platform createThread function that delays the execution of the thread function until
137         after the thread identifier has been set up.
138         * wtf/Threading.h:
139         * wtf/ThreadingGtk.cpp:
140         (WTF::establishIdentifierForThread):
141         (WTF::createThreadInternal):
142         * wtf/ThreadingNone.cpp:
143         (WTF::createThreadInternal):
144         * wtf/ThreadingPthreads.cpp:
145         (WTF::establishIdentifierForPthreadHandle):
146         (WTF::createThreadInternal):
147         * wtf/ThreadingQt.cpp:
148         (WTF::identifierByQthreadHandle):
149         (WTF::establishIdentifierForThread):
150         (WTF::createThreadInternal):
151         * wtf/ThreadingWin.cpp:
152         (WTF::storeThreadHandleByIdentifier):
153         (WTF::createThreadInternal):
154
155         Add Threading.cpp to the build.
156
157         * GNUmakefile.am:
158         * JavaScriptCore.pri:
159         * JavaScriptCore.scons:
160         * JavaScriptCore.vcproj/WTF/WTF.vcproj:
161         * JavaScriptCore.xcodeproj/project.pbxproj:
162         * JavaScriptCoreSources.bkl:
163
164 2008-12-26  Sam Weinig  <sam@webkit.org>
165
166         Reviewed by Alexey Proskuryakov.
167
168         Remove unused method.
169
170         * runtime/Structure.h: Remove mutableTypeInfo.
171
172 2008-12-22  Gavin Barraclough  <barraclough@apple.com>
173
174         Reviewed by Oliver Hunt.
175
176         Fix rounding / bounds / signed comparison bug in ExecutableAllocator.
177
178         ExecutableAllocator::alloc assumed that m_freePtr would be aligned.  This was
179         not always true, since the first allocation from an additional pool would not
180         be rounded up.  Subsequent allocations would be unaligned, and too much memory
181         could be erroneously allocated from the pool, when the size requested was
182         available, but the size rounded up to word granularity was not available in the
183         pool.  This may result in the value of m_freePtr being greater than m_end.
184
185         Under these circumstances, the unsigned check for space will always pass,
186         resulting in pointers to memory outside of the arena being returned, and
187         ultimately segfaulty goodness when attempting to memcpy the hot freshly jitted
188         code from the AssemblerBuffer.
189
190         https://bugs.webkit.org/show_bug.cgi?id=22974
191         ... and probably many, many more.
192
193         * jit/ExecutableAllocator.h:
194         (JSC::ExecutablePool::alloc):
195         (JSC::ExecutablePool::roundUpAllocationSize):
196         (JSC::ExecutablePool::ExecutablePool):
197         (JSC::ExecutablePool::poolAllocate):
198
199 2008-12-22  Sam Weinig  <sam@webkit.org>
200
201         Reviewed by Gavin Barraclough.
202
203         Rename all uses of the term "repatch" to "patch".
204
205         * assembler/MacroAssembler.h:
206         (JSC::MacroAssembler::DataLabelPtr::patch):
207         (JSC::MacroAssembler::DataLabel32::patch):
208         (JSC::MacroAssembler::Jump::patch):
209         (JSC::MacroAssembler::PatchBuffer::PatchBuffer):
210         (JSC::MacroAssembler::PatchBuffer::setPtr):
211         (JSC::MacroAssembler::loadPtrWithAddressOffsetPatch):
212         (JSC::MacroAssembler::storePtrWithAddressOffsetPatch):
213         (JSC::MacroAssembler::storePtrWithPatch):
214         (JSC::MacroAssembler::jnePtrWithPatch):
215         * assembler/X86Assembler.h:
216         (JSC::X86Assembler::patchAddress):
217         (JSC::X86Assembler::patchImmediate):
218         (JSC::X86Assembler::patchPointer):
219         (JSC::X86Assembler::patchBranchOffset):
220         * interpreter/Interpreter.cpp:
221         (JSC::Interpreter::tryCTICachePutByID):
222         (JSC::Interpreter::tryCTICacheGetByID):
223         (JSC::Interpreter::cti_op_put_by_id):
224         (JSC::Interpreter::cti_op_get_by_id):
225         (JSC::Interpreter::cti_op_get_by_id_self_fail):
226         (JSC::Interpreter::cti_op_get_by_id_proto_list):
227         (JSC::Interpreter::cti_vm_dontLazyLinkCall):
228         * jit/JIT.cpp:
229         (JSC::ctiPatchCallByReturnAddress):
230         (JSC::JIT::privateCompileMainPass):
231         (JSC::JIT::privateCompile):
232         (JSC::JIT::privateCompileCTIMachineTrampolines):
233         * jit/JIT.h:
234         * jit/JITCall.cpp:
235         (JSC::JIT::unlinkCall):
236         (JSC::JIT::linkCall):
237         (JSC::JIT::compileOpCall):
238         * jit/JITPropertyAccess.cpp:
239         (JSC::JIT::compileGetByIdHotPath):
240         (JSC::JIT::compilePutByIdHotPath):
241         (JSC::JIT::compileGetByIdSlowCase):
242         (JSC::JIT::compilePutByIdSlowCase):
243         (JSC::JIT::privateCompilePutByIdTransition):
244         (JSC::JIT::patchGetByIdSelf):
245         (JSC::JIT::patchPutByIdReplace):
246         (JSC::JIT::privateCompilePatchGetArrayLength):
247         (JSC::JIT::privateCompileGetByIdSelf):
248         (JSC::JIT::privateCompileGetByIdProto):
249         (JSC::JIT::privateCompileGetByIdSelfList):
250         (JSC::JIT::privateCompileGetByIdProtoList):
251         (JSC::JIT::privateCompileGetByIdChainList):
252         (JSC::JIT::privateCompileGetByIdChain):
253         (JSC::JIT::privateCompilePutByIdReplace):
254
255 2008-12-22  Adam Roben  <aroben@apple.com>
256
257         Build fix after r39428
258
259         * jit/JITCall.cpp:
260         (JSC::JIT::compileOpCallSlowCase): Added a missing MacroAssembler::
261
262 2008-12-22  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
263
264         Rubber-stamped by George Staikos.
265
266         Unify all TorchMobile copyright lines. Consolidate in a single line, as requested by Mark Rowe, some time ago.
267
268         * wtf/RandomNumber.cpp:
269         * wtf/RandomNumber.h:
270         * wtf/RandomNumberSeed.h:
271
272 2008-12-21  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
273
274         Rubber-stamped by George Staikos.
275
276         Fix copyright of the new RandomNumber* files.
277
278         * wtf/RandomNumber.cpp:
279         * wtf/RandomNumber.h:
280         * wtf/RandomNumberSeed.h:
281
282 2008-12-21  Gavin Barraclough  <barraclough@apple.com>
283
284         Reviewed by Oliver Hunt & Cameron Zwarich.
285
286         Add support for call and property access repatching on x86-64.
287
288         No change in performance on current configurations (2x impovement on v8-tests with JIT enabled on x86-64).
289
290         * assembler/MacroAssembler.h:
291         (JSC::MacroAssembler::DataLabelPtr::repatch):
292         (JSC::MacroAssembler::DataLabelPtr::operator X86Assembler::JmpDst):
293         (JSC::MacroAssembler::DataLabel32::repatch):
294         (JSC::MacroAssembler::RepatchBuffer::addressOf):
295         (JSC::MacroAssembler::add32):
296         (JSC::MacroAssembler::sub32):
297         (JSC::MacroAssembler::loadPtrWithAddressOffsetRepatch):
298         (JSC::MacroAssembler::storePtrWithAddressOffsetRepatch):
299         (JSC::MacroAssembler::jePtr):
300         (JSC::MacroAssembler::jnePtr):
301         (JSC::MacroAssembler::jnePtrWithRepatch):
302         (JSC::MacroAssembler::differenceBetween):
303         * assembler/X86Assembler.h:
304         (JSC::X86Assembler::addl_im):
305         (JSC::X86Assembler::subl_im):
306         (JSC::X86Assembler::cmpl_rm):
307         (JSC::X86Assembler::movq_rm_disp32):
308         (JSC::X86Assembler::movq_mr_disp32):
309         (JSC::X86Assembler::repatchPointer):
310         (JSC::X86Assembler::X86InstructionFormatter::oneByteOp64_disp32):
311         * jit/JIT.cpp:
312         (JSC::JIT::privateCompile):
313         (JSC::JIT::privateCompileCTIMachineTrampolines):
314         * jit/JIT.h:
315         * jit/JITCall.cpp:
316         (JSC::JIT::unlinkCall):
317         (JSC::JIT::linkCall):
318         (JSC::JIT::compileOpCall):
319         (JSC::JIT::compileOpCallSlowCase):
320         * jit/JITInlineMethods.h:
321         (JSC::JIT::restoreArgumentReferenceForTrampoline):
322         * jit/JITPropertyAccess.cpp:
323         (JSC::JIT::compileGetByIdHotPath):
324         (JSC::JIT::compileGetByIdSlowCase):
325         (JSC::JIT::compilePutByIdHotPath):
326         (JSC::JIT::compilePutByIdSlowCase):
327         (JSC::resizePropertyStorage):
328         (JSC::JIT::privateCompilePutByIdTransition):
329         (JSC::JIT::privateCompileGetByIdProto):
330         (JSC::JIT::privateCompileGetByIdProtoList):
331         (JSC::JIT::privateCompileGetByIdChainList):
332         (JSC::JIT::privateCompileGetByIdChain):
333         * wtf/Platform.h:
334
335 2008-12-20  Gavin Barraclough  <barraclough@apple.com>
336
337         Reviewed by Oliver Hunt.
338
339         Port optimized property access generation to the MacroAssembler.
340
341         * assembler/MacroAssembler.h:
342         (JSC::MacroAssembler::AbsoluteAddress::AbsoluteAddress):
343         (JSC::MacroAssembler::DataLabelPtr::repatch):
344         (JSC::MacroAssembler::DataLabel32::DataLabel32):
345         (JSC::MacroAssembler::DataLabel32::repatch):
346         (JSC::MacroAssembler::Label::operator X86Assembler::JmpDst):
347         (JSC::MacroAssembler::Jump::repatch):
348         (JSC::MacroAssembler::JumpList::empty):
349         (JSC::MacroAssembler::RepatchBuffer::link):
350         (JSC::MacroAssembler::add32):
351         (JSC::MacroAssembler::and32):
352         (JSC::MacroAssembler::sub32):
353         (JSC::MacroAssembler::loadPtrWithAddressRepatch):
354         (JSC::MacroAssembler::storePtrWithAddressRepatch):
355         (JSC::MacroAssembler::push):
356         (JSC::MacroAssembler::ja32):
357         (JSC::MacroAssembler::jePtr):
358         (JSC::MacroAssembler::jnePtr):
359         (JSC::MacroAssembler::jnePtrWithRepatch):
360         (JSC::MacroAssembler::align):
361         (JSC::MacroAssembler::differenceBetween):
362         * assembler/X86Assembler.h:
363         (JSC::X86Assembler::movl_rm_disp32):
364         (JSC::X86Assembler::movl_mr_disp32):
365         (JSC::X86Assembler::X86InstructionFormatter::oneByteOp_disp32):
366         (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
367         * jit/JIT.cpp:
368         (JSC::ctiRepatchCallByReturnAddress):
369         (JSC::JIT::privateCompileMainPass):
370         (JSC::JIT::privateCompile):
371         (JSC::JIT::privateCompileCTIMachineTrampolines):
372         * jit/JIT.h:
373         * jit/JITPropertyAccess.cpp:
374         (JSC::JIT::compileGetByIdHotPath):
375         (JSC::JIT::compileGetByIdSlowCase):
376         (JSC::JIT::compilePutByIdHotPath):
377         (JSC::JIT::compilePutByIdSlowCase):
378         (JSC::resizePropertyStorage):
379         (JSC::JIT::privateCompilePutByIdTransition):
380         (JSC::JIT::patchGetByIdSelf):
381         (JSC::JIT::patchPutByIdReplace):
382         (JSC::JIT::privateCompilePatchGetArrayLength):
383         (JSC::JIT::privateCompileGetByIdSelf):
384         (JSC::JIT::privateCompileGetByIdProto):
385         (JSC::JIT::privateCompileGetByIdSelfList):
386         (JSC::JIT::privateCompileGetByIdProtoList):
387         (JSC::JIT::privateCompileGetByIdChainList):
388         (JSC::JIT::privateCompileGetByIdChain):
389         (JSC::JIT::privateCompilePutByIdReplace):
390         * wtf/RefCounted.h:
391         (WTF::RefCountedBase::addressOfCount):
392
393 2008-12-19  Gustavo Noronha Silva  <gns@gnome.org>
394
395         Reviewed by Holger Freyther.
396
397         https://bugs.webkit.org/show_bug.cgi?id=22686
398
399         Added file which was missing to the javascriptcore_sources
400         variable, so that it shows up in the tarball created by `make
401         dist'.
402
403         * GNUmakefile.am:
404
405 2008-12-19  Holger Hans Peter Freyther  <zecke@selfish.org>
406
407         Reviewed by Antti Koivisto.
408
409         Build fix when building JS API tests with a c89 c compiler
410
411         Do not use C++ style comments and convert them to C comments.
412
413         * wtf/Platform.h:
414
415 2008-12-18  Gavin Barraclough  <barraclough@apple.com>
416
417         Reviewed by Sam Weinig.
418
419         Same as last revision, adding cases for pre & post inc & dec.
420
421         https://bugs.webkit.org/show_bug.cgi?id=22928
422
423         * jit/JIT.cpp:
424         (JSC::JIT::privateCompileMainPass):
425
426 2008-12-18  Gavin Barraclough  <barraclough@apple.com>
427
428         Reviewed by Sam Weinig.
429
430         Fixes for the JIT's handling of JSImmediate values on x86-64.
431         On 64-bit systems, the code in JSImmediate.h relies on the upper
432         bits of a JSImmediate being a sign extension of the low 32-bits.
433         This was not being enforced by the JIT, since a number of inline
434         operations were being performed on 32-bit values in registers, and
435         when a 32-bit result is written to a register on x86-64 the value
436         is zero-extended to 64-bits.
437         
438         This fix honors previous behavoir.  A better fix in the long run
439         (when the JIT is enabled by default) may be to change JSImmediate.h
440         so it no longer relies on the upper bits of the pointer,... though
441         if we're going to change JSImmediate.h for 64-bit, we probably may
442         as well change the format so that the full range of 32-bit ints can
443         be stored, rather than just 31-bits.
444
445         https://bugs.webkit.org/show_bug.cgi?id=22925
446
447         * assembler/MacroAssembler.h:
448         (JSC::MacroAssembler::addPtr):
449         (JSC::MacroAssembler::andPtr):
450         (JSC::MacroAssembler::orPtr):
451         (JSC::MacroAssembler::or32):
452         (JSC::MacroAssembler::xor32):
453         (JSC::MacroAssembler::xorPtr):
454         (JSC::MacroAssembler::signExtend32ToPtr):
455         * assembler/X86Assembler.h:
456         (JSC::X86Assembler::):
457         (JSC::X86Assembler::andq_rr):
458         (JSC::X86Assembler::andq_ir):
459         (JSC::X86Assembler::orq_rr):
460         (JSC::X86Assembler::xorq_ir):
461         (JSC::X86Assembler::movsxd_rr):
462         * jit/JIT.cpp:
463         (JSC::JIT::privateCompileMainPass):
464         * jit/JITInlineMethods.h:
465         (JSC::JIT::emitFastArithReTagImmediate):
466         (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
467         (JSC::JIT::emitFastArithImmToInt):
468
469 2008-12-18  Gavin Barraclough  <barraclough@apple.com>
470
471         Reviewed by Sam Weinig.
472
473         Just a tidy up - rename & refactor some the #defines configuring the JIT.
474
475         * interpreter/Interpreter.cpp:
476         (JSC::Interpreter::cti_op_convert_this):
477         (JSC::Interpreter::cti_op_end):
478         (JSC::Interpreter::cti_op_add):
479         (JSC::Interpreter::cti_op_pre_inc):
480         (JSC::Interpreter::cti_timeout_check):
481         (JSC::Interpreter::cti_register_file_check):
482         (JSC::Interpreter::cti_op_loop_if_less):
483         (JSC::Interpreter::cti_op_loop_if_lesseq):
484         (JSC::Interpreter::cti_op_new_object):
485         (JSC::Interpreter::cti_op_put_by_id_generic):
486         (JSC::Interpreter::cti_op_get_by_id_generic):
487         (JSC::Interpreter::cti_op_put_by_id):
488         (JSC::Interpreter::cti_op_put_by_id_second):
489         (JSC::Interpreter::cti_op_put_by_id_fail):
490         (JSC::Interpreter::cti_op_get_by_id):
491         (JSC::Interpreter::cti_op_get_by_id_second):
492         (JSC::Interpreter::cti_op_get_by_id_self_fail):
493         (JSC::Interpreter::cti_op_get_by_id_proto_list):
494         (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
495         (JSC::Interpreter::cti_op_get_by_id_proto_fail):
496         (JSC::Interpreter::cti_op_get_by_id_array_fail):
497         (JSC::Interpreter::cti_op_get_by_id_string_fail):
498         (JSC::Interpreter::cti_op_instanceof):
499         (JSC::Interpreter::cti_op_del_by_id):
500         (JSC::Interpreter::cti_op_mul):
501         (JSC::Interpreter::cti_op_new_func):
502         (JSC::Interpreter::cti_op_call_JSFunction):
503         (JSC::Interpreter::cti_op_call_arityCheck):
504         (JSC::Interpreter::cti_vm_dontLazyLinkCall):
505         (JSC::Interpreter::cti_vm_lazyLinkCall):
506         (JSC::Interpreter::cti_op_push_activation):
507         (JSC::Interpreter::cti_op_call_NotJSFunction):
508         (JSC::Interpreter::cti_op_create_arguments):
509         (JSC::Interpreter::cti_op_create_arguments_no_params):
510         (JSC::Interpreter::cti_op_tear_off_activation):
511         (JSC::Interpreter::cti_op_tear_off_arguments):
512         (JSC::Interpreter::cti_op_profile_will_call):
513         (JSC::Interpreter::cti_op_profile_did_call):
514         (JSC::Interpreter::cti_op_ret_scopeChain):
515         (JSC::Interpreter::cti_op_new_array):
516         (JSC::Interpreter::cti_op_resolve):
517         (JSC::Interpreter::cti_op_construct_JSConstruct):
518         (JSC::Interpreter::cti_op_construct_NotJSConstruct):
519         (JSC::Interpreter::cti_op_get_by_val):
520         (JSC::Interpreter::cti_op_resolve_func):
521         (JSC::Interpreter::cti_op_sub):
522         (JSC::Interpreter::cti_op_put_by_val):
523         (JSC::Interpreter::cti_op_put_by_val_array):
524         (JSC::Interpreter::cti_op_lesseq):
525         (JSC::Interpreter::cti_op_loop_if_true):
526         (JSC::Interpreter::cti_op_negate):
527         (JSC::Interpreter::cti_op_resolve_base):
528         (JSC::Interpreter::cti_op_resolve_skip):
529         (JSC::Interpreter::cti_op_resolve_global):
530         (JSC::Interpreter::cti_op_div):
531         (JSC::Interpreter::cti_op_pre_dec):
532         (JSC::Interpreter::cti_op_jless):
533         (JSC::Interpreter::cti_op_not):
534         (JSC::Interpreter::cti_op_jtrue):
535         (JSC::Interpreter::cti_op_post_inc):
536         (JSC::Interpreter::cti_op_eq):
537         (JSC::Interpreter::cti_op_lshift):
538         (JSC::Interpreter::cti_op_bitand):
539         (JSC::Interpreter::cti_op_rshift):
540         (JSC::Interpreter::cti_op_bitnot):
541         (JSC::Interpreter::cti_op_resolve_with_base):
542         (JSC::Interpreter::cti_op_new_func_exp):
543         (JSC::Interpreter::cti_op_mod):
544         (JSC::Interpreter::cti_op_less):
545         (JSC::Interpreter::cti_op_neq):
546         (JSC::Interpreter::cti_op_post_dec):
547         (JSC::Interpreter::cti_op_urshift):
548         (JSC::Interpreter::cti_op_bitxor):
549         (JSC::Interpreter::cti_op_new_regexp):
550         (JSC::Interpreter::cti_op_bitor):
551         (JSC::Interpreter::cti_op_call_eval):
552         (JSC::Interpreter::cti_op_throw):
553         (JSC::Interpreter::cti_op_get_pnames):
554         (JSC::Interpreter::cti_op_next_pname):
555         (JSC::Interpreter::cti_op_push_scope):
556         (JSC::Interpreter::cti_op_pop_scope):
557         (JSC::Interpreter::cti_op_typeof):
558         (JSC::Interpreter::cti_op_is_undefined):
559         (JSC::Interpreter::cti_op_is_boolean):
560         (JSC::Interpreter::cti_op_is_number):
561         (JSC::Interpreter::cti_op_is_string):
562         (JSC::Interpreter::cti_op_is_object):
563         (JSC::Interpreter::cti_op_is_function):
564         (JSC::Interpreter::cti_op_stricteq):
565         (JSC::Interpreter::cti_op_nstricteq):
566         (JSC::Interpreter::cti_op_to_jsnumber):
567         (JSC::Interpreter::cti_op_in):
568         (JSC::Interpreter::cti_op_push_new_scope):
569         (JSC::Interpreter::cti_op_jmp_scopes):
570         (JSC::Interpreter::cti_op_put_by_index):
571         (JSC::Interpreter::cti_op_switch_imm):
572         (JSC::Interpreter::cti_op_switch_char):
573         (JSC::Interpreter::cti_op_switch_string):
574         (JSC::Interpreter::cti_op_del_by_val):
575         (JSC::Interpreter::cti_op_put_getter):
576         (JSC::Interpreter::cti_op_put_setter):
577         (JSC::Interpreter::cti_op_new_error):
578         (JSC::Interpreter::cti_op_debug):
579         (JSC::Interpreter::cti_vm_throw):
580         * interpreter/Interpreter.h:
581         * jit/JIT.cpp:
582         (JSC::):
583         (JSC::JIT::privateCompileMainPass):
584         (JSC::JIT::privateCompile):
585         * jit/JIT.h:
586         * jit/JITInlineMethods.h:
587         (JSC::JIT::restoreArgumentReference):
588         (JSC::JIT::restoreArgumentReferenceForTrampoline):
589         * wtf/Platform.h:
590
591 2008-12-18  Cameron Zwarich  <zwarich@apple.com>
592
593         Reviewed by Geoff Garen.
594
595         Bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
596         <https://bugs.webkit.org/show_bug.cgi?id=21855>
597         <rdar://problem/6278244>
598
599         Move DynamicGlobalObjectScope to JSGlobalObject.h so that it can be used
600         from WebCore.
601
602         * interpreter/Interpreter.cpp:
603         * runtime/JSGlobalObject.h:
604         (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
605         (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
606
607 2008-12-17  Geoffrey Garen  <ggaren@apple.com>
608
609         Reviewed by Gavin Barraclough.
610         
611         Fixed https://bugs.webkit.org/show_bug.cgi?id=22393
612         Segfault when caching property accesses to primitive cells.
613         
614         Changed some asObject casts to asCell casts in cases where a primitive
615         value may be a cell and not an object.
616         
617         Re-enabled property caching for primitives in cases where it had been
618         disabled because of this bug.
619         
620         Updated a comment to better explain something Darin thought needed
621         explaining in an old patch review.
622
623         * interpreter/Interpreter.cpp:
624         (JSC::countPrototypeChainEntriesAndCheckForProxies):
625         (JSC::Interpreter::tryCacheGetByID):
626         (JSC::Interpreter::tryCTICacheGetByID):
627         (JSC::Interpreter::cti_op_get_by_id_self_fail):
628         (JSC::Interpreter::cti_op_get_by_id_proto_list):
629
630 2008-12-17  Gavin Barraclough  <barraclough@apple.com>
631
632         Reviewed by Cameron Zwarich.
633
634         Fixes for Sunspider failures with the JIT enabled on x86-64.
635
636         * assembler/MacroAssembler.h:
637             Switch the order of the RegisterID & Address form of je32, to keep it consistent with jne32.
638         * jit/JIT.cpp:
639         * jit/JIT.h:
640         * jit/JITInlineMethods.h:
641             Port the m_ctiVirtualCall tramopline generation to use the MacroAssembler interface.
642         * jit/JITCall.cpp:
643             Fix bug in the non-optimizing code path, vptr check should have been to the memory address pointer
644             to by the register, not to the register itself.
645         * wrec/WRECGenerator.cpp:
646             See assembler/MacroAssembler.h, above.
647
648 2008-12-17  Gavin Barraclough  <barraclough@apple.com>
649
650         Reviewed by Sam Weinig.
651
652         print("Hello, 64-bit jitted world!");
653         Get hello-world working through the JIT, on x86-64.
654
655         * assembler/X86Assembler.h:
656             Fix encoding of opcode + RegisterID format instructions for 64-bit.
657         * interpreter/Interpreter.cpp:
658         * interpreter/Interpreter.h:
659             Make VoidPtrPair actually be a pair of void*s.
660             (Possibly should make this change for 32-bit Mac platforms, too - but won't change 32-bit behaviour in this patch).
661         * jit/JIT.cpp:
662         * jit/JIT.h:
663             Provide names for the timeoutCheckRegister & callFrameRegister on x86-64,
664             force x86-64 ctiTrampoline arguments onto the stack,
665             implement the asm trampolines for x86-64,
666             implement the restoreArgumentReference methods for x86-64 calling conventions.
667         * jit/JITCall.cpp:
668         * jit/JITInlineMethods.h:
669         * wtf/Platform.h:
670             Add switch settings to ENABLE(JIT), on PLATFORM(X86_64) (currently still disabled).
671
672 2008-12-17  Sam Weinig  <sam@webkit.org>
673
674         Reviewed by Gavin Barraclough.
675
676         Add more CodeBlock statistics.
677
678         * bytecode/CodeBlock.cpp:
679         (JSC::CodeBlock::dumpStatistics):
680
681 2008-12-17  Sam Weinig  <sam@webkit.org>
682
683         Reviewed by Darin Adler.
684
685         Fix for https://bugs.webkit.org/show_bug.cgi?id=22897
686         <rdar://problem/6428342>
687         Look into feasibility of discarding bytecode after native codegen
688
689         Clear the bytecode Instruction vector at the end JIT generation.
690
691         Saves 4.8 MB on Membuster head.
692
693         * bytecode/CodeBlock.cpp:
694         (JSC::CodeBlock::dump): Add logging for the case that someone tries
695         to dump the instructions of a CodeBlock that has had its bytecode
696         vector cleared.
697         (JSC::CodeBlock::CodeBlock): Initialize the instructionCount
698         (JSC::CodeBlock::handlerForBytecodeOffset): Use instructionCount instead
699         of the size of the instruction vector in the assertion.
700         (JSC::CodeBlock::lineNumberForBytecodeOffset): Ditto.
701         (JSC::CodeBlock::expressionRangeForBytecodeOffset): Ditto.
702         (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): Ditto.
703         (JSC::CodeBlock::functionRegisterForBytecodeOffset): Ditto.
704         * bytecode/CodeBlock.h:
705         (JSC::CodeBlock::setInstructionCount): Store the instruction vector size
706         in debug builds for assertions.
707         * bytecompiler/BytecodeGenerator.cpp:
708         (JSC::BytecodeGenerator::generate):
709         * jit/JIT.cpp:
710         (JSC::JIT::privateCompile): Clear the bytecode vector unless we
711         have compiled with Opcode sampling where we will continue to require it
712
713 2008-12-17  Cary Clark  <caryclark@google.com>
714
715         Reviewed by Darin Adler.
716         Landed by Adam Barth.
717
718         Add ENABLE_TEXT_CARET to permit the ANDROID platform
719         to invalidate and draw the caret in a separate thread.
720
721         * wtf/Platform.h:
722         Default ENABLE_TEXT_CARET to 1.
723
724 2008-12-17  Alexey Proskuryakov  <ap@webkit.org>
725
726         Reviewed by Darin Adler.
727
728         Don't use unique context group in JSGlobalContextCreate() on Tiger or Leopard, take two.
729
730         * API/JSContextRef.cpp: The previous patch that claimed to do this was making Tiger and
731         Leopard always use unique context group instead.
732
733 2008-12-16  Sam Weinig  <sam@webkit.org>
734
735         Reviewed by Geoffrey Garen.
736
737         Fix for https://bugs.webkit.org/show_bug.cgi?id=22838
738         Remove dependency on the bytecode Instruction buffer in Interpreter::throwException
739         Part of <rdar://problem/6428342>
740
741         * bytecode/CodeBlock.cpp:
742         (JSC::CodeBlock::functionRegisterForBytecodeOffset): Added. Function to get
743         a function Register index in a callFrame for a bytecode offset.
744         (JSC::CodeBlock::shrinkToFit): Shrink m_getByIdExceptionInfo and m_functionRegisterInfos.
745         * bytecode/CodeBlock.h:
746         (JSC::FunctionRegisterInfo::FunctionRegisterInfo): Added.
747         (JSC::CodeBlock::addFunctionRegisterInfo):
748         * bytecompiler/BytecodeGenerator.cpp:
749         (JSC::BytecodeGenerator::emitCall):
750         * interpreter/Interpreter.cpp:
751         (JSC::Interpreter::throwException): Use functionRegisterForBytecodeOffset in JIT
752         mode.
753
754 2008-12-16  Sam Weinig  <sam@webkit.org>
755
756         Reviewed by Gavin Barraclough.
757
758         Fix for https://bugs.webkit.org/show_bug.cgi?id=22837
759         Remove dependency on the bytecode Instruction buffer in Interpreter::cti_op_call_NotJSFunction
760         Part of <rdar://problem/6428342>
761
762         * interpreter/CallFrame.h: Added comment regarding returnPC storing a void*.
763         * interpreter/Interpreter.cpp:
764         (JSC::bytecodeOffsetForPC): We no longer have any cases of the PC
765         being in the instruction stream for JIT, so we can remove the check.
766         (JSC::Interpreter::cti_op_call_NotJSFunction): Use the CTI_RETURN_ADDRESS
767         as the call frame returnPC as it is only necessary for looking up when
768         throwing an exception.
769         * interpreter/RegisterFile.h:
770         (JSC::RegisterFile::): Added comment regarding returnPC storing a void*.
771         * jit/JIT.h: Remove ARG_instr4.
772         * jit/JITCall.cpp:
773         (JSC::JIT::compileOpCallSetupArgs): Don't pass the instruction pointer.
774
775 2008-12-16  Darin Adler  <darin@apple.com>
776
777         Reviewed and landed by Cameron Zwarich.
778
779         Preparatory work for fixing
780
781         Bug 22887: Make UString::Rep use RefCounted rather than implementing its own ref counting
782         <https://bugs.webkit.org/show_bug.cgi?id=22887>
783
784         Change the various string translators used by Identifier:add() so that
785         they never zero the ref count of a newly created UString::Rep.
786
787         * runtime/Identifier.cpp:
788         (JSC::CStringTranslator::translate):
789         (JSC::Identifier::add):
790         (JSC::UCharBufferTranslator::translate):
791
792 2008-12-16  Gavin Barraclough  <barraclough@apple.com>
793
794         Build fix for 'doze.
795
796         * assembler/AssemblerBuffer.h:
797
798 2008-12-16  Gavin Barraclough  <barraclough@apple.com>
799
800         Reviewed by Cameron Zwarich.
801
802         Make the JIT compile on x86-64.
803         This largely involves populting the missing calls in MacroAssembler.h.
804         In addition some reinterpret_casts need removing from the JIT, and the
805         repatching property access code will need to be fully compiled out for
806         now.  The changes in interpret.cpp are to reorder the functions so that
807         the _generic forms come before all other property access methods, and
808         then to place all property access methods other than the generic forms
809         under control of the ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS macro.
810
811         No performance impact.
812
813         * assembler/AssemblerBuffer.h:
814         (JSC::AssemblerBuffer::putInt64Unchecked):
815         * assembler/MacroAssembler.h:
816         (JSC::MacroAssembler::loadPtr):
817         (JSC::MacroAssembler::load32):
818         (JSC::MacroAssembler::storePtr):
819         (JSC::MacroAssembler::storePtrWithRepatch):
820         (JSC::MacroAssembler::store32):
821         (JSC::MacroAssembler::poke):
822         (JSC::MacroAssembler::move):
823         (JSC::MacroAssembler::testImm64):
824         (JSC::MacroAssembler::jePtr):
825         (JSC::MacroAssembler::jnePtr):
826         (JSC::MacroAssembler::jnzPtr):
827         (JSC::MacroAssembler::jzPtr):
828         * assembler/X86Assembler.h:
829         (JSC::X86Assembler::):
830         (JSC::X86Assembler::cmpq_rr):
831         (JSC::X86Assembler::cmpq_rm):
832         (JSC::X86Assembler::cmpq_im):
833         (JSC::X86Assembler::testq_i32m):
834         (JSC::X86Assembler::movl_mEAX):
835         (JSC::X86Assembler::movl_i32r):
836         (JSC::X86Assembler::movl_EAXm):
837         (JSC::X86Assembler::movq_rm):
838         (JSC::X86Assembler::movq_mEAX):
839         (JSC::X86Assembler::movq_mr):
840         (JSC::X86Assembler::movq_i64r):
841         (JSC::X86Assembler::movl_mr):
842         (JSC::X86Assembler::X86InstructionFormatter::oneByteOp64):
843         (JSC::X86Assembler::X86InstructionFormatter::immediate64):
844         * interpreter/Interpreter.cpp:
845         (JSC::Interpreter::cti_op_put_by_id_generic):
846         (JSC::Interpreter::cti_op_get_by_id_generic):
847         (JSC::Interpreter::cti_op_put_by_id):
848         (JSC::Interpreter::cti_op_put_by_id_second):
849         * jit/JIT.cpp:
850         (JSC::JIT::privateCompileMainPass):
851         (JSC::JIT::privateCompile):
852         (JSC::JIT::privateCompileCTIMachineTrampolines):
853         * jit/JITCall.cpp:
854         (JSC::JIT::compileOpCallSetupArgs):
855         (JSC::JIT::compileOpCall):
856         * jit/JITPropertyAccess.cpp:
857         (JSC::JIT::compileGetByIdHotPath):
858         (JSC::JIT::compilePutByIdHotPath):
859         * runtime/JSImmediate.h:
860         (JSC::JSImmediate::makeInt):
861
862 2008-12-16  Cameron Zwarich  <zwarich@apple.com>
863
864         Reviewed by Darin Adler.
865
866         Bug 22869: REGRESSION (r38407): http://news.cnet.com/8301-13579_3-9953533-37.html crashes
867         <https://bugs.webkit.org/show_bug.cgi?id=22869>
868         <rdar://problem/6402499>
869
870         Before r38407, Structure::m_nameInPrevious was ref'd due to it being
871         stored in a PropertyMap. However, PropertyMaps are created lazily after
872         r38407, so Structure::m_nameInPrevious is not necessarily ref'd while
873         it is being used. Making it a RefPtr instead of a raw pointer fixes
874         the problem.
875
876         Unfortunately, the crash in the bug is rather intermittent, and it is
877         impossible to add an assertion in UString::Ref::ref() to catch this bug
878         because some users of UString::Rep deliberately zero out the reference
879         count. Therefore, there is no layout test accompanying this bug fix.
880
881         * runtime/Structure.cpp:
882         (JSC::Structure::~Structure): Use get().
883         (JSC::Structure::materializePropertyMap): Use get().
884         (JSC::Structure::addPropertyTransitionToExistingStructure): Use get().
885         (JSC::Structure::addPropertyTransition): Use get().
886         * runtime/Structure.h: Make Structure::m_nameInPrevious a RefPtr instead
887         of a raw pointer.
888
889 2008-12-16  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
890
891         Not reviewed. Attempt to fix win build. No 'using namespace WTF' in this file, needs manual WTF:: prefix.
892         Not sure why the build works as is here.
893
894         * runtime/MathObject.cpp:
895         (JSC::mathProtoFuncRandom):
896
897 2008-12-16  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
898
899         Reviewed by Darin Adler.
900
901         Fixes: https://bugs.webkit.org/show_bug.cgi?id=22876
902
903         Unify random number generation in JavaScriptCore & WebCore, by introducing
904         wtf/RandomNumber.h and moving wtf_random/wtf_random_init out of MathExtras.h.
905
906         wtf_random_init() has been renamed to initializeRandomNumberGenerator() and
907         lives in it's own private header: wtf/RandomNumberSeed.h, only intended to
908         be used from within JavaScriptCore.
909
910         wtf_random() has been renamed to randomNumber() and lives in a public header
911         wtf/RandomNumber.h, usable from within JavaScriptCore & WebCore. It encapsulates
912         the code taking care of initializing the random number generator (only when
913         building without ENABLE(JSC_MULTIPLE_THREADS), otherwhise initializeThreading()
914         already took care of that).
915
916         Functional change on darwin: Use random() instead of rand(), as it got a larger
917         period (more randomness). HTMLFormElement already contains this implementation
918         and I just moved it in randomNumber(), as  special case for PLATFORM(DARWIN).
919
920         * GNUmakefile.am: Add RandomNumber.(cpp/h) / RandomNumberSeed.h.
921         * JavaScriptCore.exp: Ditto.
922         * JavaScriptCore.pri: Ditto.
923         * JavaScriptCore.scons: Ditto.
924         * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
925         * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
926         * JavaScriptCoreSources.bkl: Ditto.
927         * runtime/MathObject.cpp: Use new WTF::randomNumber() functionality.
928         (JSC::mathProtoFuncRandom):
929         * wtf/MathExtras.h: Move wtf_random / wtf_random_init to new files.
930         * wtf/RandomNumber.cpp: Added.
931         (WTF::randomNumber):
932         * wtf/RandomNumber.h: Added.
933         * wtf/RandomNumberSeed.h: Added. Internal usage within JSC only.
934         (WTF::initializeRandomNumberGenerator):
935         * wtf/ThreadingGtk.cpp: Rename wtf_random_init() to initializeRandomNumberGenerator().
936         (WTF::initializeThreading):
937         * wtf/ThreadingPthreads.cpp: Ditto.
938         (WTF::initializeThreading):
939         * wtf/ThreadingQt.cpp: Ditto.
940         (WTF::initializeThreading):
941         * wtf/ThreadingWin.cpp: Ditto.
942         (WTF::initializeThreading):
943
944 2008-12-16 Yael Aharon <yael.aharon@nokia.com>
945
946         Reviewed by Tor Arne Vestbø.
947
948         Qt/Win build fix
949
950         * JavaScriptCore.pri:
951
952 2008-12-15  Mark Rowe  <mrowe@apple.com>
953
954         Reviewed by Cameron Zwarich.
955
956         Fix the build with GCC 4.0.
957
958         * Configurations/JavaScriptCore.xcconfig:  GCC 4.0 appears to have a bug when compiling with -funwind-tables on,
959         so don't use it with that compiler version.
960
961 2008-12-15  Mark Rowe  <mrowe@apple.com>
962
963         Rubber-stamped by Cameron Zwarich.
964
965         <rdar://problem/6289933> Change WebKit-related projects to build with GCC 4.2 on Leopard.
966
967         * Configurations/Base.xcconfig:
968         * Configurations/DebugRelease.xcconfig:
969
970 2008-12-15  Alexey Proskuryakov  <ap@webkit.org>
971
972         Reviewed by Darin Adler.
973
974         Don't use unique context group in JSGlobalContextCreate() on Tiger or Leopard.
975
976         * API/JSContextRef.cpp: (JSGlobalContextCreate):
977
978 2008-12-15  Alexey Proskuryakov  <ap@webkit.org>
979
980         Reviewed by Darin Adler.
981
982         <rdar://problem/6445089> Mach ports leak from worker threads
983
984         * interpreter/Interpreter.cpp: (JSC::getCPUTime):
985         Deallocate the thread self port.
986
987 2008-12-15  Gavin Barraclough  <barraclough@apple.com>
988
989         Reviewed by Mark Rowe.
990
991         Construct stack frames in JIT code, so that backtracing can still work.
992         <rdar://problem/6447870> JIT should play nice with attempts to take stack traces
993
994         * jit/JIT.cpp:
995         (JSC::):
996         (JSC::JIT::privateCompileMainPass):
997
998 2008-12-15  Mark Rowe  <mrowe@apple.com>
999
1000         Reviewed by Gavin Barraclough.
1001
1002         <rdar://problem/6402262> JavaScriptCore needs exception handling tables in order to get stack traces without frame pointers
1003
1004         * Configurations/JavaScriptCore.xcconfig:
1005
1006 2008-12-15  Gavin Barraclough  <barraclough@apple.com>
1007
1008         Rubber stamped by Mark Rowe.
1009
1010         Revert r39226 / Bug 22818: Unify JIT callback argument access OS X / Windows
1011         This causes Acid3 failures – reverting for now & will revisit later.
1012         https://bugs.webkit.org/show_bug.cgi?id=22873
1013
1014         * interpreter/Interpreter.h:
1015         * jit/JIT.cpp:
1016         (JSC::JIT::privateCompileCTIMachineTrampolines):
1017         * jit/JIT.h:
1018         * jit/JITInlineMethods.h:
1019         (JSC::JIT::restoreArgumentReference):
1020         (JSC::JIT::restoreArgumentReferenceForTrampoline):
1021         (JSC::JIT::emitCTICall_internal):
1022         * jit/JITPropertyAccess.cpp:
1023         (JSC::JIT::privateCompilePutByIdTransition):
1024         * wtf/Platform.h:
1025
1026 2008-12-15  Darin Adler  <darin@apple.com>
1027
1028         Reviewed by Sam Weinig.
1029
1030         - fix <rdar://problem/6427048> crash due to infinite recursion after setting window.__proto__ = window
1031
1032         Replaced toGlobalObject with the more generally useful unwrappedObject and used it to
1033         fix the cycle detection code in put(__proto__).
1034
1035         * JavaScriptCore.exp: Updated.
1036
1037         * runtime/JSGlobalObject.cpp: Removed toGlobalObject. We now use unwrappedObject instead.
1038         * runtime/JSGlobalObject.h:
1039         (JSC::JSGlobalObject::isGlobalObject): Ditto.
1040
1041         * runtime/JSGlobalObjectFunctions.cpp:
1042         (JSC::globalFuncEval): Use unwrappedObject and isGlobalObject here rather than toGlobalObject.
1043
1044         * runtime/JSObject.cpp:
1045         (JSC::JSObject::put): Rewrote prototype cycle checking loop. Use unwrappedObject in the loop now.
1046         (JSC::JSObject::unwrappedObject): Replaced toGlobalObject with this new function.
1047         * runtime/JSObject.h: More of the same.
1048
1049 2008-12-15  Steve Falkenburg  <sfalken@apple.com>
1050
1051         Windows build fix.
1052         
1053         Visual Studio requires visibility of forward declarations to match class declaration.
1054
1055         * assembler/X86Assembler.h:
1056
1057 2008-12-15  Gustavo Noronha Silva  <kov@kov.eti.br>
1058
1059         Reviewed by Mark Rowe.
1060
1061         https://bugs.webkit.org/show_bug.cgi?id=22686
1062
1063         GTK+ build fix.
1064
1065         * GNUmakefile.am:
1066
1067 2008-12-15  Gavin Barraclough  <barraclough@apple.com>
1068
1069         Reviewed by Geoff Garen.
1070
1071         Add support to X86Assembler emitting instructions that access all 16 registers on x86-64.
1072         Add a new formating class, that is reponsible for both emitting the opcode bytes and the
1073         ModRm  bytes of an instruction in a single call; this can insert the REX byte as necessary
1074         before the opcode, but has access to the register numbers to build the REX.
1075
1076         * assembler/AssemblerBuffer.h:
1077         (JSC::AssemblerBuffer::isAligned):
1078         (JSC::AssemblerBuffer::data):
1079         * assembler/MacroAssembler.h:
1080         (JSC::MacroAssembler::addPtr):
1081         (JSC::MacroAssembler::add32):
1082         (JSC::MacroAssembler::and32):
1083         (JSC::MacroAssembler::or32):
1084         (JSC::MacroAssembler::sub32):
1085         (JSC::MacroAssembler::xor32):
1086         (JSC::MacroAssembler::loadPtr):
1087         (JSC::MacroAssembler::load32):
1088         (JSC::MacroAssembler::load16):
1089         (JSC::MacroAssembler::storePtr):
1090         (JSC::MacroAssembler::storePtrWithRepatch):
1091         (JSC::MacroAssembler::store32):
1092         (JSC::MacroAssembler::pop):
1093         (JSC::MacroAssembler::push):
1094         (JSC::MacroAssembler::compareImm32ForBranch):
1095         (JSC::MacroAssembler::compareImm32ForBranchEquality):
1096         (JSC::MacroAssembler::testImm32):
1097         (JSC::MacroAssembler::jae32):
1098         (JSC::MacroAssembler::jb32):
1099         (JSC::MacroAssembler::je16):
1100         (JSC::MacroAssembler::jg32):
1101         (JSC::MacroAssembler::jnePtr):
1102         (JSC::MacroAssembler::jne32):
1103         (JSC::MacroAssembler::jump):
1104         * assembler/X86Assembler.h:
1105         (JSC::X86::):
1106         (JSC::X86Assembler::):
1107         (JSC::X86Assembler::size):
1108         (JSC::X86Assembler::push_r):
1109         (JSC::X86Assembler::pop_r):
1110         (JSC::X86Assembler::push_i32):
1111         (JSC::X86Assembler::push_m):
1112         (JSC::X86Assembler::pop_m):
1113         (JSC::X86Assembler::addl_rr):
1114         (JSC::X86Assembler::addl_mr):
1115         (JSC::X86Assembler::addl_ir):
1116         (JSC::X86Assembler::addq_ir):
1117         (JSC::X86Assembler::addl_im):
1118         (JSC::X86Assembler::andl_rr):
1119         (JSC::X86Assembler::andl_ir):
1120         (JSC::X86Assembler::orl_rr):
1121         (JSC::X86Assembler::orl_mr):
1122         (JSC::X86Assembler::orl_ir):
1123         (JSC::X86Assembler::subl_rr):
1124         (JSC::X86Assembler::subl_mr):
1125         (JSC::X86Assembler::subl_ir):
1126         (JSC::X86Assembler::subl_im):
1127         (JSC::X86Assembler::xorl_rr):
1128         (JSC::X86Assembler::xorl_ir):
1129         (JSC::X86Assembler::sarl_i8r):
1130         (JSC::X86Assembler::sarl_CLr):
1131         (JSC::X86Assembler::shll_i8r):
1132         (JSC::X86Assembler::shll_CLr):
1133         (JSC::X86Assembler::imull_rr):
1134         (JSC::X86Assembler::imull_i32r):
1135         (JSC::X86Assembler::idivl_r):
1136         (JSC::X86Assembler::cmpl_rr):
1137         (JSC::X86Assembler::cmpl_rm):
1138         (JSC::X86Assembler::cmpl_mr):
1139         (JSC::X86Assembler::cmpl_ir):
1140         (JSC::X86Assembler::cmpl_ir_force32):
1141         (JSC::X86Assembler::cmpl_im):
1142         (JSC::X86Assembler::cmpl_im_force32):
1143         (JSC::X86Assembler::cmpw_rm):
1144         (JSC::X86Assembler::testl_rr):
1145         (JSC::X86Assembler::testl_i32r):
1146         (JSC::X86Assembler::testl_i32m):
1147         (JSC::X86Assembler::testq_rr):
1148         (JSC::X86Assembler::testq_i32r):
1149         (JSC::X86Assembler::testb_i8r):
1150         (JSC::X86Assembler::sete_r):
1151         (JSC::X86Assembler::setz_r):
1152         (JSC::X86Assembler::setne_r):
1153         (JSC::X86Assembler::setnz_r):
1154         (JSC::X86Assembler::cdq):
1155         (JSC::X86Assembler::xchgl_rr):
1156         (JSC::X86Assembler::movl_rr):
1157         (JSC::X86Assembler::movl_rm):
1158         (JSC::X86Assembler::movl_mr):
1159         (JSC::X86Assembler::movl_i32r):
1160         (JSC::X86Assembler::movl_i32m):
1161         (JSC::X86Assembler::movq_rr):
1162         (JSC::X86Assembler::movq_rm):
1163         (JSC::X86Assembler::movq_mr):
1164         (JSC::X86Assembler::movzwl_mr):
1165         (JSC::X86Assembler::movzbl_rr):
1166         (JSC::X86Assembler::leal_mr):
1167         (JSC::X86Assembler::call):
1168         (JSC::X86Assembler::jmp):
1169         (JSC::X86Assembler::jmp_r):
1170         (JSC::X86Assembler::jmp_m):
1171         (JSC::X86Assembler::jne):
1172         (JSC::X86Assembler::jnz):
1173         (JSC::X86Assembler::je):
1174         (JSC::X86Assembler::jl):
1175         (JSC::X86Assembler::jb):
1176         (JSC::X86Assembler::jle):
1177         (JSC::X86Assembler::jbe):
1178         (JSC::X86Assembler::jge):
1179         (JSC::X86Assembler::jg):
1180         (JSC::X86Assembler::ja):
1181         (JSC::X86Assembler::jae):
1182         (JSC::X86Assembler::jo):
1183         (JSC::X86Assembler::jp):
1184         (JSC::X86Assembler::js):
1185         (JSC::X86Assembler::addsd_rr):
1186         (JSC::X86Assembler::addsd_mr):
1187         (JSC::X86Assembler::cvtsi2sd_rr):
1188         (JSC::X86Assembler::cvttsd2si_rr):
1189         (JSC::X86Assembler::movd_rr):
1190         (JSC::X86Assembler::movsd_rm):
1191         (JSC::X86Assembler::movsd_mr):
1192         (JSC::X86Assembler::mulsd_rr):
1193         (JSC::X86Assembler::mulsd_mr):
1194         (JSC::X86Assembler::pextrw_irr):
1195         (JSC::X86Assembler::subsd_rr):
1196         (JSC::X86Assembler::subsd_mr):
1197         (JSC::X86Assembler::ucomis_rr):
1198         (JSC::X86Assembler::int3):
1199         (JSC::X86Assembler::ret):
1200         (JSC::X86Assembler::predictNotTaken):
1201         (JSC::X86Assembler::label):
1202         (JSC::X86Assembler::align):
1203         (JSC::X86Assembler::link):
1204         (JSC::X86Assembler::executableCopy):
1205         (JSC::X86Assembler::X86InstructionFormater::prefix):
1206         (JSC::X86Assembler::X86InstructionFormater::oneByteOp):
1207         (JSC::X86Assembler::X86InstructionFormater::twoByteOp):
1208         (JSC::X86Assembler::X86InstructionFormater::oneByteOp64):
1209         (JSC::X86Assembler::X86InstructionFormater::oneByteOp8):
1210         (JSC::X86Assembler::X86InstructionFormater::twoByteOp8):
1211         (JSC::X86Assembler::X86InstructionFormater::instructionImmediate8):
1212         (JSC::X86Assembler::X86InstructionFormater::instructionImmediate32):
1213         (JSC::X86Assembler::X86InstructionFormater::instructionRel32):
1214         (JSC::X86Assembler::X86InstructionFormater::size):
1215         (JSC::X86Assembler::X86InstructionFormater::isAligned):
1216         (JSC::X86Assembler::X86InstructionFormater::data):
1217         (JSC::X86Assembler::X86InstructionFormater::executableCopy):
1218         (JSC::X86Assembler::X86InstructionFormater::registerModRM):
1219         (JSC::X86Assembler::X86InstructionFormater::memoryModRM):
1220         * jit/JIT.cpp:
1221         (JSC::JIT::privateCompileMainPass):
1222         (JSC::JIT::privateCompile):
1223         (JSC::JIT::privateCompileCTIMachineTrampolines):
1224         * jit/JITArithmetic.cpp:
1225         (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
1226         (JSC::JIT::compileBinaryArithOp):
1227         * jit/JITCall.cpp:
1228         (JSC::JIT::compileOpCall):
1229         (JSC::JIT::compileOpCallSlowCase):
1230         * jit/JITPropertyAccess.cpp:
1231         (JSC::JIT::compileGetByIdHotPath):
1232         (JSC::JIT::compilePutByIdHotPath):
1233         (JSC::JIT::privateCompilePutByIdTransition):
1234         (JSC::JIT::privateCompilePatchGetArrayLength):
1235         (JSC::JIT::privateCompileGetByIdProto):
1236         (JSC::JIT::privateCompileGetByIdProtoList):
1237         (JSC::JIT::privateCompileGetByIdChainList):
1238         (JSC::JIT::privateCompileGetByIdChain):
1239
1240 2008-12-15  Darin Adler  <darin@apple.com>
1241
1242         * interpreter/RegisterFile.h: Tweak include formatting.
1243
1244 2008-12-15  Holger Hans Peter Freyther  <zecke@selfish.org>
1245
1246         Build fix for Gtk+.
1247
1248         * interpreter/RegisterFile.h: Include stdio.h for fprintf
1249
1250 2008-12-15  Alexey Proskuryakov  <ap@webkit.org>
1251
1252         Reviewed by Oliver Hunt.
1253
1254         <rdar://problem/6444455> Worker Thread crash running multiple workers for a moderate amount of time
1255
1256         * interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile):
1257         Improve error handling: if mmap fails, crash immediately, and print out the reason.
1258
1259 2008-12-13  Gavin Barraclough  <barraclough@apple.com>
1260
1261         Reviewed by Cameron Zwarich.
1262
1263         Re-enable WREC on 64-bit.
1264         Implements one of the MacroAssembler::jnzPtr methods, previously only implemented for 32-bit x86.
1265
1266         https://bugs.webkit.org/show_bug.cgi?id=22849
1267
1268         * assembler/MacroAssembler.h:
1269         (JSC::MacroAssembler::testImm64):
1270         (JSC::MacroAssembler::jnzPtr):
1271         * assembler/X86Assembler.h:
1272         (JSC::X86Assembler::testq_i32r):
1273         (JSC::X86Assembler::testq_rr):
1274         * wtf/Platform.h:
1275
1276 2008-12-13  Gavin Barraclough  <barraclough@apple.com>
1277
1278         Fix PPC builds.
1279
1280         * assembler/MacroAssembler.h:
1281
1282 2008-12-13  Gavin Barraclough  <barraclough@apple.com>
1283
1284         Build fix only, no review.
1285
1286         * bytecode/CodeBlock.h:
1287
1288 2008-12-13  Gavin Barraclough  <barraclough@apple.com>
1289
1290         Reviewed by Cameron Zwarich.
1291
1292         Port the remainder of the JIT, bar calling convention related code, and code
1293         implementing optimizations which can be disabled, to use the MacroAssembler.
1294
1295         * assembler/MacroAssembler.h:
1296         (JSC::MacroAssembler::DataLabelPtr::DataLabelPtr):
1297         (JSC::MacroAssembler::RepatchBuffer::RepatchBuffer):
1298         (JSC::MacroAssembler::RepatchBuffer::link):
1299         (JSC::MacroAssembler::RepatchBuffer::addressOf):
1300         (JSC::MacroAssembler::RepatchBuffer::setPtr):
1301         (JSC::MacroAssembler::addPtr):
1302         (JSC::MacroAssembler::lshift32):
1303         (JSC::MacroAssembler::mod32):
1304         (JSC::MacroAssembler::rshift32):
1305         (JSC::MacroAssembler::storePtrWithRepatch):
1306         (JSC::MacroAssembler::jnzPtr):
1307         (JSC::MacroAssembler::jzPtr):
1308         (JSC::MacroAssembler::jump):
1309         (JSC::MacroAssembler::label):
1310         * assembler/X86Assembler.h:
1311         (JSC::X86Assembler::):
1312         (JSC::X86Assembler::xchgl_rr):
1313         (JSC::X86Assembler::jmp_m):
1314         (JSC::X86Assembler::repatchAddress):
1315         (JSC::X86Assembler::getRelocatedAddress):
1316         * bytecode/CodeBlock.cpp:
1317         (JSC::CodeBlock::CodeBlock):
1318         * bytecode/CodeBlock.h:
1319         (JSC::JITCodeRef::JITCodeRef):
1320         (JSC::CodeBlock::setJITCode):
1321         (JSC::CodeBlock::jitCode):
1322         (JSC::CodeBlock::executablePool):
1323         * jit/JIT.cpp:
1324         (JSC::JIT::privateCompileMainPass):
1325         (JSC::JIT::privateCompileLinkPass):
1326         (JSC::JIT::privateCompile):
1327         (JSC::JIT::privateCompileCTIMachineTrampolines):
1328         * jit/JIT.h:
1329         (JSC::CallRecord::CallRecord):
1330         (JSC::JumpTable::JumpTable):
1331         (JSC::JIT::emitCTICall):
1332         (JSC::JIT::JSRInfo::JSRInfo):
1333         * jit/JITArithmetic.cpp:
1334         * jit/JITCall.cpp:
1335         * jit/JITInlineMethods.h:
1336         (JSC::JIT::emitNakedCall):
1337         (JSC::JIT::emitCTICall_internal):
1338         (JSC::JIT::checkStructure):
1339         (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
1340         (JSC::JIT::addSlowCase):
1341         (JSC::JIT::addJump):
1342         (JSC::JIT::emitJumpSlowToHot):
1343         * jit/JITPropertyAccess.cpp:
1344         (JSC::JIT::privateCompileGetByIdChainList):
1345         (JSC::JIT::privateCompileGetByIdChain):
1346
1347 2008-12-12  Cameron Zwarich  <zwarich@apple.com>
1348
1349         Reviewed by Sam Weinig.
1350
1351         Fix the failures of the following layout tests, which regressed in
1352         r39255:
1353
1354         fast/dom/StyleSheet/ownerNode-lifetime-2.html
1355         fast/xsl/transform-xhr-doc.xhtml
1356
1357         The binary search in CodeBlock::getByIdExceptionInfoForBytecodeOffset()
1358         doesn't guarantee that it actually finds a match, so add an explicit check
1359         for this.
1360
1361         * bytecode/CodeBlock.cpp:
1362         (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
1363
1364 2008-12-12  Gavin Barraclough  <barraclough@apple.com>
1365
1366         Reviewed by Cameron Zwarich.
1367
1368         Replace emitPutCallArg methods with emitPutJITStubArg methods.  Primarily to make the argument numbering
1369         more sensible (1-based incrementing by 1, rather than 0-based incrementing by 4).  The CTI name also seems
1370         to be being deprecated from the code generally.
1371
1372         * jit/JIT.cpp:
1373         (JSC::JIT::privateCompileMainPass):
1374         (JSC::JIT::privateCompileSlowCases):
1375         (JSC::JIT::privateCompileCTIMachineTrampolines):
1376         * jit/JIT.h:
1377         * jit/JITArithmetic.cpp:
1378         (JSC::JIT::compileBinaryArithOp):
1379         (JSC::JIT::compileBinaryArithOpSlowCase):
1380         * jit/JITCall.cpp:
1381         (JSC::JIT::compileOpCallSetupArgs):
1382         (JSC::JIT::compileOpCallEvalSetupArgs):
1383         (JSC::JIT::compileOpConstructSetupArgs):
1384         (JSC::JIT::compileOpCall):
1385         * jit/JITInlineMethods.h:
1386         (JSC::JIT::emitPutJITStubArg):
1387         (JSC::JIT::emitPutJITStubArgConstant):
1388         (JSC::JIT::emitGetJITStubArg):
1389         (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
1390         * jit/JITPropertyAccess.cpp:
1391         (JSC::JIT::compileGetByIdHotPath):
1392         (JSC::JIT::compilePutByIdHotPath):
1393         (JSC::JIT::compileGetByIdSlowCase):
1394         (JSC::JIT::compilePutByIdSlowCase):
1395
1396 2008-12-12  Gavin Barraclough  <barraclough@apple.com>
1397
1398         Fix windows builds.
1399
1400         * jit/JIT.cpp:
1401         (JSC::JIT::privateCompileMainPass):
1402         (JSC::JIT::privateCompileSlowCases):
1403         (JSC::JIT::privateCompile):
1404
1405 2008-12-12  Gavin Barraclough  <barraclough@apple.com>
1406
1407         Reviewed by Geoff Garen.
1408
1409         Remove loop counter 'i' from the JIT generation passes, replace with a member m_bytecodeIndex.
1410
1411         No impact on performance.
1412
1413         * jit/JIT.cpp:
1414         (JSC::JIT::compileOpStrictEq):
1415         (JSC::JIT::emitSlowScriptCheck):
1416         (JSC::JIT::privateCompileMainPass):
1417         (JSC::JIT::privateCompileSlowCases):
1418         (JSC::JIT::privateCompile):
1419         * jit/JIT.h:
1420         (JSC::CallRecord::CallRecord):
1421         (JSC::JmpTable::JmpTable):
1422         (JSC::JIT::emitCTICall):
1423         * jit/JITArithmetic.cpp:
1424         (JSC::JIT::compileBinaryArithOp):
1425         (JSC::JIT::compileBinaryArithOpSlowCase):
1426         * jit/JITCall.cpp:
1427         (JSC::JIT::compileOpCall):
1428         (JSC::JIT::compileOpCallSlowCase):
1429         * jit/JITInlineMethods.h:
1430         (JSC::JIT::emitGetVirtualRegister):
1431         (JSC::JIT::emitGetVirtualRegisters):
1432         (JSC::JIT::emitNakedCall):
1433         (JSC::JIT::emitCTICall_internal):
1434         (JSC::JIT::emitJumpSlowCaseIfJSCell):
1435         (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
1436         (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
1437         (JSC::JIT::emitJumpSlowCaseIfNotImmNums):
1438         (JSC::JIT::emitFastArithIntToImmOrSlowCase):
1439         (JSC::JIT::addSlowCase):
1440         (JSC::JIT::addJump):
1441         (JSC::JIT::emitJumpSlowToHot):
1442         * jit/JITPropertyAccess.cpp:
1443         (JSC::JIT::compileGetByIdHotPath):
1444         (JSC::JIT::compileGetByIdSlowCase):
1445         (JSC::JIT::compilePutByIdHotPath):
1446         (JSC::JIT::compilePutByIdSlowCase):
1447
1448 2008-12-12  Sam Weinig  <sam@webkit.org>
1449
1450         Reviewed by Cameron Zwarich.
1451
1452         <rdar://problem/6428342> Look into feasibility of discarding bytecode after native codegen
1453
1454         Move more JIT functionality to using offsets into the Instruction buffer
1455         instead of raw pointers. Two to go!
1456
1457         * interpreter/Interpreter.cpp:
1458         (JSC::bytecodeOffsetForPC): Rename from vPCForPC.
1459         (JSC::Interpreter::resolve): Pass offset to exception helper.
1460         (JSC::Interpreter::resolveSkip): Ditto.
1461         (JSC::Interpreter::resolveGlobal): Ditto.
1462         (JSC::Interpreter::resolveBaseAndProperty): Ditto.
1463         (JSC::Interpreter::resolveBaseAndFunc): Ditto.
1464         (JSC::isNotObject): Ditto.
1465         (JSC::Interpreter::unwindCallFrame): Call bytecodeOffsetForPC.
1466         (JSC::Interpreter::throwException): Use offsets instead of vPCs.
1467         (JSC::Interpreter::privateExecute): Pass offset to exception helper.
1468         (JSC::Interpreter::retrieveLastCaller): Ditto.
1469         (JSC::Interpreter::cti_op_instanceof): Ditto.
1470         (JSC::Interpreter::cti_op_call_NotJSFunction): Ditto.
1471         (JSC::Interpreter::cti_op_resolve): Pass offset to exception helper.
1472         (JSC::Interpreter::cti_op_construct_NotJSConstruct): Ditto.
1473         (JSC::Interpreter::cti_op_resolve_func): Ditto.
1474         (JSC::Interpreter::cti_op_resolve_skip): Ditto.
1475         (JSC::Interpreter::cti_op_resolve_global): Ditto.
1476         (JSC::Interpreter::cti_op_resolve_with_base): Ditto.
1477         (JSC::Interpreter::cti_op_throw): Ditto.
1478         (JSC::Interpreter::cti_op_in): Ditto.
1479         (JSC::Interpreter::cti_vm_throw): Ditto.
1480         * interpreter/Interpreter.h:
1481
1482         * jit/JIT.cpp:
1483         (JSC::JIT::privateCompileMainPass): Don't pass unnecessary vPC to stub.
1484         * jit/JIT.h: Remove ARG_instr1 - ARG_instr3 and ARG_instr5 - ARG_instr6.
1485         * jit/JITCall.cpp:
1486         (JSC::JIT::compileOpCallEvalSetupArgs): Don't pass unnecessary vPC to stub..
1487         (JSC::JIT::compileOpConstructSetupArgs): Ditto.
1488
1489         * runtime/ExceptionHelpers.cpp:
1490         (JSC::createUndefinedVariableError): Take an offset instead of vPC.
1491         (JSC::createInvalidParamError): Ditto.
1492         (JSC::createNotAConstructorError): Ditto.
1493         (JSC::createNotAFunctionError): Ditto.
1494         (JSC::createNotAnObjectError): Ditto.
1495         * runtime/ExceptionHelpers.h:
1496
1497 2008-12-12  Cameron Zwarich  <zwarich@apple.com>
1498
1499         Reviewed by Oliver Hunt.
1500
1501         Bug 22835: Crash during bytecode generation when comparing to null
1502         <https://bugs.webkit.org/show_bug.cgi?id=22835>
1503         <rdar://problem/6286749>
1504
1505         Change the special cases in bytecode generation for comparison to null
1506         to use tempDestination().
1507
1508         * parser/Nodes.cpp:
1509         (JSC::BinaryOpNode::emitBytecode):
1510         (JSC::EqualNode::emitBytecode):
1511
1512 2008-12-12  Gavin Barraclough  <barraclough@apple.com>
1513
1514         Reviewed by Geoff Garen.
1515
1516         Move slow-cases of JIT code generation over to the MacroAssembler interface.
1517
1518         * assembler/MacroAssembler.h:
1519         (JSC::MacroAssembler::Label::Label):
1520         (JSC::MacroAssembler::jae32):
1521         (JSC::MacroAssembler::jg32):
1522         (JSC::MacroAssembler::jzPtr):
1523         * jit/JIT.cpp:
1524         (JSC::JIT::privateCompileSlowCases):
1525         (JSC::JIT::privateCompile):
1526         (JSC::JIT::emitGetVariableObjectRegister):
1527         (JSC::JIT::emitPutVariableObjectRegister):
1528         * jit/JIT.h:
1529         (JSC::SlowCaseEntry::SlowCaseEntry):
1530         (JSC::JIT::getSlowCase):
1531         (JSC::JIT::linkSlowCase):
1532         * jit/JITArithmetic.cpp:
1533         (JSC::JIT::compileBinaryArithOpSlowCase):
1534         * jit/JITCall.cpp:
1535         (JSC::JIT::compileOpCallInitializeCallFrame):
1536         (JSC::JIT::compileOpCall):
1537         (JSC::JIT::compileOpCallSlowCase):
1538         * jit/JITInlineMethods.h:
1539         (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
1540         (JSC::JIT::linkSlowCaseIfNotJSCell):
1541         * jit/JITPropertyAccess.cpp:
1542         (JSC::JIT::compileGetByIdHotPath):
1543         (JSC::JIT::compilePutByIdHotPath):
1544         (JSC::JIT::compileGetByIdSlowCase):
1545         (JSC::JIT::compilePutByIdSlowCase):
1546
1547 2008-12-12  Cameron Zwarich  <zwarich@apple.com>
1548
1549         Reviewed by Sam Weinig.
1550
1551         Bug 22828: Do not inspect bytecode instruction stream for op_get_by_id exception information
1552         <https://bugs.webkit.org/show_bug.cgi?id=22828>
1553
1554         In order to remove the bytecode instruction stream after generating
1555         native code, all inspection of bytecode instructions at runtime must
1556         be removed. One particular instance of this is the special handling of
1557         exceptions thrown by the op_get_by_id emitted directly before an
1558         op_construct or an op_instanceof. This patch moves that information to
1559         an auxiliary data structure in CodeBlock.
1560
1561         * bytecode/CodeBlock.cpp:
1562         (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
1563         * bytecode/CodeBlock.h:
1564         (JSC::CodeBlock::addGetByIdExceptionInfo):
1565         * bytecompiler/BytecodeGenerator.cpp:
1566         (JSC::BytecodeGenerator::emitConstruct):
1567         * bytecompiler/BytecodeGenerator.h:
1568         (JSC::BytecodeGenerator::emitGetByIdExceptionInfo):
1569         * parser/Nodes.cpp:
1570         (JSC::InstanceOfNode::emitBytecode):
1571         * runtime/ExceptionHelpers.cpp:
1572         (JSC::createNotAnObjectError):
1573
1574 2008-12-12  Sam Weinig  <sam@webkit.org>
1575
1576         Reviewed by Geoffrey Garen.
1577
1578         Change exception information accessors to take offsets into the bytecode
1579         instruction buffer instead of pointers so that they can work even even
1580         if the bytecode buffer is purged.
1581
1582         * bytecode/CodeBlock.cpp:
1583         (JSC::instructionOffsetForNth):
1584         (JSC::CodeBlock::handlerForBytecodeOffset):
1585         (JSC::CodeBlock::lineNumberForBytecodeOffset):
1586         (JSC::CodeBlock::expressionRangeForBytecodeOffset):
1587         * bytecode/CodeBlock.h:
1588         * bytecode/SamplingTool.cpp:
1589         (JSC::SamplingTool::dump):
1590         * interpreter/Interpreter.cpp:
1591         (JSC::Interpreter::throwException):
1592         (JSC::Interpreter::privateExecute):
1593         (JSC::Interpreter::retrieveLastCaller):
1594         * jit/JIT.cpp:
1595         (JSC::JIT::privateCompileMainPass):
1596         * runtime/ExceptionHelpers.cpp:
1597         (JSC::createUndefinedVariableError):
1598         (JSC::createInvalidParamError):
1599         (JSC::createNotAConstructorError):
1600         (JSC::createNotAFunctionError):
1601         (JSC::createNotAnObjectError):
1602
1603 2008-12-12  Geoffrey Garen  <ggaren@apple.com>
1604
1605         Reviewed by Cameron Zwarich.
1606         
1607         Tiny bit of refactoring in quantifier generation.
1608
1609         * wrec/WRECGenerator.cpp:
1610         (JSC::WREC::Generator::generateNonGreedyQuantifier):
1611         (JSC::WREC::Generator::generateGreedyQuantifier):
1612
1613 2008-12-11  Sam Weinig  <sam@webkit.org>
1614
1615         Reviewed by Geoffrey Garen.
1616
1617         Remove dependancy on having the Instruction buffer in order to
1618         deref Structures used for property access and global resolves.
1619         Instead, we put references to the necessary Structures in auxiliary
1620         data structures on the CodeBlock. This is not an ideal solution,
1621         as we still pay for having the Structures in two places and we
1622         would like to eventually just hold on to offsets into the machine
1623         code buffer.
1624
1625         - Also removes CodeBlock bloat in non-JIT by #ifdefing the JIT
1626           only data structures.
1627
1628         * GNUmakefile.am:
1629         * JavaScriptCore.pri:
1630         * JavaScriptCore.scons:
1631         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1632         * JavaScriptCore.xcodeproj/project.pbxproj:
1633         * JavaScriptCoreSources.bkl:
1634         * bytecode/CodeBlock.cpp:
1635         (JSC::isGlobalResolve):
1636         (JSC::isPropertyAccess):
1637         (JSC::instructionOffsetForNth):
1638         (JSC::printGlobalResolveInfo):
1639         (JSC::printStructureStubInfo):
1640         (JSC::CodeBlock::printStructures):
1641         (JSC::CodeBlock::dump):
1642         (JSC::CodeBlock::~CodeBlock):
1643         (JSC::CodeBlock::shrinkToFit):
1644         * bytecode/CodeBlock.h:
1645         (JSC::GlobalResolveInfo::GlobalResolveInfo):
1646         (JSC::getNativePC):
1647         (JSC::CodeBlock::instructions):
1648         (JSC::CodeBlock::getStubInfo):
1649         (JSC::CodeBlock::getBytecodeIndex):
1650         (JSC::CodeBlock::addPropertyAccessInstruction):
1651         (JSC::CodeBlock::addGlobalResolveInstruction):
1652         (JSC::CodeBlock::numberOfStructureStubInfos):
1653         (JSC::CodeBlock::addStructureStubInfo):
1654         (JSC::CodeBlock::structureStubInfo):
1655         (JSC::CodeBlock::addGlobalResolveInfo):
1656         (JSC::CodeBlock::globalResolveInfo):
1657         (JSC::CodeBlock::numberOfCallLinkInfos):
1658         (JSC::CodeBlock::addCallLinkInfo):
1659         (JSC::CodeBlock::callLinkInfo):
1660         * bytecode/Instruction.h:
1661         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
1662         (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
1663         * bytecode/Opcode.h:
1664         (JSC::):
1665         * bytecode/StructureStubInfo.cpp: Copied from bytecode/CodeBlock.cpp.
1666         (JSC::StructureStubInfo::deref):
1667         * bytecode/StructureStubInfo.h: Copied from bytecode/CodeBlock.h.
1668         (JSC::StructureStubInfo::StructureStubInfo):
1669         (JSC::StructureStubInfo::initGetByIdSelf):
1670         (JSC::StructureStubInfo::initGetByIdProto):
1671         (JSC::StructureStubInfo::initGetByIdChain):
1672         (JSC::StructureStubInfo::initGetByIdSelfList):
1673         (JSC::StructureStubInfo::initGetByIdProtoList):
1674         (JSC::StructureStubInfo::initPutByIdTransition):
1675         (JSC::StructureStubInfo::initPutByIdReplace):
1676         (JSC::StructureStubInfo::):
1677         * bytecompiler/BytecodeGenerator.cpp:
1678         (JSC::BytecodeGenerator::emitResolve):
1679         (JSC::BytecodeGenerator::emitGetById):
1680         (JSC::BytecodeGenerator::emitPutById):
1681         (JSC::BytecodeGenerator::emitCall):
1682         (JSC::BytecodeGenerator::emitConstruct):
1683         (JSC::BytecodeGenerator::emitCatch):
1684         * interpreter/Interpreter.cpp:
1685         (JSC::Interpreter::tryCTICachePutByID):
1686         (JSC::Interpreter::tryCTICacheGetByID):
1687         (JSC::Interpreter::cti_op_get_by_id_self_fail):
1688         (JSC::getPolymorphicAccessStructureListSlot):
1689         (JSC::Interpreter::cti_op_get_by_id_proto_list):
1690         (JSC::Interpreter::cti_op_resolve_global):
1691         * jit/JIT.cpp:
1692         (JSC::JIT::JIT):
1693         (JSC::JIT::privateCompileMainPass):
1694         (JSC::JIT::privateCompileSlowCases):
1695         (JSC::JIT::privateCompile):
1696         * jit/JITPropertyAccess.cpp:
1697         (JSC::JIT::compileGetByIdHotPath):
1698         (JSC::JIT::compilePutByIdHotPath):
1699         (JSC::JIT::compileGetByIdSlowCase):
1700         (JSC::JIT::compilePutByIdSlowCase):
1701         (JSC::JIT::privateCompileGetByIdSelfList):
1702         (JSC::JIT::privateCompileGetByIdProtoList):
1703         (JSC::JIT::privateCompileGetByIdChainList):
1704
1705 2008-12-11  Gavin Barraclough  <barraclough@apple.com>
1706
1707         Reviewed by Oliver Hunt.
1708
1709         Remove CTI_ARGUMENTS mode, use va_start implementation on Windows,
1710         unifying JIT callback (cti_*) argument access on OS X & Windows
1711
1712         No performance impact.
1713
1714         * interpreter/Interpreter.h:
1715         * jit/JIT.cpp:
1716         (JSC::JIT::privateCompileCTIMachineTrampolines):
1717         * jit/JIT.h:
1718         * jit/JITInlineMethods.h:
1719         (JSC::JIT::emitCTICall):
1720         * jit/JITPropertyAccess.cpp:
1721         (JSC::JIT::privateCompilePutByIdTransition):
1722         * wtf/Platform.h:
1723
1724 2008-12-11  Holger Freyther  <zecke@selfish.org>
1725
1726         Reviewed by Simon Hausmann.
1727
1728         https://bugs.webkit.org/show_bug.cgi?id=20953
1729
1730         For Qt it is not pratical to have a FontCache and GlyphPageTreeNode
1731         implementation. This is one of the reasons why the Qt port is currently not
1732         using WebCore/platform/graphics/Font.cpp. By allowing to not use
1733         the simple/fast-path the Qt port will be able to use it.
1734
1735         Introduce USE(FONT_FAST_PATH) and define it for every port but the
1736         Qt one.
1737
1738         * wtf/Platform.h: Enable USE(FONT_FAST_PATH)
1739
1740 2008-12-11  Gabor Loki  <loki@inf.u-szeged.hu>
1741
1742         Reviewed by Darin Adler and landed by Holger Freyther.
1743
1744         <https://bugs.webkit.org/show_bug.cgi?id=22648>
1745         Fix threading on Qt-port and Gtk-port for Sampling tool.
1746
1747         * wtf/ThreadingGtk.cpp:
1748         (WTF::waitForThreadCompletion):
1749         * wtf/ThreadingQt.cpp:
1750         (WTF::waitForThreadCompletion):
1751
1752 2008-12-10  Cameron Zwarich  <zwarich@apple.com>
1753
1754         Reviewed by Oliver Hunt.
1755
1756         Bug 22734: Debugger crashes when stepping into a function call in a return statement
1757         <https://bugs.webkit.org/show_bug.cgi?id=22734>
1758         <rdar://problem/6426796>
1759
1760         * bytecompiler/BytecodeGenerator.cpp:
1761         (JSC::BytecodeGenerator::BytecodeGenerator): The DebuggerCallFrame uses
1762         the 'this' value stored in a callFrame, so op_convert_this should be
1763         emitted at the beginning of a function body when generating bytecode
1764         with debug hooks.
1765         * debugger/DebuggerCallFrame.cpp:
1766         (JSC::DebuggerCallFrame::thisObject): The assertion inherent in the call
1767         to asObject() here is valid, because any 'this' value should have been
1768         converted to a JSObject*.
1769
1770 2008-12-10  Gavin Barraclough  <barraclough@apple.com>
1771
1772         Reviewed by Geoff Garen.
1773
1774         Port more of the JIT to use the MacroAssembler interface.
1775         
1776         Everything in the main pass, bar a few corner cases (operations with required
1777         registers, or calling convention code).  Slightly refactors array creation,
1778         moving the offset calculation into the callFrame into C code (reducing code
1779         planted).
1780
1781         Overall this appears to be a 1% win on v8-tests, due to the smaller immediates
1782         being planted (in jfalse in particular).
1783
1784         * interpreter/Interpreter.cpp:
1785         (JSC::Interpreter::cti_op_new_array):
1786         * jit/JIT.cpp:
1787         (JSC::JIT::privateCompileMainPass):
1788         (JSC::JIT::privateCompileSlowCases):
1789         * jit/JIT.h:
1790         * wrec/WRECGenerator.cpp:
1791         (JSC::WREC::Generator::generateEnter):
1792
1793 2008-12-10  Sam Weinig  <sam@webkit.org>
1794
1795         Fix non-JIT builds.
1796
1797         * bytecode/CodeBlock.h:
1798
1799 2008-12-10  Sam Weinig  <sam@webkit.org>
1800
1801         Reviewed by Geoffrey Garen.
1802
1803         <rdar://problem/6428332> Remove the CTI return address table from CodeBlock
1804
1805         Step 2:
1806
1807         Convert the return address table from a HashMap to a sorted Vector.  This
1808         reduces the size of the data structure by ~4.5MB on Membuster head.
1809
1810         SunSpider reports a 0.5% progression.
1811
1812         * bytecode/CodeBlock.cpp:
1813         (JSC::sizeInBytes): Generic method to get the cost of a Vector.
1814         (JSC::CodeBlock::dumpStatistics): Add dumping of member sizes.
1815         * bytecode/CodeBlock.h:
1816         (JSC::PC::PC): Struct representing NativePC -> VirtualPC mappings.
1817         (JSC::getNativePC): Helper for binary chop.
1818         (JSC::CodeBlock::getBytecodeIndex): Used to get the VirtualPC from a
1819         NativePC using a binary chop of the pcVector.
1820         (JSC::CodeBlock::pcVector): Accessor.
1821
1822         * interpreter/Interpreter.cpp:
1823         (JSC::vPCForPC): Use getBytecodeIndex instead of jitReturnAddressVPCMap().get().
1824         (JSC::Interpreter::cti_op_instanceof): Ditto.
1825         (JSC::Interpreter::cti_op_resolve): Ditto.
1826         (JSC::Interpreter::cti_op_resolve_func): Ditto.
1827         (JSC::Interpreter::cti_op_resolve_skip): Ditto.
1828         (JSC::Interpreter::cti_op_resolve_with_base): Ditto.
1829         (JSC::Interpreter::cti_op_throw): Ditto.
1830         (JSC::Interpreter::cti_op_in): Ditto.
1831         (JSC::Interpreter::cti_vm_throw): Ditto.
1832
1833         * jit/JIT.cpp:
1834         (JSC::JIT::privateCompile): Reserve exact capacity and fill the pcVector.
1835
1836 2008-12-09  Geoffrey Garen  <ggaren@apple.com>
1837
1838         Reviewed by Oliver Hunt.
1839
1840         Added WREC support for an assertion followed by a quantifier. Fixed
1841         PCRE to match.
1842
1843         * wrec/WRECParser.cpp:
1844         (JSC::WREC::Parser::parseParentheses): Throw away the quantifier, since
1845         it's meaningless. (Firefox does the same.)
1846
1847         * pcre/pcre_compile.cpp:
1848         (compileBranch): ditto.
1849
1850 2008-12-09  Geoffrey Garen  <ggaren@apple.com>
1851
1852         Reviewed by Cameron Zwarich.
1853
1854         In preparation for compiling WREC without PCRE:
1855         
1856         Further relaxed WREC's parsing to be more web-compatible. Fixed PCRE to
1857         match in cases where it didn't already.
1858         
1859         Changed JavaScriptCore to report syntax errors detected by WREC, rather
1860         than falling back on PCRE any time WREC sees an error.
1861         
1862         * pcre/pcre_compile.cpp:
1863         (checkEscape): Relaxed parsing of \c and \N escapes to be more
1864         web-compatible.
1865         
1866         * runtime/RegExp.cpp:
1867         (JSC::RegExp::RegExp): Only fall back on PCRE if WREC has not reported
1868         a syntax error.
1869
1870         * wrec/WREC.cpp:
1871         (JSC::WREC::Generator::compileRegExp): Fixed some error reporting to
1872         match PCRE.
1873
1874         * wrec/WRECParser.cpp: Added error messages that match PCRE.
1875
1876         (JSC::WREC::Parser::consumeGreedyQuantifier):
1877         (JSC::WREC::Parser::parseParentheses):
1878         (JSC::WREC::Parser::parseCharacterClass):
1879         (JSC::WREC::Parser::parseNonCharacterEscape): Updated the above functions to
1880         use the new setError API.
1881
1882         (JSC::WREC::Parser::consumeEscape): Relaxed parsing of \c \N \u \x \B
1883         to be more web-compatible.
1884
1885         (JSC::WREC::Parser::parseAlternative): Distinguish between a malformed
1886         quantifier and a quantifier with no prefix, like PCRE does.
1887
1888         (JSC::WREC::Parser::consumeParenthesesType): Updated to use the new setError API.
1889
1890         * wrec/WRECParser.h:
1891         (JSC::WREC::Parser::error):
1892         (JSC::WREC::Parser::syntaxError):
1893         (JSC::WREC::Parser::parsePattern):
1894         (JSC::WREC::Parser::reset):
1895         (JSC::WREC::Parser::setError): Store error messages instead of error codes,
1896         to provide for exception messages. Use a setter for reporting errors, so
1897         errors detected early are not overwritten by errors detected later.
1898
1899 2008-12-09  Gavin Barraclough  <barraclough@apple.com>
1900
1901         Reviewed by Oliver Hunt.
1902
1903         Use va_args to access cti function arguments.
1904         https://bugs.webkit.org/show_bug.cgi?id=22774
1905
1906         This may be a minor regression, but we'll take the hit if so to reduce fragility.
1907
1908         * interpreter/Interpreter.cpp:
1909         * interpreter/Interpreter.h:
1910
1911 2008-12-09  Sam Weinig  <sam@webkit.org>
1912
1913         Reviewed twice by Cameron Zwarich.
1914
1915         Fix for https://bugs.webkit.org/show_bug.cgi?id=22752
1916         Clear SymbolTable after codegen for Function codeblocks that
1917         don't require an activation
1918
1919         This is a ~1.5MB improvement on Membuster-head.
1920
1921         * bytecode/CodeBlock.cpp:
1922         (JSC::CodeBlock::dumpStatistics): Add logging of non-empty symbol tables
1923         and total size used by symbol tables.
1924         * bytecompiler/BytecodeGenerator.cpp:
1925         (JSC::BytecodeGenerator::generate): Clear the symbol table here.
1926
1927 2008-12-09  Sam Weinig  <sam@webkit.org>
1928
1929         Reviewed by Geoffrey Garen.
1930
1931         Remove unnecessary extra lookup when throwing an exception.
1932         We used to first lookup the target offset using getHandlerForVPC
1933         and then we would lookup the native code stub using 
1934         nativeExceptionCodeForHandlerVPC.  Instead, we can just pass around
1935         the HandlerInfo.
1936
1937         * bytecode/CodeBlock.cpp:
1938         (JSC::CodeBlock::handlerForVPC): Return the HandlerInfo.
1939         * bytecode/CodeBlock.h: Remove nativeExceptionCodeForHandlerVPC.
1940
1941         * interpreter/Interpreter.cpp:
1942         (JSC::Interpreter::throwException): Return a HandlerInfo instead of
1943         and Instruction offset.
1944         (JSC::Interpreter::privateExecute): Get the offset from HandlerInfo.
1945         (JSC::Interpreter::cti_op_throw): Get the native code from the HandleInfo.
1946         (JSC::Interpreter::cti_vm_throw): Ditto.
1947         * interpreter/Interpreter.h:
1948
1949 2008-12-09  Eric Seidel  <eric@webkit.org>
1950
1951         Build fix only, no review.
1952
1953         Speculative fix for the Chromium-Windows bot.
1954         Add JavaScriptCore/os-win32 to the include path (for stdint.h)
1955         Strangely it builds fine on my local windows box (or at least doesn't hit this error)
1956
1957         * JavaScriptCore.scons:
1958
1959 2008-12-09  Eric Seidel  <eric@webkit.org>
1960
1961         No review, build fix only.
1962         
1963         Add ExecutableAllocator files missing from Scons build.
1964
1965         * JavaScriptCore.scons:
1966
1967 2008-12-09  Dimitri Glazkov  <dglazkov@chromium.org>
1968
1969         Reviewed by Timothy Hatcher.
1970
1971         https://bugs.webkit.org/show_bug.cgi?id=22631
1972         Allow ScriptCallFrame query names of functions in the call stack.
1973
1974         * JavaScriptCore.exp: added InternalFunction::name and
1975         UString operator==() as exported symbol
1976
1977 2008-12-08  Judit Jasz  <jasy@inf.u-szeged.hu>
1978
1979         Reviewed and tweaked by Cameron Zwarich.
1980
1981         Bug 22352: Annotate opcodes with their length
1982         <https://bugs.webkit.org/show_bug.cgi?id=22352>
1983
1984         * bytecode/Opcode.cpp:
1985         * bytecode/Opcode.h:
1986         * interpreter/Interpreter.cpp:
1987         (JSC::Interpreter::privateExecute):
1988         * jit/JIT.cpp:
1989         (JSC::JIT::privateCompileMainPass):
1990         (JSC::JIT::privateCompileSlowCases):
1991
1992 2008-12-08  Geoffrey Garen  <ggaren@apple.com>
1993
1994         Reviewed by Oliver Hunt.
1995         
1996         Implemented more of the relaxed and somewhat weird rules for deciding
1997         how to interpret a non-pattern-character.
1998         
1999         * wrec/Escapes.h:
2000         (JSC::WREC::Escape::):
2001         (JSC::WREC::Escape::Escape): Eliminated Escape::None because it was
2002         unused. If you see an '\\', it's either a valid escape or an error.
2003
2004         * wrec/Quantifier.h:
2005         (JSC::WREC::Quantifier::Quantifier):
2006         * wrec/WRECGenerator.cpp:
2007         (JSC::WREC::Generator::generateNonGreedyQuantifier):
2008         (JSC::WREC::Generator::generateGreedyQuantifier): Renamed "noMaxSpecified"
2009         to "Infinity", since that's what it means.
2010
2011         * wrec/WRECParser.cpp:
2012         (JSC::WREC::Parser::consumeGreedyQuantifier): Re-wrote {n,m} parsing rules
2013         because they were too strict before. Added support for backtracking
2014         in the case where the {n,m} fails to parse as a quantifier, and yet is
2015         not a syntax error.
2016
2017         (JSC::WREC::Parser::parseCharacterClass):
2018         (JSC::WREC::Parser::parseNonCharacterEscape): Eliminated Escape::None,
2019         as above.
2020
2021         (JSC::WREC::Parser::consumeEscape): Don't treat ASCII and _ escapes
2022         as syntax errors. See fast/regex/non-pattern-characters.html.
2023         
2024         * wrec/WRECParser.h:
2025         (JSC::WREC::Parser::SavedState::SavedState):
2026         (JSC::WREC::Parser::SavedState::restore): Added a state backtracker,
2027         since parsing {n,m} forms requires backtracking if the form turns out
2028         not to be a quantifier.
2029
2030 2008-12-08  Geoffrey Garen  <ggaren@apple.com>
2031
2032         Reviewed by Oliver Hunt.
2033         
2034         Refactored WREC parsing so that only one piece of code needs to know
2035         the relaxed and somewhat weird rules for deciding how to interpret a
2036         non-pattern-character, in preparation for implementing those rules.
2037         
2038         Also, implemented the relaxed and somewhat weird rules for '}' and ']'.
2039
2040         * wrec/WREC.cpp: Reduced the regular expression size limit. Now that
2041         WREC handles ']' properly, it compiles fast/js/regexp-charclass-crash.html,
2042         which makes it hang at the old limit. (The old limit was based on the
2043         misimpression that the same value in PCRE limited the regular expression
2044         pattern size; in reality, it limited the expected compiled regular
2045         expression size. WREC doesn't have a way to calculate an expected
2046         compiled regular expression size, but this should be good enough.)
2047
2048         * wrec/WRECParser.cpp:
2049         (JSC::WREC::parsePatternCharacterSequence): Nixed this function because
2050         it contained a second copy of the logic for handling non-pattern-characters,
2051         which is about to get a lot more complicated.
2052
2053         (JSC::WREC::PatternCharacterSequence::PatternCharacterSequence): 
2054         (JSC::WREC::PatternCharacterSequence::size):
2055         (JSC::WREC::PatternCharacterSequence::append):
2056         (JSC::WREC::PatternCharacterSequence::flush): Helper object for generating
2057         an optimized sequence of pattern characters.
2058
2059         (JSC::WREC::Parser::parseNonCharacterEscape): Renamed to reflect the fact
2060         that the main parseAlternative loop handles character escapes.
2061
2062         (JSC::WREC::Parser::parseAlternative): Moved pattern character sequence
2063         logic from parsePatternCharacterSequence to here, using
2064         PatternCharacterSequence to help with the details.
2065
2066         * wrec/WRECParser.h: Updated for renames.
2067
2068 2008-12-08  Alexey Proskuryakov  <ap@webkit.org>
2069
2070         Reviewed by Geoff Garen.
2071
2072         <rdar://problem/6166088> Give JSGlobalContextCreate a behavior that is concurrency aware,
2073         and un-deprecate it
2074
2075         * API/JSContextRef.cpp: (JSGlobalContextCreate):
2076         * API/JSContextRef.h:
2077         Use a unique context group for the context, unless the application was linked against old
2078         JavaScriptCore.
2079
2080 2008-12-08  Sam Weinig  <sam@webkit.org>
2081
2082         Reviewed by Cameron Zwarich.
2083
2084         Fix for <rdar://problem/6428332> Remove the CTI return address table from CodeBlock
2085
2086         Step 1:
2087
2088         Remove use of jitReturnAddressVPCMap when looking for vPC to store Structures
2089         in for cached lookup.  Instead, use the offset in the StructureStubInfo that is
2090         already required.
2091
2092         * bytecode/CodeBlock.cpp:
2093         (JSC::CodeBlock::dumpStatistics): Fix extraneous semicolon.
2094         * interpreter/Interpreter.cpp:
2095         (JSC::Interpreter::tryCTICachePutByID):
2096         (JSC::Interpreter::tryCTICacheGetByID):
2097         (JSC::Interpreter::cti_op_get_by_id_self_fail):
2098         (JSC::Interpreter::cti_op_get_by_id_proto_list):
2099         * jit/JIT.h:
2100         (JSC::JIT::compileGetByIdSelf):
2101         (JSC::JIT::compileGetByIdProto):
2102         (JSC::JIT::compileGetByIdChain):
2103         (JSC::JIT::compilePutByIdReplace):
2104         (JSC::JIT::compilePutByIdTransition):
2105         * jit/JITPropertyAccess.cpp:
2106         (JSC::JIT::privateCompilePutByIdTransition):
2107         (JSC::JIT::patchGetByIdSelf):
2108         (JSC::JIT::patchPutByIdReplace):
2109         (JSC::JIT::privateCompilePatchGetArrayLength): Remove extra call to getStubInfo.
2110         (JSC::JIT::privateCompileGetByIdSelf):
2111         (JSC::JIT::privateCompileGetByIdProto):
2112         (JSC::JIT::privateCompileGetByIdChain):
2113         (JSC::JIT::privateCompilePutByIdReplace):
2114
2115 2008-12-08  Gavin Barraclough  <barraclough@apple.com>
2116
2117         Reviewed by Oliver Hunt.
2118
2119         Port the op_j?n?eq_null JIT code generation to use the MacroAssembler,
2120         and clean up slightly at the same time.  The 'j' forms currently compare,
2121         then set a register, then compare again, then branch.  Branch directly on
2122         the result of the first compare.
2123
2124         Around a 1% progression on deltablue, crypto & early boyer, for about 1/2%
2125         overall on v8-tests.
2126
2127         * jit/JIT.cpp:
2128         (JSC::JIT::privateCompileMainPass):
2129         * jit/JITPropertyAccess.cpp:
2130         (JSC::JIT::compileGetByIdSlowCase):
2131
2132 2008-12-08  Gavin Barraclough  <barraclough@apple.com>
2133
2134         Reviewed by Geoff Garen.
2135
2136         Expand MacroAssembler to support more operations, required by the JIT.
2137
2138         Generally adds more operations and permutations of operands to the existing
2139         interface.  Rename 'jset' to 'jnz' and 'jnset' to 'jz', which seem clearer,
2140         and require that immediate pointer operands (though not pointer addresses to
2141         load and store instructions) are wrapped in a ImmPtr() type, akin to Imm32().
2142
2143         No performance impact.
2144
2145         * assembler/MacroAssembler.h:
2146         (JSC::MacroAssembler::):
2147         (JSC::MacroAssembler::ImmPtr::ImmPtr):
2148         (JSC::MacroAssembler::add32):
2149         (JSC::MacroAssembler::and32):
2150         (JSC::MacroAssembler::or32):
2151         (JSC::MacroAssembler::sub32):
2152         (JSC::MacroAssembler::xor32):
2153         (JSC::MacroAssembler::loadPtr):
2154         (JSC::MacroAssembler::load32):
2155         (JSC::MacroAssembler::storePtr):
2156         (JSC::MacroAssembler::store32):
2157         (JSC::MacroAssembler::poke):
2158         (JSC::MacroAssembler::move):
2159         (JSC::MacroAssembler::testImm32):
2160         (JSC::MacroAssembler::jae32):
2161         (JSC::MacroAssembler::jb32):
2162         (JSC::MacroAssembler::jePtr):
2163         (JSC::MacroAssembler::je32):
2164         (JSC::MacroAssembler::jnePtr):
2165         (JSC::MacroAssembler::jne32):
2166         (JSC::MacroAssembler::jnzPtr):
2167         (JSC::MacroAssembler::jnz32):
2168         (JSC::MacroAssembler::jzPtr):
2169         (JSC::MacroAssembler::jz32):
2170         (JSC::MacroAssembler::joSub32):
2171         (JSC::MacroAssembler::jump):
2172         (JSC::MacroAssembler::sete32):
2173         (JSC::MacroAssembler::setne32):
2174         (JSC::MacroAssembler::setnz32):
2175         (JSC::MacroAssembler::setz32):
2176         * assembler/X86Assembler.h:
2177         (JSC::X86Assembler::addl_mr):
2178         (JSC::X86Assembler::andl_i8r):
2179         (JSC::X86Assembler::cmpl_rm):
2180         (JSC::X86Assembler::cmpl_mr):
2181         (JSC::X86Assembler::cmpl_i8m):
2182         (JSC::X86Assembler::subl_mr):
2183         (JSC::X86Assembler::testl_i32m):
2184         (JSC::X86Assembler::xorl_i32r):
2185         (JSC::X86Assembler::movl_rm):
2186         (JSC::X86Assembler::modRm_opmsib):
2187         * jit/JIT.cpp:
2188         (JSC::JIT::privateCompileMainPass):
2189         * jit/JITInlineMethods.h:
2190         (JSC::JIT::emitGetVirtualRegister):
2191         (JSC::JIT::emitPutCTIArgConstant):
2192         (JSC::JIT::emitPutCTIParam):
2193         (JSC::JIT::emitPutImmediateToCallFrameHeader):
2194         (JSC::JIT::emitInitRegister):
2195         (JSC::JIT::checkStructure):
2196         (JSC::JIT::emitJumpIfJSCell):
2197         (JSC::JIT::emitJumpIfNotJSCell):
2198         (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
2199
2200 2008-12-08  Geoffrey Garen  <ggaren@apple.com>
2201
2202         Reviewed by Sam Weinig.
2203         
2204         Fixed a bug where WREC would allow a quantifier whose minimum was
2205         greater than its maximum.
2206         
2207         * wrec/Quantifier.h:
2208         (JSC::WREC::Quantifier::Quantifier): ASSERT that the quantifier is not
2209         backwards.
2210         
2211         * wrec/WRECParser.cpp:
2212         (JSC::WREC::Parser::consumeGreedyQuantifier): Verify that the minimum
2213         is not greater than the maximum.
2214
2215 2008-12-08  Eric Seidel  <eric@webkit.org>
2216         
2217         Build fix only, no review.
2218
2219         * JavaScriptCore.scons: add bytecode/JumpTable.cpp
2220
2221 2008-12-08  Sam Weinig  <sam@webkit.org>
2222
2223         Reviewed by Geoffrey Garen.
2224
2225         Patch for https://bugs.webkit.org/show_bug.cgi?id=22716
2226         <rdar://problem/6428315>
2227         Add RareData structure to CodeBlock for infrequently used auxiliary data
2228         members.
2229
2230         Reduces memory on Membuster-head by ~.5MB 
2231
2232         * bytecode/CodeBlock.cpp:
2233         (JSC::CodeBlock::dump):
2234         (JSC::CodeBlock::dumpStatistics):
2235         (JSC::CodeBlock::mark):
2236         (JSC::CodeBlock::getHandlerForVPC):
2237         (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC):
2238         (JSC::CodeBlock::shrinkToFit):
2239         * bytecode/CodeBlock.h:
2240         (JSC::CodeBlock::numberOfExceptionHandlers):
2241         (JSC::CodeBlock::addExceptionHandler):
2242         (JSC::CodeBlock::exceptionHandler):
2243         (JSC::CodeBlock::addFunction):
2244         (JSC::CodeBlock::function):
2245         (JSC::CodeBlock::addUnexpectedConstant):
2246         (JSC::CodeBlock::unexpectedConstant):
2247         (JSC::CodeBlock::addRegExp):
2248         (JSC::CodeBlock::regexp):
2249         (JSC::CodeBlock::numberOfImmediateSwitchJumpTables):
2250         (JSC::CodeBlock::addImmediateSwitchJumpTable):
2251         (JSC::CodeBlock::immediateSwitchJumpTable):
2252         (JSC::CodeBlock::numberOfCharacterSwitchJumpTables):
2253         (JSC::CodeBlock::addCharacterSwitchJumpTable):
2254         (JSC::CodeBlock::characterSwitchJumpTable):
2255         (JSC::CodeBlock::numberOfStringSwitchJumpTables):
2256         (JSC::CodeBlock::addStringSwitchJumpTable):
2257         (JSC::CodeBlock::stringSwitchJumpTable):
2258         (JSC::CodeBlock::evalCodeCache):
2259         (JSC::CodeBlock::createRareDataIfNecessary):
2260
2261 2008-11-26  Peter Kasting  <pkasting@google.com>
2262
2263         Reviewed by Anders Carlsson.
2264
2265         https://bugs.webkit.org/show_bug.cgi?id=16814
2266         Allow ports to disable ActiveX->NPAPI conversion for Media Player.
2267         Improve handling of miscellaneous ActiveX objects.
2268
2269         * wtf/Platform.h: Add another ENABLE(...).
2270
2271 2008-12-08  Sam Weinig  <sam@webkit.org>
2272
2273         Reviewed by Mark Rowe.
2274
2275         Add dumping of CodeBlock member structure usage.
2276
2277         * bytecode/CodeBlock.cpp:
2278         (JSC::CodeBlock::dumpStatistics):
2279         * bytecode/EvalCodeCache.h:
2280         (JSC::EvalCodeCache::isEmpty):
2281
2282 2008-12-08  David Kilzer  <ddkilzer@apple.com>
2283
2284         Bug 22555: Sort "children" sections in Xcode project files
2285
2286         <https://bugs.webkit.org/show_bug.cgi?id=22555>
2287
2288         Reviewed by Eric Seidel.
2289
2290         * JavaScriptCore.xcodeproj/project.pbxproj: Sorted.
2291
2292 2008-12-08  Tony Chang  <tony@chromium.org>
2293
2294         Reviewed by Eric Seidel.
2295
2296         Enable Pan scrolling only when building on PLATFORM(WIN_OS)
2297         Previously platforms like Apple Windows WebKit, Cairo Windows WebKit,
2298         Wx and Chromium were enabling it explicitly, now we just turn it on
2299         for all WIN_OS, later platforms can turn it off as needed on Windows
2300         (or turn it on under Linux, etc.)
2301         https://bugs.webkit.org/show_bug.cgi?id=22698
2302
2303         * wtf/Platform.h:
2304
2305 2008-12-08  Sam Weinig  <sam@webkit.org>
2306
2307         Reviewed by Cameron Zwarich.
2308
2309         Add basic memory statistics dumping for CodeBlock.
2310
2311         * bytecode/CodeBlock.cpp:
2312         (JSC::CodeBlock::dumpStatistics):
2313         (JSC::CodeBlock::CodeBlock):
2314         (JSC::CodeBlock::~CodeBlock):
2315         * bytecode/CodeBlock.h:
2316
2317 2008-12-08  Simon Hausmann  <simon.hausmann@nokia.com>
2318
2319         Fix the Linux build with newer gcc/glibc.
2320
2321         * jit/ExecutableAllocatorPosix.cpp: Include unistd.h for
2322         getpagesize(), according to
2323         http://opengroup.org/onlinepubs/007908775/xsh/getpagesize.html
2324
2325 2008-12-08  Simon Hausmann  <simon.hausmann@nokia.com>
2326
2327         Fix the build with Qt on Windows.
2328
2329         * JavaScriptCore.pri: Compile ExecutableAllocatorWin.cpp on Windows.
2330
2331 2008-12-07  Oliver Hunt  <oliver@apple.com>
2332
2333         Reviewed by NOBODY (Buildfix).
2334
2335         Fix non-WREC builds
2336
2337         * runtime/RegExp.cpp:
2338         (JSC::RegExp::RegExp):
2339
2340 2008-12-07  Oliver Hunt  <oliver@apple.com>
2341
2342         Reviewed by NOBODY (Build fix).
2343
2344         Put ENABLE(ASSEMBLER) guards around use of ExecutableAllocator in global data
2345
2346         Correct Qt and Gtk project files
2347
2348         * GNUmakefile.am:
2349         * JavaScriptCore.pri:
2350         * runtime/JSGlobalData.h:
2351
2352 2008-12-07  Oliver Hunt  <oliver@apple.com>
2353
2354         Reviewed by NOBODY (Build fix).
2355
2356         Add new files to other projects.
2357
2358         * GNUmakefile.am:
2359         * JavaScriptCore.pri:
2360         * JavaScriptCore.pro:
2361
2362 2008-12-07  Oliver Hunt  <oliver@apple.com>
2363
2364         Rubber stamped by Mark Rowe.
2365
2366         Rename ExecutableAllocatorMMAP to the more sensible ExecutableAllocatorPosix
2367
2368         * JavaScriptCore.xcodeproj/project.pbxproj:
2369         * jit/ExecutableAllocator.h:
2370         * jit/ExecutableAllocatorPosix.cpp: Renamed from JavaScriptCore/jit/ExecutableAllocatorMMAP.cpp.
2371         (JSC::ExecutableAllocator::intializePageSize):
2372         (JSC::ExecutablePool::systemAlloc):
2373         (JSC::ExecutablePool::systemRelease):
2374
2375 2008-12-07  Oliver Hunt  <oliver@apple.com>
2376
2377         Reviewed by Cameron Zwarich and Sam Weinig
2378
2379         <rdar://problem/6309878> Need more granular control over allocation of executable memory (21783)
2380         <https://bugs.webkit.org/show_bug.cgi?id=21783>
2381
2382         Add a new allocator for use by the JIT that provides executable pages, so
2383         we can get rid of the current hack that makes the entire heap executable.
2384
2385         1-2% progression on SunSpider-v8, 1% on SunSpider.  Reduces memory usage as well!
2386
2387         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2388         * JavaScriptCore.vcproj/jsc/jsc.vcproj:
2389         * JavaScriptCore.xcodeproj/project.pbxproj:
2390         * assembler/AssemblerBuffer.h:
2391         (JSC::AssemblerBuffer::size):
2392         (JSC::AssemblerBuffer::executableCopy):
2393         * assembler/MacroAssembler.h:
2394         (JSC::MacroAssembler::size):
2395         (JSC::MacroAssembler::copyCode):
2396         * assembler/X86Assembler.h:
2397         (JSC::X86Assembler::size):
2398         (JSC::X86Assembler::executableCopy):
2399         * bytecode/CodeBlock.cpp:
2400         (JSC::CodeBlock::~CodeBlock):
2401         * bytecode/CodeBlock.h:
2402         (JSC::CodeBlock::executablePool):
2403         (JSC::CodeBlock::setExecutablePool):
2404         * bytecode/Instruction.h:
2405         (JSC::PolymorphicAccessStructureList::derefStructures):
2406         * interpreter/Interpreter.cpp:
2407         (JSC::Interpreter::~Interpreter):
2408         * interpreter/Interpreter.h:
2409         * jit/ExecutableAllocator.cpp: Added.
2410         * jit/ExecutableAllocator.h: Added.
2411         (JSC::ExecutablePool::create):
2412         (JSC::ExecutablePool::alloc):
2413         (JSC::ExecutablePool::~ExecutablePool):
2414         (JSC::ExecutablePool::available):
2415         (JSC::ExecutablePool::ExecutablePool):
2416         (JSC::ExecutablePool::poolAllocate):
2417         (JSC::ExecutableAllocator::ExecutableAllocator):
2418         (JSC::ExecutableAllocator::poolForSize):
2419         (JSC::ExecutablePool::sizeForAllocation):
2420         * jit/ExecutableAllocatorMMAP.cpp: Added.
2421         (JSC::ExecutableAllocator::intializePageSize):
2422         (JSC::ExecutablePool::systemAlloc):
2423         (JSC::ExecutablePool::systemRelease):
2424         * jit/ExecutableAllocatorWin.cpp: Added.
2425         (JSC::ExecutableAllocator::intializePageSize):
2426         (JSC::ExecutablePool::systemAlloc):
2427         (JSC::ExecutablePool::systemRelease):
2428         * jit/JIT.cpp:
2429         (JSC::JIT::privateCompile):
2430         (JSC::JIT::privateCompileCTIMachineTrampolines):
2431         * jit/JIT.h:
2432         (JSC::JIT::compileCTIMachineTrampolines):
2433         * jit/JITPropertyAccess.cpp:
2434         (JSC::JIT::privateCompilePutByIdTransition):
2435         (JSC::JIT::privateCompilePatchGetArrayLength):
2436         (JSC::JIT::privateCompileGetByIdSelf):
2437         (JSC::JIT::privateCompileGetByIdProto):
2438         (JSC::JIT::privateCompileGetByIdSelfList):
2439         (JSC::JIT::privateCompileGetByIdProtoList):
2440         (JSC::JIT::privateCompileGetByIdChainList):
2441         (JSC::JIT::privateCompileGetByIdChain):
2442         (JSC::JIT::privateCompilePutByIdReplace):
2443         * parser/Nodes.cpp:
2444         (JSC::RegExpNode::emitBytecode):
2445         * runtime/JSGlobalData.h:
2446         (JSC::JSGlobalData::poolForSize):
2447         * runtime/RegExp.cpp:
2448         (JSC::RegExp::RegExp):
2449         (JSC::RegExp::create):
2450         (JSC::RegExp::~RegExp):
2451         * runtime/RegExp.h:
2452         * runtime/RegExpConstructor.cpp:
2453         (JSC::constructRegExp):
2454         * runtime/RegExpPrototype.cpp:
2455         (JSC::regExpProtoFuncCompile):
2456         * runtime/StringPrototype.cpp:
2457         (JSC::stringProtoFuncMatch):
2458         (JSC::stringProtoFuncSearch):
2459         * wrec/WREC.cpp:
2460         (JSC::WREC::Generator::compileRegExp):
2461         * wrec/WRECGenerator.h:
2462         * wtf/FastMalloc.cpp:
2463         * wtf/FastMalloc.h:
2464         * wtf/TCSystemAlloc.cpp:
2465         (TryMmap):
2466         (TryVirtualAlloc):
2467         (TryDevMem):
2468         (TCMalloc_SystemRelease):
2469
2470 2008-12-06  Sam Weinig  <sam@webkit.org>
2471
2472         Fix the Gtk build.
2473
2474         * jit/JITPropertyAccess.cpp:
2475         (JSC::JIT::compileGetByIdHotPath):
2476         (JSC::JIT::compilePutByIdHotPath):
2477
2478 2008-12-06  Sam Weinig  <sam@webkit.org>
2479
2480         Reviewed by Cameron Zwarich,
2481
2482         Move CodeBlock constructor into the .cpp file.
2483
2484         Sunspider reports a .7% progression, but I can only assume this
2485         is noise.
2486
2487         * bytecode/CodeBlock.cpp:
2488         (JSC::CodeBlock::CodeBlock):
2489         * bytecode/CodeBlock.h:
2490
2491 2008-12-06  Sam Weinig  <sam@webkit.org>
2492
2493         Reviewed by Cameron Zwarich.
2494
2495         Split JumpTable code into its own file.
2496
2497         * GNUmakefile.am:
2498         * JavaScriptCore.pri:
2499         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2500         * JavaScriptCore.xcodeproj/project.pbxproj:
2501         * JavaScriptCoreSources.bkl:
2502         * bytecode/CodeBlock.cpp:
2503         * bytecode/CodeBlock.h:
2504         * bytecode/JumpTable.cpp: Copied from bytecode/CodeBlock.cpp.
2505         * bytecode/JumpTable.h: Copied from bytecode/CodeBlock.h.
2506
2507 2008-12-05  Sam Weinig  <sam@webkit.org>
2508
2509         Reviewed by Cameron Zwarich.
2510
2511         Fix for https://bugs.webkit.org/show_bug.cgi?id=22715
2512         Encapsulate more CodeBlock members in preparation
2513         of moving some of them to a rare data structure.
2514
2515         * bytecode/CodeBlock.cpp:
2516         (JSC::locationForOffset):
2517         (JSC::printConditionalJump):
2518         (JSC::printGetByIdOp):
2519         (JSC::printPutByIdOp):
2520         (JSC::CodeBlock::printStructure):
2521         (JSC::CodeBlock::printStructures):
2522         (JSC::CodeBlock::dump):
2523         (JSC::CodeBlock::~CodeBlock):
2524         (JSC::CodeBlock::unlinkCallers):
2525         (JSC::CodeBlock::derefStructures):
2526         (JSC::CodeBlock::refStructures):
2527         (JSC::CodeBlock::mark):
2528         (JSC::CodeBlock::getHandlerForVPC):
2529         (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC):
2530         (JSC::CodeBlock::lineNumberForVPC):
2531         (JSC::CodeBlock::expressionRangeForVPC):
2532         (JSC::CodeBlock::shrinkToFit):
2533         * bytecode/CodeBlock.h:
2534         (JSC::CodeBlock::CodeBlock):
2535         (JSC::CodeBlock::addCaller):
2536         (JSC::CodeBlock::removeCaller):
2537         (JSC::CodeBlock::isKnownNotImmediate):
2538         (JSC::CodeBlock::isConstantRegisterIndex):
2539         (JSC::CodeBlock::getConstant):
2540         (JSC::CodeBlock::isTemporaryRegisterIndex):
2541         (JSC::CodeBlock::getStubInfo):
2542         (JSC::CodeBlock::getCallLinkInfo):
2543         (JSC::CodeBlock::instructions):
2544         (JSC::CodeBlock::setJITCode):
2545         (JSC::CodeBlock::jitCode):
2546         (JSC::CodeBlock::ownerNode):
2547         (JSC::CodeBlock::setGlobalData):
2548         (JSC::CodeBlock::setThisRegister):
2549         (JSC::CodeBlock::thisRegister):
2550         (JSC::CodeBlock::setNeedsFullScopeChain):
2551         (JSC::CodeBlock::needsFullScopeChain):
2552         (JSC::CodeBlock::setUsesEval):
2553         (JSC::CodeBlock::usesEval):
2554         (JSC::CodeBlock::setUsesArguments):
2555         (JSC::CodeBlock::usesArguments):
2556         (JSC::CodeBlock::codeType):
2557         (JSC::CodeBlock::source):
2558         (JSC::CodeBlock::sourceOffset):
2559         (JSC::CodeBlock::addGlobalResolveInstruction):
2560         (JSC::CodeBlock::numberOfPropertyAccessInstructions):
2561         (JSC::CodeBlock::addPropertyAccessInstruction):
2562         (JSC::CodeBlock::propertyAccessInstruction):
2563         (JSC::CodeBlock::numberOfCallLinkInfos):
2564         (JSC::CodeBlock::addCallLinkInfo):
2565         (JSC::CodeBlock::callLinkInfo):
2566         (JSC::CodeBlock::numberOfJumpTargets):
2567         (JSC::CodeBlock::addJumpTarget):
2568         (JSC::CodeBlock::jumpTarget):
2569         (JSC::CodeBlock::lastJumpTarget):
2570         (JSC::CodeBlock::numberOfExceptionHandlers):
2571         (JSC::CodeBlock::addExceptionHandler):
2572         (JSC::CodeBlock::exceptionHandler):
2573         (JSC::CodeBlock::addExpressionInfo):
2574         (JSC::CodeBlock::numberOfLineInfos):
2575         (JSC::CodeBlock::addLineInfo):
2576         (JSC::CodeBlock::lastLineInfo):
2577         (JSC::CodeBlock::jitReturnAddressVPCMap):
2578         (JSC::CodeBlock::numberOfIdentifiers):
2579         (JSC::CodeBlock::addIdentifier):
2580         (JSC::CodeBlock::identifier):
2581         (JSC::CodeBlock::numberOfConstantRegisters):
2582         (JSC::CodeBlock::addConstantRegister):
2583         (JSC::CodeBlock::constantRegister):
2584         (JSC::CodeBlock::addFunction):
2585         (JSC::CodeBlock::function):
2586         (JSC::CodeBlock::addFunctionExpression):
2587         (JSC::CodeBlock::functionExpression):
2588         (JSC::CodeBlock::addUnexpectedConstant):
2589         (JSC::CodeBlock::unexpectedConstant):
2590         (JSC::CodeBlock::addRegExp):
2591         (JSC::CodeBlock::regexp):
2592         (JSC::CodeBlock::symbolTable):
2593         (JSC::CodeBlock::evalCodeCache):
2594         New inline setters/getters.
2595
2596         (JSC::ProgramCodeBlock::ProgramCodeBlock):
2597         (JSC::ProgramCodeBlock::~ProgramCodeBlock):
2598         (JSC::ProgramCodeBlock::clearGlobalObject):
2599         * bytecode/SamplingTool.cpp:
2600         (JSC::ScopeSampleRecord::sample):
2601         (JSC::SamplingTool::dump):
2602         * bytecompiler/BytecodeGenerator.cpp:
2603         * bytecompiler/BytecodeGenerator.h:
2604         * bytecompiler/Label.h:
2605         * interpreter/CallFrame.cpp:
2606         * interpreter/Interpreter.cpp:
2607         * jit/JIT.cpp:
2608         * jit/JITCall.cpp:
2609         * jit/JITInlineMethods.h:
2610         * jit/JITPropertyAccess.cpp:
2611         * parser/Nodes.cpp:
2612         * runtime/Arguments.h:
2613         * runtime/ExceptionHelpers.cpp:
2614         * runtime/JSActivation.cpp:
2615         * runtime/JSActivation.h:
2616         * runtime/JSGlobalObject.cpp:
2617         Change direct access to use new getter/setters.
2618
2619 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2620
2621         Reviewed by Oliver Hunt.
2622
2623         Prevent GCC4.2 from hanging when trying to compile Interpreter.cpp.
2624         Added "-fno-var-tracking" compiler flag.
2625
2626         https://bugs.webkit.org/show_bug.cgi?id=22704
2627
2628         * JavaScriptCore.xcodeproj/project.pbxproj:
2629
2630 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2631
2632         Reviewed by Oliver Hunt.
2633
2634         Ordering of branch operands in MacroAssembler in unnecessarily  inconsistent.
2635
2636         je, jg etc take an immediate operand as the second argument, but for the
2637         equality branches (je, jne) the immediate operand was the first argument.  This
2638         was unnecessarily inconsistent.  Change je, jne methods to take the immediate
2639         as the second argument.
2640
2641         https://bugs.webkit.org/show_bug.cgi?id=22703
2642
2643         * assembler/MacroAssembler.h:
2644         (JSC::MacroAssembler::je32):
2645         (JSC::MacroAssembler::jne32):
2646         * jit/JIT.cpp:
2647         (JSC::JIT::compileOpStrictEq):
2648         * wrec/WRECGenerator.cpp:
2649         (JSC::WREC::Generator::generateEnter):
2650         (JSC::WREC::Generator::generateNonGreedyQuantifier):
2651         (JSC::WREC::Generator::generateGreedyQuantifier):
2652         (JSC::WREC::Generator::generatePatternCharacterPair):
2653         (JSC::WREC::Generator::generatePatternCharacter):
2654         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
2655         (JSC::WREC::Generator::generateCharacterClassInverted):
2656         (JSC::WREC::Generator::generateAssertionBOL):
2657         (JSC::WREC::Generator::generateAssertionWordBoundary):
2658
2659 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2660
2661         Reviewed by Geoff Garen.
2662
2663         Second tranche of porting JIT.cpp to MacroAssembler interface.
2664
2665         * assembler/MacroAssembler.h:
2666         (JSC::MacroAssembler::mul32):
2667         (JSC::MacroAssembler::jl32):
2668         (JSC::MacroAssembler::jnzSub32):
2669         (JSC::MacroAssembler::joAdd32):
2670         (JSC::MacroAssembler::joMul32):
2671         (JSC::MacroAssembler::jzSub32):
2672         * jit/JIT.cpp:
2673         (JSC::JIT::emitSlowScriptCheck):
2674         (JSC::JIT::privateCompileMainPass):
2675         (JSC::JIT::privateCompileSlowCases):
2676         (JSC::JIT::privateCompileCTIMachineTrampolines):
2677         * jit/JIT.h:
2678         * jit/JITInlineMethods.h:
2679         (JSC::JIT::emitJumpIfNotJSCell):
2680         (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
2681
2682 2008-12-05  David Kilzer  <ddkilzer@apple.com>
2683
2684         Bug 22609: Provide a build-time choice when generating hash tables for properties of built-in DOM objects
2685
2686         <https://bugs.webkit.org/show_bug.cgi?id=22609>
2687         <rdar://problem/6331749>
2688
2689         Reviewed by Darin Adler.
2690
2691         Initial patch by Yosen Lin.  Adapted for ToT WebKit by David Kilzer.
2692
2693         Added back the code that generates a "compact" hash (instead of a
2694         perfect hash) as a build-time option using the
2695         ENABLE(PERFECT_HASH_SIZE) macro as defined in Lookup.h.
2696
2697         * create_hash_table: Rename variables to differentiate perfect hash
2698         values from compact hash values.  Added back code to compute compact
2699         hash tables.  Generate both hash table sizes and emit
2700         conditionalized code based on ENABLE(PERFECT_HASH_SIZE).
2701         * runtime/Lookup.cpp:
2702         (JSC::HashTable::createTable): Added version of createTable() for
2703         use with compact hash tables.
2704         (JSC::HashTable::deleteTable): Updated to work with compact hash
2705         tables.
2706         * runtime/Lookup.h: Defined ENABLE(PERFECT_HASH_SIZE) macro here.
2707         (JSC::HashEntry::initialize): Set m_next to zero when using compact
2708         hash tables.
2709         (JSC::HashEntry::setNext): Added for compact hash tables.
2710         (JSC::HashEntry::next): Added for compact hash tables.
2711         (JSC::HashTable::entry): Added version of entry() for use with
2712         compact hash tables.
2713         * runtime/Structure.cpp:
2714         (JSC::Structure::getEnumerablePropertyNames): Updated to work with
2715         compact hash tables.
2716
2717 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2718
2719         Reviewed by Geoff Garen.
2720
2721         Remove redundant calls to JIT::emitSlowScriptCheck.
2722         This is checked in the hot path, so is not needed on the slow path - and the code
2723         was being planted before the start of the slow case, so was completely unreachable!
2724
2725         * jit/JIT.cpp:
2726         (JSC::JIT::privateCompileSlowCases):
2727
2728 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2729
2730         Reviewed by Geoff Garen.
2731
2732         Move JIT::compileOpStrictEq to MacroAssembler interface.
2733
2734         The rewrite also looks like a small (<1%) performance progression.
2735
2736         https://bugs.webkit.org/show_bug.cgi?id=22697
2737
2738         * jit/JIT.cpp:
2739         (JSC::JIT::compileOpStrictEq):
2740         (JSC::JIT::privateCompileSlowCases):
2741         * jit/JIT.h:
2742         * jit/JITInlineMethods.h:
2743         (JSC::JIT::emitJumpIfJSCell):
2744         (JSC::JIT::emitJumpSlowCaseIfJSCell):
2745
2746 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2747
2748         Reviewed by Geoff Garen.
2749
2750         Remove m_assembler from MacroAssembler::Jump.
2751         Keeping a pointer allowed for some syntactic sugar - "link()" looks nicer
2752         than "link(this)".  But maintaining this doubles the size of Jump, which
2753         is even more unfortunate for the JIT, since there are many large structures
2754         holding JmpSrcs.  Probably best to remove it.
2755
2756         https://bugs.webkit.org/show_bug.cgi?id=22693
2757
2758         * assembler/MacroAssembler.h:
2759         (JSC::MacroAssembler::Jump::Jump):
2760         (JSC::MacroAssembler::Jump::link):
2761         (JSC::MacroAssembler::Jump::linkTo):
2762         (JSC::MacroAssembler::JumpList::link):
2763         (JSC::MacroAssembler::JumpList::linkTo):
2764         (JSC::MacroAssembler::jae32):
2765         (JSC::MacroAssembler::je32):
2766         (JSC::MacroAssembler::je16):
2767         (JSC::MacroAssembler::jg32):
2768         (JSC::MacroAssembler::jge32):
2769         (JSC::MacroAssembler::jl32):
2770         (JSC::MacroAssembler::jle32):
2771         (JSC::MacroAssembler::jnePtr):
2772         (JSC::MacroAssembler::jne32):
2773         (JSC::MacroAssembler::jnset32):
2774         (JSC::MacroAssembler::jset32):
2775         (JSC::MacroAssembler::jump):
2776         (JSC::MacroAssembler::jzSub32):
2777         (JSC::MacroAssembler::joAdd32):
2778         (JSC::MacroAssembler::call):
2779         * wrec/WREC.cpp:
2780         (JSC::WREC::Generator::compileRegExp):
2781         * wrec/WRECGenerator.cpp:
2782         (JSC::WREC::Generator::generateEnter):
2783         (JSC::WREC::Generator::generateBackreferenceQuantifier):
2784         (JSC::WREC::Generator::generateNonGreedyQuantifier):
2785         (JSC::WREC::Generator::generateGreedyQuantifier):
2786         (JSC::WREC::Generator::generatePatternCharacter):
2787         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
2788         (JSC::WREC::Generator::generateCharacterClassInverted):
2789         (JSC::WREC::Generator::generateCharacterClass):
2790         (JSC::WREC::Generator::generateParenthesesAssertion):
2791         (JSC::WREC::Generator::generateParenthesesInvertedAssertion):
2792         (JSC::WREC::Generator::generateParenthesesNonGreedy):
2793         (JSC::WREC::Generator::generateParenthesesResetTrampoline):
2794         (JSC::WREC::Generator::generateAssertionBOL):
2795         (JSC::WREC::Generator::generateAssertionEOL):
2796         (JSC::WREC::Generator::generateAssertionWordBoundary):
2797         (JSC::WREC::Generator::generateBackreference):
2798         (JSC::WREC::Generator::terminateAlternative):
2799         (JSC::WREC::Generator::terminateDisjunction):
2800         * wrec/WRECParser.h:
2801
2802 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
2803
2804         Reviewed by Geoffrey Garen.
2805
2806         Simplify JIT generated checks for timeout code, by moving more work into the C function.
2807         https://bugs.webkit.org/show_bug.cgi?id=22688
2808
2809         * interpreter/Interpreter.cpp:
2810         (JSC::Interpreter::cti_timeout_check):
2811         * interpreter/Interpreter.h:
2812         * jit/JIT.cpp:
2813         (JSC::JIT::emitSlowScriptCheck):
2814
2815 2008-12-05  Sam Weinig  <sam@webkit.org>
2816
2817         Reviewed by Geoffrey Garen.
2818
2819         Encapsulate access to jump tables in the CodeBlock in preparation
2820         of moving them to a rare data structure.
2821
2822         * bytecode/CodeBlock.cpp:
2823         (JSC::CodeBlock::dump):
2824         (JSC::CodeBlock::shrinkToFit):
2825         * bytecode/CodeBlock.h:
2826         (JSC::CodeBlock::numberOfImmediateSwitchJumpTables):
2827         (JSC::CodeBlock::addImmediateSwitchJumpTable):
2828         (JSC::CodeBlock::immediateSwitchJumpTable):
2829         (JSC::CodeBlock::numberOfCharacterSwitchJumpTables):
2830         (JSC::CodeBlock::addCharacterSwitchJumpTable):
2831         (JSC::CodeBlock::characterSwitchJumpTable):
2832         (JSC::CodeBlock::numberOfStringSwitchJumpTables):
2833         (JSC::CodeBlock::addStringSwitchJumpTable):
2834         (JSC::CodeBlock::stringSwitchJumpTable):
2835         * bytecompiler/BytecodeGenerator.cpp:
2836         (JSC::BytecodeGenerator::generate):
2837         (JSC::BytecodeGenerator::endSwitch):
2838         * interpreter/Interpreter.cpp:
2839         (JSC::Interpreter::privateExecute):
2840         (JSC::Interpreter::cti_op_switch_imm):
2841         (JSC::Interpreter::cti_op_switch_char):
2842         (JSC::Interpreter::cti_op_switch_string):
2843         * jit/JIT.cpp:
2844         (JSC::JIT::privateCompileMainPass):
2845
2846 2008-12-05  Adam Roben  <aroben@apple.com>
2847
2848         Windows build fix after r39020
2849
2850         * jit/JITInlineMethods.h:
2851         (JSC::JIT::restoreArgumentReference):
2852         (JSC::JIT::restoreArgumentReferenceForTrampoline):
2853         Add some apparently-missing __.
2854
2855 2008-12-04  Geoffrey Garen  <ggaren@apple.com>
2856
2857         Reviewed by Darin Adler.
2858         
2859         https://bugs.webkit.org/show_bug.cgi?id=22673
2860         
2861         Added support for the assertion (?=) and inverted assertion (?!) atoms
2862         in WREC.
2863
2864         * wrec/WRECGenerator.cpp:
2865         (JSC::WREC::Generator::generateParenthesesAssertion):
2866         (JSC::WREC::Generator::generateParenthesesInvertedAssertion): Split the
2867         old (unused) generateParentheses into these two functions, with more
2868         limited capabilities.
2869         
2870         * wrec/WRECGenerator.h:
2871         (JSC::WREC::Generator::): Moved an enum to the top of the class definition,
2872         to match the WebKit style, and removed a defunct comment.
2873
2874         * wrec/WRECParser.cpp:
2875         (JSC::WREC::Parser::parseParentheses):
2876         (JSC::WREC::Parser::consumeParenthesesType):
2877         * wrec/WRECParser.h:
2878         (JSC::WREC::Parser::): Added support for parsing (?=) and (?!).
2879
2880 2008-12-05  Simon Hausmann  <simon.hausmann@nokia.com>
2881
2882         Rubber-stamped by Tor Arne Vestbø.
2883
2884         Disable the JIT for the Qt build alltogether again, after observing
2885         more miscompilations in a wider range of newer gcc versions.
2886
2887         * JavaScriptCore.pri:
2888
2889 2008-12-05  Simon Hausmann  <simon.hausmann@nokia.com>
2890
2891         Reviewed by Tor Arne Vestbø.
2892
2893         Disable the JIT for the Qt build on Linux unless gcc is >= 4.2,
2894         due to miscompilations.
2895
2896         * JavaScriptCore.pri:
2897
2898 2008-12-04  Gavin Barraclough  <barraclough@apple.com>
2899
2900         Reviewed by Geoff Garen.
2901
2902         Start porting the JIT to use the MacroAssembler.
2903
2904         https://bugs.webkit.org/show_bug.cgi?id=22671
2905         No change in performance.
2906
2907         * assembler/MacroAssembler.h:
2908         (JSC::MacroAssembler::Jump::operator X86Assembler::JmpSrc):
2909         (JSC::MacroAssembler::add32):
2910         (JSC::MacroAssembler::and32):
2911         (JSC::MacroAssembler::lshift32):
2912         (JSC::MacroAssembler::rshift32):
2913         (JSC::MacroAssembler::storePtr):
2914         (JSC::MacroAssembler::store32):
2915         (JSC::MacroAssembler::poke):
2916         (JSC::MacroAssembler::move):
2917         (JSC::MacroAssembler::compareImm32ForBranchEquality):
2918         (JSC::MacroAssembler::jnePtr):
2919         (JSC::MacroAssembler::jnset32):
2920         (JSC::MacroAssembler::jset32):
2921         (JSC::MacroAssembler::jzeroSub32):
2922         (JSC::MacroAssembler::joverAdd32):
2923         (JSC::MacroAssembler::call):
2924         * assembler/X86Assembler.h:
2925         (JSC::X86Assembler::shll_i8r):
2926         * jit/JIT.cpp:
2927         (JSC::JIT::privateCompileMainPass):
2928         (JSC::JIT::privateCompile):
2929         (JSC::JIT::privateCompileCTIMachineTrampolines):
2930         * jit/JIT.h:
2931         * jit/JITArithmetic.cpp:
2932         (JSC::JIT::compileBinaryArithOp):
2933         * jit/JITInlineMethods.h:
2934         (JSC::JIT::emitGetVirtualRegister):
2935         (JSC::JIT::emitPutCTIArg):
2936         (JSC::JIT::emitPutCTIArgConstant):
2937         (JSC::JIT::emitGetCTIArg):
2938         (JSC::JIT::emitPutCTIArgFromVirtualRegister):
2939         (JSC::JIT::emitPutCTIParam):
2940         (JSC::JIT::emitGetCTIParam):
2941         (JSC::JIT::emitPutToCallFrameHeader):
2942         (JSC::JIT::emitPutImmediateToCallFrameHeader):
2943         (JSC::JIT::emitGetFromCallFrameHeader):
2944         (JSC::JIT::emitPutVirtualRegister):
2945         (JSC::JIT::emitInitRegister):
2946         (JSC::JIT::emitNakedCall):
2947         (JSC::JIT::restoreArgumentReference):
2948         (JSC::JIT::restoreArgumentReferenceForTrampoline):
2949         (JSC::JIT::emitCTICall):
2950         (JSC::JIT::checkStructure):
2951         (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
2952         (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
2953         (JSC::JIT::emitJumpSlowCaseIfNotImmNums):
2954         (JSC::JIT::emitFastArithDeTagImmediate):
2955         (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
2956         (JSC::JIT::emitFastArithReTagImmediate):
2957         (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
2958         (JSC::JIT::emitFastArithImmToInt):
2959         (JSC::JIT::emitFastArithIntToImmOrSlowCase):
2960         (JSC::JIT::emitFastArithIntToImmNoCheck):
2961         (JSC::JIT::emitTagAsBoolImmediate):
2962         * jit/JITPropertyAccess.cpp:
2963         (JSC::JIT::privateCompilePutByIdTransition):
2964
2965 2008-12-04  Geoffrey Garen  <ggaren@apple.com>
2966
2967         Reviewed by Oliver Hunt.
2968         
2969         Some refactoring for generateGreedyQuantifier.
2970         
2971         SunSpider reports no change (possibly a 0.3% speedup).
2972
2973         * wrec/WRECGenerator.cpp:
2974         (JSC::WREC::Generator::generateGreedyQuantifier): Clarified label
2975         meanings and unified some logic to simplify things.
2976
2977         * wrec/WRECParser.h:
2978         (JSC::WREC::Parser::parseAlternative): Added a version of parseAlternative
2979         that can jump to a Label, instead of a JumpList, upon failure. (Eventually,
2980         when we have a true Label class, this will be redundant.) This makes
2981         things easier for generateGreedyQuantifier, because it can avoid
2982         explicitly linking things.
2983
2984 2008-12-04  Simon Hausmann  <simon.hausmann@nokia.com>
2985
2986         Reviewed by Holger Freyther.
2987
2988         Fix crashes in the Qt build on Linux/i386 with non-executable memory
2989         by enabling TCSystemAlloc and the PROT_EXEC flag for mmap.
2990
2991         * JavaScriptCore.pri: Enable the use of TCSystemAlloc if the JIT is
2992         enabled.
2993         * wtf/TCSystemAlloc.cpp: Extend the PROT_EXEC permissions to
2994         PLATFORM(QT).
2995
2996 2008-12-04  Simon Hausmann  <simon.hausmann@nokia.com>
2997
2998         Reviewed by Tor Arne Vestbø.
2999
3000         Enable ENABLE_JIT_OPTIMIZE_CALL, ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
3001         and ENABLE_JIT_OPTIMIZE_ARITHMETIC, as suggested by Niko.
3002
3003         * JavaScriptCore.pri: 
3004
3005 2008-12-04  Kent Hansen  <khansen@trolltech.com>
3006
3007         Reviewed by Simon Hausmann.
3008
3009         Enable the JSC jit for the Qt build by default for release builds on
3010         linux-g++ and win32-msvc.
3011
3012         * JavaScriptCore.pri:
3013
3014 2008-12-04  Gavin Barraclough  <barraclough@apple.com>
3015
3016         Reviewed by Oliver Hunt.
3017
3018         Allow JIT to function without property access repatching and arithmetic optimizations.
3019         Controlled by ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS and ENABLE_JIT_OPTIMIZE_ARITHMETIC switches.
3020
3021         https://bugs.webkit.org/show_bug.cgi?id=22643
3022
3023         * JavaScriptCore.xcodeproj/project.pbxproj:
3024         * jit/JIT.cpp:
3025         (JSC::JIT::privateCompileMainPass):
3026         (JSC::JIT::privateCompileSlowCases):
3027         * jit/JIT.h:
3028         * jit/JITArithmetic.cpp: Copied from jit/JIT.cpp.
3029         (JSC::JIT::compileBinaryArithOp):
3030         (JSC::JIT::compileBinaryArithOpSlowCase):
3031         * jit/JITPropertyAccess.cpp: Copied from jit/JIT.cpp.
3032         (JSC::JIT::compileGetByIdHotPath):
3033         (JSC::JIT::compileGetByIdSlowCase):
3034         (JSC::JIT::compilePutByIdHotPath):
3035         (JSC::JIT::compilePutByIdSlowCase):
3036         (JSC::resizePropertyStorage):
3037         (JSC::transitionWillNeedStorageRealloc):
3038         (JSC::JIT::privateCompilePutByIdTransition):
3039         (JSC::JIT::patchGetByIdSelf):
3040         (JSC::JIT::patchPutByIdReplace):
3041         (JSC::JIT::privateCompilePatchGetArrayLength):
3042         * wtf/Platform.h:
3043
3044 2008-12-03  Geoffrey Garen  <ggaren@apple.com>
3045
3046         Reviewed by Oliver Hunt.
3047         
3048         Optimized sequences of characters in regular expressions by comparing
3049         two characters at a time.
3050         
3051         1-2% speedup on SunSpider, 19-25% speedup on regexp-dna.
3052
3053         * assembler/MacroAssembler.h:
3054         (JSC::MacroAssembler::load32):
3055         (JSC::MacroAssembler::jge32): Filled out a few more macro methods.
3056
3057         * assembler/X86Assembler.h:
3058         (JSC::X86Assembler::movl_mr): Added a verion of movl_mr that operates
3059         without an offset, to allow the macro assembler to optmize for that case.
3060         
3061         * wrec/WREC.cpp:
3062         (JSC::WREC::Generator::compileRegExp): Test the saved value of index
3063         instead of the index register when checking for "end of input." The
3064         index register doesn't increment by 1 in an orderly fashion, so testing
3065         it for == "end of input" is not valid.
3066         
3067         Also, jump all the way to "return failure" upon reaching "end of input,"
3068         instead of executing the next alternative. This is more logical, and
3069         it's a slight optimization in the case of an expression with many alternatives.
3070
3071         * wrec/WRECGenerator.cpp:
3072         (JSC::WREC::Generator::generateIncrementIndex): Added support for
3073         jumping to a failure label in the case where the index has reached "end
3074         of input."
3075
3076         (JSC::WREC::Generator::generatePatternCharacterSequence):
3077         (JSC::WREC::Generator::generatePatternCharacterPair): This is the
3078         optmization. It's basically like generatePatternCharacter, but it runs two
3079         characters at a time.
3080         
3081         (JSC::WREC::Generator::generatePatternCharacter): Changed to use isASCII,
3082         since it's clearer than comparing to a magic hex value.
3083         
3084         * wrec/WRECGenerator.h:
3085
3086 2008-12-03  Gavin Barraclough  <barraclough@apple.com>
3087
3088         Reviewed by Cameron Zwarich.
3089
3090         Allow JIT to operate without the call-repatching optimization.
3091         Controlled by ENABLE(JIT_OPTIMIZE_CALL), defaults on, disabling
3092         this leads to significant performance regression.
3093
3094         https://bugs.webkit.org/show_bug.cgi?id=22639
3095
3096         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3097         * JavaScriptCore.xcodeproj/project.pbxproj:
3098         * jit/JIT.cpp:
3099         (JSC::JIT::privateCompileSlowCases):
3100         * jit/JIT.h:
3101         * jit/JITCall.cpp: Copied from jit/JIT.cpp.
3102         (JSC::JIT::compileOpCallInitializeCallFrame):
3103         (JSC::JIT::compileOpCallSetupArgs):
3104         (JSC::JIT::compileOpCallEvalSetupArgs):
3105         (JSC::JIT::compileOpConstructSetupArgs):
3106         (JSC::JIT::compileOpCall):
3107         (JSC::JIT::compileOpCallSlowCase):
3108         (JSC::unreachable):
3109         * jit/JITInlineMethods.h: Copied from jit/JIT.cpp.
3110         (JSC::JIT::checkStructure):
3111         (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
3112         (JSC::JIT::emitTagAsBoolImmediate):
3113         * wtf/Platform.h:
3114
3115 2008-12-03  Eric Seidel  <eric@webkit.org>
3116
3117         Rubber-stamped by David Hyatt.
3118
3119         Make HAVE_ACCESSIBILITY only define if !defined
3120
3121         * wtf/Platform.h:
3122
3123 2008-12-03  Sam Weinig  <sam@webkit.org>
3124
3125         Fix build.
3126
3127         * assembler/X86Assembler.h:
3128         (JSC::X86Assembler::orl_i32r):
3129
3130 2008-12-03  Sam Weinig  <sam@webkit.org>
3131
3132         Reviewed by Geoffrey Garen.
3133
3134         Remove shared AssemblerBuffer 1MB buffer and instead give AssemblerBuffer
3135         an 256 byte inline capacity.
3136
3137         1% progression on Sunspider.
3138
3139         * assembler/AssemblerBuffer.h:
3140         (JSC::AssemblerBuffer::AssemblerBuffer):
3141         (JSC::AssemblerBuffer::~AssemblerBuffer):
3142         (JSC::AssemblerBuffer::grow):
3143         * assembler/MacroAssembler.h:
3144         (JSC::MacroAssembler::MacroAssembler):
3145         * assembler/X86Assembler.h:
3146         (JSC::X86Assembler::X86Assembler):
3147         * interpreter/Interpreter.cpp:
3148         (JSC::Interpreter::Interpreter):
3149         * interpreter/Interpreter.h:
3150         * jit/JIT.cpp:
3151         (JSC::JIT::JIT):
3152         * parser/Nodes.cpp:
3153         (JSC::RegExpNode::emitBytecode):
3154         * runtime/RegExp.cpp:
3155         (JSC::RegExp::RegExp):
3156         (JSC::RegExp::create):
3157         * runtime/RegExp.h:
3158         * runtime/RegExpConstructor.cpp:
3159         (JSC::constructRegExp):
3160         * runtime/RegExpPrototype.cpp:
3161         (JSC::regExpProtoFuncCompile):
3162         * runtime/StringPrototype.cpp:
3163         (JSC::stringProtoFuncMatch):
3164         (JSC::stringProtoFuncSearch):
3165         * wrec/WREC.cpp:
3166         (JSC::WREC::Generator::compileRegExp):
3167         * wrec/WRECGenerator.h:
3168         (JSC::WREC::Generator::Generator):
3169         * wrec/WRECParser.h:
3170         (JSC::WREC::Parser::Parser):
3171
3172 2008-12-03  Geoffrey Garen  <ggaren@apple.com>
3173
3174         Reviewed by Oliver Hunt, with help from Gavin Barraclough.
3175         
3176         orl_i32r was actually coded as an 8bit OR. So, I renamed orl_i32r to
3177         orl_i8r, changed all orl_i32r clients to use orl_i8r, and then added
3178         a new orl_i32r that actually does a 32bit OR.
3179         
3180         (32bit OR is currently unused, but a patch I'm working on uses it.)
3181
3182         * assembler/MacroAssembler.h:
3183         (JSC::MacroAssembler::or32): Updated to choose between 8bit and 32bit OR.
3184
3185         * assembler/X86Assembler.h:
3186         (JSC::X86Assembler::orl_i8r): The old orl_i32r.
3187         (JSC::X86Assembler::orl_i32r): The new orl_i32r.
3188         
3189         * jit/JIT.cpp:
3190         (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
3191         (JSC::JIT::emitTagAsBoolImmediate): Use orl_i8r, since we're ORing 8bit
3192         values.
3193
3194 2008-12-03  Dean Jackson  <dino@apple.com>
3195
3196         Reviewed by Dan Bernstein.
3197
3198         Helper functions for turn -> degrees.
3199         https://bugs.webkit.org/show_bug.cgi?id=22497
3200
3201         * wtf/MathExtras.h:
3202         (turn2deg):
3203         (deg2turn):
3204
3205 2008-12-02  Cameron Zwarich  <zwarich@apple.com>
3206
3207         Reviewed by Geoff Garen.
3208
3209         Bug 22504: Crashes during code generation occur due to refing of ignoredResult()
3210         <https://bugs.webkit.org/show_bug.cgi?id=22504>
3211
3212         Since ignoredResult() was implemented by casting 1 to a RegisterID*, any
3213         attempt to ref ignoredResult() results in a crash. This will occur in
3214         code generation of a function body where a node emits another node with
3215         the dst that was passed to it, and then refs the returned RegisterID*.
3216
3217         To fix this problem, make ignoredResult() a member function of
3218         BytecodeGenerator that simply returns a pointe to a fixed RegisterID
3219         member of BytecodeGenerator.
3220
3221         * bytecompiler/BytecodeGenerator.h:
3222         (JSC::BytecodeGenerator::ignoredResult):
3223         * bytecompiler/RegisterID.h:
3224         * parser/Nodes.cpp:
3225         (JSC::NullNode::emitBytecode):
3226         (JSC::BooleanNode::emitBytecode):
3227         (JSC::NumberNode::emitBytecode):
3228         (JSC::StringNode::emitBytecode):
3229         (JSC::RegExpNode::emitBytecode):
3230         (JSC::ThisNode::emitBytecode):
3231         (JSC::ResolveNode::emitBytecode):
3232         (JSC::ObjectLiteralNode::emitBytecode):
3233         (JSC::PostfixResolveNode::emitBytecode):
3234         (JSC::PostfixBracketNode::emitBytecode):
3235         (JSC::PostfixDotNode::emitBytecode):
3236         (JSC::DeleteValueNode::emitBytecode):
3237         (JSC::VoidNode::emitBytecode):
3238         (JSC::TypeOfResolveNode::emitBytecode):
3239         (JSC::TypeOfValueNode::emitBytecode):
3240         (JSC::PrefixResolveNode::emitBytecode):
3241         (JSC::AssignResolveNode::emitBytecode):
3242         (JSC::CommaNode::emitBytecode):
3243         (JSC::ForNode::emitBytecode):
3244         (JSC::ForInNode::emitBytecode):
3245         (JSC::ReturnNode::emitBytecode):
3246         (JSC::ThrowNode::emitBytecode):
3247         (JSC::FunctionBodyNode::emitBytecode):
3248         (JSC::FuncDeclNode::emitBytecode):
3249
3250 2008-12-02  Geoffrey Garen  <ggaren@apple.com>
3251
3252         Reviewed by Cameron Zwarich.
3253         
3254         Fixed https://bugs.webkit.org/show_bug.cgi?id=22537
3255         REGRESSION (r38745): Assertion failure in jsSubstring() at ge.com
3256
3257         The bug was that index would become greater than length, so our
3258         "end of input" checks, which all check "index == length", would fail.
3259         
3260         The solution is to check for end of input before incrementing index,
3261         to ensure that index is always <= length.
3262         
3263         As a side benefit, generateJumpIfEndOfInput can now use je instead of
3264         jg, which should be slightly faster.
3265
3266         * wrec/WREC.cpp:
3267         (JSC::WREC::Generator::compileRegExp):
3268         * wrec/WRECGenerator.cpp:
3269         (JSC::WREC::Generator::generateJumpIfEndOfInput):
3270
3271 2008-12-02  Gavin Barraclough  <barraclough@apple.com>
3272
3273         Reviewed by Geoffrey Garen.
3274
3275         Plant shift right immediate instructions, which are awesome.
3276         https://bugs.webkit.org/show_bug.cgi?id=22610
3277         ~5% on the v8-crypto test.
3278
3279         * jit/JIT.cpp:
3280         (JSC::JIT::privateCompileMainPass):
3281         (JSC::JIT::privateCompileSlowCases):
3282
3283 2008-12-02  Geoffrey Garen  <ggaren@apple.com>
3284
3285         Reviewed by Sam Weinig.
3286         
3287         Cleaned up SegmentedVector by abstracting segment access into helper
3288         functions.
3289         
3290         SunSpider reports no change.
3291
3292         * bytecompiler/SegmentedVector.h:
3293         (JSC::SegmentedVector::SegmentedVector):
3294         (JSC::SegmentedVector::~SegmentedVector):
3295         (JSC::SegmentedVector::size):
3296         (JSC::SegmentedVector::at):
3297         (JSC::SegmentedVector::operator[]):
3298         (JSC::SegmentedVector::last):
3299         (JSC::SegmentedVector::append):
3300         (JSC::SegmentedVector::removeLast):
3301         (JSC::SegmentedVector::grow):
3302         (JSC::SegmentedVector::clear):
3303         (JSC::SegmentedVector::deleteAllSegments):
3304         (JSC::SegmentedVector::segmentFor):
3305         (JSC::SegmentedVector::subscriptFor):
3306         (JSC::SegmentedVector::ensureSegmentsFor):
3307         (JSC::SegmentedVector::ensureSegment):
3308
3309 2008-12-02  Geoffrey Garen  <ggaren@apple.com>
3310
3311         Reviewed by Geoffrey Garen. (Patch by Cameron Zwarich <zwarich@apple.com>.)
3312         
3313         Fixed https://bugs.webkit.org/show_bug.cgi?id=22482
3314         REGRESSION (r37991): Occasionally see "Scene rendered incorrectly"
3315         message when running the V8 Raytrace benchmark
3316         
3317         Rolled out r37991. It didn't properly save xmm0, which is caller-save,
3318         before calling helper functions.
3319         
3320         SunSpider and v8 benchmarks show little change -- possibly a .2%
3321         SunSpider regression, possibly a .2% v8 benchmark speedup.
3322
3323         * assembler/X86Assembler.h:
3324         (JSC::X86Assembler::):
3325         * bytecode/CodeBlock.cpp:
3326         (JSC::CodeBlock::dump):
3327         * bytecode/Instruction.h:
3328         (JSC::Instruction::):
3329         * bytecompiler/BytecodeGenerator.cpp:
3330         (JSC::BytecodeGenerator::emitUnaryOp):
3331         * bytecompiler/BytecodeGenerator.h:
3332         (JSC::BytecodeGenerator::emitToJSNumber):
3333         (JSC::BytecodeGenerator::emitTypeOf):
3334         (JSC::BytecodeGenerator::emitGetPropertyNames):
3335         * interpreter/Interpreter.cpp:
3336         (JSC::Interpreter::privateExecute):
3337         * interpreter/Interpreter.h:
3338         * jit/JIT.cpp:
3339         (JSC::JIT::privateCompileMainPass):
3340         (JSC::JIT::privateCompileSlowCases):
3341         * jit/JIT.h:
3342         * parser/Nodes.cpp:
3343         (JSC::UnaryOpNode::emitBytecode):
3344         (JSC::BinaryOpNode::emitBytecode):
3345         (JSC::EqualNode::emitBytecode):
3346         * parser/ResultType.h:
3347         (JSC::ResultType::isReusable):
3348         (JSC::ResultType::mightBeNumber):
3349         * runtime/JSNumberCell.h:
3350
3351 2008-12-01  Gavin Barraclough  <barraclough@apple.com>
3352
3353         Reviewed by Geoffrey Garen.
3354
3355         Remove unused (sampling only, and derivable) argument to JIT::emitCTICall.
3356         https://bugs.webkit.org/show_bug.cgi?id=22587
3357
3358         * jit/JIT.cpp:
3359         (JSC::JIT::emitCTICall):
3360         (JSC::JIT::compileOpCall):
3361         (JSC::JIT::emitSlowScriptCheck):
3362         (JSC::JIT::compileBinaryArithOpSlowCase):
3363         (JSC::JIT::privateCompileMainPass):
3364         (JSC::JIT::privateCompileSlowCases):
3365         (JSC::JIT::privateCompile):
3366         * jit/JIT.h:
3367
3368 2008-12-02  Dimitri Glazkov  <dglazkov@chromium.org>
3369
3370         Reviewed by Eric Seidel.
3371         
3372         Fix the inheritance chain for JSFunction.
3373
3374         * runtime/JSFunction.cpp:
3375         (JSC::JSFunction::info): Add InternalFunction::info as parent class
3376
3377 2008-12-02  Simon Hausmann  <hausmann@webkit.org>
3378
3379         Reviewed by Tor Arne Vestbø.
3380
3381         Fix ability to include JavaScriptCore.pri from other .pro files.
3382
3383         * JavaScriptCore.pri: Moved -O3 setting into the .pro files.
3384         * JavaScriptCore.pro:
3385         * jsc.pro:
3386
3387 2008-12-01  Geoffrey Garen  <ggaren@apple.com>
3388
3389         Reviewed by Cameron Zwarich, with help from Gavin Barraclough.
3390         
3391         Fixed https://bugs.webkit.org/show_bug.cgi?id=22583.
3392
3393         Refactored regular expression parsing to parse sequences of characters
3394         as a single unit, in preparation for optimizing sequences of characters.
3395         
3396         SunSpider reports no change.
3397
3398         * JavaScriptCore.xcodeproj/project.pbxproj:
3399         * wrec/Escapes.h: Added. Set of classes for representing an escaped
3400         token in a pattern.
3401
3402         * wrec/Quantifier.h:
3403         (JSC::WREC::Quantifier::Quantifier): Simplified this constructor slightly,
3404         to match the new Escape constructor.
3405
3406         * wrec/WRECGenerator.cpp:
3407         (JSC::WREC::Generator::generatePatternCharacterSequence):
3408         * wrec/WRECGenerator.h: Added an interface for generating a sequence
3409         of pattern characters at a time. It doesn't do anything special yet.
3410
3411         * wrec/WRECParser.cpp:
3412         (JSC::WREC::Parser::consumeGreedyQuantifier):
3413         (JSC::WREC::Parser::consumeQuantifier): Renamed "parse" to "consume" in
3414         these functions, to match "consumeEscape."
3415
3416         (JSC::WREC::Parser::parsePatternCharacterSequence): New function for
3417         iteratively aggregating a sequence of characters in a pattern.
3418
3419         (JSC::WREC::Parser::parseCharacterClassQuantifier):
3420         (JSC::WREC::Parser::parseBackreferenceQuantifier): Renamed "parse" to
3421         "consume" in these functions, to match "consumeEscape."
3422
3423         (JSC::WREC::Parser::parseCharacterClass): Refactored to use the common
3424         escape processing code in consumeEscape.
3425
3426         (JSC::WREC::Parser::parseEscape): Refactored to use the common
3427         escape processing code in consumeEscape.
3428
3429         (JSC::WREC::Parser::consumeEscape): Factored escaped token processing
3430         into a common function, since we were doing this in a few places.
3431
3432         (JSC::WREC::Parser::parseTerm): Refactored to use the common
3433         escape processing code in consumeEscape.
3434
3435         * wrec/WRECParser.h:
3436         (JSC::WREC::Parser::consumeOctal): Refactored to use a helper function
3437         for reading a digit.
3438
3439 2008-12-01  Cameron Zwarich  <zwarich@apple.com>
3440
3441         Reviewed by Oliver Hunt.
3442
3443         Bug 20340: SegmentedVector segment allocations can lead to unsafe use of temporary registers
3444         <https://bugs.webkit.org/show_bug.cgi?id=20340>
3445
3446         SegmentedVector currently frees segments and reallocates them when used
3447         as a stack. This can lead to unsafe use of pointers into freed segments.
3448
3449         In order to fix this problem, SegmentedVector will be changed to only
3450         grow and never shrink. Also, rename the reserveCapacity() member
3451         function to grow() to match the actual usage in BytecodeGenerator, where
3452         this function is used to allocate a group of registers at once, rather
3453         than merely saving space for them.
3454
3455         * bytecompiler/BytecodeGenerator.cpp:
3456         (JSC::BytecodeGenerator::BytecodeGenerator): Use grow() instead of 
3457         reserveCapacity().
3458         * bytecompiler/SegmentedVector.h:
3459         (JSC::SegmentedVector::SegmentedVector):
3460         (JSC::SegmentedVector::last):
3461         (JSC::SegmentedVector::append):
3462         (JSC::SegmentedVector::removeLast):
3463         (JSC::SegmentedVector::grow): Renamed from reserveCapacity().
3464         (JSC::SegmentedVector::clear):
3465
3466 2008-12-01  Mark Rowe  <mrowe@apple.com>
3467
3468         Rubber-stamped by Anders Carlsson.
3469
3470         Disable WREC for x86_64 since memory allocated by the system allocator is not marked executable,
3471         which causes 64-bit debug builds to crash.  Once we have a dedicated allocator for executable
3472         memory we can turn this back on.
3473
3474         * wtf/Platform.h:
3475
3476 2008-12-01  Antti Koivisto  <antti@apple.com>
3477
3478         Reviewed by Maciej Stachowiak.
3479         
3480         Restore inline buffer after vector is shrunk back below its inline capacity.
3481
3482         * wtf/Vector.h:
3483         (WTF::):
3484         (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
3485         (WTF::::shrinkCapacity):
3486
3487 2008-11-30  Antti Koivisto  <antti@apple.com>
3488
3489         Reviewed by Mark Rowe.
3490         
3491         Try to return free pages in the current thread cache too.
3492
3493         * wtf/FastMalloc.cpp:
3494         (WTF::TCMallocStats::releaseFastMallocFreeMemory):
3495
3496 2008-12-01  David Levin  <levin@chromium.org>
3497
3498         Reviewed by Alexey Proskuryakov.
3499
3500         https://bugs.webkit.org/show_bug.cgi?id=22567
3501         Make HashTable work as expected with respect to threads. Specifically, it has class-level
3502         thread safety and constant methods work on constant objects without synchronization.
3503         
3504         No observable change in behavior, so no test. This only affects debug builds.
3505
3506         * wtf/HashTable.cpp:
3507         (WTF::hashTableStatsMutex):
3508         (WTF::HashTableStats::~HashTableStats):
3509         (WTF::HashTableStats::recordCollisionAtCount):
3510         Guarded variable access with a mutex.
3511
3512         * wtf/HashTable.h:
3513         (WTF::::lookup):
3514         (WTF::::lookupForWriting):
3515         (WTF::::fullLookupForWriting):
3516         (WTF::::add):
3517         (WTF::::reinsert):
3518         (WTF::::remove):
3519         (WTF::::rehash):
3520         Changed increments of static variables to use atomicIncrement.
3521
3522         (WTF::::invalidateIterators):
3523         (WTF::addIterator):
3524         (WTF::removeIterator):
3525         Guarded mutable access with a mutex.
3526
3527 2008-11-29  Gavin Barraclough  <barraclough@apple.com>
3528
3529         Reviewed by Cameron Zwarich.
3530
3531         Enable WREC on PLATFORM(X86_64).  This change predominantly requires changes to the
3532         WREC::Generator::generateEnter method to support the x86-64 ABI, and addition of
3533         support for a limited number of quadword operations in the X86Assembler.
3534
3535         This patch will cause the JS heap to be allocated with RWX permissions on 64-bit Mac
3536         platforms.  This is a regression with respect to previous 64-bit behaviour, but is no
3537         more permissive than on 32-bit builds.  This issue should be addressed at some point.
3538         (This is tracked by bug #21783.)
3539
3540         https://bugs.webkit.org/show_bug.cgi?id=22554
3541         Greater than 4x speedup on regexp-dna, on x86-64.
3542
3543         * assembler/MacroAssembler.h:
3544         (JSC::MacroAssembler::addPtr):
3545         (JSC::MacroAssembler::loadPtr):
3546         (JSC::MacroAssembler::storePtr):
3547         (JSC::MacroAssembler::pop):
3548         (JSC::MacroAssembler::push):
3549         (JSC::MacroAssembler::move):
3550         * assembler/X86Assembler.h:
3551         (JSC::X86Assembler::):
3552         (JSC::X86Assembler::movq_rr):
3553         (JSC::X86Assembler::addl_i8m):
3554         (JSC::X86Assembler::addl_i32r):
3555         (JSC::X86Assembler::addq_i8r):
3556         (JSC::X86Assembler::addq_i32r):
3557         (JSC::X86Assembler::movq_mr):
3558         (JSC::X86Assembler::movq_rm):
3559         * wrec/WREC.h:
3560         * wrec/WRECGenerator.cpp:
3561         (JSC::WREC::Generator::generateEnter):
3562         (JSC::WREC::Generator::generateReturnSuccess):
3563         (JSC::WREC::Generator::generateReturnFailure):
3564         * wtf/Platform.h:
3565         * wtf/TCSystemAlloc.cpp:
3566
3567 2008-12-01  Cameron Zwarich  <zwarich@apple.com>
3568
3569         Reviewed by Sam Weinig.
3570
3571         Preliminary work for bug 20340: SegmentedVector segment allocations can lead to unsafe use of temporary registers
3572         <https://bugs.webkit.org/show_bug.cgi?id=20340>
3573
3574         SegmentedVector currently frees segments and reallocates them when used
3575         as a stack. This can lead to unsafe use of pointers into freed segments.
3576
3577         In order to fix this problem, SegmentedVector will be changed to only
3578         grow and never shrink, with the sole exception of clearing all of its
3579         data, a capability that is required by Lexer. This patch changes the
3580         public interface to only allow for these capabilities.
3581
3582         * bytecompiler/BytecodeGenerator.cpp:
3583         (JSC::BytecodeGenerator::BytecodeGenerator): Use reserveCapacity()
3584         instead of resize() for m_globals and m_parameters.
3585         * bytecompiler/SegmentedVector.h:
3586         (JSC::SegmentedVector::resize): Removed.
3587         (JSC::SegmentedVector::reserveCapacity): Added.
3588         (JSC::SegmentedVector::clear): Added.
3589         (JSC::SegmentedVector::shrink): Removed.
3590         (JSC::SegmentedVector::grow): Removed.
3591         * parser/Lexer.cpp:
3592         (JSC::Lexer::clear): Use clear() instead of resize(0).
3593
3594 2008-11-30  Sam Weinig  <sam@webkit.org>
3595
3596         Reviewed by Mark Rowe.
3597
3598         Renames jumps to m_jumps in JumpList.
3599
3600         * assembler/MacroAssembler.h:
3601         (JSC::MacroAssembler::JumpList::link):
3602         (JSC::MacroAssembler::JumpList::linkTo):
3603         (JSC::MacroAssembler::JumpList::append):
3604
3605 2008-11-30  Antti Koivisto  <antti@apple.com>
3606
3607         Reviewed by Mark Rowe.
3608         
3609         https://bugs.webkit.org/show_bug.cgi?id=22557
3610         
3611         Report free size in central and thread caches too.
3612
3613         * wtf/FastMalloc.cpp:
3614         (WTF::TCMallocStats::fastMallocStatistics):
3615         * wtf/FastMalloc.h:
3616
3617 2008-11-29  Antti Koivisto  <antti@apple.com>
3618
3619         Reviewed by Dan Bernstein.
3620         
3621         https://bugs.webkit.org/show_bug.cgi?id=22557
3622         Add statistics for JavaScript GC heap.
3623
3624         * JavaScriptCore.exp:
3625         * runtime/Collector.cpp:
3626         (JSC::Heap::objectCount):
3627         (JSC::addToStatistics):
3628         (JSC::Heap::statistics):
3629         * runtime/Collector.h:
3630
3631 2008-11-29  Antti Koivisto  <antti@apple.com>
3632
3633         Fix debug build by adding a stub method.
3634
3635         * wtf/FastMalloc.cpp:
3636         (WTF::fastMallocStatistics):
3637
3638 2008-11-29  Antti Koivisto  <antti@apple.com>
3639
3640         Reviewed by Alexey Proskuryakov.
3641         
3642         https://bugs.webkit.org/show_bug.cgi?id=22557
3643         
3644         Add function for getting basic statistics from FastMalloc.
3645
3646         * JavaScriptCore.exp:
3647         * wtf/FastMalloc.cpp:
3648         (WTF::DLL_Length):
3649         (WTF::TCMalloc_PageHeap::ReturnedBytes):
3650         (WTF::TCMallocStats::fastMallocStatistics):
3651         * wtf/FastMalloc.h:
3652
3653 2008-11-29  Cameron Zwarich  <zwarich@apple.com>
3654
3655         Not reviewed.
3656
3657         The C++ standard does not automatically grant the friendships of an
3658         enclosing class to its nested subclasses, so we should do so explicitly.
3659         This fixes the GCC 4.0 build, although both GCC 4.2 and Visual C++ 2005
3660         accept the incorrect code as it is.
3661
3662         * assembler/MacroAssembler.h:
3663
3664 2008-11-29  Gavin Barraclough  <barraclough@apple.com>
3665
3666         Reviewed by Cameron Zwarich.
3667
3668         Add the class MacroAssembler to provide some abstraction of code generation,
3669         and change WREC to make use of this class, rather than directly accessing
3670         the X86Assembler.
3671
3672         This patch also allows WREC to be compiled without the rest of the JIT enabled.
3673
3674         * JavaScriptCore.xcodeproj/project.pbxproj:
3675         * assembler/MacroAssembler.h: Added.
3676         (JSC::MacroAssembler::):
3677         (JSC::MacroAssembler::MacroAssembler):
3678         (JSC::MacroAssembler::copyCode):
3679         (JSC::MacroAssembler::Address::Address):
3680         (JSC::MacroAssembler::ImplicitAddress::ImplicitAddress):
3681         (JSC::MacroAssembler::BaseIndex::BaseIndex):
3682         (JSC::MacroAssembler::Label::Label):
3683         (JSC::MacroAssembler::Jump::Jump):
3684         (JSC::MacroAssembler::Jump::link):
3685         (JSC::MacroAssembler::Jump::linkTo):
3686         (JSC::MacroAssembler::JumpList::link):
3687         (JSC::MacroAssembler::JumpList::linkTo):
3688         (JSC::MacroAssembler::JumpList::append):
3689         (JSC::MacroAssembler::Imm32::Imm32):
3690         (JSC::MacroAssembler::add32):
3691         (JSC::MacroAssembler::or32):
3692         (JSC::MacroAssembler::sub32):
3693         (JSC::MacroAssembler::loadPtr):
3694         (JSC::MacroAssembler::load32):
3695         (JSC::MacroAssembler::load16):
3696         (JSC::MacroAssembler::storePtr):
3697         (JSC::MacroAssembler::store32):
3698         (JSC::MacroAssembler::pop):
3699         (JSC::MacroAssembler::push):
3700         (JSC::MacroAssembler::peek):
3701         (JSC::MacroAssembler::poke):
3702         (JSC::MacroAssembler::move):
3703         (JSC::MacroAssembler::compareImm32ForBranch):
3704         (JSC::MacroAssembler::compareImm32ForBranchEquality):
3705         (JSC::MacroAssembler::jae32):
3706         (JSC::MacroAssembler::je32):
3707         (JSC::MacroAssembler::je16):
3708         (JSC::MacroAssembler::jg32):
3709         (JSC::MacroAssembler::jge32):
3710         (JSC::MacroAssembler::jl32):
3711         (JSC::MacroAssembler::jle32):
3712         (JSC::MacroAssembler::jne32):
3713         (JSC::MacroAssembler::jump):
3714         (JSC::MacroAssembler::breakpoint):
3715         (JSC::MacroAssembler::ret):
3716         * assembler/X86Assembler.h:
3717         (JSC::X86Assembler::cmpw_rm):
3718         * interpreter/Interpreter.cpp:
3719         (JSC::Interpreter::Interpreter):
3720         * interpreter/Interpreter.h:
3721         (JSC::Interpreter::assemblerBuffer):
3722         * runtime/RegExp.cpp:
3723         (JSC::RegExp::RegExp):
3724         * wrec/WREC.cpp:
3725         (JSC::WREC::Generator::compileRegExp):
3726         * wrec/WREC.h:
3727         * wrec/WRECFunctors.cpp:
3728         (JSC::WREC::GeneratePatternCharacterFunctor::generateAtom):
3729         (JSC::WREC::GenerateCharacterClassFunctor::generateAtom):
3730         (JSC::WREC::GenerateBackreferenceFunctor::generateAtom):
3731         (JSC::WREC::GenerateParenthesesNonGreedyFunctor::generateAtom):
3732         * wrec/WRECFunctors.h:
3733         (JSC::WREC::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
3734         * wrec/WRECGenerator.cpp:
3735         (JSC::WREC::Generator::generateEnter):
3736         (JSC::WREC::Generator::generateReturnSuccess):
3737         (JSC::WREC::Generator::generateSaveIndex):
3738         (JSC::WREC::Generator::generateIncrementIndex):
3739         (JSC::WREC::Generator::generateLoadCharacter):
3740         (JSC::WREC::Generator::generateJumpIfEndOfInput):
3741         (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
3742         (JSC::WREC::Generator::generateReturnFailure):
3743         (JSC::WREC::Generator::generateBacktrack1):
3744         (JSC::WREC::Generator::generateBacktrackBackreference):
3745         (JSC::WREC::Generator::generateBackreferenceQuantifier):
3746         (JSC::WREC::Generator::generateNonGreedyQuantifier):
3747         (JSC::WREC::Generator::generateGreedyQuantifier):
3748         (JSC::WREC::Generator::generatePatternCharacter):
3749         (JSC::WREC::Generator::generateCharacterClassInvertedRange):
3750         (JSC::WREC::Generator::generateCharacterClassInverted):
3751         (JSC::WREC::Generator::generateCharacterClass):
3752         (JSC::WREC::Generator::generateParentheses):
3753         (JSC::WREC::Generator::generateParenthesesNonGreedy):
3754         (JSC::WREC::Generator::generateParenthesesResetTrampoline):
3755         (JSC::WREC::Generator::generateAssertionBOL):
3756         (JSC::WREC::Generator::generateAssertionEOL):
3757         (JSC::WREC::Generator::generateAssertionWordBoundary):
3758         (JSC::WREC::Generator::generateBackreference):
3759         (JSC::WREC::Generator::terminateAlternative):
3760         (JSC::WREC::Generator::terminateDisjunction):
3761         * wrec/WRECGenerator.h:
3762         (JSC::WREC::Generator::Generator):
3763         * wrec/WRECParser.cpp:
3764         (JSC::WREC::Parser::parsePatternCharacterQualifier):
3765         (JSC::WREC::Parser::parseCharacterClassQuantifier):
3766         (JSC::WREC::Parser::parseBackreferenceQuantifier):
3767         (JSC::WREC::Parser::parseParentheses):
3768         (JSC::WREC::Parser::parseCharacterClass):
3769         (JSC::WREC::Parser::parseOctalEscape):
3770         (JSC::WREC::Parser::parseEscape):
3771         (JSC::WREC::Parser::parseTerm):
3772         (JSC::WREC::Parser::parseDisjunction):
3773         * wrec/WRECParser.h:
3774         (JSC::WREC::Parser::Parser):
3775         (JSC::WREC::Parser::parsePattern):
3776         (JSC::WREC::Parser::parseAlternative):
3777         * wtf/Platform.h:
3778
3779 2008-11-28  Simon Hausmann  <hausmann@webkit.org>
3780
3781         Reviewed by Tor Arne Vestbø.
3782
3783         Fix compilation on Windows CE
3784
3785         Port away from the use of errno after calling strtol(), instead
3786         detect conversion errors by checking the result and the stop
3787         position.
3788
3789         * runtime/DateMath.cpp:
3790         (JSC::parseLong):
3791         (JSC::parseDate):
3792
3793 2008-11-28  Joerg Bornemann  <joerg.bornemann@trolltech.com>
3794
3795         Reviewed by Simon Hausmann.
3796
3797         Implement lowResUTCTime() on Windows CE using GetSystemTime as _ftime() is not available.
3798
3799         * runtime/DateMath.cpp:
3800         (JSC::lowResUTCTime):
3801
3802 2008-11-28  Simon Hausmann  <hausmann@webkit.org>
3803
3804         Rubber-stamped by Tor Arne Vestbø.
3805
3806         Removed unnecessary inclusion of errno.h, which also fixes compilation on Windows CE.
3807
3808         * runtime/JSGlobalObjectFunctions.cpp:
3809
3810 2008-11-27  Cameron Zwarich  <zwarich@apple.com>
3811
3812         Not reviewed.
3813
3814         r38825 made JSFunction::m_body private, but some inspector code in
3815         WebCore sets the field. Add setters for it.
3816
3817         * runtime/JSFunction.h:
3818         (JSC::JSFunction::setBody):
3819
3820 2008-11-27  Sam Weinig  <sam@webkit.org>
3821
3822         Reviewed by Cameron Zwarich.
3823
3824         Fix FIXME by adding accessor for JSFunction's m_body property.
3825
3826         * interpreter/Interpreter.cpp:
3827         (JSC::Interpreter::cti_op_call_JSFunction):
3828         (JSC::Interpreter::cti_vm_dontLazyLinkCall):
3829         (JSC::Interpreter::cti_vm_lazyLinkCall):
3830         * profiler/Profiler.cpp:
3831         (JSC::createCallIdentifierFromFunctionImp):
3832         * runtime/Arguments.h:
3833         (JSC::Arguments::getArgumentsData):
3834         (JSC::Arguments::Arguments):
3835         * runtime/FunctionPrototype.cpp:
3836         (JSC::functionProtoFuncToString):
3837         * runtime/JSFunction.h:
3838         (JSC::JSFunction::JSFunction):
3839         (JSC::JSFunction::body):
3840
3841 2008-11-27  Sam Weinig  <sam@webkit.org>
3842
3843         Reviewed by Oliver Hunt.
3844
3845         Remove unused member variables from ProgramNode.
3846
3847         * parser/Nodes.h:
3848
3849 2008-11-27  Brent Fulgham  <bfulgham@gmail.com>
3850
3851         Reviewed by Alexey Proskuryakov.
3852
3853         Enable mouse panning feaure on Windows Cairo build.
3854         See http://bugs.webkit.org/show_bug.cgi?id=22525
3855
3856         * wtf/Platform.h: Enable mouse panning feaure on Windows Cairo build.
3857
3858 2008-11-27  Alp Toker  <alp@nuanti.com>
3859
3860         Change recently introduced C++ comments in Platform.h to C comments to
3861         fix the minidom build with traditional C.
3862
3863         Build GtkLauncher and minidom with the '-ansi' compiler flag to detect
3864         API header breakage at build time.
3865
3866         * GNUmakefile.am:
3867         * wtf/Platform.h:
3868
3869 2008-11-27  Alp Toker  <alp@nuanti.com>
3870
3871         Remove C++ comment from JavaScriptCore API headers (introduced r35449).
3872         Fixes build for ANSI C applications using the public API.
3873
3874         * API/WebKitAvailability.h:
3875
3876 2008-11-26  Eric Seidel  <eric@webkit.org>
3877
3878         No review, build fix only.
3879
3880         Fix the JSC Chromium Mac build by adding JavaScriptCore/icu into the include path
3881
3882         * JavaScriptCore.scons:
3883
3884 2008-11-25  Cameron Zwarich  <zwarich@apple.com>
3885
3886         Reviewed by Maciej Stachowiak.
3887
3888         Remove the unused member function JSFunction::getParameterName().
3889
3890         * runtime/JSFunction.cpp:
3891         * runtime/JSFunction.h:
3892
3893 2008-11-24  Gavin Barraclough  <barraclough@apple.com>
3894
3895         Reviewed by Geoff Garen.
3896
3897         Polymorpic caching for get by id chain.  Similar to the polymorphic caching already implemented
3898         for self and proto accesses (implemented by allowing multiple trampolines to be JIT genertaed,
3899         and linked together) - the get by id chain caching is implemented as a genericization of the
3900         proto list caching, allowing cached access lists to contain a mix of proto and proto chain
3901         accesses (since in JS style inheritance hierarchies you may commonly see a mix of properties
3902         being overridden on the direct prototype, or higher up its prototype chain).
3903
3904         In order to allow this patch to compile there is a fix to appease gcc 4.2 compiler issues
3905         (removing the jumps between fall-through cases in privateExecute).
3906         
3907         This patch also removes redundant immediate checking from the reptach code, and fixes a related
3908         memory leak (failure to deallocate trampolines). 
3909
3910         ~2% progression on v8 tests (bulk on the win on deltablue)
3911
3912         * bytecode/Instruction.h:
3913         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::):
3914         (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
3915         (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
3916         (JSC::PolymorphicAccessStructureList::derefStructures):
3917         * interpreter/Interpreter.cpp:
3918         (JSC::countPrototypeChainEntriesAndCheckForProxies):
3919         (JSC::Interpreter::tryCacheGetByID):
3920         (JSC::Interpreter::privateExecute):
3921         (JSC::Interpreter::tryCTICacheGetByID):
3922         (JSC::Interpreter::cti_op_get_by_id_self_fail):
3923         (JSC::getPolymorphicAccessStructureListSlot):
3924         (JSC::Interpreter::cti_op_get_by_id_proto_list):
3925         * interpreter/Interpreter.h:
3926         * jit/JIT.cpp:
3927         (JSC::JIT::privateCompileGetByIdProto):
3928         (JSC::JIT::privateCompileGetByIdSelfList):
3929         (JSC::JIT::privateCompileGetByIdProtoList):
3930         (JSC::JIT::privateCompileGetByIdChainList):
3931         (JSC::JIT::privateCompileGetByIdChain):
3932         (JSC::JIT::privateCompilePatchGetArrayLength):
3933         * jit/JIT.h:
3934         (JSC::JIT::compileGetByIdChainList):
3935
3936 2008-11-25  Cameron Zwarich  <zwarich@apple.com>
3937
3938         Reviewed by Alexey Proskuryakov.
3939
3940         Move the collect() call in Heap::heapAllocate() that is conditionally
3941         compiled under COLLECT_ON_EVERY_ALLOCATION so that it is before we get
3942         information about the heap. This was causing assertion failures for me
3943         while I was reducing a bug.
3944
3945         * runtime/Collector.cpp:
3946         (JSC::Heap::heapAllocate):
3947
3948 2008-11-24  Cameron Zwarich  <zwarich@apple.com>
3949
3950         Reviewed by Geoff Garen.
3951
3952         Bug 13790: Function declarations are not treated as statements (used to affect starcraft2.com)
3953         <https://bugs.webkit.org/show_bug.cgi?id=13790>
3954
3955         Modify the parser to treat function declarations as statements,
3956         simplifying the grammar in the process. Technically, according to the
3957         grammar in the ECMA spec, function declarations are not statements and
3958         can not be used everywhere that statements can, but it is not worth the
3959         possibility compatibility issues just to stick to the spec in this case.
3960
3961         * parser/Grammar.y:
3962         * parser/Nodes.cpp:
3963         (JSC::FuncDeclNode::emitBytecode): Avoid returning ignoredResult()
3964         as a result, because it causes a crash in DoWhileNode::emitBytecode().
3965
3966 2008-11-24  Geoffrey Garen  <ggaren@apple.com>
3967
3968         Reviewed by Sam Weinig.
3969         
3970         Unroll the regexp matching loop by 1. 10% speedup on simple matching
3971         stress test. No change on SunSpider.
3972         
3973         (I decided not to unroll to arbitrary levels because the returns diminsh
3974         quickly.)
3975
3976         * wrec/WREC.cpp:
3977         (JSC::WREC::compileRegExp):
3978         * wrec/WRECGenerator.cpp:
3979         (JSC::WREC::Generator::generateJumpIfEndOfInput):
3980         (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
3981         * wrec/WRECGenerator.h:
3982         * wrec/WRECParser.h:
3983         (JSC::WREC::Parser::error):
3984         (JSC::WREC::Parser::parsePattern):
3985
3986 2008-11-24  Geoffrey Garen  <ggaren@apple.com>
3987
3988         Reviewed by Sam Weinig.
3989         
3990         Removed some unnecessary "Generator::" prefixes.
3991
3992         * wrec/WRECGenerator.cpp:
3993         (JSC::WREC::Generator::generateEnter):
3994         (JSC::WREC::Generator::generateReturnSuccess):
3995         (JSC::WREC::Generator::generateSaveIndex):
3996         (JSC::WREC::Generator::generateIncrementIndex):
3997         (JSC::WREC::Generator::generateLoopIfNotEndOfInput):
3998         (JSC::WREC::Generator::generateReturnFailure):
3999
4000 2008-11-24  Geoffrey Garen  <ggaren@apple.com>
4001
4002         Reviewed by Sam Weinig.
4003         
4004         Made a bunch of WREC::Parser functions private, and added an explicit
4005         "reset()" function, so a parser can be reused.
4006
4007         * wrec/WRECParser.h:
4008         (JSC::WREC::Parser::Parser):
4009         (JSC::WREC::Parser::generator):
4010         (JSC::WREC::Parser::ignoreCase):
4011         (JSC::WREC::Parser::multiline):
4012         (JSC::WREC::Parser::recordSubpattern):
4013         (JSC::WREC::Parser::numSubpatterns):
4014         (JSC::WREC::Parser::parsePattern):
4015         (JSC::WREC::Parser::parseAlternative):
4016         (JSC::WREC::Parser::reset):
4017
4018 2008-11-24  Gavin Barraclough  <barraclough@apple.com>
4019
4020         Reviewed by Cameron Zwarich.
4021
4022         Implement repatching for get by id chain.
4023         Previously the access is performed in a function stub, in the repatch form
4024         the trampoline is not called to; instead the hot path is relinked to jump
4025         directly to the trampoline, if it fails it will jump to the slow case.
4026
4027         https://bugs.webkit.org/show_bug.cgi?id=22449
4028         3% progression on deltablue.
4029
4030         * jit/JIT.cpp:
4031         (JSC::JIT::privateCompileGetByIdProto):
4032         (JSC::JIT::privateCompileGetByIdChain):
4033
4034 2008-11-24  Joerg Bornemann  <joerg.bornemann@trolltech.com>
4035
4036         Reviewed by Simon Hausmann.
4037
4038         https://bugs.webkit.org/show_bug.cgi?id=20746
4039
4040         Various small compilation fixes to make the Qt port of WebKit
4041         compile on Windows CE.
4042
4043         * config.h: Don't set _CRT_RAND_S for CE, it's not available.
4044         * jsc.cpp: Disabled use of debugger includes for CE. It
4045           does not have the debugging functions.
4046         * runtime/DateMath.cpp: Use localtime() on Windows CE.
4047         * wtf/Assertions.cpp: Compile on Windows CE without debugger.
4048         * wtf/Assertions.h: Include windows.h before defining ASSERT.
4049         * wtf/MathExtras.h: Include stdlib.h instead of xmath.h.
4050         * wtf/Platform.h: Disable ERRNO_H and detect endianess based
4051           on the Qt endianess. On Qt for Windows CE the endianess is
4052           defined by the vendor specific build spec.
4053         * wtf/Threading.h: Use the volatile-less atomic functions.
4054         * wtf/dtoa.cpp: Compile without errno.
4055         * wtf/win/MainThreadWin.cpp: Don't include windows.h on CE after
4056         Assertions.h due to the redefinition of ASSERT.
4057
4058 2008-11-22  Gavin Barraclough  <barraclough@apple.com>
4059
4060         Reviewed by Cameron Zwarich.
4061
4062         Replace accidentally deleted immediate check from get by id chain trampoline.
4063         https://bugs.webkit.org/show_bug.cgi?id=22413
4064
4065         * jit/JIT.cpp:
4066         (JSC::JIT::privateCompileGetByIdChain):
4067
4068 2008-11-21  Gavin Barraclough  <barraclough@apple.com>
4069
4070         Reviewed by Oliver Hunt.
4071
4072         Add (really) polymorphic caching for get by id self.
4073         Very similar to caching of prototype accesses, described below.
4074
4075         Oh, also, probably shouldn't have been leaking those structure list objects.
4076         
4077         4% preogression on deltablue.
4078
4079         * bytecode/CodeBlock.cpp:
4080         (JSC::CodeBlock::dump):
4081         (JSC::CodeBlock::derefStructures):
4082         (JSC::PrototypeStructureList::derefStructures):
4083         * bytecode/Instruction.h:
4084         * bytecode/Opcode.h:
4085         * interpreter/Interpreter.cpp:
4086         (JSC::Interpreter::privateExecute):
4087         (JSC::Interpreter::cti_op_get_by_id_self_fail):
4088         * jit/JIT.cpp:
4089         (JSC::JIT::privateCompileMainPass):
4090         (JSC::JIT::privateCompileGetByIdSelfList):
4091         (JSC::JIT::patchGetByIdSelf):
4092         * jit/JIT.h:
4093         (JSC::JIT::compileGetByIdSelfList):
4094
4095 2008-11-21  Geoffrey Garen  <ggaren@apple.com>
4096
4097         Reviewed by Sam Weinig.
4098         
4099         Fixed many crashes seen 'round the world (but only in release builds).
4100         
4101         Update outputParameter offset to reflect slight re-ordering of push
4102         instructions in r38669.
4103
4104         * wrec/WRECGenerator.cpp:
4105
4106 2008-11-21  Geoffrey Garen  <ggaren@apple.com>
4107
4108         Reviewed by Sam Weinig.
4109         
4110         A little more RegExp refactoring.
4111         
4112         Deployed a helper function for reading the next character. Used the "link
4113         vector of jumps" helper in a place I missed before.
4114
4115         * wrec/WRECGenerator.cpp:
4116         (JSC::WREC::Generator::generateLoadCharacter):
4117         (JSC::WREC::Generator::generatePatternCharacter):
4118         (JSC::WREC::Generator::generateCharacterClass):
4119         (JSC::WREC::Generator::generateAssertionEOL):
4120         (JSC::WREC::Generator::generateAssertionWordBoundary):
4121         * wrec/WRECGenerator.h:
4122
4123 2008-11-21  Alexey Proskuryakov  <ap@webkit.org>
4124
4125         Reviewed by Dan Bernstein.
4126
4127         https://bugs.webkit.org/show_bug.cgi?id=22402
4128         Replace abort() with CRASH()
4129
4130         * wtf/Assertions.h: Added a different method to crash, which should work even is 0xbbadbeef
4131         is a valid memory address.
4132
4133         * runtime/Collector.cpp:
4134         * wtf/FastMalloc.cpp:
4135         * wtf/FastMalloc.h:
4136         * wtf/TCSpinLock.h:
4137         Replace abort() with CRASH().
4138
4139 2008-11-21  Alexey Proskuryakov  <ap@webkit.org>
4140
4141         Reverted fix for bug 22042 (Replace abort() with CRASH()), because it was breaking
4142         FOR_EACH_OPCODE_ID macro somehow, making Safari crash.
4143
4144         * runtime/Collector.cpp:
4145         (JSC::Heap::heapAllocate):
4146         (JSC::Heap::collect):
4147         * wtf/Assertions.h:
4148         * wtf/FastMalloc.cpp:
4149         (WTF::fastMalloc):
4150         (WTF::fastCalloc):
4151         (WTF::fastRealloc):
4152         (WTF::InitSizeClasses):
4153         (WTF::PageHeapAllocator::New):
4154         (WTF::TCMallocStats::do_malloc):
4155         * wtf/FastMalloc.h:
4156         * wtf/TCSpinLock.h:
4157         (TCMalloc_SpinLock::Init):
4158         (TCMalloc_SpinLock::Finalize):
4159         (TCMalloc_SpinLock::Lock):
4160         (TCMalloc_SpinLock::Unlock):
4161
4162 2008-11-21  Geoffrey Garen  <ggaren@apple.com>
4163
4164         Reviewed by Sam Weinig.
4165         
4166         A little more RegExp refactoring.
4167         
4168         Moved all assembly from WREC.cpp into WRECGenerator helper functions.