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