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