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