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