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