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