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