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