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