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