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