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