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