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