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