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