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