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