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