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