2db959a135991b129f2d1ecd875671cc395d2f38
[WebKit.git] / JavaScriptCore / ChangeLog
1 2008-09-23  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2
3         Reviewed by Oliver Hunt.
4
5         Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
6         <https://bugs.webkit.org/show_bug.cgi?id=20989>
7
8         Make special cases for the 'callee' and 'length' properties in the
9         Arguments object.
10
11         This is somewhere between a 7.8% speedup and a 10% speedup on the V8
12         Raytrace benchmark, depending on whether it is run alone or with the
13         other V8 benchmarks.
14
15         * kjs/Arguments.cpp:
16         (JSC::ArgumentsData::ArgumentsData):
17         (JSC::Arguments::Arguments):
18         (JSC::Arguments::mark):
19         (JSC::Arguments::getOwnPropertySlot):
20         (JSC::Arguments::put):
21         (JSC::Arguments::deleteProperty):
22
23 2008-09-23  Maciej Stachowiak  <mjs@apple.com>
24
25         Reviewed by Darin.
26
27         - speed up instanceof some more
28         https://bugs.webkit.org/show_bug.cgi?id=20818
29         
30         ~2% speedup on EarleyBoyer
31
32         The idea here is to record in the StructureID whether the class
33         needs a special hasInstance or if it can use the normal logic from
34         JSObject. 
35         
36         Based on this I inlined the real work directly into
37         cti_op_instanceof and put the fastest checks up front and the
38         error handling at the end (so it should be fairly straightforward
39         to split off the beginning to be inlined if desired).
40
41         I only did this for CTI, not the bytecode interpreter.
42         
43         * API/JSCallbackObject.h:
44         (JSC::JSCallbackObject::createStructureID):
45         * ChangeLog:
46         * VM/Machine.cpp:
47         (JSC::Machine::cti_op_instanceof):
48         * kjs/JSImmediate.h:
49         (JSC::JSImmediate::isAnyImmediate):
50         * kjs/TypeInfo.h:
51         (JSC::TypeInfo::overridesHasInstance):
52         (JSC::TypeInfo::flags):
53
54 2008-09-22  Darin Adler  <darin@apple.com>
55
56         Reviewed by Sam Weinig.
57
58         - https://bugs.webkit.org/show_bug.cgi?id=21019
59           make FunctionBodyNode::ref/deref fast
60
61         Speeds up v8-raytrace by 7.2%.
62
63         * kjs/nodes.cpp:
64         (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
65         * kjs/nodes.h:
66         (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
67         m_refCount.
68         (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
69
70 2008-09-22  Darin Adler  <darin@apple.com>
71
72         Pointed out by Sam Weinig.
73
74         * kjs/Arguments.cpp:
75         (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
76
77 2008-09-22  Darin Adler  <darin@apple.com>
78
79         Reviewed by Cameron Zwarich.
80
81         - https://bugs.webkit.org/show_bug.cgi?id=20983
82           ArgumentsData should have some room to allocate some extra arguments inline
83
84         Speeds up v8-raytrace by 5%.
85
86         * kjs/Arguments.cpp:
87         (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
88         extra arguments.
89         (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
90         extra arguments.
91         (JSC::Arguments::~Arguments): Delete the buffer if necessary.
92         (JSC::Arguments::mark): Update since extraArguments are now Register.
93         (JSC::Arguments::fillArgList): Added special case for the only case that's
94         actually used in the practice, when there are no parameters. There are some
95         other special cases in there too, but that's the only one that matters.
96         (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
97         no operation to get you at the JSValue* inside a Register as a "slot".
98
99 2008-09-22  Sam Weinig  <sam@webkit.org>
100
101         Reviewed by Maciej Stachowiak.
102
103         Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
104         Speed up for..in by using StructureID to avoid calls to hasProperty
105
106         Speeds up fasta by 8%.
107
108         * VM/JSPropertyNameIterator.cpp:
109         (JSC::JSPropertyNameIterator::invalidate):
110         * VM/JSPropertyNameIterator.h:
111         (JSC::JSPropertyNameIterator::next):
112         * kjs/PropertyNameArray.h:
113         (JSC::PropertyNameArrayData::begin):
114         (JSC::PropertyNameArrayData::end):
115         (JSC::PropertyNameArrayData::setCachedStructureID):
116         (JSC::PropertyNameArrayData::cachedStructureID):
117         * kjs/StructureID.cpp:
118         (JSC::StructureID::getEnumerablePropertyNames):
119         (JSC::structureIDChainsAreEqual):
120         * kjs/StructureID.h:
121
122 2008-09-22  Kelvin Sherlock  <ksherlock@gmail.com>
123
124         Updated and tweaked by Sam Weinig.
125
126         Reviewed by Geoffrey Garen.
127
128         Bug 20020: Proposed enhancement to JavaScriptCore API
129         <https://bugs.webkit.org/show_bug.cgi?id=20020>
130
131         Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
132         functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
133
134         * API/JSObjectRef.cpp: The functions
135         * API/JSObjectRef.h: Function prototype and documentation
136         * JavaScriptCore.exp: Added functions to exported function list
137         * API/tests/testapi.c: Added basic functionality tests.
138
139         * kjs/DateConstructor.cpp:
140         Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
141         with JSObject* constructDate(ExecState* exec, const ArgList& args).
142         Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
143
144         * kjs/DateConstructor.h:
145         added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
146
147         * kjs/ErrorConstructor.cpp:
148         removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
149
150         * kjs/ErrorConstructor.h:
151         added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
152
153         * kjs/RegExpConstructor.cpp:
154         removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
155
156         * kjs/RegExpConstructor.h:
157         added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
158
159 2008-09-22  Matt Lilek  <webkit@mattlilek.com>
160
161         Not reviewed, Windows build fix.
162
163         * kjs/Arguments.cpp:
164         * kjs/FunctionPrototype.cpp:
165
166 2008-09-22  Sam Weinig  <sam@webkit.org>
167
168         Reviewed by Darin Adler.
169
170         Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
171         Speed up the apply method of functions by special-casing array and 'arguments' objects
172
173         1% speedup on v8-raytrace.
174
175         Test: fast/js/function-apply.html
176
177         * kjs/Arguments.cpp:
178         (JSC::Arguments::fillArgList):
179         * kjs/Arguments.h:
180         * kjs/FunctionPrototype.cpp:
181         (JSC::functionProtoFuncApply):
182         * kjs/JSArray.cpp:
183         (JSC::JSArray::fillArgList):
184         * kjs/JSArray.h:
185
186 2008-09-22  Darin Adler  <darin@apple.com>
187
188         Reviewed by Sam Weinig.
189
190         - https://bugs.webkit.org/show_bug.cgi?id=20993
191           Array.push/pop need optimized cases for JSArray
192
193         3% or so speedup on DeltaBlue benchmark.
194
195         * kjs/ArrayPrototype.cpp:
196         (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
197         (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
198
199         * kjs/JSArray.cpp:
200         (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
201         us into the fast code path.
202         (JSC::JSArray::pop): Added.
203         (JSC::JSArray::push): Added.
204         * kjs/JSArray.h: Added push and pop.
205
206         * kjs/operations.cpp:
207         (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
208
209 2008-09-22  Maciej Stachowiak  <mjs@apple.com>
210
211         Reviewed by Cameron Zwarich.
212         
213         - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
214
215         Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
216         
217         2.2% speedup on EarleyBoyer benchmark.
218
219         * API/JSCallbackConstructor.cpp:
220         * API/JSCallbackConstructor.h:
221         (JSC::JSCallbackConstructor::createStructureID):
222         * API/JSCallbackFunction.cpp:
223         * API/JSCallbackFunction.h:
224         (JSC::JSCallbackFunction::createStructureID):
225         * API/JSCallbackObject.h:
226         (JSC::JSCallbackObject::createStructureID):
227         * API/JSCallbackObjectFunctions.h:
228         (JSC::::hasInstance):
229         * API/JSValueRef.cpp:
230         (JSValueIsInstanceOfConstructor):
231         * JavaScriptCore.exp:
232         * VM/Machine.cpp:
233         (JSC::Machine::privateExecute):
234         (JSC::Machine::cti_op_instanceof):
235         * kjs/InternalFunction.cpp:
236         * kjs/InternalFunction.h:
237         (JSC::InternalFunction::createStructureID):
238         * kjs/JSObject.cpp:
239         * kjs/JSObject.h:
240         * kjs/TypeInfo.h:
241         (JSC::TypeInfo::implementsHasInstance):
242
243 2008-09-22  Maciej Stachowiak  <mjs@apple.com>
244
245         Reviewed by Dave Hyatt.
246         
247         Based on initial work by Darin Adler.
248         
249         - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
250         - use this to JIT inline code for eq_null and neq_null
251         https://bugs.webkit.org/show_bug.cgi?id=20823
252
253         0.5% speedup on SunSpider
254         ~4% speedup on Richards benchmark
255         
256         * VM/CTI.cpp:
257         (JSC::CTI::privateCompileMainPass):
258         * VM/Machine.cpp:
259         (JSC::jsTypeStringForValue):
260         (JSC::jsIsObjectType):
261         (JSC::Machine::privateExecute):
262         (JSC::Machine::cti_op_is_undefined):
263         * VM/Machine.h:
264         * kjs/JSCell.h:
265         * kjs/JSValue.h:
266         * kjs/StringObjectThatMasqueradesAsUndefined.h:
267         (JSC::StringObjectThatMasqueradesAsUndefined::create):
268         (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
269         * kjs/StructureID.h:
270         (JSC::StructureID::mutableTypeInfo):
271         * kjs/TypeInfo.h:
272         (JSC::TypeInfo::TypeInfo):
273         (JSC::TypeInfo::masqueradesAsUndefined):
274         * kjs/operations.cpp:
275         (JSC::equal):
276         * masm/X86Assembler.h:
277         (JSC::X86Assembler::):
278         (JSC::X86Assembler::setne_r):
279         (JSC::X86Assembler::setnz_r):
280         (JSC::X86Assembler::testl_i32m):
281
282 2008-09-22  Tor Arne Vestbø  <tavestbo@trolltech.com>
283
284         Reviewed by Simon.
285
286         Initialize QCoreApplication in kjs binary/Shell.cpp
287         
288         This allows us to use QCoreApplication::instance() to
289         get the main thread in ThreadingQt.cpp
290
291         * kjs/Shell.cpp:
292         (main):
293         * wtf/ThreadingQt.cpp:
294         (WTF::initializeThreading):
295
296 2008-09-21  Darin Adler  <darin@apple.com>
297
298         - blind attempt to fix non-all-in-one builds
299
300         * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
301
302 2008-09-21  Darin Adler  <darin@apple.com>
303
304         - fix debug build
305
306         * kjs/StructureID.cpp:
307         (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
308         (JSC::StructureID::createCachedPrototypeChain): Ditto.
309
310 2008-09-21  Maciej Stachowiak  <mjs@apple.com>
311
312         Reviewed by Darin Adler.
313         
314         - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
315         https://bugs.webkit.org/show_bug.cgi?id=20981
316
317         * JavaScriptCore.exp:
318         * JavaScriptCore.xcodeproj/project.pbxproj:
319         * VM/CTI.cpp:
320         (JSC::CTI::privateCompileMainPass):
321         (JSC::CTI::privateCompilePutByIdTransition):
322         * VM/Machine.cpp:
323         (JSC::jsIsObjectType):
324         (JSC::Machine::Machine):
325         * kjs/AllInOneFile.cpp:
326         * kjs/JSCell.h:
327         (JSC::JSCell::isObject):
328         (JSC::JSCell::isString):
329         * kjs/JSGlobalData.cpp:
330         (JSC::JSGlobalData::JSGlobalData):
331         * kjs/JSGlobalObject.cpp:
332         (JSC::JSGlobalObject::reset):
333         * kjs/JSGlobalObject.h:
334         (JSC::StructureID::prototypeForLookup):
335         * kjs/JSNumberCell.h:
336         (JSC::JSNumberCell::createStructureID):
337         * kjs/JSObject.cpp:
338         (JSC::JSObject::createInheritorID):
339         * kjs/JSObject.h:
340         (JSC::JSObject::createStructureID):
341         * kjs/JSString.h:
342         (JSC::JSString::createStructureID):
343         * kjs/NativeErrorConstructor.cpp:
344         (JSC::NativeErrorConstructor::NativeErrorConstructor):
345         * kjs/RegExpConstructor.cpp:
346         * kjs/RegExpMatchesArray.h: Added.
347         (JSC::RegExpMatchesArray::getOwnPropertySlot):
348         (JSC::RegExpMatchesArray::put):
349         (JSC::RegExpMatchesArray::deleteProperty):
350         (JSC::RegExpMatchesArray::getPropertyNames):
351         * kjs/StructureID.cpp:
352         (JSC::StructureID::StructureID):
353         (JSC::StructureID::addPropertyTransition):
354         (JSC::StructureID::toDictionaryTransition):
355         (JSC::StructureID::changePrototypeTransition):
356         (JSC::StructureID::getterSetterTransition):
357         * kjs/StructureID.h:
358         (JSC::StructureID::create):
359         (JSC::StructureID::typeInfo):
360         * kjs/TypeInfo.h: Added.
361         (JSC::TypeInfo::TypeInfo):
362         (JSC::TypeInfo::type):
363
364 2008-09-21  Darin Adler  <darin@apple.com>
365
366         Reviewed by Cameron Zwarich.
367
368         - fix crash logging into Gmail due to recent Arguments change
369
370         * kjs/Arguments.cpp:
371         (JSC::Arguments::Arguments): Fix window where mark() function could
372         see d->extraArguments with uninitialized contents.
373         (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
374         cases: 1) Inside the constructor before it's initialized.
375         2) numArguments <= numParameters.
376
377 2008-09-21  Darin Adler  <darin@apple.com>
378
379         - fix loose end from the "duplicate constant values" patch
380
381         * VM/CodeGenerator.cpp:
382         (JSC::CodeGenerator::emitLoad): Add a special case for values the
383         hash table can't handle.
384
385 2008-09-21  Mark Rowe  <mrowe@apple.com>
386
387         Fix the non-AllInOneFile build.
388
389         * kjs/Arguments.cpp: Add missing #include.
390
391 2008-09-21  Darin Adler  <darin@apple.com>
392
393         Reviewed by Cameron Zwarich and Mark Rowe.
394
395         - fix test failure caused by my recent IndexToNameMap patch
396
397         * kjs/Arguments.cpp:
398         (JSC::Arguments::deleteProperty): Added the accidentally-omitted
399         check of the boolean result from toArrayIndex.
400
401 2008-09-21  Darin Adler  <darin@apple.com>
402
403         Reviewed by Maciej Stachowiak.
404
405         - https://bugs.webkit.org/show_bug.cgi?id=20975
406           inline immediate-number case of ==
407
408         * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
409         emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
410
411         * VM/CTI.cpp: Updated for new name.
412         (JSC::CTI::privateCompileMainPass): Added op_eq.
413         (JSC::CTI::privateCompileSlowCases): Added op_eq.
414
415         * VM/Machine.cpp:
416         (JSC::Machine::cti_op_eq): Removed fast case, since it's now
417         compiled.
418
419 2008-09-21  Peter Gal  <galpter@inf.u-szeged.hu>
420
421         Reviewed by Tim Hatcher and Eric Seidel.
422
423         Fix the QT/Linux JavaScriptCore segmentation fault.
424         https://bugs.webkit.org/show_bug.cgi?id=20914
425
426         * wtf/ThreadingQt.cpp:
427         (WTF::initializeThreading): Use currentThread() if
428         platform is not a MAC (like in pre 36541 revisions)
429
430 2008-09-21  Darin Adler  <darin@apple.com>
431
432         Reviewed by Sam Weinig.
433
434         * kjs/debugger.h: Removed some unneeded includes and declarations.
435
436 2008-09-21  Darin Adler  <darin@apple.com>
437
438         Reviewed by Sam Weinig.
439
440         - https://bugs.webkit.org/show_bug.cgi?id=20972
441           speed up Arguments further by eliminating the IndexToNameMap
442
443         No change on SunSpider. 1.29x as fast on V8 Raytrace.
444
445         * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
446         indexToNameMap and hadDeletes data members. Changed extraArguments into
447         an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
448         Replaced numExtraArguments with numParameters, since that's what's
449         used more directly in hot code paths.
450         (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
451         Initialize ArgumentsData the new way.
452         (JSC::Arguments::mark): Updated.
453         (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
454         we don't have to convert integers to identifiers just to get an argument.
455         Integrated the deleted case with the fast case.
456         (JSC::Arguments::put): Ditto.
457         (JSC::Arguments::deleteProperty): Ditto.
458
459         * kjs/Arguments.h: Minimized includes. Made everything private. Added
460         overloads for the integral property name case. Eliminated mappedIndexSetter.
461         Moved ArgumentsData into the .cpp file.
462
463         * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
464         * kjs/IndexToNameMap.h: Ditto.
465
466         * kjs/JSActivation.cpp:
467         (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
468
469         * GNUmakefile.am:
470         * JavaScriptCore.pri:
471         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
472         * JavaScriptCore.xcodeproj/project.pbxproj:
473         * JavaScriptCoreSources.bkl:
474         * kjs/AllInOneFile.cpp:
475         Removed IndexToNameMap.
476
477 2008-09-21  Darin Adler  <darin@apple.com>
478
479         * VM/CodeGenerator.cpp:
480         (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
481         clearer style.
482
483 2008-09-21  Judit Jasz  <jasy@inf.u-szeged.hu>
484
485         Reviewed and tweaked by Darin Adler.
486
487         - https://bugs.webkit.org/show_bug.cgi?id=20645
488           Elminate duplicate constant values in CodeBlocks.
489
490         Seems to be a wash on SunSpider.
491
492         * VM/CodeGenerator.cpp:
493         (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
494         we emit the same JSValue* for identical numbers and strings.
495         * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
496         Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
497         * kjs/nodes.cpp:
498         (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
499         JSString creation.
500
501 2008-09-21  Paul Pedriana  <webkit@pedriana.com>
502
503         Reviewed and tweaked by Darin Adler.
504
505         - https://bugs.webkit.org/show_bug.cgi?id=16925
506           Fixed lack of Vector buffer alignment for both GCC and MSVC.
507           Since there's no portable way to do this, for now we don't support
508           other compilers.
509
510         * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
511         Use AlignedBuffer insteadof an array of char in VectorBuffer.
512
513 2008-09-21  Gabor Loki  <loki@inf.u-szeged.hu>
514
515         Reviewed by Darin Adler.
516
517         - https://bugs.webkit.org/show_bug.cgi?id=19408
518           Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
519
520         1.008x as fast on SunSpider.
521
522         * kjs/grammar.y:
523         (makeNegateNode): Fold if expression is a number > 0.
524         (makeBitwiseNotNode): Fold if expression is a number.
525         (makeMultNode): Fold if expressions are both numbers.
526         (makeDivNode): Fold if expressions are both numbers.
527         (makeAddNode): Fold if expressions are both numbers.
528         (makeLeftShiftNode): Fold if expressions are both numbers.
529         (makeRightShiftNode): Fold if expressions are both numbers.
530
531 2008-09-21  Maciej Stachowiak  <mjs@apple.com>
532
533         Reviewed by Oliver.
534         
535         - speed up === operator by generating inline machine code for the fast paths
536         https://bugs.webkit.org/show_bug.cgi?id=20820
537
538         * VM/CTI.cpp:
539         (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
540         (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
541         (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
542         (JSC::CTI::emitTagAsBoolImmediate):
543         (JSC::CTI::privateCompileMainPass):
544         (JSC::CTI::privateCompileSlowCases):
545         * VM/CTI.h:
546         * VM/Machine.cpp:
547         (JSC::Machine::cti_op_stricteq):
548         * masm/X86Assembler.h:
549         (JSC::X86Assembler::):
550         (JSC::X86Assembler::sete_r):
551         (JSC::X86Assembler::setz_r):
552         (JSC::X86Assembler::movzbl_rr):
553         (JSC::X86Assembler::emitUnlinkedJnz):
554
555 2008-09-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
556
557         Reviewed by Maciej Stachowiak.
558
559         Free memory allocated for extra arguments in the destructor of the
560         Arguments object.
561
562         * kjs/Arguments.cpp:
563         (JSC::Arguments::~Arguments):
564         * kjs/Arguments.h:
565
566 2008-09-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
567
568         Reviewed by Maciej Stachowiak.
569
570         Bug 20815: 'arguments' object creation is non-optimal
571         <https://bugs.webkit.org/show_bug.cgi?id=20815>
572
573         Fix our inefficient way of creating the arguments object by only
574         creating named properties for each of the arguments after a use of the
575         'delete' statement. This patch also speeds up access to the 'arguments'
576         object slightly, but it still does not use the array fast path for
577         indexed access that exists for many opcodes.
578
579         This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
580         improvement on the Earley-Boyer benchmark, which gives a 4% improvement
581         overall.
582
583         * kjs/Arguments.cpp:
584         (JSC::Arguments::Arguments):
585         (JSC::Arguments::mark):
586         (JSC::Arguments::getOwnPropertySlot):
587         (JSC::Arguments::put):
588         (JSC::Arguments::deleteProperty):
589         * kjs/Arguments.h:
590         (JSC::Arguments::ArgumentsData::ArgumentsData):
591         * kjs/IndexToNameMap.h:
592         (JSC::IndexToNameMap::size):
593         * kjs/JSActivation.cpp:
594         (JSC::JSActivation::createArgumentsObject):
595         * kjs/JSActivation.h:
596         (JSC::JSActivation::uncheckedSymbolTableGet):
597         (JSC::JSActivation::uncheckedSymbolTableGetValue):
598         (JSC::JSActivation::uncheckedSymbolTablePut):
599         * kjs/JSFunction.h:
600         (JSC::JSFunction::numParameters):
601
602 2008-09-20  Darin Adler  <darin@apple.com>
603
604         Reviewed by Mark Rowe.
605
606         - fix crash seen on buildbot
607
608         * kjs/JSGlobalObject.cpp:
609         (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
610         deleted by accident in my recent check-in.
611
612 2008-09-20  Maciej Stachowiak  <mjs@apple.com>
613
614         Not reviewed, build fix.
615         
616         - speculative fix for non-AllInOne builds
617
618         * kjs/operations.h:
619
620 2008-09-20  Maciej Stachowiak  <mjs@apple.com>
621
622         Reviewed by Darin Adler.
623         
624         - assorted optimizations to === and !== operators
625         (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
626         
627         2.5% speedup on earley-boyer test
628
629         * VM/Machine.cpp:
630         (JSC::Machine::cti_op_stricteq): Use inline version of
631         strictEqualSlowCase; remove unneeded exception check.
632         (JSC::Machine::cti_op_nstricteq): ditto
633         * kjs/operations.cpp:
634         (JSC::strictEqual): Use strictEqualSlowCaseInline
635         (JSC::strictEqualSlowCase): ditto
636         * kjs/operations.h:
637         (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
638         since the extra function call indirection is a lose for CTI.
639
640 2008-09-20  Darin Adler  <darin@apple.com>
641
642         Reviewed by Maciej Stachowiak.
643
644         - finish https://bugs.webkit.org/show_bug.cgi?id=20858
645           make each distinct C++ class get a distinct JSC::Structure
646
647         This also includes some optimizations that make the change an overall
648         small speedup. Without those it was a bit of a slowdown.
649
650         * API/JSCallbackConstructor.cpp:
651         (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
652         * API/JSCallbackConstructor.h: Ditto.
653         * API/JSCallbackFunction.cpp:
654         (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
655         * API/JSCallbackObject.h: Take a structure.
656         * API/JSCallbackObjectFunctions.h:
657         (JSC::JSCallbackObject::JSCallbackObject): Ditto.
658
659         * API/JSClassRef.cpp:
660         (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
661         if there's a custom prototype involved.
662         * API/JSObjectRef.cpp:
663         (JSObjectMake): Ditto.
664         (JSObjectMakeConstructor): Pass in a structure.
665
666         * JavaScriptCore.exp: Updated.
667
668         * VM/Machine.cpp:
669         (JSC::jsLess): Added a special case for when both arguments are strings.
670         This avoids converting both strings to with UString::toDouble.
671         (JSC::jsLessEq): Ditto.
672         (JSC::Machine::privateExecute): Pass in a structure.
673         (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
674         (JSC::Machine::cti_op_new_regexp): Ditto.
675         (JSC::Machine::cti_op_is_string): Ditto.
676         * VM/Machine.h: Made isJSString public so it can be used in the CTI.
677
678         * kjs/Arguments.cpp:
679         (JSC::Arguments::Arguments): Pass in a structure.
680
681         * kjs/JSCell.h: Mark constructor explicit.
682
683         * kjs/JSGlobalObject.cpp:
684         (JSC::markIfNeeded): Added an overload for marking structures.
685         (JSC::JSGlobalObject::reset): Eliminate code to set data members to
686         zero. We now do that in the constructor, and we no longer use this
687         anywhere except in the constructor. Added code to create structures.
688         Pass structures rather than prototypes when creating objects.
689         (JSC::JSGlobalObject::mark): Mark the structures.
690
691         * kjs/JSGlobalObject.h: Removed unneeded class declarations.
692         Added initializers for raw pointers in JSGlobalObjectData so
693         everything starts with a 0. Added structure data and accessor
694         functions.
695
696         * kjs/JSImmediate.cpp:
697         (JSC::JSImmediate::nonInlineNaN): Added.
698         * kjs/JSImmediate.h:
699         (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
700
701         * kjs/JSNumberCell.cpp:
702         (JSC::jsNumberCell): Made non-inline to avoid PIC branches
703         in functions that call this one.
704         (JSC::jsNaN): Ditto.
705         * kjs/JSNumberCell.h: Ditto.
706
707         * kjs/JSObject.h: Removed constructor that takes a prototype.
708         All callers now pass structures.
709
710         * kjs/ArrayConstructor.cpp:
711         (JSC::ArrayConstructor::ArrayConstructor):
712         (JSC::constructArrayWithSizeQuirk):
713         * kjs/ArrayConstructor.h:
714         * kjs/ArrayPrototype.cpp:
715         (JSC::ArrayPrototype::ArrayPrototype):
716         * kjs/ArrayPrototype.h:
717         * kjs/BooleanConstructor.cpp:
718         (JSC::BooleanConstructor::BooleanConstructor):
719         (JSC::constructBoolean):
720         (JSC::constructBooleanFromImmediateBoolean):
721         * kjs/BooleanConstructor.h:
722         * kjs/BooleanObject.cpp:
723         (JSC::BooleanObject::BooleanObject):
724         * kjs/BooleanObject.h:
725         * kjs/BooleanPrototype.cpp:
726         (JSC::BooleanPrototype::BooleanPrototype):
727         * kjs/BooleanPrototype.h:
728         * kjs/DateConstructor.cpp:
729         (JSC::DateConstructor::DateConstructor):
730         (JSC::constructDate):
731         * kjs/DateConstructor.h:
732         * kjs/DateInstance.cpp:
733         (JSC::DateInstance::DateInstance):
734         * kjs/DateInstance.h:
735         * kjs/DatePrototype.cpp:
736         (JSC::DatePrototype::DatePrototype):
737         * kjs/DatePrototype.h:
738         * kjs/ErrorConstructor.cpp:
739         (JSC::ErrorConstructor::ErrorConstructor):
740         (JSC::constructError):
741         * kjs/ErrorConstructor.h:
742         * kjs/ErrorInstance.cpp:
743         (JSC::ErrorInstance::ErrorInstance):
744         * kjs/ErrorInstance.h:
745         * kjs/ErrorPrototype.cpp:
746         (JSC::ErrorPrototype::ErrorPrototype):
747         * kjs/ErrorPrototype.h:
748         * kjs/FunctionConstructor.cpp:
749         (JSC::FunctionConstructor::FunctionConstructor):
750         * kjs/FunctionConstructor.h:
751         * kjs/FunctionPrototype.cpp:
752         (JSC::FunctionPrototype::FunctionPrototype):
753         (JSC::FunctionPrototype::addFunctionProperties):
754         * kjs/FunctionPrototype.h:
755         * kjs/GlobalEvalFunction.cpp:
756         (JSC::GlobalEvalFunction::GlobalEvalFunction):
757         * kjs/GlobalEvalFunction.h:
758         * kjs/InternalFunction.cpp:
759         (JSC::InternalFunction::InternalFunction):
760         * kjs/InternalFunction.h:
761         (JSC::InternalFunction::InternalFunction):
762         * kjs/JSArray.cpp:
763         (JSC::JSArray::JSArray):
764         (JSC::constructEmptyArray):
765         (JSC::constructArray):
766         * kjs/JSArray.h:
767         * kjs/JSFunction.cpp:
768         (JSC::JSFunction::JSFunction):
769         (JSC::JSFunction::construct):
770         * kjs/JSObject.cpp:
771         (JSC::constructEmptyObject):
772         * kjs/JSString.cpp:
773         (JSC::StringObject::create):
774         * kjs/JSWrapperObject.h:
775         * kjs/MathObject.cpp:
776         (JSC::MathObject::MathObject):
777         * kjs/MathObject.h:
778         * kjs/NativeErrorConstructor.cpp:
779         (JSC::NativeErrorConstructor::NativeErrorConstructor):
780         (JSC::NativeErrorConstructor::construct):
781         * kjs/NativeErrorConstructor.h:
782         * kjs/NativeErrorPrototype.cpp:
783         (JSC::NativeErrorPrototype::NativeErrorPrototype):
784         * kjs/NativeErrorPrototype.h:
785         * kjs/NumberConstructor.cpp:
786         (JSC::NumberConstructor::NumberConstructor):
787         (JSC::constructWithNumberConstructor):
788         * kjs/NumberConstructor.h:
789         * kjs/NumberObject.cpp:
790         (JSC::NumberObject::NumberObject):
791         (JSC::constructNumber):
792         (JSC::constructNumberFromImmediateNumber):
793         * kjs/NumberObject.h:
794         * kjs/NumberPrototype.cpp:
795         (JSC::NumberPrototype::NumberPrototype):
796         * kjs/NumberPrototype.h:
797         * kjs/ObjectConstructor.cpp:
798         (JSC::ObjectConstructor::ObjectConstructor):
799         (JSC::constructObject):
800         * kjs/ObjectConstructor.h:
801         * kjs/ObjectPrototype.cpp:
802         (JSC::ObjectPrototype::ObjectPrototype):
803         * kjs/ObjectPrototype.h:
804         * kjs/PrototypeFunction.cpp:
805         (JSC::PrototypeFunction::PrototypeFunction):
806         * kjs/PrototypeFunction.h:
807         * kjs/RegExpConstructor.cpp:
808         (JSC::RegExpConstructor::RegExpConstructor):
809         (JSC::RegExpMatchesArray::RegExpMatchesArray):
810         (JSC::constructRegExp):
811         * kjs/RegExpConstructor.h:
812         * kjs/RegExpObject.cpp:
813         (JSC::RegExpObject::RegExpObject):
814         * kjs/RegExpObject.h:
815         * kjs/RegExpPrototype.cpp:
816         (JSC::RegExpPrototype::RegExpPrototype):
817         * kjs/RegExpPrototype.h:
818         * kjs/Shell.cpp:
819         (GlobalObject::GlobalObject):
820         * kjs/StringConstructor.cpp:
821         (JSC::StringConstructor::StringConstructor):
822         (JSC::constructWithStringConstructor):
823         * kjs/StringConstructor.h:
824         * kjs/StringObject.cpp:
825         (JSC::StringObject::StringObject):
826         * kjs/StringObject.h:
827         * kjs/StringObjectThatMasqueradesAsUndefined.h:
828         (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
829         * kjs/StringPrototype.cpp:
830         (JSC::StringPrototype::StringPrototype):
831         * kjs/StringPrototype.h:
832         Take and pass structures.
833
834 2008-09-19  Alp Toker  <alp@nuanti.com>
835
836         Build fix for the 'gold' linker and recent binutils. New behaviour
837         requires that we link to used libraries explicitly.
838
839         * GNUmakefile.am:
840
841 2008-09-19  Sam Weinig  <sam@webkit.org>
842
843         Roll r36694 back in.  It did not cause the crash.
844
845         * JavaScriptCore.exp:
846         * VM/JSPropertyNameIterator.cpp:
847         (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
848         (JSC::JSPropertyNameIterator::invalidate):
849         * VM/JSPropertyNameIterator.h:
850         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
851         (JSC::JSPropertyNameIterator::create):
852         * kjs/JSObject.cpp:
853         (JSC::JSObject::getPropertyNames):
854         * kjs/PropertyMap.cpp:
855         (JSC::PropertyMap::getEnumerablePropertyNames):
856         * kjs/PropertyMap.h:
857         * kjs/PropertyNameArray.cpp:
858         (JSC::PropertyNameArray::add):
859         * kjs/PropertyNameArray.h:
860         (JSC::PropertyNameArrayData::create):
861         (JSC::PropertyNameArrayData::propertyNameVector):
862         (JSC::PropertyNameArrayData::setCachedPrototypeChain):
863         (JSC::PropertyNameArrayData::cachedPrototypeChain):
864         (JSC::PropertyNameArrayData::begin):
865         (JSC::PropertyNameArrayData::end):
866         (JSC::PropertyNameArrayData::PropertyNameArrayData):
867         (JSC::PropertyNameArray::PropertyNameArray):
868         (JSC::PropertyNameArray::addKnownUnique):
869         (JSC::PropertyNameArray::size):
870         (JSC::PropertyNameArray::operator[]):
871         (JSC::PropertyNameArray::begin):
872         (JSC::PropertyNameArray::end):
873         (JSC::PropertyNameArray::setData):
874         (JSC::PropertyNameArray::data):
875         (JSC::PropertyNameArray::releaseData):
876         * kjs/StructureID.cpp:
877         (JSC::structureIDChainsAreEqual):
878         (JSC::StructureID::getEnumerablePropertyNames):
879         (JSC::StructureID::clearEnumerationCache):
880         (JSC::StructureID::createCachedPrototypeChain):
881         * kjs/StructureID.h:
882
883 2008-09-19  Sam Weinig  <sam@webkit.org>
884
885         Roll out r36694.
886
887         * JavaScriptCore.exp:
888         * VM/JSPropertyNameIterator.cpp:
889         (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
890         (JSC::JSPropertyNameIterator::invalidate):
891         * VM/JSPropertyNameIterator.h:
892         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
893         (JSC::JSPropertyNameIterator::create):
894         * kjs/JSObject.cpp:
895         (JSC::JSObject::getPropertyNames):
896         * kjs/PropertyMap.cpp:
897         (JSC::PropertyMap::getEnumerablePropertyNames):
898         * kjs/PropertyMap.h:
899         * kjs/PropertyNameArray.cpp:
900         (JSC::PropertyNameArray::add):
901         * kjs/PropertyNameArray.h:
902         (JSC::PropertyNameArray::PropertyNameArray):
903         (JSC::PropertyNameArray::addKnownUnique):
904         (JSC::PropertyNameArray::begin):
905         (JSC::PropertyNameArray::end):
906         (JSC::PropertyNameArray::size):
907         (JSC::PropertyNameArray::operator[]):
908         (JSC::PropertyNameArray::releaseIdentifiers):
909         * kjs/StructureID.cpp:
910         (JSC::StructureID::getEnumerablePropertyNames):
911         * kjs/StructureID.h:
912         (JSC::StructureID::clearEnumerationCache):
913
914 2008-09-19  Oliver Hunt  <oliver@apple.com>
915
916         Reviewed by Maciej Stachowiak.
917
918         Improve peformance of local variable initialisation.
919
920         Pull local and constant initialisation out of slideRegisterWindowForCall
921         and into its own opcode.  This allows the JIT to generate the initialisation
922         code for a function directly into the instruction stream and so avoids a few
923         branches on function entry.
924
925         Results a 1% progression in SunSpider, particularly in a number of the bitop
926         tests where the called functions are very fast. 
927
928         * VM/CTI.cpp:
929         (JSC::CTI::emitInitialiseRegister):
930         (JSC::CTI::privateCompileMainPass):
931         * VM/CTI.h:
932         * VM/CodeBlock.cpp:
933         (JSC::CodeBlock::dump):
934         * VM/CodeGenerator.cpp:
935         (JSC::CodeGenerator::CodeGenerator):
936         * VM/Machine.cpp:
937         (JSC::slideRegisterWindowForCall):
938         (JSC::Machine::privateExecute):
939         * VM/Opcode.h:
940
941 2008-09-19  Sam Weinig  <sam@webkit.org>
942
943         Reviewed by Darin Adler.
944
945         Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
946         Speed up JS property enumeration by caching entire PropertyNameArray
947
948         1.3% speedup on Sunspider, 30% on string-fasta.
949
950         * JavaScriptCore.exp:
951         * VM/JSPropertyNameIterator.cpp:
952         (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
953         (JSC::JSPropertyNameIterator::invalidate):
954         * VM/JSPropertyNameIterator.h:
955         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
956         (JSC::JSPropertyNameIterator::create):
957         * kjs/JSObject.cpp:
958         (JSC::JSObject::getPropertyNames):
959         * kjs/PropertyMap.cpp:
960         (JSC::PropertyMap::getEnumerablePropertyNames):
961         * kjs/PropertyMap.h:
962         * kjs/PropertyNameArray.cpp:
963         (JSC::PropertyNameArray::add):
964         * kjs/PropertyNameArray.h:
965         (JSC::PropertyNameArrayData::create):
966         (JSC::PropertyNameArrayData::propertyNameVector):
967         (JSC::PropertyNameArrayData::setCachedPrototypeChain):
968         (JSC::PropertyNameArrayData::cachedPrototypeChain):
969         (JSC::PropertyNameArrayData::begin):
970         (JSC::PropertyNameArrayData::end):
971         (JSC::PropertyNameArrayData::PropertyNameArrayData):
972         (JSC::PropertyNameArray::PropertyNameArray):
973         (JSC::PropertyNameArray::addKnownUnique):
974         (JSC::PropertyNameArray::size):
975         (JSC::PropertyNameArray::operator[]):
976         (JSC::PropertyNameArray::begin):
977         (JSC::PropertyNameArray::end):
978         (JSC::PropertyNameArray::setData):
979         (JSC::PropertyNameArray::data):
980         (JSC::PropertyNameArray::releaseData):
981         * kjs/ScopeChain.cpp:
982         (JSC::ScopeChainNode::print):
983         * kjs/StructureID.cpp:
984         (JSC::structureIDChainsAreEqual):
985         (JSC::StructureID::getEnumerablePropertyNames):
986         (JSC::StructureID::clearEnumerationCache):
987         (JSC::StructureID::createCachedPrototypeChain):
988         * kjs/StructureID.h:
989
990 2008-09-19  Holger Hans Peter Freyther  <zecke@selfish.org>
991
992         Reviewed by Maciej Stachowiak.
993
994         Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
995
996         * kjs/JSObject.cpp:
997         (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
998
999 2008-09-19  Darin Adler  <darin@apple.com>
1000
1001         Reviewed by Sam Weinig.
1002
1003         - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
1004           make each distinct C++ class get a distinct JSC::Structure
1005
1006         * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
1007
1008         * kjs/JSGlobalObject.h: Changed the protected constructor to take a
1009         structure instead of a prototype.
1010
1011         * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
1012
1013 2008-09-19  Julien Chaffraix  <jchaffraix@pleyo.com>
1014
1015         Reviewed by Alexey Proskuryakov.
1016
1017         Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
1018         non-template methods' code been copied for each instance of the template.
1019         The patch splits RefCounted between a base class that holds non-template methods and attributes
1020         and the template RefCounted class that keeps the same functionnality.
1021
1022         On my Linux with gcc 4.3 for the Gtk port, this is:
1023         - a ~600KB save on libwebkit.so in release.
1024         - a ~1.6MB save on libwebkit.so in debug.
1025
1026         It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
1027         On the whole, it should be a small win as we reduce the compiled code size and the only
1028         new function call should be inlined by the compiler.
1029
1030         * wtf/RefCounted.h:
1031         (WTF::RefCountedBase::ref): Copied from RefCounted.
1032         (WTF::RefCountedBase::hasOneRef): Ditto.
1033         (WTF::RefCountedBase::refCount): Ditto.
1034         (WTF::RefCountedBase::RefCountedBase): Ditto.
1035         (WTF::RefCountedBase::~RefCountedBase): Ditto.
1036         (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
1037         template section.
1038         (WTF::RefCounted::RefCounted):
1039         (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
1040         (WTF::RefCounted::~RefCounted): Keep private destructor.
1041
1042 2008-09-18  Darin Adler  <darin@apple.com>
1043
1044         Reviewed by Maciej Stachowiak.
1045
1046         - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
1047           make each distinct C++ class get a distinct JSC::Structure
1048
1049         * kjs/lookup.h: Removed things here that were used only in WebCore:
1050         cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
1051         and JSC_IMPLEMENT_PROTOTYPE.
1052
1053 2008-09-18  Darin Adler  <darin@apple.com>
1054
1055         Reviewed by Maciej Stachowiak.
1056
1057         - https://bugs.webkit.org/show_bug.cgi?id=20927
1058           simplify/streamline the code to turn strings into identifiers while parsing
1059
1060         * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
1061         well as for IDENT.
1062
1063         * kjs/lexer.cpp:
1064         (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
1065         * kjs/lexer.h: Remove makeUString.
1066
1067         * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
1068
1069         * VM/CodeGenerator.cpp:
1070         (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
1071         (JSC::prepareJumpTableForStringSwitch): Ditto.
1072         * kjs/nodes.cpp:
1073         (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
1074         (JSC::processClauseList): Ditto.
1075         * kjs/nodes2string.cpp:
1076         (JSC::StringNode::streamTo): Ditto.
1077
1078 2008-09-18  Sam Weinig  <sam@webkit.org>
1079
1080         Fix style.
1081
1082         * VM/Instruction.h:
1083         (JSC::Instruction::Instruction):
1084
1085 2008-09-18  Oliver Hunt  <oliver@apple.com>
1086
1087         Reviewed by Maciej Stachowiak.
1088
1089         Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
1090         <https://bugs.webkit.org/show_bug.cgi?id=20911>
1091
1092         The problem was simply caused by the int constructor for Instruction
1093         failing to initialise the full struct in 64bit builds.
1094
1095         * VM/Instruction.h:
1096         (JSC::Instruction::Instruction):
1097
1098 2008-09-18  Darin Adler  <darin@apple.com>
1099
1100         - fix release build
1101
1102         * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
1103
1104 2008-09-18  Darin Adler  <darin@apple.com>
1105
1106         Reviewed by Sam Weinig.
1107
1108         * kjs/JSGlobalObject.h: Tiny style guideline tweak.
1109
1110 2008-09-18  Darin Adler  <darin@apple.com>
1111
1112         Reviewed by Sam Weinig.
1113
1114         - fix https://bugs.webkit.org/show_bug.cgi?id=20925
1115           LEAK messages appear every time I quit
1116
1117         * JavaScriptCore.exp: Updated, and also added an export
1118         needed for future WebCore use of JSC::StructureID.
1119
1120         * wtf/RefCountedLeakCounter.cpp:
1121         (WTF::RefCountedLeakCounter::suppressMessages): Added.
1122         (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
1123         (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
1124         (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
1125         log the reason there was no leak checking done.
1126         (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
1127         (WTF::RefCountedLeakCounter::decrement): Ditto.
1128
1129         * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
1130         new functions, suppressMessages and cancelMessageSuppression. Also
1131         added m_ prefixes to the data member names.
1132
1133 2008-09-18  Holger Hans Peter Freyther  <zecke@selfish.org>
1134
1135         Reviewed by Mark Rowe.
1136
1137         https://bugs.webkit.org/show_bug.cgi?id=20437
1138
1139         Add a proper #define to define which XML Parser implementation to use. Client
1140         code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
1141         implementation is going to be used.
1142
1143         * wtf/Platform.h:
1144
1145 2008-09-18  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1146
1147         Reviewed by Maciej Stachowiak.
1148
1149         Make a Unicode non-breaking space count as a whitespace character in
1150         PCRE. This change was already made in WREC, and it fixes one of the
1151         Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
1152         in a new set of expected test results.
1153
1154         * pcre/pcre_internal.h:
1155         (isSpaceChar):
1156         * tests/mozilla/expected.html:
1157
1158 2008-09-18  Stephanie Lewis  <slewis@apple.com>
1159
1160         Reviewed by Mark Rowe and Maciej Stachowiak.
1161
1162         add an option use arch to specify which architecture to run.
1163
1164         * tests/mozilla/jsDriver.pl:
1165
1166 2008-09-17  Oliver Hunt  <oliver@apple.com>
1167
1168         Correctly restore argument reference prior to SFX runtime calls.
1169         
1170         Reviewed by Steve Falkenburg.
1171
1172         * VM/CTI.cpp:
1173         (JSC::CTI::privateCompileSlowCases):
1174         (JSC::CTI::privateCompile):
1175
1176 2008-09-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1177
1178         Reviewed by Maciej Stachowiak.
1179
1180         Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
1181         <https://bugs.webkit.org/show_bug.cgi?id=20876>
1182
1183         r36417 and r36427 caused an get_by_id opcode to be emitted before the
1184         instanceof and construct opcodes, in order to enable inline caching of
1185         the prototype property. Unfortunately, this regressed some tests dealing
1186         with exceptions thrown by 'instanceof' and the 'new' operator. We fix
1187         these problems by detecting whether an "is not an object" exception is
1188         thrown before op_instanceof or op_construct, and emit the proper
1189         exception in those cases.
1190
1191         * VM/CodeGenerator.cpp:
1192         (JSC::CodeGenerator::emitConstruct):
1193         * VM/CodeGenerator.h:
1194         * VM/ExceptionHelpers.cpp:
1195         (JSC::createInvalidParamError):
1196         (JSC::createNotAConstructorError):
1197         (JSC::createNotAnObjectError):
1198         * VM/ExceptionHelpers.h:
1199         * VM/Machine.cpp:
1200         (JSC::Machine::getOpcode):
1201         (JSC::Machine::privateExecute):
1202         * VM/Machine.h:
1203         * kjs/nodes.cpp:
1204         (JSC::NewExprNode::emitCode):
1205         (JSC::InstanceOfNode::emitCode):
1206
1207 2008-09-17  Gavin Barraclough  <barraclough@apple.com>
1208
1209         Reviewed by Oliver Hunt.
1210
1211         JIT generation cti_op_construct_verify.
1212         
1213         Quarter to half percent progression on v8-tests.
1214         Roughly not change on SunSpider (possible minor progression).
1215
1216         * VM/CTI.cpp:
1217         (JSC::CTI::privateCompileMainPass):
1218         * VM/Machine.cpp:
1219         * VM/Machine.h:
1220
1221 2008-09-15  Steve Falkenburg  <sfalken@apple.com>
1222
1223         Improve timer accuracy for JavaScript Date object on Windows.
1224         
1225         Use a combination of ftime and QueryPerformanceCounter.
1226         ftime returns the information we want, but doesn't have sufficient resolution.
1227         QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
1228         To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
1229         QueryPerformanceCounter by itself, adding the delta to the saved ftime.  We re-sync to
1230         correct for drift if the low-res and high-res elapsed time between calls differs by more
1231         than twice the low-resolution timer resolution.
1232         
1233         QueryPerformanceCounter may be inaccurate due to a problems with:
1234         - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
1235         - BIOS bugs (http://support.microsoft.com/kb/895980/)
1236         - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
1237         
1238         Reviewed by Darin Adler.
1239
1240         * kjs/DateMath.cpp:
1241         (JSC::highResUpTime):
1242         (JSC::lowResUTCTime):
1243         (JSC::qpcAvailable):
1244         (JSC::getCurrentUTCTimeWithMicroseconds):
1245
1246 2008-09-17  Gavin Barraclough  <barraclough@apple.com>
1247
1248         Reviewed by Geoff Garen.
1249
1250         Implement JIT generation of CallFrame initialization, for op_call.
1251
1252         1% sunspider 2.5% v8-tests.
1253
1254         * VM/CTI.cpp:
1255         (JSC::CTI::compileOpCall):
1256         * VM/Machine.cpp:
1257         (JSC::Machine::cti_op_call_JSFunction):
1258         (JSC::Machine::cti_op_call_NotJSFunction):
1259
1260 2008-09-17  Gavin Barraclough  <barraclough@apple.com>
1261
1262         Reviewed by Geoff Garen.
1263
1264         Optimizations for op_call in CTI.  Move check for (ctiCode == 0) into JIT code,
1265         move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
1266         functions, instead of checking prior to making the call.
1267
1268         3% on v8-tests (4% on richards, 6% in delta-blue)
1269
1270         * VM/CTI.cpp:
1271         (JSC::CTI::compileOpCall):
1272         (JSC::CTI::privateCompileSlowCases):
1273         (JSC::CTI::privateCompile):
1274         * VM/Machine.cpp:
1275         (JSC::Machine::execute):
1276         (JSC::Machine::cti_op_call_JSFunction):
1277         (JSC::Machine::cti_vm_compile):
1278         (JSC::Machine::cti_vm_updateScopeChain):
1279         (JSC::Machine::cti_op_construct_JSConstruct):
1280         * VM/Machine.h:
1281
1282 2008-09-17  Tor Arne Vestbø  <tavestbo@trolltech.com>
1283
1284         Fix the QtWebKit/Mac build
1285
1286         * wtf/ThreadingQt.cpp:
1287         (WTF::initializeThreading): use QCoreApplication to get the main thread
1288
1289 2008-09-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1290
1291         Reviewed by Maciej Stachowiak.
1292
1293         Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
1294         <https://bugs.webkit.org/show_bug.cgi?id=20857>
1295
1296         Fix a problem stemming from the slightly unsafe behaviour of the
1297         CodeGenerator::finalDestination() method by putting the "func" argument
1298         of the emitConstruct() method in a RefPtr in its caller. Also, add an
1299         assertion guaranteeing that this is always the case.
1300
1301         CodeGenerator::finalDestination() is still incorrect and can cause
1302         problems with a different allocator; see bug 20340 for more details.
1303
1304         * VM/CodeGenerator.cpp:
1305         (JSC::CodeGenerator::emitConstruct):
1306         * kjs/nodes.cpp:
1307         (JSC::NewExprNode::emitCode):
1308
1309 2008-09-16  Alice Liu  <alice.liu@apple.com>
1310
1311         build fix.
1312
1313         * VM/CTI.cpp:
1314         (JSC::CTI::privateCompileMainPass):
1315
1316 2008-09-16  Gavin Barraclough  <barraclough@apple.com>
1317
1318         Reviewed by Geoff Garen.
1319
1320         CTI code generation for op_ret.  The majority of the work
1321         (updating variables on the stack & on exec) can be performed
1322         directly in generated code.
1323
1324         We still need to check, & to call out to C-code to handle
1325         activation records, profiling, and full scope chains.
1326
1327         +1.5% Sunspider, +5/6% v8 tests.
1328
1329         * VM/CTI.cpp:
1330         (JSC::CTI::emitPutCTIParam):
1331         (JSC::CTI::compileOpCall):
1332         (JSC::CTI::privateCompileMainPass):
1333         * VM/CTI.h:
1334         * VM/Machine.cpp:
1335         (JSC::Machine::cti_op_ret_activation):
1336         (JSC::Machine::cti_op_ret_profiler):
1337         (JSC::Machine::cti_op_ret_scopeChain):
1338         * VM/Machine.h:
1339
1340 2008-09-16  Dimitri Glazkov  <dglazkov@chromium.org>
1341
1342         Fix the Windows build.
1343
1344         Add some extra parentheses to stop MSVC from complaining so much.
1345
1346         * VM/Machine.cpp:
1347         (JSC::Machine::privateExecute):
1348         (JSC::Machine::cti_op_stricteq):
1349         (JSC::Machine::cti_op_nstricteq):
1350         * kjs/operations.cpp:
1351         (JSC::strictEqual):
1352
1353 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
1354
1355         Reviewed by Cameron Zwarich.
1356         
1357         - speed up the === and !== operators by choosing the fast cases better
1358         
1359         No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
1360
1361         * VM/Machine.cpp:
1362         (JSC::Machine::privateExecute):
1363         (JSC::Machine::cti_op_stricteq):
1364         (JSC::Machine::cti_op_nstricteq):
1365         * kjs/JSImmediate.h:
1366         (JSC::JSImmediate::areBothImmediate):
1367         * kjs/operations.cpp:
1368         (JSC::strictEqual):
1369         (JSC::strictEqualSlowCase):
1370         * kjs/operations.h:
1371
1372 2008-09-15  Oliver Hunt  <oliver@apple.com>
1373
1374         RS=Sam Weinig.
1375
1376         Coding style cleanup.
1377
1378         * VM/Machine.cpp:
1379         (JSC::Machine::privateExecute):
1380
1381 2008-09-15  Oliver Hunt  <oliver@apple.com>
1382
1383         Reviewed by Cameron Zwarich.
1384
1385         Bug 20874: op_resolve does not do any form of caching
1386         <https://bugs.webkit.org/show_bug.cgi?id=20874>
1387
1388         This patch adds an op_resolve_global opcode to handle (and cache)
1389         property lookup we can statically determine must occur on the global
1390         object (if at all).
1391
1392         3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
1393         10% in math-partial-sums
1394
1395         * VM/CTI.cpp:
1396         (JSC::CTI::privateCompileMainPass):
1397         * VM/CTI.h:
1398         * VM/CodeBlock.cpp:
1399         (JSC::CodeBlock::dump):
1400         * VM/CodeGenerator.cpp:
1401         (JSC::CodeGenerator::findScopedProperty):
1402         (JSC::CodeGenerator::emitResolve):
1403         * VM/Machine.cpp:
1404         (JSC::resolveGlobal):
1405         (JSC::Machine::privateExecute):
1406         (JSC::Machine::cti_op_resolve_global):
1407         * VM/Machine.h:
1408         * VM/Opcode.h:
1409
1410 2008-09-15  Sam Weinig  <sam@webkit.org>
1411
1412         Roll out r36462.  It broke document.all.
1413
1414         * VM/CTI.cpp:
1415         (JSC::CTI::privateCompileMainPass):
1416         (JSC::CTI::privateCompileSlowCases):
1417         * VM/CTI.h:
1418         * VM/Machine.cpp:
1419         (JSC::Machine::Machine):
1420         (JSC::Machine::cti_op_eq_null):
1421         (JSC::Machine::cti_op_neq_null):
1422         * VM/Machine.h:
1423         (JSC::Machine::isJSString):
1424         * kjs/JSCell.h:
1425         * kjs/JSWrapperObject.h:
1426         * kjs/StringObject.h:
1427         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1428
1429 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1430
1431         Reviewed by Maciej Stachowiak.
1432
1433         Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
1434         <https://bugs.webkit.org/show_bug.cgi?id=20863>
1435
1436         r36427 changed the number of arguments to op_construct without changing
1437         the argument index for the vPC in the call to initializeCallFrame() in
1438         the CTI case. This caused a JSC test failure. Correcting the argument
1439         index fixes the test failure.
1440
1441         * VM/Machine.cpp:
1442         (JSC::Machine::cti_op_construct_JSConstruct):
1443
1444 2008-09-15  Mark Rowe  <mrowe@apple.com>
1445
1446         Fix GCC 4.2 build.
1447
1448         * VM/CTI.h:
1449
1450 2008-09-15  Geoffrey Garen  <ggaren@apple.com>
1451
1452         Reviewed by Maciej Stachowiak.
1453         
1454         Fixed a typo in op_get_by_id_chain that caused it to miss every time
1455         in the interpreter.
1456         
1457         Also, a little cleanup.
1458
1459         * VM/Machine.cpp:
1460         (JSC::Machine::privateExecute): Set up baseObject before entering the
1461         loop, so we compare against the right values.
1462
1463 2008-09-15  Geoffrey Garen  <ggaren@apple.com>
1464
1465         Reviewed by Sam Weinig.
1466         
1467         Removed the CalledAsConstructor flag from the call frame header. Now,
1468         we use an explicit opcode at the call site to fix up constructor results.
1469
1470         SunSpider says 0.4% faster.
1471         
1472         cti_op_construct_verify is an out-of-line function call for now, but we
1473         can fix that once StructureID holds type information like isObject.
1474
1475         * VM/CTI.cpp:
1476         (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
1477
1478         * VM/CodeBlock.cpp:
1479         (JSC::CodeBlock::dump):
1480
1481         * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
1482         (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
1483         (JSC::CodeGenerator::emitConstruct): ... ditto.
1484
1485         * VM/Machine.cpp: No more CalledAsConstructor
1486         (JSC::Machine::privateExecute): Implementation for the new opcode.
1487         (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
1488         called as a constructor.
1489         (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
1490         * VM/Machine.h:
1491
1492         * VM/Opcode.h: Declare new opcode.
1493
1494         * VM/RegisterFile.h:
1495         (JSC::RegisterFile::): No more CalledAsConstructor
1496
1497 2008-09-15  Gavin Barraclough  <barraclough@apple.com>
1498
1499         Reviewed by Geoff Garen.
1500
1501         Inline code generation of eq_null/neq_null for CTI.  Uses vptr checking for
1502         StringObjectsThatAreMasqueradingAsBeingUndefined.  In the long run, the
1503         masquerading may be handled differently (through the StructureIDs - see bug
1504         #20823).
1505
1506         >1% on v8-tests.
1507
1508         * VM/CTI.cpp:
1509         (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
1510         (JSC::CTI::privateCompileMainPass):
1511         (JSC::CTI::privateCompileSlowCases):
1512         * VM/CTI.h:
1513         * VM/Machine.cpp:
1514         (JSC::Machine::Machine):
1515         (JSC::Machine::cti_op_eq_null):
1516         (JSC::Machine::cti_op_neq_null):
1517         * VM/Machine.h:
1518         (JSC::Machine::doesMasqueradesAsUndefined):
1519         * kjs/JSWrapperObject.h:
1520         (JSC::JSWrapperObject::):
1521         (JSC::JSWrapperObject::JSWrapperObject):
1522         * kjs/StringObject.h:
1523         (JSC::StringObject::StringObject):
1524         * kjs/StringObjectThatMasqueradesAsUndefined.h:
1525         (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1526
1527 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1528
1529         Rubber-stamped by Oliver Hunt.
1530
1531         r36427 broke CodeBlock::dump() by changing the number of arguments to
1532         op_construct without changing the code that prints it. This patch fixes
1533         it by printing the additional argument.
1534
1535         * JavaScriptCore.xcodeproj/project.pbxproj:
1536         * VM/CodeBlock.cpp:
1537         (JSC::CodeBlock::dump):
1538
1539 2008-09-15  Adam Roben  <aroben@apple.com>
1540
1541         Build fix
1542
1543         * kjs/StructureID.cpp: Removed a stray semicolon.
1544
1545 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1546
1547         Reviewed by Maciej Stachowiak.
1548
1549         Fix a crash in fast/js/exception-expression-offset.html caused by not
1550         updating all mentions of the length of op_construct in r36427.
1551
1552         * VM/Machine.cpp:
1553         (JSC::Machine::cti_op_construct_NotJSConstruct):
1554
1555 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
1556
1557         Reviewed by Cameron Zwarich.
1558         
1559         - fix layout test failure introduced by fix for 20849
1560         
1561         (The failing test was fast/js/delete-then-put.html)
1562
1563         * kjs/JSObject.cpp:
1564         (JSC::JSObject::removeDirect): Clear enumeration cache
1565         in the dictionary case.
1566         * kjs/JSObject.h:
1567         (JSC::JSObject::putDirect): Ditto.
1568         * kjs/StructureID.h:
1569         (JSC::StructureID::clearEnumerationCache): Inline to handle the
1570         clear.
1571
1572 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
1573
1574         Reviewed by Cameron Zwarich.
1575         
1576         - fix JSC test failures introduced by fix for 20849
1577
1578         * kjs/PropertyMap.cpp:
1579         (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
1580
1581 2008-09-15  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1582
1583         Reviewed by Maciej Stachowiak.
1584
1585         Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
1586         <https://bugs.webkit.org/show_bug.cgi?id=20851>
1587
1588         r36410 introduced an optimization for parseInt() that is incorrect when
1589         its argument is larger than the range of a 32-bit integer. If the
1590         argument is a number that is not an immediate integer, then the correct
1591         behaviour is to return the floor of its value, unless it is an infinite
1592         value, in which case the correct behaviour is to return 0.
1593
1594         * kjs/JSGlobalObjectFunctions.cpp:
1595         (JSC::globalFuncParseInt):
1596
1597 2008-09-15  Sam Weinig  <sam@webkit.org>
1598
1599         Reviewed by Maciej Stachowiak.
1600
1601         Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
1602         Cache property names for getEnumerablePropertyNames in the StructureID.
1603
1604         ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta).  ~1% speedup
1605         on the v8 test suite.
1606
1607         * kjs/JSObject.cpp:
1608         (JSC::JSObject::getPropertyNames):
1609         * kjs/PropertyMap.cpp:
1610         (JSC::PropertyMap::getEnumerablePropertyNames):
1611         * kjs/PropertyMap.h:
1612         * kjs/StructureID.cpp:
1613         (JSC::StructureID::StructureID):
1614         (JSC::StructureID::getEnumerablePropertyNames):
1615         * kjs/StructureID.h:
1616
1617 2008-09-14  Maciej Stachowiak  <mjs@apple.com>
1618
1619         Reviewed by Cameron Zwarich.
1620         
1621         - speed up JS construction by extracting "prototype" lookup so PIC applies.
1622         
1623         ~0.5% speedup on SunSpider
1624         Speeds up some of the V8 tests as well, most notably earley-boyer.
1625
1626         * VM/CTI.cpp:
1627         (JSC::CTI::compileOpCall): Account for extra arg for prototype.
1628         (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
1629         * VM/CodeGenerator.cpp:
1630         (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
1631         * VM/Machine.cpp:
1632         (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
1633         (JSC::Machine::cti_op_construct_JSConstruct): ditto
1634         (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
1635
1636 2008-09-10  Alexey Proskuryakov  <ap@webkit.org>
1637
1638         Reviewed by Eric Seidel.
1639
1640         Add a protected destructor for RefCounted.
1641
1642         It is wrong to call its destructor directly, because (1) this should be taken care of by
1643         deref(), and (2) many classes that use RefCounted have non-virtual destructors.
1644
1645         No change in behavior.
1646
1647         * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
1648
1649 2008-09-14  Gavin Barraclough  <barraclough@apple.com>
1650
1651         Reviewed by Sam Weinig.
1652
1653         Accelerated property accesses.
1654
1655         Inline more of the array access code into the JIT code for get/put_by_val.
1656         Accelerate get/put_by_id by speculatively inlining a disable direct access
1657         into the hot path of the code, and repatch this with the correct StructureID
1658         and property map offset once these are known.  In the case of accesses to the
1659         prototype and reading the array-length a trampoline is genertaed, and the
1660         branch to the slow-case is relinked to jump to this.
1661
1662         By repatching, we mean rewriting the x86 instruction stream.  Instructions are
1663         only modified in a simple fasion - altering immediate operands, memory access
1664         deisplacements, and branch offsets.
1665         
1666         For regular get_by_id/put_by_id accesses to an object, a StructureID in an
1667         instruction's immediate operant is updateded, and a memory access operation's
1668         displacement is updated to access the correct field on the object.  In the case
1669         of more complex accesses (array length and get_by_id_prototype) the offset on
1670         the branch to slow-case is updated, to now jump to a trampoline.
1671
1672         +2.8% sunspider, +13% v8-tests
1673
1674         * VM/CTI.cpp:
1675         (JSC::CTI::emitCall):
1676         (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
1677         (JSC::CTI::CTI):
1678         (JSC::CTI::privateCompileMainPass):
1679         (JSC::CTI::privateCompileSlowCases):
1680         (JSC::CTI::privateCompile):
1681         (JSC::CTI::privateCompileGetByIdSelf):
1682         (JSC::CTI::privateCompileGetByIdProto):
1683         (JSC::CTI::privateCompileGetByIdChain):
1684         (JSC::CTI::privateCompilePutByIdReplace):
1685         (JSC::CTI::privateCompilePutByIdTransition):
1686         (JSC::CTI::privateCompileArrayLengthTrampoline):
1687         (JSC::CTI::privateCompileStringLengthTrampoline):
1688         (JSC::CTI::patchGetByIdSelf):
1689         (JSC::CTI::patchPutByIdReplace):
1690         (JSC::CTI::privateCompilePatchGetArrayLength):
1691         (JSC::CTI::privateCompilePatchGetStringLength):
1692         * VM/CTI.h:
1693         (JSC::CTI::compileGetByIdSelf):
1694         (JSC::CTI::compileGetByIdProto):
1695         (JSC::CTI::compileGetByIdChain):
1696         (JSC::CTI::compilePutByIdReplace):
1697         (JSC::CTI::compilePutByIdTransition):
1698         (JSC::CTI::compileArrayLengthTrampoline):
1699         (JSC::CTI::compileStringLengthTrampoline):
1700         (JSC::CTI::compilePatchGetArrayLength):
1701         (JSC::CTI::compilePatchGetStringLength):
1702         * VM/CodeBlock.cpp:
1703         (JSC::CodeBlock::dump):
1704         (JSC::CodeBlock::~CodeBlock):
1705         * VM/CodeBlock.h:
1706         (JSC::StructureStubInfo::StructureStubInfo):
1707         (JSC::CodeBlock::getStubInfo):
1708         * VM/Machine.cpp:
1709         (JSC::Machine::tryCTICachePutByID):
1710         (JSC::Machine::tryCTICacheGetByID):
1711         (JSC::Machine::cti_op_put_by_val_array):
1712         * VM/Machine.h:
1713         * masm/X86Assembler.h:
1714         (JSC::X86Assembler::):
1715         (JSC::X86Assembler::cmpl_i8m):
1716         (JSC::X86Assembler::emitUnlinkedJa):
1717         (JSC::X86Assembler::getRelocatedAddress):
1718         (JSC::X86Assembler::getDifferenceBetweenLabels):
1719         (JSC::X86Assembler::emitModRm_opmsib):
1720
1721 2008-09-14  Maciej Stachowiak  <mjs@apple.com>
1722
1723         Reviewed by Cameron Zwarich.
1724         
1725         - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
1726         
1727         ~5% speedup on v8 earley-boyer test
1728
1729         * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
1730         * API/JSCallbackObjectFunctions.h:
1731         (JSC::::hasInstance): Ditto.
1732         * API/JSValueRef.cpp:
1733         (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
1734         * JavaScriptCore.exp:
1735         * VM/CTI.cpp:
1736         (JSC::CTI::privateCompileMainPass): Pass along prototype.
1737         * VM/CodeBlock.cpp:
1738         (JSC::CodeBlock::dump): Print third arg.
1739         * VM/CodeGenerator.cpp:
1740         (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
1741         is a third argument.
1742         * VM/CodeGenerator.h:
1743         * VM/Machine.cpp:
1744         (JSC::Machine::privateExecute): Pass along the prototype.
1745         (JSC::Machine::cti_op_instanceof): ditto
1746         * kjs/JSObject.cpp:
1747         (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
1748         * kjs/JSObject.h:
1749         * kjs/nodes.cpp:
1750         (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
1751         property and pass that register to instanceof.
1752         * kjs/nodes.h:
1753
1754 2008-09-14  Gavin Barraclough  <barraclough@apple.com>
1755
1756         Reviewed by Sam Weinig.
1757
1758         Remove unnecessary virtual function call from cti_op_call_JSFunction -
1759         ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
1760
1761         * VM/Machine.cpp:
1762         (JSC::Machine::cti_op_call_JSFunction):
1763
1764 2008-09-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1765
1766         Reviewed by Maciej Stachowiak.
1767
1768         Bug 20827: the 'typeof' operator is slow
1769         <https://bugs.webkit.org/show_bug.cgi?id=20827>
1770
1771         Optimize the 'typeof' operator when its result is compared to a constant
1772         string.
1773
1774         This is a 5.5% speedup on the V8 Earley-Boyer test.
1775
1776         * VM/CTI.cpp:
1777         (JSC::CTI::privateCompileMainPass):
1778         * VM/CodeBlock.cpp:
1779         (JSC::CodeBlock::dump):
1780         * VM/CodeGenerator.cpp:
1781         (JSC::CodeGenerator::emitEqualityOp):
1782         * VM/CodeGenerator.h:
1783         * VM/Machine.cpp:
1784         (JSC::jsIsObjectType):
1785         (JSC::jsIsFunctionType):
1786         (JSC::Machine::privateExecute):
1787         (JSC::Machine::cti_op_is_undefined):
1788         (JSC::Machine::cti_op_is_boolean):
1789         (JSC::Machine::cti_op_is_number):
1790         (JSC::Machine::cti_op_is_string):
1791         (JSC::Machine::cti_op_is_object):
1792         (JSC::Machine::cti_op_is_function):
1793         * VM/Machine.h:
1794         * VM/Opcode.h:
1795         * kjs/nodes.cpp:
1796         (JSC::BinaryOpNode::emitCode):
1797         (JSC::EqualNode::emitCode):
1798         (JSC::StrictEqualNode::emitCode):
1799         * kjs/nodes.h:
1800
1801 2008-09-14  Sam Weinig  <sam@webkit.org>
1802
1803         Reviewed by Cameron Zwarich.
1804
1805         Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
1806         Speed up parseInt for numbers
1807
1808         Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
1809         No change on the v8 suite.
1810
1811         * kjs/JSGlobalObjectFunctions.cpp:
1812         (JSC::globalFuncParseInt): Don't convert numbers to strings just to
1813         convert them back to numbers.
1814
1815 2008-09-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1816
1817         Reviewed by Oliver Hunt.
1818
1819         Bug 20816: op_lesseq should be optimized
1820         <https://bugs.webkit.org/show_bug.cgi?id=20816>
1821
1822         Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
1823
1824         This is a 9.4% speedup on the V8 Crypto benchmark.
1825
1826         * VM/CTI.cpp:
1827         (JSC::CTI::privateCompileMainPass):
1828         (JSC::CTI::privateCompileSlowCases):
1829         * VM/CodeBlock.cpp:
1830         (JSC::CodeBlock::dump):
1831         * VM/CodeGenerator.cpp:
1832         (JSC::CodeGenerator::emitJumpIfTrue):
1833         * VM/Machine.cpp:
1834         (JSC::Machine::privateExecute):
1835         (JSC::Machine::cti_op_loop_if_lesseq):
1836         * VM/Machine.h:
1837         * VM/Opcode.h:
1838
1839 2008-09-14  Sam Weinig  <sam@webkit.org>
1840
1841         Reviewed by Cameron Zwarich.
1842
1843         Cleanup Sampling code.
1844
1845         * VM/CTI.cpp:
1846         (JSC::CTI::emitCall):
1847         (JSC::CTI::privateCompileMainPass):
1848         * VM/CTI.h:
1849         (JSC::CTI::execute):
1850         * VM/SamplingTool.cpp:
1851         (JSC::):
1852         (JSC::SamplingTool::run):
1853         (JSC::SamplingTool::dump):
1854         * VM/SamplingTool.h:
1855         (JSC::SamplingTool::callingHostFunction):
1856
1857 2008-09-13  Oliver Hunt  <oliver@apple.com>
1858
1859         Reviewed by Cameron Zwarich.
1860
1861         Bug 20821: Cache property transitions to speed up object initialization
1862         https://bugs.webkit.org/show_bug.cgi?id=20821
1863
1864         Implement a transition cache to improve the performance of new properties
1865         being added to objects.  This is extremely beneficial in constructors and
1866         shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
1867         overall)
1868
1869         * VM/CTI.cpp:
1870         (JSC::CTI::privateCompileMainPass):
1871         (JSC::):
1872         (JSC::transitionWillNeedStorageRealloc):
1873         (JSC::CTI::privateCompilePutByIdTransition):
1874         * VM/CTI.h:
1875         (JSC::CTI::compilePutByIdTransition):
1876         * VM/CodeBlock.cpp:
1877         (JSC::printPutByIdOp):
1878         (JSC::CodeBlock::printStructureIDs):
1879         (JSC::CodeBlock::dump):
1880         (JSC::CodeBlock::derefStructureIDs):
1881         (JSC::CodeBlock::refStructureIDs):
1882         * VM/CodeGenerator.cpp:
1883         (JSC::CodeGenerator::emitPutById):
1884         * VM/Machine.cpp:
1885         (JSC::cachePrototypeChain):
1886         (JSC::Machine::tryCachePutByID):
1887         (JSC::Machine::tryCacheGetByID):
1888         (JSC::Machine::privateExecute):
1889         (JSC::Machine::tryCTICachePutByID):
1890         (JSC::Machine::tryCTICacheGetByID):
1891         * VM/Machine.h:
1892         * VM/Opcode.h:
1893         * kjs/JSObject.h:
1894         (JSC::JSObject::putDirect):
1895         (JSC::JSObject::transitionTo):
1896         * kjs/PutPropertySlot.h:
1897         (JSC::PutPropertySlot::PutPropertySlot):
1898         (JSC::PutPropertySlot::wasTransition):
1899         (JSC::PutPropertySlot::setWasTransition):
1900         * kjs/StructureID.cpp:
1901         (JSC::StructureID::transitionTo):
1902         (JSC::StructureIDChain::StructureIDChain):
1903         * kjs/StructureID.h:
1904         (JSC::StructureID::previousID):
1905         (JSC::StructureID::setCachedPrototypeChain):
1906         (JSC::StructureID::cachedPrototypeChain):
1907         (JSC::StructureID::propertyMap):
1908         * masm/X86Assembler.h:
1909         (JSC::X86Assembler::addl_i8m):
1910         (JSC::X86Assembler::subl_i8m):
1911
1912 2008-09-12  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1913
1914         Reviewed by Maciej Stachowiak.
1915
1916         Bug 20819: JSValue::isObject() is slow
1917         <https://bugs.webkit.org/show_bug.cgi?id=20819>
1918
1919         Optimize JSCell::isObject() and JSCell::isString() by making them
1920         non-virtual calls that rely on the StructureID type information.
1921
1922         This is a 0.7% speedup on SunSpider and a 1.0% speedup on the V8
1923         benchmark suite.
1924
1925         * JavaScriptCore.exp:
1926         * kjs/JSCell.cpp:
1927         * kjs/JSCell.h:
1928         (JSC::JSCell::isObject):
1929         (JSC::JSCell::isString):
1930         * kjs/JSObject.cpp:
1931         * kjs/JSObject.h:
1932         * kjs/JSString.cpp:
1933         * kjs/JSString.h:
1934         (JSC::JSString::JSString):
1935         * kjs/StructureID.h:
1936         (JSC::StructureID::type):
1937
1938 2008-09-11  Stephanie Lewis  <slewis@apple.com>
1939
1940         Reviewed by Oliver Hunt.
1941
1942         Turn off PGO Optimization on CTI.cpp -> <rdar://problem/6207709>.  Fixes
1943         crash on CNN and on Dromaeo.
1944         Fix Missing close tag in vcproj. 
1945
1946         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1947
1948 2008-09-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1949
1950         Not reviewed.
1951
1952         Correct an SVN problem with the last commit and actually add the new
1953         files.
1954
1955         * wrec/CharacterClassConstructor.cpp: Added.
1956         (JSC::):
1957         (JSC::getCharacterClassNewline):
1958         (JSC::getCharacterClassDigits):
1959         (JSC::getCharacterClassSpaces):
1960         (JSC::getCharacterClassWordchar):
1961         (JSC::getCharacterClassNondigits):
1962         (JSC::getCharacterClassNonspaces):
1963         (JSC::getCharacterClassNonwordchar):
1964         (JSC::CharacterClassConstructor::addSorted):
1965         (JSC::CharacterClassConstructor::addSortedRange):
1966         (JSC::CharacterClassConstructor::put):
1967         (JSC::CharacterClassConstructor::flush):
1968         (JSC::CharacterClassConstructor::append):
1969         * wrec/CharacterClassConstructor.h: Added.
1970         (JSC::CharacterClassConstructor::CharacterClassConstructor):
1971         (JSC::CharacterClassConstructor::isUpsideDown):
1972         (JSC::CharacterClassConstructor::charClass):
1973
1974 2008-09-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1975
1976         Reviewed by Maciej Stachowiak.
1977
1978         Bug 20788: Split CharacterClassConstructor into its own file
1979         <https://bugs.webkit.org/show_bug.cgi?id=20788>
1980
1981         Split CharacterClassConstructor into its own file and clean up some
1982         style issues.
1983
1984         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1985         * JavaScriptCore.xcodeproj/project.pbxproj:
1986         * wrec/CharacterClassConstructor.cpp: Added.
1987         (JSC::):
1988         (JSC::getCharacterClassNewline):
1989         (JSC::getCharacterClassDigits):
1990         (JSC::getCharacterClassSpaces):
1991         (JSC::getCharacterClassWordchar):
1992         (JSC::getCharacterClassNondigits):
1993         (JSC::getCharacterClassNonspaces):
1994         (JSC::getCharacterClassNonwordchar):
1995         (JSC::CharacterClassConstructor::addSorted):
1996         (JSC::CharacterClassConstructor::addSortedRange):
1997         (JSC::CharacterClassConstructor::put):
1998         (JSC::CharacterClassConstructor::flush):
1999         (JSC::CharacterClassConstructor::append):
2000         * wrec/CharacterClassConstructor.h: Added.
2001         (JSC::CharacterClassConstructor::CharacterClassConstructor):
2002         (JSC::CharacterClassConstructor::isUpsideDown):
2003         (JSC::CharacterClassConstructor::charClass):
2004         * wrec/WREC.cpp:
2005         (JSC::WRECParser::parseCharacterClass):
2006
2007 2008-09-10  Simon Hausmann  <hausmann@webkit.org>
2008
2009         Not reviewed but trivial one-liner for yet unused macro.
2010
2011         Changed PLATFORM(WINCE) to PLATFORM(WIN_CE) as requested by Mark.
2012
2013         (part of https://bugs.webkit.org/show_bug.cgi?id=20746)
2014
2015         * wtf/Platform.h:
2016
2017 2008-09-10  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2018
2019         Rubber-stamped by Oliver Hunt.
2020
2021         Fix a typo by renaming the overloaded orl_rr that takes an immediate to
2022         orl_i32r.
2023
2024         * VM/CTI.cpp:
2025         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2026         * masm/X86Assembler.h:
2027         (JSC::X86Assembler::orl_i32r):
2028         * wrec/WREC.cpp:
2029         (JSC::WRECGenerator::generatePatternCharacter):
2030         (JSC::WRECGenerator::generateCharacterClassInverted):
2031
2032 2008-09-10  Sam Weinig  <sam@webkit.org>
2033
2034         Reviewed by Geoff Garen.
2035
2036         Add inline property storage for JSObject.
2037
2038         1.2% progression on Sunspider. .5% progression on the v8 test suite.
2039
2040         * JavaScriptCore.exp:
2041         * VM/CTI.cpp:
2042         (JSC::CTI::privateCompileGetByIdProto):
2043         (JSC::CTI::privateCompileGetByIdChain):
2044         * kjs/JSObject.cpp:
2045         (JSC::JSObject::mark): There is no reason to check storageSize now that
2046         we start from 0.
2047         (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
2048         * kjs/JSObject.h:
2049         (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr
2050         now so there is no reason to .get()
2051         (JSC::JSObject::usingInlineStorage):
2052         (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the
2053         inline storage.
2054         (JSC::JSObject::~JSObject): Free the heap storage if not using the inline
2055         storage.
2056         (JSC::JSObject::putDirect): Switch to the heap storage only when we know
2057         we know that we are about to add a property that will overflow the inline
2058         storage.
2059         * kjs/PropertyMap.cpp:
2060         (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is
2061         now handled by JSObject.
2062         (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
2063         * kjs/PropertyMap.h:
2064         (JSC::PropertyMap::storageSize): Rename from markingCount.
2065         * kjs/StructureID.cpp:
2066         (JSC::StructureID::addPropertyTransition): Don't resize the property storage
2067         if we are using inline storage.
2068         * kjs/StructureID.h:
2069
2070 2008-09-10  Oliver Hunt  <oliver@apple.com>
2071
2072         Reviewed by Geoff Garen.
2073
2074         Inline immediate number version of op_mul.
2075
2076         Renamed mull_rr to imull_rr as that's what it's 
2077         actually doing, and added imull_i32r for the constant
2078         case immediate multiply.
2079
2080         1.1% improvement to SunSpider.
2081
2082         * VM/CTI.cpp:
2083         (JSC::CTI::privateCompileMainPass):
2084         (JSC::CTI::privateCompileSlowCases):
2085         * masm/X86Assembler.h:
2086         (JSC::X86Assembler::):
2087         (JSC::X86Assembler::imull_rr):
2088         (JSC::X86Assembler::imull_i32r):
2089
2090 2008-09-10  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2091
2092         Not reviewed.
2093
2094         Mac build fix.
2095
2096         * JavaScriptCore.xcodeproj/project.pbxproj:
2097
2098 2008-09-09  Oliver Hunt  <oliver@apple.com>
2099
2100         Reviewed by Maciej Stachowiak.
2101
2102         Add optimised access to known properties on the global object.
2103
2104         Improve cross scope access to the global object by emitting
2105         code to access it directly rather than by walking the scope chain.
2106
2107         This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
2108
2109         * VM/CTI.cpp:
2110         (JSC::CTI::privateCompileMainPass):
2111         (JSC::CTI::emitGetVariableObjectRegister):
2112         (JSC::CTI::emitPutVariableObjectRegister):
2113         * VM/CTI.h:
2114         * VM/CodeBlock.cpp:
2115         (JSC::CodeBlock::dump):
2116         * VM/CodeGenerator.cpp:
2117         (JSC::CodeGenerator::findScopedProperty):
2118         (JSC::CodeGenerator::emitResolve):
2119         (JSC::CodeGenerator::emitGetScopedVar):
2120         (JSC::CodeGenerator::emitPutScopedVar):
2121         * VM/CodeGenerator.h:
2122         * VM/Machine.cpp:
2123         (JSC::Machine::privateExecute):
2124         * VM/Opcode.h:
2125         * kjs/nodes.cpp:
2126         (JSC::FunctionCallResolveNode::emitCode):
2127         (JSC::PostfixResolveNode::emitCode):
2128         (JSC::PrefixResolveNode::emitCode):
2129         (JSC::ReadModifyResolveNode::emitCode):
2130         (JSC::AssignResolveNode::emitCode):
2131
2132 2008-09-10  Maciej Stachowiak  <mjs@apple.com>
2133
2134         Reviewed by Oliver.
2135         
2136         - enable polymorphic inline caching of properties of primitives
2137         
2138         1.012x speedup on SunSpider.
2139
2140         We create special structure IDs for JSString and
2141         JSNumberCell. Unlike normal structure IDs, these cannot hold the
2142         true prototype. Due to JS autoboxing semantics, the prototype used
2143         when looking up string or number properties depends on the lexical
2144         global object of the call site, not the creation site. Thus we
2145         enable StructureIDs to handle this quirk for primitives.
2146         
2147         Everything else should be straightforward.
2148         
2149         * VM/CTI.cpp:
2150         (JSC::CTI::privateCompileGetByIdProto):
2151         (JSC::CTI::privateCompileGetByIdChain):
2152         * VM/CTI.h:
2153         (JSC::CTI::compileGetByIdProto):
2154         (JSC::CTI::compileGetByIdChain):
2155         * VM/JSPropertyNameIterator.h:
2156         (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2157         * VM/Machine.cpp:
2158         (JSC::Machine::Machine):
2159         (JSC::cachePrototypeChain):
2160         (JSC::Machine::tryCachePutByID):
2161         (JSC::Machine::tryCacheGetByID):
2162         (JSC::Machine::privateExecute):
2163         (JSC::Machine::tryCTICachePutByID):
2164         (JSC::Machine::tryCTICacheGetByID):
2165         * kjs/GetterSetter.h:
2166         (JSC::GetterSetter::GetterSetter):
2167         * kjs/JSCell.h:
2168         * kjs/JSGlobalData.cpp:
2169         (JSC::JSGlobalData::JSGlobalData):
2170         * kjs/JSGlobalData.h:
2171         * kjs/JSGlobalObject.h:
2172         (JSC::StructureID::prototypeForLookup):
2173         * kjs/JSNumberCell.h:
2174         (JSC::JSNumberCell::JSNumberCell):
2175         (JSC::jsNumberCell):
2176         * kjs/JSObject.h:
2177         (JSC::JSObject::prototype):
2178         * kjs/JSString.cpp:
2179         (JSC::jsString):
2180         (JSC::jsSubstring):
2181         (JSC::jsOwnedString):
2182         * kjs/JSString.h:
2183         (JSC::JSString::JSString):
2184         (JSC::JSString::):
2185         (JSC::jsSingleCharacterString):
2186         (JSC::jsSingleCharacterSubstring):
2187         (JSC::jsNontrivialString):
2188         * kjs/SmallStrings.cpp:
2189         (JSC::SmallStrings::createEmptyString):
2190         (JSC::SmallStrings::createSingleCharacterString):
2191         * kjs/StructureID.cpp:
2192         (JSC::StructureID::StructureID):
2193         (JSC::StructureID::addPropertyTransition):
2194         (JSC::StructureID::getterSetterTransition):
2195         (JSC::StructureIDChain::StructureIDChain):
2196         * kjs/StructureID.h:
2197         (JSC::StructureID::create):
2198         (JSC::StructureID::storedPrototype):
2199
2200 2008-09-09  Joerg Bornemann  <joerg.bornemann@trolltech.com>
2201
2202         Reviewed by Sam Weinig.
2203
2204         https://bugs.webkit.org/show_bug.cgi?id=20746
2205
2206         Added WINCE platform macro.
2207
2208         * wtf/Platform.h:
2209
2210 2008-09-09  Sam Weinig  <sam@webkit.org>
2211
2212         Reviewed by Mark Rowe.
2213
2214         Remove unnecessary override of getOffset.
2215
2216         Sunspider reports this as a .6% progression.
2217
2218         * JavaScriptCore.exp:
2219         * kjs/JSObject.h:
2220         (JSC::JSObject::getDirectLocation):
2221         (JSC::JSObject::getOwnPropertySlotForWrite):
2222         (JSC::JSObject::putDirect):
2223         * kjs/PropertyMap.cpp:
2224         * kjs/PropertyMap.h:
2225
2226 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2227
2228         Reviewed by Maciej Stachowiak.
2229
2230         Bug 20759: Remove MacroAssembler
2231         <https://bugs.webkit.org/show_bug.cgi?id=20759>
2232
2233         Remove MacroAssembler and move its functionality to X86Assembler.
2234
2235         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2236         * JavaScriptCore.xcodeproj/project.pbxproj:
2237         * VM/CTI.cpp:
2238         (JSC::CTI::emitGetArg):
2239         (JSC::CTI::emitGetPutArg):
2240         (JSC::CTI::emitPutArg):
2241         (JSC::CTI::emitPutCTIParam):
2242         (JSC::CTI::emitGetCTIParam):
2243         (JSC::CTI::emitPutToCallFrameHeader):
2244         (JSC::CTI::emitGetFromCallFrameHeader):
2245         (JSC::CTI::emitPutResult):
2246         (JSC::CTI::emitDebugExceptionCheck):
2247         (JSC::CTI::emitJumpSlowCaseIfNotImm):
2248         (JSC::CTI::emitJumpSlowCaseIfNotImms):
2249         (JSC::CTI::emitFastArithDeTagImmediate):
2250         (JSC::CTI::emitFastArithReTagImmediate):
2251         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2252         (JSC::CTI::emitFastArithImmToInt):
2253         (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2254         (JSC::CTI::emitFastArithIntToImmNoCheck):
2255         (JSC::CTI::compileOpCall):
2256         (JSC::CTI::emitSlowScriptCheck):
2257         (JSC::CTI::privateCompileMainPass):
2258         (JSC::CTI::privateCompileSlowCases):
2259         (JSC::CTI::privateCompile):
2260         (JSC::CTI::privateCompileGetByIdSelf):
2261         (JSC::CTI::privateCompileGetByIdProto):
2262         (JSC::CTI::privateCompileGetByIdChain):
2263         (JSC::CTI::privateCompilePutByIdReplace):
2264         (JSC::CTI::privateArrayLengthTrampoline):
2265         (JSC::CTI::privateStringLengthTrampoline):
2266         (JSC::CTI::compileRegExp):
2267         * VM/CTI.h:
2268         (JSC::CallRecord::CallRecord):
2269         (JSC::JmpTable::JmpTable):
2270         (JSC::SlowCaseEntry::SlowCaseEntry):
2271         (JSC::CTI::JSRInfo::JSRInfo):
2272         * masm/MacroAssembler.h: Removed.
2273         * masm/MacroAssemblerWin.cpp: Removed.
2274         * masm/X86Assembler.h:
2275         (JSC::X86Assembler::emitConvertToFastCall):
2276         (JSC::X86Assembler::emitRestoreArgumentReference):
2277         * wrec/WREC.h:
2278         (JSC::WRECGenerator::WRECGenerator):
2279         (JSC::WRECParser::WRECParser):
2280
2281 2008-09-09  Sam Weinig  <sam@webkit.org>
2282
2283         Reviewed by Cameron Zwarich.
2284
2285         Don't waste the first item in the PropertyStorage.
2286
2287         - Fix typo (makingCount -> markingCount)
2288         - Remove undefined method declaration.
2289
2290         No change on Sunspider.
2291
2292         * kjs/JSObject.cpp:
2293         (JSC::JSObject::mark):
2294         * kjs/PropertyMap.cpp:
2295         (JSC::PropertyMap::put):
2296         (JSC::PropertyMap::remove):
2297         (JSC::PropertyMap::getOffset):
2298         (JSC::PropertyMap::insert):
2299         (JSC::PropertyMap::rehash):
2300         (JSC::PropertyMap::resizePropertyStorage):
2301         (JSC::PropertyMap::checkConsistency):
2302         * kjs/PropertyMap.h:
2303         (JSC::PropertyMap::markingCount): Fix typo.
2304
2305 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2306
2307         Not reviewed.
2308
2309         Speculative Windows build fix.
2310
2311         * masm/MacroAssemblerWin.cpp:
2312         (JSC::MacroAssembler::emitConvertToFastCall):
2313         (JSC::MacroAssembler::emitRestoreArgumentReference):
2314
2315 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2316
2317         Reviewed by Maciej Stachowiak.
2318
2319         Bug 20755: Create an X86 namespace for register names and other things
2320         <https://bugs.webkit.org/show_bug.cgi?id=20755>
2321
2322         Create an X86 namespace to put X86 register names. Perhaps I will move
2323         opcode names here later as well.
2324
2325         * VM/CTI.cpp:
2326         (JSC::CTI::emitGetArg):
2327         (JSC::CTI::emitGetPutArg):
2328         (JSC::CTI::emitPutArg):
2329         (JSC::CTI::emitPutArgConstant):
2330         (JSC::CTI::emitPutCTIParam):
2331         (JSC::CTI::emitGetCTIParam):
2332         (JSC::CTI::emitPutToCallFrameHeader):
2333         (JSC::CTI::emitGetFromCallFrameHeader):
2334         (JSC::CTI::emitPutResult):
2335         (JSC::CTI::emitDebugExceptionCheck):
2336         (JSC::CTI::emitJumpSlowCaseIfNotImms):
2337         (JSC::CTI::compileOpCall):
2338         (JSC::CTI::emitSlowScriptCheck):
2339         (JSC::CTI::privateCompileMainPass):
2340         (JSC::CTI::privateCompileSlowCases):
2341         (JSC::CTI::privateCompile):
2342         (JSC::CTI::privateCompileGetByIdSelf):
2343         (JSC::CTI::privateCompileGetByIdProto):
2344         (JSC::CTI::privateCompileGetByIdChain):
2345         (JSC::CTI::privateCompilePutByIdReplace):
2346         (JSC::CTI::privateArrayLengthTrampoline):
2347         (JSC::CTI::privateStringLengthTrampoline):
2348         (JSC::CTI::compileRegExp):
2349         * VM/CTI.h:
2350         * masm/X86Assembler.h:
2351         (JSC::X86::):
2352         (JSC::X86Assembler::emitModRm_rm):
2353         (JSC::X86Assembler::emitModRm_rm_Unchecked):
2354         (JSC::X86Assembler::emitModRm_rmsib):
2355         * wrec/WREC.cpp:
2356         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2357         (JSC::WRECGenerator::generateGreedyQuantifier):
2358         (JSC::WRECGenerator::generateParentheses):
2359         (JSC::WRECGenerator::generateBackreference):
2360         (JSC::WRECGenerator::gernerateDisjunction):
2361         * wrec/WREC.h:
2362
2363 2008-09-09  Sam Weinig  <sam@webkit.org>
2364
2365         Reviewed by Geoffrey Garen.
2366
2367         Remove unnecessary friend declaration.
2368
2369         * kjs/PropertyMap.h:
2370
2371 2008-09-09  Sam Weinig  <sam@webkit.org>
2372
2373         Reviewed by Geoffrey Garen.
2374
2375         Replace uses of PropertyMap::get and PropertyMap::getLocation with
2376         PropertyMap::getOffset.
2377
2378         Sunspider reports this as a .6% improvement.
2379
2380         * JavaScriptCore.exp:
2381         * kjs/JSObject.cpp:
2382         (JSC::JSObject::put):
2383         (JSC::JSObject::deleteProperty):
2384         (JSC::JSObject::getPropertyAttributes):
2385         * kjs/JSObject.h:
2386         (JSC::JSObject::getDirect):
2387         (JSC::JSObject::getDirectLocation):
2388         (JSC::JSObject::locationForOffset):
2389         * kjs/PropertyMap.cpp:
2390         (JSC::PropertyMap::remove):
2391         (JSC::PropertyMap::getOffset):
2392         * kjs/PropertyMap.h:
2393
2394 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2395
2396         Reviewed by Sam Weinig.
2397
2398         Bug 20754: Remove emit prefix from assembler opcode methods
2399         <https://bugs.webkit.org/show_bug.cgi?id=20754>
2400
2401         * VM/CTI.cpp:
2402         (JSC::CTI::emitGetArg):
2403         (JSC::CTI::emitGetPutArg):
2404         (JSC::CTI::emitPutArg):
2405         (JSC::CTI::emitPutArgConstant):
2406         (JSC::CTI::emitPutCTIParam):
2407         (JSC::CTI::emitGetCTIParam):
2408         (JSC::CTI::emitPutToCallFrameHeader):
2409         (JSC::CTI::emitGetFromCallFrameHeader):
2410         (JSC::CTI::emitPutResult):
2411         (JSC::CTI::emitDebugExceptionCheck):
2412         (JSC::CTI::emitCall):
2413         (JSC::CTI::emitJumpSlowCaseIfNotImm):
2414         (JSC::CTI::emitJumpSlowCaseIfNotImms):
2415         (JSC::CTI::emitFastArithDeTagImmediate):
2416         (JSC::CTI::emitFastArithReTagImmediate):
2417         (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2418         (JSC::CTI::emitFastArithImmToInt):
2419         (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2420         (JSC::CTI::emitFastArithIntToImmNoCheck):
2421         (JSC::CTI::compileOpCall):
2422         (JSC::CTI::emitSlowScriptCheck):
2423         (JSC::CTI::privateCompileMainPass):
2424         (JSC::CTI::privateCompileSlowCases):
2425         (JSC::CTI::privateCompile):
2426         (JSC::CTI::privateCompileGetByIdSelf):
2427         (JSC::CTI::privateCompileGetByIdProto):
2428         (JSC::CTI::privateCompileGetByIdChain):
2429         (JSC::CTI::privateCompilePutByIdReplace):
2430         (JSC::CTI::privateArrayLengthTrampoline):
2431         (JSC::CTI::privateStringLengthTrampoline):
2432         (JSC::CTI::compileRegExp):
2433         * masm/MacroAssemblerWin.cpp:
2434         (JSC::MacroAssembler::emitConvertToFastCall):
2435         (JSC::MacroAssembler::emitRestoreArgumentReference):
2436         * masm/X86Assembler.h:
2437         (JSC::X86Assembler::pushl_r):
2438         (JSC::X86Assembler::pushl_m):
2439         (JSC::X86Assembler::popl_r):
2440         (JSC::X86Assembler::popl_m):
2441         (JSC::X86Assembler::movl_rr):
2442         (JSC::X86Assembler::addl_rr):
2443         (JSC::X86Assembler::addl_i8r):
2444         (JSC::X86Assembler::addl_i32r):
2445         (JSC::X86Assembler::addl_mr):
2446         (JSC::X86Assembler::andl_rr):
2447         (JSC::X86Assembler::andl_i32r):
2448         (JSC::X86Assembler::cmpl_i8r):
2449         (JSC::X86Assembler::cmpl_rr):
2450         (JSC::X86Assembler::cmpl_rm):
2451         (JSC::X86Assembler::cmpl_i32r):
2452         (JSC::X86Assembler::cmpl_i32m):
2453         (JSC::X86Assembler::cmpw_rm):
2454         (JSC::X86Assembler::orl_rr):
2455         (JSC::X86Assembler::subl_rr):
2456         (JSC::X86Assembler::subl_i8r):
2457         (JSC::X86Assembler::subl_i32r):
2458         (JSC::X86Assembler::subl_mr):
2459         (JSC::X86Assembler::testl_i32r):
2460         (JSC::X86Assembler::testl_rr):
2461         (JSC::X86Assembler::xorl_i8r):
2462         (JSC::X86Assembler::xorl_rr):
2463         (JSC::X86Assembler::sarl_i8r):
2464         (JSC::X86Assembler::sarl_CLr):
2465         (JSC::X86Assembler::shl_i8r):
2466         (JSC::X86Assembler::shll_CLr):
2467         (JSC::X86Assembler::mull_rr):
2468         (JSC::X86Assembler::idivl_r):
2469         (JSC::X86Assembler::cdq):
2470         (JSC::X86Assembler::movl_mr):
2471         (JSC::X86Assembler::movzwl_mr):
2472         (JSC::X86Assembler::movl_rm):
2473         (JSC::X86Assembler::movl_i32r):
2474         (JSC::X86Assembler::movl_i32m):
2475         (JSC::X86Assembler::leal_mr):
2476         (JSC::X86Assembler::ret):
2477         (JSC::X86Assembler::jmp_r):
2478         (JSC::X86Assembler::jmp_m):
2479         (JSC::X86Assembler::call_r):
2480         * wrec/WREC.cpp:
2481         (JSC::WRECGenerator::generateBacktrack1):
2482         (JSC::WRECGenerator::generateBacktrackBackreference):
2483         (JSC::WRECGenerator::generateBackreferenceQuantifier):
2484         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2485         (JSC::WRECGenerator::generateGreedyQuantifier):
2486         (JSC::WRECGenerator::generatePatternCharacter):
2487         (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2488         (JSC::WRECGenerator::generateCharacterClassInverted):
2489         (JSC::WRECGenerator::generateCharacterClass):
2490         (JSC::WRECGenerator::generateParentheses):
2491         (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2492         (JSC::WRECGenerator::generateAssertionBOL):
2493         (JSC::WRECGenerator::generateAssertionEOL):
2494         (JSC::WRECGenerator::generateAssertionWordBoundary):
2495         (JSC::WRECGenerator::generateBackreference):
2496         (JSC::WRECGenerator::gernerateDisjunction):
2497
2498 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2499
2500         Reviewed by Maciej Stachowiak.
2501
2502         Clean up the WREC code some more.
2503
2504         * VM/CTI.cpp:
2505         (JSC::CTI::compileRegExp):
2506         * wrec/WREC.cpp:
2507         (JSC::getCharacterClassNewline):
2508         (JSC::getCharacterClassDigits):
2509         (JSC::getCharacterClassSpaces):
2510         (JSC::getCharacterClassWordchar):
2511         (JSC::getCharacterClassNondigits):
2512         (JSC::getCharacterClassNonspaces):
2513         (JSC::getCharacterClassNonwordchar):
2514         (JSC::WRECGenerator::generateBacktrack1):
2515         (JSC::WRECGenerator::generateBacktrackBackreference):
2516         (JSC::WRECGenerator::generateBackreferenceQuantifier):
2517         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2518         (JSC::WRECGenerator::generateGreedyQuantifier):
2519         (JSC::WRECGenerator::generatePatternCharacter):
2520         (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2521         (JSC::WRECGenerator::generateCharacterClassInverted):
2522         (JSC::WRECGenerator::generateCharacterClass):
2523         (JSC::WRECGenerator::generateParentheses):
2524         (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2525         (JSC::WRECGenerator::generateAssertionBOL):
2526         (JSC::WRECGenerator::generateAssertionEOL):
2527         (JSC::WRECGenerator::generateAssertionWordBoundary):
2528         (JSC::WRECGenerator::generateBackreference):
2529         (JSC::WRECGenerator::gernerateDisjunction):
2530         (JSC::WRECParser::parseCharacterClass):
2531         (JSC::WRECParser::parseEscape):
2532         (JSC::WRECParser::parseTerm):
2533         * wrec/WREC.h:
2534
2535 2008-09-09  Mark Rowe  <mrowe@apple.com>
2536
2537         Build fix, rubber-stamped by Anders Carlsson.
2538
2539         Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.
2540
2541         * JavaScriptCore.xcodeproj/project.pbxproj:
2542
2543 2008-09-09  Mark Rowe  <mrowe@apple.com>
2544
2545         Rubber-stamped by Oliver Hunt.
2546
2547         Fix builds using the "debug" variant.
2548
2549         This reverts r36130 and tweaks Identifier to export the same symbols for Debug
2550         and Release configurations.
2551
2552         * Configurations/JavaScriptCore.xcconfig:
2553         * DerivedSources.make:
2554         * JavaScriptCore.Debug.exp: Removed.
2555         * JavaScriptCore.base.exp: Removed.
2556         * JavaScriptCore.exp: Added.
2557         * JavaScriptCore.xcodeproj/project.pbxproj:
2558         * kjs/identifier.cpp:
2559         (JSC::Identifier::addSlowCase): #ifdef the call to checkSameIdentifierTable so that
2560         there is no overhead in Release builds.
2561         (JSC::Identifier::checkSameIdentifierTable): Add empty functions for Release builds.
2562         * kjs/identifier.h:
2563         (JSC::Identifier::add): #ifdef the calls to checkSameIdentifierTable so that there is
2564         no overhead in Release builds, and remove the inline definitions of checkSameIdentifierTable.
2565
2566 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2567
2568         Reviewed by Maciej Stachowiak.
2569
2570         Clean up WREC a bit to bring it closer to our coding style guidelines.
2571
2572         * wrec/WREC.cpp:
2573         (JSC::):
2574         (JSC::getCharacterClass_newline):
2575         (JSC::getCharacterClass_d):
2576         (JSC::getCharacterClass_s):
2577         (JSC::getCharacterClass_w):
2578         (JSC::getCharacterClass_D):
2579         (JSC::getCharacterClass_S):
2580         (JSC::getCharacterClass_W):
2581         (JSC::CharacterClassConstructor::append):
2582         (JSC::WRECGenerator::generateNonGreedyQuantifier):
2583         (JSC::WRECGenerator::generateGreedyQuantifier):
2584         (JSC::WRECGenerator::generateCharacterClassInverted):
2585         (JSC::WRECParser::parseQuantifier):
2586         (JSC::WRECParser::parsePatternCharacterQualifier):
2587         (JSC::WRECParser::parseCharacterClassQuantifier):
2588         (JSC::WRECParser::parseBackreferenceQuantifier):
2589         * wrec/WREC.h:
2590         (JSC::Quantifier::):
2591         (JSC::Quantifier::Quantifier):
2592
2593 2008-09-09  Jungshik Shin  <jungshik.shin@gmail.com>
2594
2595         Reviewed by Alexey Proskuryakov.
2596
2597         Try MIME charset names before trying IANA names 
2598         ( https://bugs.webkit.org/show_bug.cgi?id=17537 )
2599
2600         * wtf/StringExtras.h: (strcasecmp): Added.
2601
2602 2008-09-09  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2603
2604         Reviewed by Mark Rowe.
2605
2606         Bug 20719: REGRESSION (r36135-36244): Hangs, then crashes after several seconds
2607         <https://bugs.webkit.org/show_bug.cgi?id=20719>
2608         <rdar://problem/6205787>
2609
2610         Fix a typo in the case-insensitive matching of character patterns.
2611
2612         * wrec/WREC.cpp:
2613         (JSC::WRECGenerator::generatePatternCharacter):
2614
2615 2008-09-09  Maciej Stachowiak  <mjs@apple.com>
2616
2617         Reviewed by Sam Weinig.
2618         
2619         - allow polymorphic inline cache to handle Math object functions and possibly other similar things
2620         
2621         1.012x speedup on SunSpider.
2622
2623         * kjs/MathObject.cpp:
2624         (JSC::MathObject::getOwnPropertySlot):
2625         * kjs/lookup.cpp:
2626         (JSC::setUpStaticFunctionSlot):
2627         * kjs/lookup.h:
2628         (JSC::getStaticPropertySlot):
2629
2630 2008-09-08  Sam Weinig  <sam@webkit.org>
2631
2632         Reviewed by Maciej Stachowiak and Oliver Hunt.
2633
2634         Split storage of properties out of the PropertyMap and into the JSObject
2635         to allow sharing PropertyMap on the StructureID.  In order to get this
2636         function correctly, the StructureID's transition mappings were changed to
2637         transition based on property name and attribute pairs, instead of just
2638         property name.
2639
2640         - Removes the single property optimization now that the PropertyMap is shared.
2641           This will be replaced by in-lining some values on the JSObject.
2642
2643         This is a wash on Sunspider and a 6.7% win on the v8 test suite.
2644
2645         * JavaScriptCore.base.exp:
2646         * VM/CTI.cpp:
2647         (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject.
2648         (JSC::CTI::privateCompileGetByIdProto): Ditto.
2649         (JSC::CTI::privateCompileGetByIdChain): Ditto.
2650         (JSC::CTI::privateCompilePutByIdReplace): Ditto.
2651         * kjs/JSObject.cpp:
2652         (JSC::JSObject::mark): Mark the PropertyStorage.
2653         (JSC::JSObject::put): Update to get the propertyMap of the StructureID.
2654         (JSC::JSObject::deleteProperty): Ditto.
2655         (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter.
2656         (JSC::JSObject::defineSetter): Ditto.
2657         (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID
2658         (JSC::JSObject::getPropertyNames): Ditto.
2659         (JSC::JSObject::removeDirect): Ditto.
2660         * kjs/JSObject.h: Remove PropertyMap and add PropertyStorage.
2661         (JSC::JSObject::propertyStorage): return the PropertyStorage.
2662         (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID.
2663         (JSC::JSObject::getDirectLocation): Ditto.
2664         (JSC::JSObject::offsetForLocation): Compute location directly.
2665         (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID.
2666         (JSC::JSObject::hasGetterSetterProperties): Ditto.
2667         (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage.
2668         (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage.
2669         (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID.
2670         (JSC::JSObject::getOwnPropertySlot): Ditto.
2671         (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
2672         * kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues.
2673         (JSC::PropertyMap::checkConsistency): 
2674         (JSC::PropertyMap::operator=):
2675         (JSC::PropertyMap::~PropertyMap):
2676         (JSC::PropertyMap::get):
2677         (JSC::PropertyMap::getLocation):
2678         (JSC::PropertyMap::put):
2679         (JSC::PropertyMap::getOffset):
2680         (JSC::PropertyMap::insert):
2681         (JSC::PropertyMap::expand):
2682         (JSC::PropertyMap::rehash):
2683         (JSC::PropertyMap::createTable):
2684         (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map
2685         (JSC::PropertyMap::remove):
2686         (JSC::PropertyMap::getEnumerablePropertyNames):
2687         * kjs/PropertyMap.h: 
2688         (JSC::PropertyMapEntry::PropertyMapEntry):
2689         (JSC::PropertyMap::isEmpty):
2690         (JSC::PropertyMap::size):
2691         (JSC::PropertyMap::makingCount):
2692         (JSC::PropertyMap::PropertyMap):
2693
2694         * kjs/StructureID.cpp: 
2695         (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name
2696         and attributes. 
2697         (JSC::StructureID::toDictionaryTransition): Copy the map.
2698         (JSC::StructureID::changePrototypeTransition): Copy the map.
2699         (JSC::StructureID::getterSetterTransition): Copy the map.
2700         (JSC::StructureID::~StructureID): 
2701         * kjs/StructureID.h:
2702         (JSC::TransitionTableHash::hash): Custom hash for transition map.
2703         (JSC::TransitionTableHash::equal): Ditto.
2704         (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map
2705         (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto.
2706         (JSC::TransitionTableHashTraits::isDeletedValue): Ditto.
2707         (JSC::StructureID::propertyMap): Added.
2708
2709 2008-09-08  Oliver Hunt  <oliver@apple.com>
2710
2711         Reviewed by Mark Rowe.
2712
2713         Bug 20694: Slow Script error pops up when running Dromaeo tests
2714
2715         Correct error in timeout logic where execution tick count would
2716         be reset to incorrect value due to incorrect offset and indirection.
2717         Codegen for the slow script dialog was factored out into a separate
2718         method (emitSlowScriptCheck) rather than having multiple copies of
2719         the same code.  Also added calls to generate slow script checks
2720         for loop_if_less and loop_if_true opcodes.
2721
2722         * VM/CTI.cpp:
2723         (JSC::CTI::emitSlowScriptCheck):
2724         (JSC::CTI::privateCompileMainPass):
2725         (JSC::CTI::privateCompileSlowCases):
2726         * VM/CTI.h:
2727
2728 2008-09-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2729
2730         Reviewed by Maciej Stachowiak.
2731
2732         Remove references to the removed WRECompiler class.
2733
2734         * VM/Machine.h:
2735         * wrec/WREC.h:
2736
2737 2008-09-08  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2738
2739         Rubber-stamped by Mark Rowe.
2740
2741         Fix the build with CTI enabled but WREC disabled.
2742
2743         * VM/CTI.cpp:
2744         * VM/CTI.h:
2745
2746 2008-09-08  Dan Bernstein  <mitz@apple.com>
2747
2748         - build fix
2749
2750         * kjs/nodes.h:
2751         (JSC::StatementNode::):
2752         (JSC::BlockNode::):
2753
2754 2008-09-08  Kevin McCullough  <kmccullough@apple.com>
2755
2756         Reviewed by Geoff.
2757
2758        <rdar://problem/6134407> Breakpoints in for loops, while loops or
2759        conditions without curly braces don't break. (19306)
2760        -Statement Lists already emit debug hooks but conditionals without
2761        brackets are not lists.
2762
2763         * kjs/nodes.cpp:
2764         (KJS::IfNode::emitCode):
2765         (KJS::IfElseNode::emitCode):
2766         (KJS::DoWhileNode::emitCode):
2767         (KJS::WhileNode::emitCode):
2768         (KJS::ForNode::emitCode):
2769         (KJS::ForInNode::emitCode):
2770         * kjs/nodes.h:
2771         (KJS::StatementNode::):
2772         (KJS::BlockNode::):
2773
2774 2008-09-08  Maciej Stachowiak  <mjs@apple.com>
2775
2776         Reviewed by Anders Carlsson.
2777         
2778         - Cache the code generated for eval to speed up SunSpider and web sites
2779         https://bugs.webkit.org/show_bug.cgi?id=20718
2780         
2781         1.052x on SunSpider
2782         2.29x on date-format-tofte
2783         
2784         Lots of real sites seem to get many hits on this cache as well,
2785         including GMail, Google Spreadsheets, Slate and Digg (the last of
2786         these gets over 100 hits on initial page load).
2787
2788         * VM/CodeBlock.h:
2789         (JSC::EvalCodeCache::get):
2790         * VM/Machine.cpp:
2791         (JSC::Machine::callEval):
2792         (JSC::Machine::privateExecute):
2793         (JSC::Machine::cti_op_call_eval):
2794         * VM/Machine.h:
2795
2796 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2797
2798         Reviewed by Oliver Hunt.
2799
2800         Bug 20711: Change KJS prefix on preprocessor macros to JSC
2801         <https://bugs.webkit.org/show_bug.cgi?id=20711>
2802
2803         * kjs/CommonIdentifiers.cpp:
2804         (JSC::CommonIdentifiers::CommonIdentifiers):
2805         * kjs/CommonIdentifiers.h:
2806         * kjs/PropertySlot.h:
2807         (JSC::PropertySlot::getValue):
2808         (JSC::PropertySlot::putValue):
2809         (JSC::PropertySlot::setValueSlot):
2810         (JSC::PropertySlot::setValue):
2811         (JSC::PropertySlot::setRegisterSlot):
2812         * kjs/lookup.h:
2813         * kjs/nodes.cpp:
2814         * kjs/nodes.h:
2815         (JSC::Node::):
2816         (JSC::ExpressionNode::):
2817         (JSC::StatementNode::):
2818         (JSC::NullNode::):
2819         (JSC::BooleanNode::):
2820         (JSC::NumberNode::):
2821         (JSC::ImmediateNumberNode::):
2822         (JSC::StringNode::):
2823         (JSC::RegExpNode::):
2824         (JSC::ThisNode::):
2825         (JSC::ResolveNode::):
2826         (JSC::ElementNode::):
2827         (JSC::ArrayNode::):
2828         (JSC::PropertyNode::):
2829         (JSC::PropertyListNode::):
2830         (JSC::ObjectLiteralNode::):
2831         (JSC::BracketAccessorNode::):
2832         (JSC::DotAccessorNode::):
2833         (JSC::ArgumentListNode::):
2834         (JSC::ArgumentsNode::):
2835         (JSC::NewExprNode::):
2836         (JSC::EvalFunctionCallNode::):
2837         (JSC::FunctionCallValueNode::):
2838         (JSC::FunctionCallResolveNode::):
2839         (JSC::FunctionCallBracketNode::):
2840         (JSC::FunctionCallDotNode::):
2841         (JSC::PrePostResolveNode::):
2842         (JSC::PostfixResolveNode::):
2843         (JSC::PostfixBracketNode::):
2844         (JSC::PostfixDotNode::):
2845         (JSC::PostfixErrorNode::):
2846         (JSC::DeleteResolveNode::):
2847         (JSC::DeleteBracketNode::):
2848         (JSC::DeleteDotNode::):
2849         (JSC::DeleteValueNode::):
2850         (JSC::VoidNode::):
2851         (JSC::TypeOfResolveNode::):
2852         (JSC::TypeOfValueNode::):
2853         (JSC::PrefixResolveNode::):
2854         (JSC::PrefixBracketNode::):
2855         (JSC::PrefixDotNode::):
2856         (JSC::PrefixErrorNode::):
2857         (JSC::UnaryPlusNode::):
2858         (JSC::NegateNode::):
2859         (JSC::BitwiseNotNode::):
2860         (JSC::LogicalNotNode::):
2861         (JSC::MultNode::):
2862         (JSC::DivNode::):
2863         (JSC::ModNode::):
2864         (JSC::AddNode::):
2865         (JSC::SubNode::):
2866         (JSC::LeftShiftNode::):
2867         (JSC::RightShiftNode::):
2868         (JSC::UnsignedRightShiftNode::):
2869         (JSC::LessNode::):
2870         (JSC::GreaterNode::):
2871         (JSC::LessEqNode::):
2872         (JSC::GreaterEqNode::):
2873         (JSC::ThrowableBinaryOpNode::):
2874         (JSC::InstanceOfNode::):
2875         (JSC::InNode::):
2876         (JSC::EqualNode::):
2877         (JSC::NotEqualNode::):
2878         (JSC::StrictEqualNode::):
2879         (JSC::NotStrictEqualNode::):
2880         (JSC::BitAndNode::):
2881         (JSC::BitOrNode::):
2882         (JSC::BitXOrNode::):
2883         (JSC::LogicalOpNode::):
2884         (JSC::ConditionalNode::):
2885         (JSC::ReadModifyResolveNode::):
2886         (JSC::AssignResolveNode::):
2887         (JSC::ReadModifyBracketNode::):
2888         (JSC::AssignBracketNode::):
2889         (JSC::AssignDotNode::):
2890         (JSC::ReadModifyDotNode::):
2891         (JSC::AssignErrorNode::):
2892         (JSC::CommaNode::):
2893         (JSC::VarDeclCommaNode::):
2894         (JSC::ConstDeclNode::):
2895         (JSC::ConstStatementNode::):
2896         (JSC::EmptyStatementNode::):
2897         (JSC::DebuggerStatementNode::):
2898         (JSC::ExprStatementNode::):
2899         (JSC::VarStatementNode::):
2900         (JSC::IfNode::):
2901         (JSC::IfElseNode::):
2902         (JSC::DoWhileNode::):
2903         (JSC::WhileNode::):
2904         (JSC::ForNode::):
2905         (JSC::ContinueNode::):
2906         (JSC::BreakNode::):
2907         (JSC::ReturnNode::):
2908         (JSC::WithNode::):
2909         (JSC::LabelNode::):
2910         (JSC::ThrowNode::):
2911         (JSC::TryNode::):
2912         (JSC::ParameterNode::):
2913         (JSC::ScopeNode::):
2914         (JSC::ProgramNode::):
2915         (JSC::EvalNode::):
2916         (JSC::FunctionBodyNode::):
2917         (JSC::FuncExprNode::):
2918         (JSC::FuncDeclNode::):
2919         (JSC::CaseClauseNode::):
2920         (JSC::ClauseListNode::):
2921         (JSC::CaseBlockNode::):
2922         (JSC::SwitchNode::):
2923
2924 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2925
2926         Reviewed by Maciej Stachowiak.
2927
2928         Bug 20704: Replace the KJS namespace
2929         <https://bugs.webkit.org/show_bug.cgi?id=20704>
2930
2931         Rename the KJS namespace to JSC. There are still some uses of KJS in
2932         preprocessor macros and comments, but these will also be changed some
2933         time in the near future.
2934
2935         * API/APICast.h:
2936         (toJS):
2937         (toRef):
2938         (toGlobalRef):
2939         * API/JSBase.cpp:
2940         * API/JSCallbackConstructor.cpp:
2941         * API/JSCallbackConstructor.h:
2942         * API/JSCallbackFunction.cpp:
2943         * API/JSCallbackFunction.h:
2944         * API/JSCallbackObject.cpp:
2945         * API/JSCallbackObject.h:
2946         * API/JSCallbackObjectFunctions.h:
2947         * API/JSClassRef.cpp:
2948         (OpaqueJSClass::staticValues):
2949         (OpaqueJSClass::staticFunctions):
2950         * API/JSClassRef.h:
2951         * API/JSContextRef.cpp:
2952         * API/JSObjectRef.cpp:
2953         * API/JSProfilerPrivate.cpp:
2954         * API/JSStringRef.cpp:
2955         * API/JSValueRef.cpp:
2956         (JSValueGetType):
2957         * API/OpaqueJSString.cpp:
2958         * API/OpaqueJSString.h:
2959         * JavaScriptCore.Debug.exp:
2960         * JavaScriptCore.base.exp:
2961         * VM/CTI.cpp:
2962         (JSC::):
2963         * VM/CTI.h:
2964         * VM/CodeBlock.cpp:
2965         * VM/CodeBlock.h:
2966         * VM/CodeGenerator.cpp:
2967         * VM/CodeGenerator.h:
2968         * VM/ExceptionHelpers.cpp:
2969         * VM/ExceptionHelpers.h:
2970         * VM/Instruction.h:
2971         * VM/JSPropertyNameIterator.cpp:
2972         * VM/JSPropertyNameIterator.h:
2973         * VM/LabelID.h:
2974         * VM/Machine.cpp:
2975         * VM/Machine.h:
2976         * VM/Opcode.cpp:
2977         * VM/Opcode.h:
2978         * VM/Register.h:
2979         (WTF::):
2980         * VM/RegisterFile.cpp:
2981         * VM/RegisterFile.h:
2982         * VM/RegisterID.h:
2983         (WTF::):
2984         * VM/SamplingTool.cpp:
2985         * VM/SamplingTool.h:
2986         * VM/SegmentedVector.h:
2987         * kjs/ArgList.cpp:
2988         * kjs/ArgList.h:
2989         * kjs/Arguments.cpp:
2990         * kjs/Arguments.h:
2991         * kjs/ArrayConstructor.cpp:
2992         * kjs/ArrayConstructor.h:
2993         * kjs/ArrayPrototype.cpp:
2994         * kjs/ArrayPrototype.h:
2995         * kjs/BatchedTransitionOptimizer.h:
2996         * kjs/BooleanConstructor.cpp:
2997         * kjs/BooleanConstructor.h:
2998         * kjs/BooleanObject.cpp:
2999         * kjs/BooleanObject.h:
3000         * kjs/BooleanPrototype.cpp:
3001         * kjs/BooleanPrototype.h:
3002         * kjs/CallData.cpp:
3003         * kjs/CallData.h:
3004         * kjs/ClassInfo.h:
3005         * kjs/CommonIdentifiers.cpp:
3006         * kjs/CommonIdentifiers.h:
3007         * kjs/ConstructData.cpp:
3008         * kjs/ConstructData.h:
3009         * kjs/DateConstructor.cpp:
3010         * kjs/DateConstructor.h:
3011         * kjs/DateInstance.cpp:
3012         (JSC::DateInstance::msToGregorianDateTime):
3013         * kjs/DateInstance.h:
3014         * kjs/DateMath.cpp:
3015         * kjs/DateMath.h:
3016         * kjs/DatePrototype.cpp:
3017         * kjs/DatePrototype.h:
3018         * kjs/DebuggerCallFrame.cpp:
3019         * kjs/DebuggerCallFrame.h:
3020         * kjs/Error.cpp:
3021         * kjs/Error.h:
3022         * kjs/ErrorConstructor.cpp:
3023         * kjs/ErrorConstructor.h:
3024         * kjs/ErrorInstance.cpp:
3025         * kjs/ErrorInstance.h:
3026         * kjs/ErrorPrototype.cpp:
3027         * kjs/ErrorPrototype.h:
3028         * kjs/ExecState.cpp:
3029         * kjs/ExecState.h:
3030         * kjs/FunctionConstructor.cpp:
3031         * kjs/FunctionConstructor.h:
3032         * kjs/FunctionPrototype.cpp:
3033         * kjs/FunctionPrototype.h:
3034         * kjs/GetterSetter.cpp:
3035         * kjs/GetterSetter.h:
3036         * kjs/GlobalEvalFunction.cpp:
3037         * kjs/GlobalEvalFunction.h:
3038         * kjs/IndexToNameMap.cpp:
3039         * kjs/IndexToNameMap.h:
3040         * kjs/InitializeThreading.cpp:
3041         * kjs/InitializeThreading.h:
3042         * kjs/InternalFunction.cpp:
3043         * kjs/InternalFunction.h:
3044         (JSC::InternalFunction::InternalFunction):
3045         * kjs/JSActivation.cpp:
3046         * kjs/JSActivation.h:
3047         * kjs/JSArray.cpp:
3048         * kjs/JSArray.h:
3049         * kjs/JSCell.cpp:
3050         * kjs/JSCell.h:
3051         * kjs/JSFunction.cpp:
3052         * kjs/JSFunction.h:
3053         (JSC::JSFunction::JSFunction):
3054         * kjs/JSGlobalData.cpp:
3055         (JSC::JSGlobalData::JSGlobalData):
3056         * kjs/JSGlobalData.h:
3057         * kjs/JSGlobalObject.cpp:
3058         * kjs/JSGlobalObject.h:
3059         * kjs/JSGlobalObjectFunctions.cpp:
3060         * kjs/JSGlobalObjectFunctions.h:
3061         * kjs/JSImmediate.cpp:
3062         * kjs/JSImmediate.h:
3063         * kjs/JSLock.cpp:
3064         * kjs/JSLock.h:
3065         * kjs/JSNotAnObject.cpp:
3066         * kjs/JSNotAnObject.h:
3067         * kjs/JSNumberCell.cpp:
3068         * kjs/JSNumberCell.h:
3069         * kjs/JSObject.cpp:
3070         * kjs/JSObject.h:
3071         * kjs/JSStaticScopeObject.cpp:
3072         * kjs/JSStaticScopeObject.h:
3073         * kjs/JSString.cpp:
3074         * kjs/JSString.h:
3075         * kjs/JSType.h:
3076         * kjs/JSValue.cpp:
3077         * kjs/JSValue.h:
3078         * kjs/JSVariableObject.cpp:
3079         * kjs/JSVariableObject.h:
3080         * kjs/JSWrapperObject.cpp:
3081         * kjs/JSWrapperObject.h:
3082         * kjs/LabelStack.cpp:
3083         * kjs/LabelStack.h:
3084         * kjs/MathObject.cpp:
3085         * kjs/MathObject.h:
3086         * kjs/NativeErrorConstructor.cpp:
3087         * kjs/NativeErrorConstructor.h:
3088         * kjs/NativeErrorPrototype.cpp:
3089         * kjs/NativeErrorPrototype.h:
3090         * kjs/NodeInfo.h:
3091         * kjs/NumberConstructor.cpp:
3092         * kjs/NumberConstructor.h:
3093         * kjs/NumberObject.cpp:
3094         * kjs/NumberObject.h:
3095         * kjs/NumberPrototype.cpp:
3096         * kjs/NumberPrototype.h:
3097         * kjs/ObjectConstructor.cpp:
3098         * kjs/ObjectConstructor.h:
3099         * kjs/ObjectPrototype.cpp:
3100         * kjs/ObjectPrototype.h:
3101         * kjs/Parser.cpp:
3102         * kjs/Parser.h:
3103         * kjs/PropertyMap.cpp:
3104         (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
3105         * kjs/PropertyMap.h:
3106         * kjs/PropertyNameArray.cpp:
3107         * kjs/PropertyNameArray.h:
3108         * kjs/PropertySlot.cpp:
3109         * kjs/PropertySlot.h:
3110         * kjs/PrototypeFunction.cpp:
3111         * kjs/PrototypeFunction.h:
3112         * kjs/PutPropertySlot.h:
3113         * kjs/RegExpConstructor.cpp:
3114         * kjs/RegExpConstructor.h:
3115         * kjs/RegExpObject.cpp:
3116         * kjs/RegExpObject.h:
3117         * kjs/RegExpPrototype.cpp:
3118         * kjs/RegExpPrototype.h:
3119         * kjs/ScopeChain.cpp:
3120         * kjs/ScopeChain.h:
3121         * kjs/ScopeChainMark.h:
3122         * kjs/Shell.cpp:
3123         (jscmain):
3124         * kjs/SmallStrings.cpp:
3125         * kjs/SmallStrings.h:
3126         * kjs/SourceProvider.h:
3127         * kjs/SourceRange.h:
3128         * kjs/StringConstructor.cpp:
3129         * kjs/StringConstructor.h:
3130         * kjs/StringObject.cpp:
3131         * kjs/StringObject.h:
3132         * kjs/StringObjectThatMasqueradesAsUndefined.h:
3133         * kjs/StringPrototype.cpp:
3134         * kjs/StringPrototype.h:
3135         * kjs/StructureID.cpp:
3136         * kjs/StructureID.h:
3137         * kjs/SymbolTable.h:
3138         * kjs/collector.cpp:
3139         * kjs/collector.h:
3140         * kjs/completion.h:
3141         * kjs/create_hash_table:
3142         * kjs/debugger.cpp:
3143         * kjs/debugger.h:
3144         * kjs/dtoa.cpp:
3145         * kjs/dtoa.h:
3146         * kjs/grammar.y:
3147         * kjs/identifier.cpp:
3148         * kjs/identifier.h:
3149         (JSC::Identifier::equal):
3150         * kjs/interpreter.cpp:
3151         * kjs/interpreter.h:
3152         * kjs/lexer.cpp:
3153         (JSC::Lexer::Lexer):
3154         (JSC::Lexer::clear):
3155         (JSC::Lexer::makeIdentifier):
3156         * kjs/lexer.h:
3157         * kjs/lookup.cpp:
3158         * kjs/lookup.h:
3159         * kjs/nodes.cpp:
3160         * kjs/nodes.h:
3161         * kjs/nodes2string.cpp:
3162         * kjs/operations.cpp:
3163         * kjs/operations.h:
3164         * kjs/protect.h:
3165         * kjs/regexp.cpp:
3166         * kjs/regexp.h:
3167         * kjs/ustring.cpp:
3168         * kjs/ustring.h:
3169         (JSC::operator!=):
3170         (JSC::IdentifierRepHash::hash):
3171         (WTF::):
3172         * masm/MacroAssembler.h:
3173         * masm/MacroAssemblerWin.cpp:
3174         * masm/X86Assembler.h:
3175         * pcre/pcre_exec.cpp:
3176         * profiler/CallIdentifier.h:
3177         (WTF::):
3178         * profiler/HeavyProfile.cpp:
3179         * profiler/HeavyProfile.h:
3180         * profiler/Profile.cpp:
3181         * profiler/Profile.h:
3182         * profiler/ProfileGenerator.cpp:
3183         * profiler/ProfileGenerator.h:
3184         * profiler/ProfileNode.cpp:
3185         * profiler/ProfileNode.h:
3186         * profiler/Profiler.cpp:
3187         * profiler/Profiler.h:
3188         * profiler/TreeProfile.cpp:
3189         * profiler/TreeProfile.h:
3190         * wrec/WREC.cpp:
3191         * wrec/WREC.h:
3192         * wtf/AVLTree.h:
3193
3194 2008-09-07  Maciej Stachowiak  <mjs@apple.com>
3195
3196         Reviewed by Dan Bernstein.
3197         
3198         - rename IA32MacroAssembler class to X86Assembler
3199         
3200         We otherwise call the platform X86, and also, I don't see any macros.
3201
3202         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3203         * JavaScriptCore.xcodeproj/project.pbxproj:
3204         * masm/IA32MacroAsm.h: Removed.
3205         * masm/MacroAssembler.h:
3206         (KJS::MacroAssembler::MacroAssembler):
3207         * masm/MacroAssemblerWin.cpp:
3208         (KJS::MacroAssembler::emitRestoreArgumentReference):
3209         * masm/X86Assembler.h: Copied from masm/IA32MacroAsm.h.
3210         (KJS::X86Assembler::X86Assembler):
3211         * wrec/WREC.cpp:
3212         (KJS::WRECGenerator::generateNonGreedyQuantifier):
3213         (KJS::WRECGenerator::generateGreedyQuantifier):
3214         (KJS::WRECGenerator::generateParentheses):
3215         (KJS::WRECGenerator::generateBackreference):
3216         (KJS::WRECGenerator::gernerateDisjunction):
3217         * wrec/WREC.h:
3218
3219 2008-09-07  Cameron Zwarich  <cwzwarich@webkit.org>
3220
3221         Not reviewed.
3222
3223         Visual C++ seems to have some odd casting rules, so just convert the
3224         offending cast back to a C-style cast for now.
3225
3226         * kjs/collector.cpp:
3227         (KJS::otherThreadStackPointer):
3228
3229 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3230
3231         Reviewed by Mark Rowe.
3232
3233         Attempt to fix the Windows build by using a const_cast to cast regs.Esp
3234         to a uintptr_t instead of a reinterpret_cast.
3235
3236         * kjs/collector.cpp:
3237         (KJS::otherThreadStackPointer):
3238
3239 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3240
3241         Reviewed by Sam Weinig.
3242
3243         Remove C-style casts from kjs/collector.cpp.
3244
3245         * kjs/collector.cpp:
3246         (KJS::Heap::heapAllocate):
3247         (KJS::currentThreadStackBase):
3248         (KJS::Heap::markConservatively):
3249         (KJS::otherThreadStackPointer):
3250         (KJS::Heap::markOtherThreadConservatively):
3251         (KJS::Heap::sweep):
3252
3253 2008-09-07  Mark Rowe  <mrowe@apple.com>
3254
3255         Build fix for the debug variant.
3256
3257         * DerivedSources.make: Also use the .Debug.exp exports file when building the debug variant.
3258
3259 2008-09-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3260
3261         Reviewed by Timothy Hatcher.
3262
3263         Remove C-style casts from the CTI code.
3264
3265         * VM/CTI.cpp:
3266         (KJS::CTI::emitGetArg):
3267         (KJS::CTI::emitGetPutArg):
3268         (KJS::ctiRepatchCallByReturnAddress):
3269         (KJS::CTI::compileOpCall):
3270         (KJS::CTI::privateCompileMainPass):
3271         (KJS::CTI::privateCompileGetByIdSelf):
3272         (KJS::CTI::privateCompileGetByIdProto):
3273         (KJS::CTI::privateCompileGetByIdChain):
3274         (KJS::CTI::privateCompilePutByIdReplace):
3275         (KJS::CTI::privateArrayLengthTrampoline):
3276         (KJS::CTI::privateStringLengthTrampoline):
3277
3278 === End merge of squirrelfish-extreme ===
3279
3280 2008-09-06  Gavin Barraclough  <barraclough@apple.com>
3281
3282         Reviewed by Sam Weinig. Adapted somewhat by Maciej Stachowiak.
3283         
3284         - refactor WREC to share more of the JIT infrastructure with CTI
3285
3286         * VM/CTI.cpp:
3287         (KJS::CTI::emitGetArg):
3288         (KJS::CTI::emitGetPutArg):
3289         (KJS::CTI::emitPutArg):
3290         (KJS::CTI::emitPutArgConstant):
3291         (KJS::CTI::emitPutCTIParam):
3292         (KJS::CTI::emitGetCTIParam):
3293         (KJS::CTI::emitPutToCallFrameHeader):
3294         (KJS::CTI::emitGetFromCallFrameHeader):
3295         (KJS::CTI::emitPutResult):
3296         (KJS::CTI::emitDebugExceptionCheck):
3297         (KJS::CTI::emitJumpSlowCaseIfNotImm):
3298         (KJS::CTI::emitJumpSlowCaseIfNotImms):
3299         (KJS::CTI::emitFastArithDeTagImmediate):
3300         (KJS::CTI::emitFastArithReTagImmediate):
3301         (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
3302         (KJS::CTI::emitFastArithImmToInt):
3303         (KJS::CTI::emitFastArithIntToImmOrSlowCase):
3304         (KJS::CTI::emitFastArithIntToImmNoCheck):
3305         (KJS::CTI::CTI):
3306         (KJS::CTI::compileOpCall):
3307         (KJS::CTI::privateCompileMainPass):
3308         (KJS::CTI::privateCompileSlowCases):
3309         (KJS::CTI::privateCompile):
3310         (KJS::CTI::privateCompileGetByIdSelf):
3311         (KJS::CTI::privateCompileGetByIdProto):
3312         (KJS::CTI::privateCompileGetByIdChain):
3313         (KJS::CTI::privateCompilePutByIdReplace):
3314         (KJS::CTI::privateArrayLengthTrampoline):
3315         (KJS::CTI::privateStringLengthTrampoline):
3316         (KJS::CTI::compileRegExp):
3317         * VM/CTI.h:
3318         (KJS::CallRecord::CallRecord):
3319         (KJS::JmpTable::JmpTable):
3320         (KJS::SlowCaseEntry::SlowCaseEntry):
3321         (KJS::CTI::JSRInfo::JSRInfo):
3322         * kjs/regexp.cpp:
3323         (KJS::RegExp::RegExp):
3324         * wrec/WREC.cpp:
3325         (KJS::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
3326         (KJS::GeneratePatternCharacterFunctor::generateAtom):
3327         (KJS::GeneratePatternCharacterFunctor::backtrack):
3328         (KJS::GenerateCharacterClassFunctor::generateAtom):
3329         (KJS::GenerateCharacterClassFunctor::backtrack):
3330         (KJS::GenerateBackreferenceFunctor::generateAtom):
3331         (KJS::GenerateBackreferenceFunctor::backtrack):
3332         (KJS::GenerateParenthesesNonGreedyFunctor::generateAtom):
3333         (KJS::GenerateParenthesesNonGreedyFunctor::backtrack):
3334         (KJS::WRECGenerate::generateBacktrack1):
3335         (KJS::WRECGenerate::generateBacktrackBackreference):
3336         (KJS::WRECGenerate::generateBackreferenceQuantifier):
3337         (KJS::WRECGenerate::generateNonGreedyQuantifier):
3338         (KJS::WRECGenerate::generateGreedyQuantifier):
3339         (KJS::WRECGenerate::generatePatternCharacter):
3340         (KJS::WRECGenerate::generateCharacterClassInvertedRange):
3341         (KJS::WRECGenerate::generateCharacterClassInverted):
3342         (KJS::WRECGenerate::generateCharacterClass):
3343         (KJS::WRECGenerate::generateParentheses):
3344         (KJS::WRECGenerate::generateParenthesesNonGreedy):
3345         (KJS::WRECGenerate::gererateParenthesesResetTrampoline):
3346         (KJS::WRECGenerate::generateAssertionBOL):
3347         (KJS::WRECGenerate::generateAssertionEOL):
3348         (KJS::WRECGenerate::generateAssertionWordBoundary):
3349         (KJS::WRECGenerate::generateBackreference):
3350         (KJS::WRECGenerate::gernerateDisjunction):
3351         (KJS::WRECGenerate::terminateDisjunction):
3352         (KJS::WRECParser::parseGreedyQuantifier):
3353         (KJS::WRECParser::parseQuantifier):
3354         (KJS::WRECParser::parsePatternCharacterQualifier):
3355         (KJS::WRECParser::parseCharacterClassQuantifier):
3356         (KJS::WRECParser::parseBackreferenceQuantifier):
3357         (KJS::WRECParser::parseParentheses):
3358         (KJS::WRECParser::parseCharacterClass):
3359         (KJS::WRECParser::parseOctalEscape):
3360         (KJS::WRECParser::parseEscape):
3361         (KJS::WRECParser::parseTerm):
3362         (KJS::WRECParser::parseDisjunction):
3363         * wrec/WREC.h:
3364         (KJS::WRECGenerate::WRECGenerate):
3365         (KJS::WRECParser::):
3366         (KJS::WRECParser::WRECParser):
3367         (KJS::WRECParser::parseAlternative):
3368         (KJS::WRECParser::isEndOfPattern):
3369
3370 2008-09-06  Oliver Hunt  <oliver@apple.com>
3371
3372         Reviewed by NOBODY (Build fix).
3373
3374         Fix the sampler build.
3375
3376         * VM/SamplingTool.h:
3377
3378 2008-09-06  Oliver Hunt  <oliver@apple.com>
3379
3380         Reviewed by Maciej Stachowiak.
3381
3382         Jump through the necessary hoops required to make MSVC cooperate with SFX
3383
3384         We now explicitly declare the calling convention on all cti_op_* cfunctions,
3385         and return int instead of bool where appropriate (despite the cdecl calling
3386         convention seems to state MSVC generates code that returns the result value
3387         through ecx).  SFX behaves slightly differently under MSVC, specifically it
3388         stores the base argument address for the cti_op_* functions in the first
3389         argument, and then does the required stack manipulation through that pointer.
3390         This is necessary as MSVC's optimisations assume they have complete control
3391         of the stack, and periodically elide our stack manipulations, or move
3392         values in unexpected ways.  MSVC also frequently produces tail calls which may
3393         clobber the first argument, so the MSVC path is slightly less efficient due
3394         to the need to restore it.
3395
3396         * JavaScriptCore.xcodeproj/project.pbxproj:
3397         * VM/CTI.cpp:
3398         (KJS::):
3399         (KJS::CTI::compileOpCall):
3400         (KJS::CTI::privateCompileMainPass):
3401         (KJS::CTI::privateCompileSlowCases):
3402         * VM/CTI.h:
3403         * VM/Machine.cpp:
3404         * VM/Machine.h:
3405         * masm/MacroAssembler.h:
3406         (KJS::MacroAssembler::emitConvertToFastCall):
3407         * masm/MacroAssemblerIA32GCC.cpp: Removed.
3408            For performance reasons we need these no-op functions to be inlined.
3409
3410         * masm/MacroAssemblerWin.cpp:
3411         (KJS::MacroAssembler::emitRestoreArgumentReference):
3412         * wtf/Platform.h:
3413
3414 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
3415
3416         Reviewed by Maciej Stachowiak, or maybe the other way around.
3417         
3418         Added the ability to coalesce JITCode buffer grow operations by first
3419         growing the buffer and then executing unchecked puts to it.
3420         
3421         About a 2% speedup on date-format-tofte.
3422
3423         * VM/CTI.cpp:
3424         (KJS::CTI::compileOpCall):
3425         * masm/IA32MacroAsm.h:
3426         (KJS::JITCodeBuffer::ensureSpace):
3427         (KJS::JITCodeBuffer::putByteUnchecked):
3428         (KJS::JITCodeBuffer::putByte):
3429         (KJS::JITCodeBuffer::putShortUnchecked):
3430         (KJS::JITCodeBuffer::putShort):
3431         (KJS::JITCodeBuffer::putIntUnchecked):
3432         (KJS::JITCodeBuffer::putInt):
3433         (KJS::IA32MacroAssembler::emitTestl_i32r):
3434         (KJS::IA32MacroAssembler::emitMovl_mr):
3435         (KJS::IA32MacroAssembler::emitMovl_rm):
3436         (KJS::IA32MacroAssembler::emitMovl_i32m):
3437         (KJS::IA32MacroAssembler::emitUnlinkedJe):
3438         (KJS::IA32MacroAssembler::emitModRm_rr):
3439         (KJS::IA32MacroAssembler::emitModRm_rr_Unchecked):
3440         (KJS::IA32MacroAssembler::emitModRm_rm_Unchecked):
3441         (KJS::IA32MacroAssembler::emitModRm_rm):
3442         (KJS::IA32MacroAssembler::emitModRm_opr):
3443         (KJS::IA32MacroAssembler::emitModRm_opr_Unchecked):
3444         (KJS::IA32MacroAssembler::emitModRm_opm_Unchecked):
3445
3446 2008-09-05  Mark Rowe  <mrowe@apple.com>
3447
3448         Reviewed by Sam Weinig.
3449
3450         Disable WREC and CTI on platforms that we have not yet had a chance to test with.
3451
3452         * wtf/Platform.h:
3453
3454 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
3455
3456         Reviewed by Sam Weinig.
3457         
3458         Use jo instead of a mask compare when fetching array.length and
3459         string.length. 4% speedup on array.length / string.length torture
3460         test.
3461
3462         * VM/CTI.cpp:
3463         (KJS::CTI::privateArrayLengthTrampoline):
3464         (KJS::CTI::privateStringLengthTrampoline):
3465
3466 2008-09-05  Geoffrey Garen  <ggaren@apple.com>
3467
3468         Reviewed by Sam Weinig.
3469
3470         Removed a CTI compilation pass by recording labels during bytecode
3471         generation. This is more to reduce complexity than it is to improve
3472         performance.
3473
3474         SunSpider reports no change.
3475
3476         CodeBlock now keeps a "labels" set, which holds the offsets of all the
3477         instructions that can be jumped to.
3478
3479         * VM/CTI.cpp: Nixed a pass.
3480
3481         * VM/CodeBlock.h: Added a "labels" set.
3482
3483         * VM/LabelID.h: No need for a special LableID for holding jump
3484         destinations, since the CodeBlock now knows all jump destinations.
3485
3486         * wtf/HashTraits.h: New hash traits to accomodate putting offset 0 in
3487         the set.
3488
3489         * kjs/nodes.cpp:
3490         (KJS::TryNode::emitCode): Emit a dummy label to record sret targets.
3491
3492 2008-09-05  Mark Rowe  <mrowe@apple.com>
3493
3494         Reviewed by Oliver Hunt and Gavin Barraclough.
3495
3496         Move the JITCodeBuffer onto Machine and remove the static variables.
3497
3498         * VM/CTI.cpp: Initialize m_jit with the Machine's code buffer.
3499         * VM/Machine.cpp:
3500         (KJS::Machine::Machine): Allocate a JITCodeBuffer.
3501         * VM/Machine.h:
3502         * kjs/RegExpConstructor.cpp:
3503         (KJS::constructRegExp): Pass the ExecState through.
3504         * kjs/RegExpPrototype.cpp:
3505         (KJS::regExpProtoFuncCompile): Ditto.
3506         * kjs/StringPrototype.cpp:
3507         (KJS::stringProtoFuncMatch): Ditto.
3508         (KJS::stringProtoFuncSearch): Ditto.
3509         * kjs/nodes.cpp:
3510         (KJS::RegExpNode::emitCode): Compile the pattern at code generation time
3511         so that we have access to an ExecState.
3512         * kjs/nodes.h:
3513         (KJS::RegExpNode::):
3514         * kjs/nodes2string.cpp:
3515         * kjs/regexp.cpp:
3516         (KJS::RegExp::RegExp): Pass the ExecState through.
3517         (KJS::RegExp::create): Ditto.
3518         * kjs/regexp.h:
3519         * masm/IA32MacroAsm.h:
3520         (KJS::IA32MacroAssembler::IA32MacroAssembler): Reset the JITCodeBuffer when we are
3521         constructed.
3522         * wrec/WREC.cpp:
3523         (KJS::WRECompiler::compile): Retrieve the JITCodeBuffer from the Machine.
3524         * wrec/WREC.h:
3525
3526 2008-09-05  Mark Rowe  <mrowe@apple.com>
3527
3528         Reviewed by Oliver Hunt and Gavin Barraclough.
3529
3530         Fix the build when CTI is disabled.
3531
3532         * VM/CodeBlock.cpp:
3533         (KJS::CodeBlock::~CodeBlock):
3534         * VM/CodeGenerator.cpp:
3535         (KJS::prepareJumpTableForStringSwitch):
3536         * VM/Machine.cpp:
3537         (KJS::Machine::Machine):
3538         (KJS::Machine::~Machine):
3539
3540 2008-09-05  Gavin Barraclough  <barraclough@apple.com>
3541
3542         Reviewed by Mark Rowe.
3543
3544         Fix some windows abi issues.
3545
3546         * VM/CTI.cpp:
3547         (KJS::CTI::privateCompileMainPass):
3548         (KJS::CTI::privateCompileSlowCases):
3549         * VM/CTI.h:
3550         (KJS::CallRecord::CallRecord):
3551         (KJS::):
3552         * VM/Machine.cpp:
3553         (KJS::Machine::cti_op_resolve_func):
3554         (KJS::Machine::cti_op_post_inc):
3555         (KJS::Machine::cti_op_resolve_with_base):
3556         (KJS::Machine::cti_op_post_dec):
3557         * VM/Machine.h:
3558
3559 2008-09-05  Mark Rowe  <mrowe@apple.com>
3560
3561         Reviewed by Sam Weinig.
3562
3563         Fix ecma/FunctionObjects/15.3.5.3.js after I broke it in r93.
3564
3565         * VM/Machine.cpp:
3566         (KJS::Machine::cti_op_call_NotJSFunction): Restore m_callFrame to the correct value after making the native call.
3567         (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3568
3569 2008-09-04  Mark Rowe  <mrowe@apple.com>
3570
3571         Reviewed by Sam Weinig.
3572
3573         Fix fast/dom/Window/console-functions.html.
3574
3575         The call frame on the ExecState was not being updated on calls into native functions.  This meant that functions
3576         such as console.log would use the line number of the last JS function on the call stack.
3577
3578         * VM/Machine.cpp:
3579         (KJS::Machine::cti_op_call_NotJSFunction): Update the ExecState's call frame before making a native function call,
3580         and restore it when the function is done.
3581         (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3582
3583 2008-09-05  Oliver Hunt  <oliver@apple.com>
3584
3585         Start bringing up SFX on windows.
3586
3587         Reviewed by Mark Rowe and Sam Weinig
3588
3589         Start doing the work to bring up SFX on windows.  Initially
3590         just working on WREC, as it does not make any calls so reduces
3591         the amount of code that needs to be corrected.
3592         
3593         Start abstracting the CTI JIT codegen engine.
3594
3595         * ChangeLog:
3596         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3597         * JavaScriptCore.xcodeproj/project.pbxproj:
3598         * VM/CTI.cpp:
3599         * masm/IA32MacroAsm.h:
3600         * masm/MacroAssembler.h: Added.
3601         (KJS::MacroAssembler::MacroAssembler):
3602         * masm/MacroAssemblerIA32GCC.cpp: Added.
3603         (KJS::MacroAssembler::emitConvertToFastCall):
3604         * masm/MacroAssemblerWin.cpp: Added.
3605         (KJS::MacroAssembler::emitConvertToFastCall):
3606         * wrec/WREC.cpp:
3607         (KJS::WRECompiler::parseGreedyQuantifier):
3608         (KJS::WRECompiler::parseCharacterClass):
3609         (KJS::WRECompiler::parseEscape):
3610         (KJS::WRECompiler::compilePattern):
3611         * wrec/WREC.h:
3612
3613 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
3614
3615         Reviewed by Sam Weinig.
3616
3617         Support for slow scripts (timeout checking).
3618
3619         * VM/CTI.cpp:
3620         (KJS::CTI::privateCompileMainPass):
3621         (KJS::CTI::privateCompile):
3622         * VM/Machine.cpp:
3623         (KJS::slideRegisterWindowForCall):
3624         (KJS::Machine::cti_timeout_check):
3625         (KJS::Machine::cti_vm_throw):
3626
3627 2008-09-04  Sam Weinig  <sam@webkit.org>
3628
3629         Reviewed by Mark Rowe.
3630
3631         Third round of style cleanup.
3632
3633         * VM/CTI.cpp:
3634         * VM/CTI.h:
3635         * VM/CodeBlock.h:
3636         * VM/Machine.cpp:
3637         * VM/Machine.h:
3638         * kjs/ExecState.h:
3639
3640 2008-09-04  Sam Weinig  <sam@webkit.org>
3641
3642         Reviewed by Jon Honeycutt.
3643
3644         Second round of style cleanup.
3645
3646         * VM/CTI.cpp:
3647         * VM/CTI.h:
3648         * wrec/WREC.h:
3649
3650 2008-09-04  Sam Weinig  <sam@webkit.org>
3651
3652         Reviewed by Mark Rowe.
3653
3654         First round of style cleanup.
3655
3656         * VM/CTI.cpp:
3657         * VM/CTI.h:
3658         * masm/IA32MacroAsm.h:
3659         * wrec/WREC.cpp:
3660         * wrec/WREC.h:
3661
3662 2008-09-04  Geoffrey Garen  <ggaren@apple.com>
3663
3664         Reviewed by Mark Rowe.
3665         
3666         Merged http://trac.webkit.org/changeset/36081 to work with CTI.
3667
3668         * VM/Machine.cpp:
3669         (KJS::Machine::tryCtiCacheGetByID):
3670
3671 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
3672
3673         Reviewed by Sam Weinig.
3674
3675         Enable profiling in CTI.
3676
3677         * VM/CTI.h:
3678         (KJS::):
3679         (KJS::CTI::execute):
3680         * VM/Machine.cpp:
3681         (KJS::Machine::cti_op_call_JSFunction):
3682         (KJS::Machine::cti_op_call_NotJSFunction):
3683         (KJS::Machine::cti_op_ret):
3684         (KJS::Machine::cti_op_construct_JSConstruct):
3685         (KJS::Machine::cti_op_construct_NotJSConstruct):
3686
3687 2008-09-04  Victor Hernandez  <vhernandez@apple.com>
3688
3689         Reviewed by Geoffrey Garen.
3690         
3691         Fixed an #if to support using WREC without CTI.
3692
3693         * kjs/regexp.cpp:
3694         (KJS::RegExp::match):
3695
3696 2008-09-04  Gavin Barraclough  <barraclough@apple.com>
3697
3698         Reviewed by Oliver Hunt.
3699
3700         The array/string length trampolines are owned by the Machine, not the codeblock that compiled them.
3701
3702         * VM/CTI.cpp:
3703         (KJS::CTI::privateArrayLengthTrampoline):
3704         (KJS::CTI::privateStringLengthTrampoline):
3705         * VM/Machine.cpp:
3706         (KJS::Machine::~Machine):
3707         * VM/Machine.h:
3708
3709 2008-09-04  Mark Rowe  <mrowe@apple.com>
3710
3711         Reviewed by Gavin Barraclough and Sam Weinig.
3712
3713         Fix a crash on launch of jsc when GuardMalloc is enabled.
3714
3715         * kjs/ScopeChain.h:
3716         (KJS::ScopeChain::ScopeChain): Initialize m_node to 0 when we have no valid scope chain.
3717         (KJS::ScopeChain::~ScopeChain): Null-check m_node before calling deref.
3718
3719 2008-09-03  Oliver Hunt  <oliver@apple.com>
3720
3721         Reviewed by Gavin Barraclough and Geoff Garen.
3722
3723         Fix inspector and fast array access so that it bounds
3724         checks correctly.
3725
3726         * VM/CTI.cpp:
3727         (KJS::CTI::privateCompile_pass2_Main):
3728         * masm/IA32MacroAsm.h:
3729         (KJS::IA32MacroAssembler::):
3730         (KJS::IA32MacroAssembler::emitUnlinkedJb):
3731         (KJS::IA32MacroAssembler::emitUnlinkedJbe):
3732
3733 2008-09-03  Mark Rowe  <mrowe@apple.com>
3734
3735         Move the assertion after the InitializeAndReturn block, as
3736         that is used even when CTI is enabled.
3737
3738         * VM/Machine.cpp:
3739         (KJS::Machine::privateExecute):
3740
3741 2008-09-03  Mark Rowe  <mrowe@apple.com>
3742
3743         Reviewed by Sam Weinig.
3744
3745         Replace calls to exit with ASSERT_WITH_MESSAGE or ASSERT_NOT_REACHED.
3746
3747         * VM/CTI.cpp:
3748         (KJS::CTI::privateCompile_pass1_Scan):
3749         (KJS::CTI::privateCompile_pass2_Main):
3750         (KJS::CTI::privateCompile_pass4_SlowCases):
3751         * VM/Machine.cpp:
3752         (KJS::Machine::privateExecute):
3753         (KJS::Machine::cti_vm_throw):
3754
3755 2008-09-03  Mark Rowe  <mrowe@apple.com>
3756
3757         Reviewed by Sam Weinig.
3758
3759         Tweak JavaScriptCore to compile on non-x86 platforms.  This is achieved
3760         by wrapping more code with ENABLE(CTI), ENABLE(WREC), and PLATFORM(X86)
3761         #if's.
3762
3763         * VM/CTI.cpp:
3764         * VM/CTI.h:
3765         * VM/CodeBlock.cpp:
3766         (KJS::CodeBlock::printStructureIDs): Use %td as the format specifier for
3767         printing a ptrdiff_t.
3768         * VM/Machine.cpp:
3769         * VM/Machine.h:
3770         * kjs/regexp.cpp:
3771         (KJS::RegExp::RegExp):
3772         (KJS::RegExp::~RegExp):
3773         (KJS::RegExp::match):
3774         * kjs/regexp.h:
3775         * masm/IA32MacroAsm.h:
3776         * wrec/WREC.cpp:
3777         * wrec/WREC.h:
3778         * wtf/Platform.h: Only enable CTI and WREC on x86.  Add an extra define to
3779         track whether any MASM-using features are enabled.
3780
3781 2008-09-03  Gavin Barraclough  <barraclough@apple.com>
3782
3783         Reviewed by Oliver Hunt.
3784
3785         Copy Geoff's array/string length optimization for CTI.
3786
3787         * VM/CTI.cpp:
3788         (KJS::CTI::privateArrayLengthTrampoline):
3789         (KJS::CTI::privateStringLengthTrampoline):
3790         * VM/CTI.h:
3791         (KJS::CTI::compileArrayLengthTrampoline):
3792         (KJS::CTI::compileStringLengthTrampoline):
3793         * VM/Machine.cpp:
3794         (KJS::Machine::Machine):
3795         (KJS::Machine::getCtiArrayLengthTrampoline):
3796         (KJS::Machine::getCtiStringLengthTrampoline):
3797         (KJS::Machine::tryCtiCacheGetByID):
3798         (KJS::Machine::cti_op_get_by_id_second):
3799         * VM/Machine.h:
3800         * kjs/JSString.h:
3801         * kjs/ustring.h:
3802
3803 2008-09-03  Gavin Barraclough  <barraclough@apple.com>
3804
3805         Reviewed by Oliver Hunt.
3806
3807         Implement fast array accesses in CTI - 2-3% progression on sunspider.
3808
3809         * VM/CTI.cpp:
3810         (KJS::CTI::emitFastArithIntToImmNoCheck):
3811         (KJS::CTI::compileOpCall):
3812         (KJS::CTI::privateCompile_pass2_Main):
3813         (KJS::CTI::privateCompile_pass4_SlowCases):
3814         * VM/CTI.h:
3815         * kjs/JSArray.h:
3816
3817 2008-09-02  Gavin Barraclough  <barraclough@apple.com>
3818
3819         Reviewed by Oliver Hunt.
3820
3821         Enable fast property access support in CTI.
3822
3823         * VM/CTI.cpp:
3824         (KJS::ctiSetReturnAddress):
3825         (KJS::ctiRepatchCallByReturnAddress):
3826         (KJS::CTI::privateCompile_pass2_Main):
3827         (KJS::CTI::privateCompile):
3828         (KJS::CTI::privateCompileGetByIdSelf):
3829         (KJS::CTI::privateCompileGetByIdProto):
3830         (KJS::CTI::privateCompileGetByIdChain):
3831         (KJS::CTI::privateCompilePutByIdReplace):
3832         * VM/CTI.h:
3833         (KJS::CTI::compileGetByIdSelf):
3834         (KJS::CTI::compileGetByIdProto):
3835         (KJS::CTI::compileGetByIdChain):
3836         (KJS::CTI::compilePutByIdReplace):
3837         * VM/CodeBlock.cpp:
3838         (KJS::CodeBlock::~CodeBlock):
3839         * VM/CodeBlock.h:
3840         * VM/Machine.cpp:
3841         (KJS::doSetReturnAddressVmThrowTrampoline):
3842         (KJS::Machine::tryCtiCachePutByID):
3843         (KJS::Machine::tryCtiCacheGetByID):
3844         (KJS::Machine::cti_op_put_by_id):
3845         (KJS::Machine::cti_op_put_by_id_second):
3846         (KJS::Machine::cti_op_put_by_id_generic):
3847         (KJS::Machine::cti_op_put_by_id_fail):
3848         (KJS::Machine::cti_op_get_by_id):
3849         (KJS::Machine::cti_op_get_by_id_second):
3850         (KJS::Machine::cti_op_get_by_id_generic):
3851         (KJS::Machine::cti_op_get_by_id_fail):
3852         (KJS::Machine::cti_op_throw):
3853         (KJS::Machine::cti_vm_throw):
3854         * VM/Machine.h:
3855         * kjs/JSCell.h:
3856         * kjs/JSObject.h:
3857         * kjs/PropertyMap.h:
3858         * kjs/StructureID.cpp:
3859         (KJS::StructureIDChain::StructureIDChain):
3860         * masm/IA32MacroAsm.h:
3861         (KJS::IA32MacroAssembler::emitCmpl_i32m):
3862         (KJS::IA32MacroAssembler::emitMovl_mr):
3863         (KJS::IA32MacroAssembler::emitMovl_rm):
3864
3865 2008-09-02  Sam Weinig  <sam@webkit.org>
3866
3867         Reviewed by Gavin Barraclough and Mark Rowe.
3868
3869         A backslash (\) at the of a RegEx should produce an error.
3870         Fixes fast/regex/test1.html.
3871
3872         * wrec/WREC.cpp:
3873         (KJS::WRECompiler::parseEscape):
3874
3875 2008-09-02  Sam Weinig  <sam@webkit.org>
3876
3877         Reviewed by Geoff Garen.
3878
3879         Link jumps for the slow case of op_loop_if_less.  Fixes acid3.
3880
3881         * VM/CTI.cpp:
3882         (KJS::CTI::privateCompile_pass4_SlowCases):
3883
3884 2008-09-01  Sam Weinig  <sam@webkit.org>
3885
3886         Rubber-stamped by Maciej Stachowiak.
3887
3888         Switch WREC on by default.
3889
3890         * wtf/Platform.h:
3891
3892 2008-09-01  Sam Weinig  <sam@webkit.org>
3893
3894         Reviewed by Mark Rowe.
3895
3896         Fix two failures in fast/regex/test1.html
3897           - \- in a character class should be treated as a literal -
3898           - A missing max quantifier needs to be treated differently than
3899             a null max quantifier.
3900
3901         * wrec/WREC.cpp:
3902         (KJS::WRECompiler::generateNonGreedyQuantifier):
3903         (KJS::WRECompiler::generateGreedyQuantifier):
3904         (KJS::WRECompiler::parseCharacterClass):
3905         * wrec/WREC.h:
3906         (KJS::Quantifier::Quantifier):
3907
3908 2008-09-01  Sam Weinig  <sam@webkit.org>
3909
3910         Reviewed by Mark Rowe.
3911
3912         Fix crash in fast/js/kde/evil-n.html
3913
3914         * kjs/regexp.cpp: Always pass a non-null offset vector to the wrec function.
3915
3916 2008-09-01  Sam Weinig  <sam@webkit.org>
3917
3918         Reviewed by Gavin Barraclough and Mark Rowe.
3919
3920         Add pattern length limit fixing one test in fast/js.
3921
3922         * wrec/WREC.cpp:
3923         (KJS::WRECompiler::compile):
3924         * wrec/WREC.h:
3925         (KJS::WRECompiler::):
3926
3927 2008-09-01  Sam Weinig  <sam@webkit.org>
3928
3929         Reviewed by Gavin Barraclough and Mark Rowe.
3930
3931         Make octal escape parsing/back-reference parsing more closely match 
3932         prior behavior fixing one test in fast/js.
3933
3934         * wrec/WREC.cpp:
3935         (KJS::WRECompiler::parseCharacterClass): 8 and 9 should be IdentityEscaped
3936         (KJS::WRECompiler::parseEscape):
3937         * wrec/WREC.h:
3938         (KJS::WRECompiler::peekDigit):
3939
3940 2008-09-01  Sam Weinig  <sam@webkit.org>
3941
3942         Reviewed by Gavin Barraclough and Mark Rowe.
3943
3944         Fix one mozilla test.
3945
3946         * wrec/WREC.cpp:
3947         (KJS::WRECompiler::generateCharacterClassInverted): Fix incorrect not
3948         ascii upper check.
3949
3950 2008-09-01  Sam Weinig  <sam@webkit.org>
3951
3952         Reviewed by Gavin Barraclough and Mark Rowe.
3953
3954         Parse octal escapes in character classes fixing one mozilla test.
3955
3956         * wrec/WREC.cpp:
3957         (KJS::WRECompiler::parseCharacterClass):
3958         (KJS::WRECompiler::parseOctalEscape):
3959         * wrec/WREC.h:
3960         (KJS::WRECompiler::consumeOctal):
3961
3962 2008-09-01  Sam Weinig  <sam@webkit.org>
3963
3964         Reviewed by Oliver Hunt.
3965
3966         Fixes two mozilla tests with WREC enabled.
3967
3968         * wrec/WREC.cpp:
3969         (KJS::CharacterClassConstructor::append): Keep the character class sorted
3970         when appending another character class.
3971
3972 2008-09-01  Sam Weinig  <sam@webkit.org>
3973
3974         Reviewed by Gavin Barraclough and Mark Rowe.
3975
3976         Fixes two mozilla tests with WREC enabled.
3977
3978         * wrec/WREC.cpp:
3979         (KJS::CharacterClassConstructor::addSortedRange): Insert the range at the correct position
3980         instead of appending it to the end.
3981
3982 2008-09-01  Gavin Barraclough  <barraclough@apple.com>
3983
3984         Reviewed by Oliver Hunt.
3985
3986         Move cross-compilation unit call into NEVER_INLINE function.
3987
3988         * VM/Machine.cpp:
3989         (KJS::doSetReturnAddressVmThrowTrampoline):
3990
3991 2008-09-01  Sam Weinig  <sam@webkit.org>
3992
3993         Reviewed by Gavin Barraclough and Geoff Garen.
3994
3995         Fix one test in fast/js.
3996
3997         * VM/Machine.cpp:
3998         (KJS::Machine::cti_op_construct_NotJSConstruct): Throw a createNotAConstructorError,
3999         instead of a createNotAFunctionError.
4000
4001 2008-08-31  Gavin Barraclough  <barraclough@apple.com>
4002
4003         Reviewed by Maciej Stachowiak.
4004         
4005         Zero-cost exception handling.  This patch takes the exception checking
4006         back of the hot path.  When an exception occurs in a Machine::cti*
4007         method, the return address to JIT code is recorded, and is then
4008         overwritten with a pointer to a trampoline routine.  When the method
4009         returns the trampoline will cause the cti_vm_throw method to be invoked.
4010
4011         cti_vm_throw uses the return address preserved above, to discover the
4012         vPC of the bytecode that raised the exception (using a map build during
4013         translation).  From the VPC of the faulting bytecode the vPC of a catch
4014         routine may be discovered (unwinding the stack where necesary), and then
4015         a bytecode address for the catch routine is looked up.  Final cti_vm_throw
4016         overwrites its return address to JIT code again, to trampoline directly
4017         to the catch routine.
4018         
4019         cti_op_throw is handled in a similar fashion.
4020
4021         * VM/CTI.cpp:
4022         (KJS::CTI::emitPutCTIParam):
4023         (KJS::CTI::emitPutToCallFrameHeader):
4024         (KJS::CTI::emitGetFromCallFrameHeader):
4025         (KJS::ctiSetReturnAddressForArgs):
4026         (KJS::CTI::emitDebugExceptionCheck):
4027         (KJS::CTI::printOpcodeOperandTypes):
4028         (KJS::CTI::emitCall):
4029         (KJS::CTI::compileOpCall):
4030         (KJS::CTI::privateCompile_pass2_Main):
4031         (KJS::CTI::privateCompile):
4032         * VM/CTI.h:
4033         (KJS::CallRecord::CallRecord):
4034         (KJS::):
4035         (KJS::CTI::execute):
4036         * VM/CodeBlock.h:
4037         * VM/Machine.cpp:
4038         (KJS::Machine::privateExecute):
4039         (KJS::Machine::cti_op_instanceof):
4040         (KJS::Machine::cti_op_call_NotJSFunction):
4041         (KJS::Machine::cti_op_resolve):
4042         (KJS::Machine::cti_op_resolve_func):
4043         (KJS::Machine::cti_op_resolve_skip):
4044         (KJS::Machine::cti_op_resolve_with_base):
4045         (KJS::Machine::cti_op_throw):
4046         (KJS::Machine::cti_op_in):
4047         (KJS::Machine::cti_vm_throw):
4048         * VM/RegisterFile.h:
4049         (KJS::RegisterFile::):
4050         * kjs/ExecState.h:
4051         (KJS::ExecState::setCtiReturnAddress):
4052         (KJS::ExecState::ctiReturnAddress):
4053         * masm/IA32MacroAsm.h:
4054         (KJS::IA32MacroAssembler::):
4055         (KJS::IA32MacroAssembler::emitPushl_m):
4056         (KJS::IA32MacroAssembler::emitPopl_m):
4057         (KJS::IA32MacroAssembler::getRelocatedAddress):
4058
4059 2008-08-31  Mark Rowe  <mrowe@apple.com>
4060
4061         Reviewed by Oliver Hunt.
4062
4063         Fall back to PCRE for any regexp containing parentheses until we correctly backtrack within them.
4064
4065         * wrec/WREC.cpp:
4066         (KJS::WRECompiler::parseParentheses):
4067         * wrec/WREC.h:
4068         (KJS::WRECompiler::):
4069
4070 2008-08-31  Mark Rowe  <mrowe@apple.com>
4071
4072         Reviewed by Oliver Hunt.
4073
4074         Fix several issues within ecma_3/RegExp/perlstress-001.js with WREC enabled.
4075
4076         * wrec/WREC.cpp:
4077         (KJS::WRECompiler::generateNonGreedyQuantifier): Compare with the maximum quantifier count rather than the minimum.
4078         (KJS::WRECompiler::generateAssertionEOL): Do a register-to-register comparison rather than immediate-to-register.
4079         (KJS::WRECompiler::parseCharacterClass): Pass through the correct inversion flag.
4080
4081 2008-08-30  Mark Rowe  <mrowe@apple.com>
4082
4083         Reviewed by Oliver Hunt.
4084
4085         Re-fix the six remaining failures in the Mozilla JavaScript tests in a manner that does not kill performance.
4086         This shows up as a 0.6% progression on SunSpider on my machine.
4087
4088         Grow the JITCodeBuffer's underlying buffer when we run out of space rather than just bailing out.
4089
4090         * VM/CodeBlock.h:
4091         (KJS::CodeBlock::~CodeBlock): Switch to using fastFree now that JITCodeBuffer::copy uses fastMalloc.
4092         * kjs/regexp.cpp: Ditto.
4093         * masm/IA32MacroAsm.h:
4094         (KJS::JITCodeBuffer::growBuffer):
4095         (KJS::JITCodeBuffer::JITCodeBuffer):
4096         (KJS::JITCodeBuffer::~JITCodeBuffer):
4097         (KJS::JITCodeBuffer::putByte):
4098         (KJS::JITCodeBuffer::putShort):
4099         (KJS::JITCodeBuffer::putInt):
4100         (KJS::JITCodeBuffer::reset):
4101         (KJS::JITCodeBuffer::copy):
4102
4103 2008-08-29  Oliver Hunt  <oliver@apple.com>
4104
4105         RS=Maciej
4106
4107         Roll out previous patch as it causes a 5% performance regression
4108
4109         * JavaScriptCore.xcodeproj/project.pbxproj:
4110         * VM/CTI.cpp:
4111         (KJS::getJCB):
4112         (KJS::CTI::privateCompile):
4113         * VM/CodeBlock.h:
4114         (KJS::CodeBlock::~CodeBlock):
4115         * masm/IA32MacroAsm.h:
4116         (KJS::JITCodeBuffer::JITCodeBuffer):
4117         (KJS::JITCodeBuffer::putByte):
4118         (KJS::JITCodeBuffer::putShort):
4119         (KJS::JITCodeBuffer::putInt):
4120         (KJS::JITCodeBuffer::getEIP):
4121         (KJS::JITCodeBuffer::start):
4122         (KJS::JITCodeBuffer::getOffset):
4123         (KJS::JITCodeBuffer::reset):
4124         (KJS::JITCodeBuffer::copy):
4125         (KJS::IA32MacroAssembler::emitModRm_rr):
4126         (KJS::IA32MacroAssembler::emitModRm_rm):
4127         (KJS::IA32MacroAssembler::emitModRm_rmsib):
4128         (KJS::IA32MacroAssembler::IA32MacroAssembler):
4129         (KJS::IA32MacroAssembler::emitInt3):
4130         (KJS::IA32MacroAssembler::emitPushl_r):
4131         (KJS::IA32MacroAssembler::emitPopl_r):
4132         (KJS::IA32MacroAssembler::emitMovl_rr):
4133         (KJS::IA32MacroAssembler::emitAddl_rr):
4134         (KJS::IA32MacroAssembler::emitAddl_i8r):
4135         (KJS::IA32MacroAssembler::emitAddl_i32r):
4136         (KJS::IA32MacroAssembler::emitAddl_mr):
4137         (KJS::IA32MacroAssembler::emitAndl_rr):
4138         (KJS::IA32MacroAssembler::emitAndl_i32r):
4139         (KJS::IA32MacroAssembler::emitCmpl_i8r):
4140         (KJS::IA32MacroAssembler::emitCmpl_rr):
4141         (KJS::IA32MacroAssembler::emitCmpl_rm):
4142         (KJS::IA32MacroAssembler::emitCmpl_i32r):
4143         (KJS::IA32MacroAssembler::emitCmpl_i32m):
4144         (KJS::IA32MacroAssembler::emitCmpw_rm):
4145         (KJS::IA32MacroAssembler::emitOrl_rr):
4146         (KJS::IA32MacroAssembler::emitOrl_i8r):
4147         (KJS::IA32MacroAssembler::emitSubl_rr):
4148         (KJS::IA32MacroAssembler::emitSubl_i8r):
4149         (KJS::IA32MacroAssembler::emitSubl_i32r):
4150         (KJS::IA32MacroAssembler::emitSubl_mr):
4151         (KJS::IA32MacroAssembler::emitTestl_i32r):
4152         (KJS::IA32MacroAssembler::emitTestl_rr):
4153         (KJS::IA32MacroAssembler::emitXorl_i8r):
4154         (KJS::IA32MacroAssembler::emitXorl_rr):
4155         (KJS::IA32MacroAssembler::emitSarl_i8r):
4156         (KJS::IA32MacroAssembler::emitSarl_CLr):
4157         (KJS::IA32MacroAssembler::emitShl_i8r):
4158         (KJS::IA32MacroAssembler::emitShll_CLr):
4159         (KJS::IA32MacroAssembler::emitMull_rr):
4160         (KJS::IA32MacroAssembler::emitIdivl_r):
4161         (KJS::IA32MacroAssembler::emitCdq):
4162         (KJS::IA32MacroAssembler::emitMovl_mr):
4163         (KJS::IA32MacroAssembler::emitMovzwl_mr):
4164         (KJS::IA32MacroAssembler::emitMovl_rm):
4165         (KJS::IA32MacroAssembler::emitMovl_i32r):
4166         (KJS::IA32MacroAssembler::emitMovl_i32m):
4167         (KJS::IA32MacroAssembler::emitLeal_mr):
4168         (KJS::IA32MacroAssembler::emitRet):
4169         (KJS::IA32MacroAssembler::emitJmpN_r):
4170         (KJS::IA32MacroAssembler::emitJmpN_m):
4171         (KJS::IA32MacroAssembler::emitCall):
4172         (KJS::IA32MacroAssembler::label):
4173         (KJS::IA32MacroAssembler::emitUnlinkedJmp):
4174         (KJS::IA32MacroAssembler::emitUnlinkedJne):
4175         (KJS::IA32MacroAssembler::emitUnlinkedJe):
4176         (KJS::IA32MacroAssembler::emitUnlinkedJl):
4177         (KJS::IA32MacroAssembler::emitUnlinkedJle):
4178         (KJS::IA32MacroAssembler::emitUnlinkedJge):
4179         (KJS::IA32MacroAssembler::emitUnlinkedJae):
4180         (KJS::IA32MacroAssembler::emitUnlinkedJo):
4181         (KJS::IA32MacroAssembler::link):
4182         * wrec/WREC.cpp:
4183         (KJS::WRECompiler::compilePattern):
4184         (KJS::WRECompiler::compile):
4185         * wrec/WREC.h:
4186
4187 2008-08-29  Mark Rowe  <mrowe@apple.com>
4188
4189         Reviewed by Oliver Hunt.
4190
4191         Have JITCodeBuffer manage a Vector containing the generated code so that it can grow
4192         as needed when generating code for a large function.  This fixes all six remaining failures
4193         in Mozilla tests in both debug and release builds.
4194
4195         * VM/CTI.cpp:
4196         (KJS::CTI::privateCompile):
4197         * VM/CodeBlock.h:
4198         (KJS::CodeBlock::~CodeBlock):
4199         * masm/IA32MacroAsm.h:
4200         (KJS::JITCodeBuffer::putByte):
4201         (KJS::JITCodeBuffer::putShort):
4202         (KJS::JITCodeBuffer::putInt):
4203         (KJS::JITCodeBuffer::getEIP):
4204         (KJS::JITCodeBuffer::start):
4205         (KJS::JITCodeBuffer::getOffset):
4206         (KJS::JITCodeBuffer::getCode):
4207         (KJS::IA32MacroAssembler::emitModRm_rr):
4208         * wrec/WREC.cpp:
4209         (KJS::WRECompiler::compilePattern):
4210         * wrec/WREC.h:
4211
4212 2008-08-29  Mark Rowe  <mrowe@apple.com>
4213
4214         Reviewed by Oliver Hunt.
4215
4216         Implement parsing of octal escapes in regular expressions.  This fixes three Mozilla tests.
4217
4218         * wrec/WREC.cpp:
4219         (KJS::WRECompiler::parseOctalEscape):
4220         (KJS::WRECompiler::parseEscape): Parse the escape sequence as an octal escape if it has a leading zero.
4221         Add a FIXME about treating invalid backreferences as octal escapes in the future.
4222         * wrec/WREC.h:
4223         (KJS::WRECompiler::consumeNumber): Multiply by 10 rather than 0 so that we handle numbers with more than
4224         one digit.
4225         * wtf/ASCIICType.h:
4226         (WTF::isASCIIOctalDigit):
4227
4228 2008-08-29  Sam Weinig  <sam@webkit.org>
4229
4230         Reviewed by Mark Rowe.
4231
4232         Pass vPC to instanceof method.  Fixes 2 mozilla tests in debug.
4233
4234         * VM/CTI.cpp:
4235         (KJS::CTI::privateCompile_pass2_Main):
4236         * VM/Machine.cpp:
4237         (KJS::Machine::cti_op_instanceof):
4238
4239 2008-08-29  Sam Weinig  <sam@webkit.org>
4240
4241         Reviewed by Mark Rowe.
4242
4243         Pass vPCs to resolve methods for correct exception creation.  Fixes
4244         17 mozilla tests in debug.
4245
4246         * VM/CTI.cpp:
4247         (KJS::CTI::privateCompile_pass2_Main):
4248         * VM/CTI.h:
4249         * VM/Machine.cpp:
4250         (KJS::Machine::cti_op_resolve):
4251         (KJS::Machine::cti_op_resolve_func):
4252         (KJS::Machine::cti_op_resolve_skip):
4253         (KJS::Machine::cti_op_resolve_with_base):
4254
4255 2008-08-29  Gavin Barraclough  <barraclough@apple.com>
4256
4257         Reviewed by Oliver Hunt.
4258
4259         Remembering to actually throw the exception passed to op throw helps.
4260         Regressions 19 -> 6.
4261
4262         * VM/Machine.cpp:
4263         (KJS::Machine::cti_op_throw):
4264         (KJS::Machine::cti_vm_throw):
4265
4266 2008-08-29  Gavin Barraclough  <barraclough@apple.com>
4267
4268         Reviewed by Sam Weinig.
4269
4270         Support for exception unwinding the stack.
4271         
4272         Once upon a time, Sam asked me for a bettr ChangeLog entry.  The return address
4273         is now preserved on entry to a JIT code function (if we preserve lazily we need
4274         restore the native return address during exception stack unwind).  This takes
4275         the number of regressions down from ~150 to 19.
4276
4277         * VM/CTI.cpp:
4278         (KJS::getJCB):
4279         (KJS::CTI::emitExceptionCheck):
4280         (KJS::CTI::compileOpCall):
4281         (KJS::CTI::privateCompile_pass2_Main):
4282         (KJS::CTI::privateCompile):
4283         * VM/CTI.h:
4284         (KJS::):
4285         * VM/Machine.cpp:
4286         (KJS::Machine::throwException):
4287         (KJS::Machine::cti_op_call_JSFunction):
4288         (KJS::Machine::cti_op_call_NotJSFunction):
4289         (KJS::Machine::cti_op_construct_JSConstruct):
4290         (KJS::Machine::cti_op_construct_NotJSConstruct):
4291         (KJS::Machine::cti_op_throw):
4292         (KJS::Machine::cti_vm_throw):
4293
4294 2008-08-29  Mark Rowe  <mrowe@apple.com>
4295
4296         Reviewed by Oliver Hunt.
4297
4298         Fix js1_2/regexp/word_boundary.js and four other Mozilla tests with WREC enabled.
4299
4300         * wrec/WREC.cpp:
4301         (KJS::WRECompiler::generateCharacterClassInvertedRange): If none of the exact matches
4302         succeeded, jump to failure.
4303         (KJS::WRECompiler::compilePattern): Restore and increment the current position stored
4304         on the stack to ensure that it will be reset to the correct position after a failed
4305         match has consumed input.
4306
4307 2008-08-29  Mark Rowe  <mrowe@apple.com>
4308
4309         Reviewed by Oliver Hunt.
4310
4311         Fix a hang in ecma_3/RegExp/15.10.2-1.js with WREC enabled.
4312         A backreference with a quantifier would get stuck in an infinite
4313         loop if the captured range was empty.
4314
4315         * wrec/WREC.cpp:
4316         (KJS::WRECompiler::generateBackreferenceQuantifier): If the captured range
4317         was empty, do not attempt to match the backreference.
4318         (KJS::WRECompiler::parseBackreferenceQuantifier):
4319         * wrec/WREC.h:
4320         (KJS::Quantifier::):
4321